nanjingliujinyu 4 luni în urmă
părinte
comite
27ebc57429

+ 1 - 1
ruoyi-ui/src/api/register/regCom.js

@@ -305,4 +305,4 @@ export function dataJisql(data) {
     method: 'post',
     data:data
   });
-}
+}

+ 10 - 1
ruoyi-ui/src/api/service/info.js

@@ -35,7 +35,9 @@ export function getServiceInfo(query) {
     params: query,
   });
 }
-
+// export function getServiceInfo(id) {
+//   return request.get(`/pt/service/modelService/${id}`);
+// }
 
 export function getPtServiceList(query) {
   return request({
@@ -102,4 +104,11 @@ export function getServiceReturn(query) {
     method: "get",
     params: query,
   });
+}
+export function postReturnlist(data) {
+  return request({
+    url: "/service/return/addList",
+    method: 'post',
+    data:data
+  });
 }

+ 128 - 93
ruoyi-ui/src/views/service/info/editModel.vue

@@ -151,7 +151,7 @@
                             </el-col>
                             <el-col :span="6">
                                 <el-form-item label="服务分类:" prop="cateCode" style="">
-                                    <el-cascader :disabled="isEdit" v-model="formJi.cateCode" :options="cascaderOptions" :props="props1" clearable style="width: 100%;"></el-cascader>
+                                    <el-cascader :disabled="isEdit" v-model="formJi.cateCode" :options="cascaderOptions" clearable style="width: 100%;"></el-cascader>
                                 </el-form-item>
                             </el-col>
                             <!-- <el-col :span="8">
@@ -276,7 +276,7 @@
                                   <div style="color: #F56C6C;" v-else-if="data.paramType=='number'">
                                     number
                                   </div>
-                                  <div style="color: #F56C6C;" v-else="data.paramType=='number'">
+                                  <div style="color: #909399;" v-else>
                                     {{ data.paramType }}
                                   </div>
                                 </div>
@@ -371,20 +371,7 @@
                             </el-tab-pane>
                         </el-tabs>
                         <div style="overflow: auto;height: 20vh;margin-top: -1%;">
-                          <!-- <JsonEditorVue
-                            v-model="dataJsonXiang"
-                            style="height:98%;width: 98%;"
-                            :mode="'code'"
-                            :showBtns="false"
-                            :options="{
-                              navigationBar: false, // 隐藏顶部导航栏
-                              statusBar: false,     // 隐藏底部状态栏
-                              mode: 'code',          // 仅保留代码编辑模式
-                              mainMenuBar: false     // 隐藏主菜单栏
-                            }"
-                            lang="zh"
-                          /> -->
-                          <el-input :disabled="isEdit" placeholder="请输入示例" :rows="8" type="textarea" v-model="dataJsonXiang" size="mini" text style="margin-top: 0%;width: 98%;" ></el-input>
+                          <el-input @change="byWay" :disabled="isEdit" placeholder="请输入示例" :rows="8" type="textarea" v-model="dataJsonXiang" size="mini" text style="margin-top: 0%;width: 98%;" ></el-input>
                         </div>
                     </div>
                     <div style="margin-top: 2.5%;margin-left: 0%;padding-bottom: 1%;">
@@ -744,7 +731,7 @@
 import {getCatalog} from "@/api/service/catalog";
 import { Plus,Search,Filter,Promotion,Check  } from '@element-plus/icons-vue'
 import { reactive } from 'vue'
-import { modelTreeSelect,getSerDe,addService,addParam,editService,editParam,addServiceParam,delService,getTreeDe,addTree,deTree,getServiceReturn } from "@/api/service/info";
+import { modelTreeSelect,getSerDe,addService,addParam,editService,editParam,addServiceParam,delService,getTreeDe,addTree,deTree,getServiceReturn,postReturnlist } from "@/api/service/info";
 import { ref, onMounted, onUnmounted, nextTick,onBeforeMount } from 'vue';
 import JsonViewer from 'vue-json-viewer'
 import 'vue-json-viewer/style.css' 
@@ -904,6 +891,7 @@ const rulesJi = reactive({
   url: [{ required: true, message: '必填', trigger: 'blur' }],
   cateCode: [{ required: true, message: '必填', trigger: 'blur' }],
 });
+const byWhich = ref('input');
 const formRefJi = ref();
 const formAdd = ref({
   name:'',
@@ -961,7 +949,11 @@ const filterNode = (value, data) => {
 };
 
 const copied = ref(false);
+function byWay() {
+  byWhich.value = 'input'
+}
 function addToTree() {
+  byWhich.value = 'tree'
   if(parLev.value === 1){
     parTreeParentId.value
     if(tableDataCanAddTree.value){
@@ -1233,6 +1225,38 @@ async function saveEditService(){
           })
         }
       })
+      // 处理返回值
+      if(byWhich.value==='input'){
+        var par = JSON.parse(dataJsonXiang.value)
+        var par1 = transformDynamicDataToTree(par)
+        // par1.length = par1.length - 1
+        console.log(par1)
+        postReturnlist(par1).then(res=>{
+          if(res.code===200){
+            proxy.$modal.msgSuccess("新增成功");
+            getTreeLeft()
+          }
+        })
+      }
+      if(byWhich.value==='tree'){
+        var par = JSON.parse(JSON.stringify(dataTreeReturn.value))
+        par.forEach((item,index) => {
+          if(item.children && item.children.length > 0){
+            item = setArry(item)
+          }
+        });
+        par.forEach((item,index) => {
+          if(item.children && item.children.length > 0){
+            item = setArrayId(item)
+          }
+        });
+        postReturnlist(par).then(res=>{
+          if(res.code===200){
+            proxy.$modal.msgSuccess("新增成功");
+            getTreeLeft()
+          }
+        })
+      }
     }
   }
 }
@@ -1293,6 +1317,7 @@ async function handleNodeClick(node,data,event){
   var par = {
     srvId:data.data.id
   }
+  console.log(JSON.parse(dataJsonXiang.value))
   getServiceReturn(par).then(res=>{
     const fullTree = buildTree1(res.data)
     fullTree.forEach((item,index) => {
@@ -1301,18 +1326,90 @@ async function handleNodeClick(node,data,event){
       }
     });
     dataTreeReturn.value = fullTree
-    var par = JSON.parse(dataJsonXiang.value)
-    var par1 = transformDynamicDataToTree(par)
-    par1.length = par1.length - 1
-    console.log(par1)
+    console.log(dataTreeReturn.value)
+    // var par = JSON.parse(JSON.stringify(fullTree))
+    // var par1 = transformDynamicDataToTree(par)
+    // par1.length = par1.length - 1
+    // par.forEach((item,index) => {
+    //   if(item.children && item.children.length > 0){
+    //     item = setArry(item)
+    //   }
+    // });
+    // par.forEach((item,index) => {
+    //   if(item.children && item.children.length > 0){
+    //     item = setArrayId(item)
+    //   }
+    // });
   })
 }
-/**
- * 将API返回的扁平台风数据转换为具有层级关系的树形结构数据
- * @param {Object} sourceData - 源数据对象(结构可动态变化)
- * @param {String} srvId - 服务ID,默认为示例值
- * @returns {Array} 转换后的树形结构数据数组
- */
+function setArry(node, parent = null, grandParent = null) {
+  if (!node) return;
+  var par = {
+    "id": Math.random(),
+    "parentId": Math.random(),
+    "srvId": parId.value,
+    "paramCode": "[0]",
+    "paramName": null,
+    "paramType": "object",
+    "paramValue": "",
+    "paramFormat": null,
+    "paramNote": null,
+    "isArray": null,
+    "children": []
+  }
+  if(parent && parent.paramType === 'array' && parent.children.length > 0){
+    parent.children.push(par)
+    parent.children = modifyArray(parent.children)
+    parent.children.length = 1
+  }
+  if(node.children){
+      node.children.forEach(child => {
+      setArry(child, node, parent);
+    });
+  }
+  return node;
+}
+function setArrayId(node, parent = null, grandParent = null) {
+  if (!node) return;
+  console.log(node,parent)
+  node.parentId = parent ? parent.id : Math.random();
+  if(node.children){
+      node.children.forEach(child => {
+      setArrayId(child, node, parent);
+    });
+  }
+  return node;
+}
+function modifyArray(originalArray) {
+  // 1. 找到所有 paramCode 为 '[0]' 的对象
+  const targetObjects = originalArray.filter(item => item.paramCode === '[0]');
+  
+  // 检查是否存在符合条件的对象
+  if (targetObjects.length === 0) {
+    console.log("没有找到 paramCode 为 '[0]' 的对象");
+    return originalArray; // 或者根据需求进行其他处理
+  }
+  
+  // 获取最后一个 paramCode 为 '[0]' 的对象
+  const lastTargetObject = targetObjects[targetObjects.length - 1]; // [7](@ref)
+  
+  // 2. 找到所有 paramCode 不为 '[0]' 的对象
+  const objectsToAdd = originalArray.filter(item => item.paramCode !== '[0]');
+  
+  // 3. 确保目标对象的 children 属性存在且为数组
+  if (!lastTargetObject.children) {
+    lastTargetObject.children = []; // 如果不存在则初始化
+  }
+  
+  objectsToAdd.forEach(obj => {
+    lastTargetObject.children.push(obj);
+  });
+  const newArray = originalArray.filter(item => item.paramCode === '[0]');
+  
+  // 返回修改后的新数组
+  return newArray;
+}
+
 function transformDynamicDataToTree(sourceData) {
     let idCounter = 1; // ID计数器,确保每个节点有唯一ID
     const result = []; // 最终返回的结果数组
@@ -1321,7 +1418,7 @@ function transformDynamicDataToTree(sourceData) {
     function inferType(value) {
         if (value === null) return 'null';
         if (Array.isArray(value)) return 'array';
-        if (typeof value === 'object') return 'object';
+        if (typeof value === 'object') return 'object'; 
         if (typeof value === 'number') {
             // 简单区分整数和浮点数(可根据需要调整)
             return Number.isInteger(value) ? 'int' : 'float';
@@ -1407,6 +1504,7 @@ function transformDynamicDataToTree(sourceData) {
 
     return result;
 }
+
 function buildTree1(list, rootParentId = 0) {
   // 1. 创建一个映射(字典)以便通过id快速查找节点,并为每个节点初始化children数组
   const nodeMap = {};
@@ -1441,48 +1539,9 @@ function buildTree1(list, rootParentId = 0) {
   // 3. 返回构建好的树
   return tree;
 }
-// function dfsRecursive(node, parent = null, grandParent = null) {
-//   if (!node) return;
-  
-//   const reg = /\[\d+\]/;
-//   let firstMatchHandled = false; // 标记第一个匹配是否已处理
-
-//   if (parent && reg.test(parent.paramCode)) {
-//     if (!firstMatchHandled) {
-//       // 处理第一个匹配的节点:提升其第一个子节点
-//       if (parent.children && parent.children.length > 0) {
-//         const firstChild = parent.children[0];
-//         // 将第一个子节点添加到祖父节点的子节点数组中
-//         if (grandParent) {
-//           if (!grandParent.children) grandParent.children = [];
-//           grandParent.children.push(firstChild);
-//         }
-//       }
-//       firstMatchHandled = true;
-//     }
-    
-//     // 删除当前父节点(从祖父节点的子节点数组中移除)
-//     if (grandParent && grandParent.children) {
-//       const index = grandParent.children.indexOf(parent);
-//       if (index > -1) {
-//         grandParent.children.splice(index, 1);
-//         // 注意:这里删除了节点,可能需要调整索引
-//       }
-//     }
-//   }
-
-//   // 递归遍历所有子节点
-//   if (Array.isArray(node.children)) {
-//     // 使用 for 循环而不是 forEach,以便在删除节点时调整索引
-//     for (let i = 0; i < node.children.length; i++) {
-//       dfsRecursive(node.children[i], node, parent);
-//     }
-//   }
-// }
 function dfsRecursive(node, parent = null, grandParent = null) {
   if (!node) return;
    const reg = /\[\d+\]/;
-  // 如果父节点存在且paramCode匹配正则表达式
   if (parent && reg.test(parent.paramCode)) {
     grandParent.children = []
     grandParent.children.push(parent);
@@ -1493,36 +1552,12 @@ function dfsRecursive(node, parent = null, grandParent = null) {
     grandParent.children.splice(0,1)
   }
   if(node.children){
-      node.children.forEach(child => {
+    node.children.forEach(child => {
       dfsRecursive(child, node, parent);
     });
   }
-  return node; // 返回处理后的当前节点
+  return node;
 }
-// function dfsRecursive(node, parent = null) {
-//   if (!node) return node; // 返回节点本身
-
-//   const reg = /\[\d+\]/;
-  
-//   // 如果父节点存在且paramCode匹配正则表达式
-//   if (parent && reg.test(parent.paramCode)) {
-//     console.log("Found matching paramCode:", parent.paramCode);
-//     // 只保留第一个子节点
-//     if (node.children && node.children.length > 0) {
-//       node.children = [node.children[0]];
-//     }
-    
-//   }
-//   // 递归遍历所有子节点
-//   if (Array.isArray(node.children)) {
-//     for (let i = 0; i < node.children.length; i++) {
-//       // 递归调用并更新子节点引用
-//       node.children[i] = dfsRecursive(node.children[i], node);
-//     }
-//   }
-//   return node; // 返回处理后的当前节点
-// }
-
 async function getTreeLeft(){
   var par
   await modelTreeSelect().then(res=>{

+ 129 - 421
ruoyi-ui/src/views/service/info/index.vue

@@ -4,12 +4,12 @@
       <div style="display: flex;padding-top: 1%;padding-top: 5%;">
         <el-input
           v-model="inputNode"
-          style="width:75%;margin-left: 5%;background-color: #ebeef5;"
+          style="width:90%;margin-left: 5%;background-color: #ebeef5;"
           class="w-50 m-2"
           :prefix-icon="Search" 
         />
         <!-- <el-button style="margin-left: 2%;width: 10%;background-color: #F7F7F7" :icon="Filter"/> -->
-        <el-button type="primary" @click="showAdd" style="margin-left: 5%;width: 10%;" :icon="Plus"/>
+        <!-- <el-button type="primary" @click="showAdd" style="margin-left: 5%;width: 10%;" :icon="Plus"/> -->
       </div>
       <!-- <Plus style="width: 1em; height: 1em; margin-left:90%;cursor: pointer;color: #337ecc;" @click="showAddTree"/> -->
       <el-tree :expand-on-click-node="false" ref="treeRef" :filter-node-method="filterNode" :current-node-key="currentNodeKey" class="treeLeft" :data="data" @node-click="handleNodeClick" node-key="id" style="margin-left: 5%;margin-top: 5%;width: 90%;background-color: transparent;" default-expand-all :key="valueKet">
@@ -21,7 +21,7 @@
                   <svg-icon svg-icon icon-class="cate" style="color: red;" v-if="data.nodeType=='TREE'"/>
                 <span>{{ node.label }}</span>
               </div>
-              <div style="margin-right: 1%;position: absolute;margin-left: 75%;">
+              <!-- <div style="margin-right: 1%;position: absolute;margin-left: 75%;">
                 <el-dropdown trigger="hover" @click.stop v-if="currentNodeKey === data.id&&data.nodeType!=='SERVICE'">
                     <el-icon class="el-icon--right" style="color: black;">
                       <plus />
@@ -56,409 +56,84 @@
                     </el-dropdown-menu>
                   </template>
                 </el-dropdown>
-              </div>
+              </div> -->
             </span>
           </template>
         </el-tree>
     </div>
     <div style="width: 84%;margin-left: 1%;padding-top: 0.5%;" class="tab-container">
-              <div style="height: 90vh;overflow: auto;">
-                <div style="display: flex;align-items: center;justify-content: space-between;">
-                    <div style="margin-left:1%;">{{detail.name}}</div>
-                    <div style="display: flex;">
-                        <!-- <el-button type="primary" size="mini" :icon="Promotion" @click="fetchData">运行</el-button>
-                        <el-button type="" size="mini">删除</el-button> -->
-                    </div>
-                </div>
-                <div style="display: flex;align-items: center;margin-left:1%;margin-top: 1%;">
-                    <el-tag v-if="formJi.type" class="ml-2">
-                      {{formJi.type}}
-                    </el-tag>
-                    <el-tag v-if="formJi.rqtype=='POST'||formJi.rqtype=='post'" style="margin-left:0.5%;" class="ml-2" type="warning">
-                      {{formJi.rqtype}}
-                    </el-tag>
-                    <el-tag v-if="formJi.rqtype=='GET'||formJi.rqtype=='get'" type="success" style="margin-left: 0.5%;" class="ml-2">
-                      {{formJi.rqtype}}
-                    </el-tag>
-                    <div style="margin-left: 1%;">
-                        {{detail.url}}
-                    </div>
-                    <el-icon style="margin-left: 1%;cursor: pointer;color:#909399" @click="copyUrl"><CopyDocument /></el-icon>
-                    <div style="margin-left: 0.5%;">
-                        <!-- <el-select class="transparent-select" v-model="valueSta" style="border-color: transparent;width: 100px;">
-                            <el-option
-                            v-for="item in options"
-                            :key="item.value"
-                            :label="item.label"
-                            :value="item.value"
-                            >
-                            <div class="flex items-center" style="display: flex;align-items: center;">
-                                <div v-if="item.label=='开发中'" style="width: 5px; height: 5px; background-color: #409EFF; border-radius: 50%;"></div>
-                                <div v-if="item.label=='运行中'" style="width: 5px; height: 5px; background-color: #67C23A; border-radius: 50%;"></div>
-                                <span style="margin-left:1%;">{{ item.label }}</span>
-                            </div>
-                            </el-option>
-                            <template #prefix>
-                                <div class="flex items-center" style="display: flex; align-items: center;">
-                                    <div v-if="valueSta && options.find(opt => opt.value === valueSta)?.label === '开发中'" 
-                                        style="width: 5px; height: 5px; background-color: #409EFF; border-radius: 50%; margin-right: 4px;"></div>
-                                    <div v-if="valueSta && options.find(opt => opt.value === valueSta)?.label === '运行中'" 
-                                        style="width: 5px; height: 5px; background-color: #67C23A; border-radius: 50%; margin-right: 4px;"></div>
-                                    <span>{{ valueSta ? options.find(opt => opt.value === valueSta)?.label : '请选择' }}</span>
-                                </div>
-                            </template>
-                        </el-select> -->
-                    </div>
-                </div>
-                <div style="display: flex;width: 100%;">
-                    <div style="display: flex;margin-left: 1%;font-size: 15px;color:#909399;width:100%;margin-top: 1%;">
-                        
-                    </div>
-                </div>
-                <div style="margin-left: 1%;font-size: 15px;color:#909399;width:100%;display: flex;margin-top: 0.5%;">
-                    <div style="margin-left: 0%;">
-                        服务说明:
-                    </div>
-                    <div style="margin-left: 0.5%;">
-                        {{detail.name}}
-                    </div>
-                </div>
-                <div style="margin-left: 1%;font-size: 15px;color:#909399;width:100%;display: flex;margin-top: 0.5%;">
-                    <!-- <div style="margin-left: 0%;">
-                        返回说明:
-                    </div>
-                    <div style="margin-left: 0.5%;">
-                        {{detail.name}}
-                    </div> -->
-                </div>
-                <div style="margin-top: 2.5%;margin-left: 1%;">
-                  <el-tabs type="card" style="margin-top: 1%;width: 90%;">
-                    <el-tab-pane label="请求参数">
-
-                    </el-tab-pane>
-                  </el-tabs>
-                    <el-table 
-                      style="margin-top: -1%;width: 90%;"
-                      :data="tableDataCan" 
-                      :cell-style="{ textAlign: 'center', }"
-                      :header-cell-style="{ textAlign: 'center'}"
-                      :row-style="{ height: heightAll*0.01+'px',fontSize: '16px',textAlign:'center'  }"
-                      border >
-                          <el-table-column prop="paramCode" label="参数字段">
-                          </el-table-column>
-                          <el-table-column prop="paramName" label="参数名称">
-                          </el-table-column>
-                          <el-table-column prop="paramType" label="参数类型" width="140">
-                          </el-table-column>
-                          <el-table-column prop="paramNote" label="参数说明">
-                          </el-table-column>
-                      </el-table>
-                </div>
-                <div style="margin-top: 2.5%;margin-left: 1%;">
-                    <el-tabs type="card" style="margin-top: 1%;width: 90%;">
-                        <el-tab-pane label="成功(200)">
-                            <div style="display: flex;align-items: center;line-height: 1.5;font-size: 14px;margin-left: 1%;color: #606266;">
-                                <!-- <div>HTTP状态码:</div>
-                                <div>200</div>
-                                <div style="margin-left: 5%;">内容格式:</div>
-                                <div>JSON</div> -->
-                            </div>
-                            <!-- <el-tree  :data="dataReturn" :props="defaultProps" @node-click="handleNodeClick" style="margin-top: 1%;margin-left: 2%;background-color: #F7F7F7;background-color: transparent;width: 15%;" default-expand-all>
-                                <template #default="{ node, data }">
-                                    <span style="display: flex;justify-content: space-between;width: 100%;align-items: center;">
-                                        <span>{{ node.label }}</span>
-                                        <span style="display: flex;align-items: center;">
-                                            <div style="color:#67C23A;">string</div>
-                                            <el-tooltip
-                                                class="box-item"
-                                                effect="light"
-                                                content="必填"
-                                                placement="top-start"
-                                            >
-                                                <el-button style="transform: scale(0.5);transform-origin: center;margin-left: 5%; " type="success" :icon="Check" circle size="mini" plain/>
-                                            </el-tooltip>
-                                        </span>
-                                    </span>
-                                </template>
-                            </el-tree> -->
-                            
-                        </el-tab-pane>
-                    </el-tabs>
-                    <div style="margin-top: -1%;width: 90%;">
-                      <json-viewer 
-                          :value="dataReturn" 
-                          :expand-depth="5" 
-                          copyable 
-                          theme="my-theme"
-                      />
-                      <!-- <JsonEditorVue
-                          v-model="dataReturn"
-                          style="height:98%;width: 100%;"
-                          :mode="'code'"
-                          :showBtns="false"
-                          :options="{
-                            navigationBar: false, // 隐藏顶部导航栏
-                            statusBar: false,     // 隐藏底部状态栏
-                            mode: 'code',          // 仅保留代码编辑模式
-                            mainMenuBar: false     // 隐藏主菜单栏
-                          }"
-                          lang="zh"
-                        /> -->
-                    </div>
-                </div>
-                <div style="margin-top: 2.5%;margin-left: 1%;padding-bottom: 1%;width: 90%;">
-                    <div>响应示例</div><el-tabs type="card" style="margin-top: 1%;">
-                        <el-tab-pane label="成功示例">
-                             <div style="overflow: auto;height: 30vh">
-                                <json-viewer 
-                                    :value="dataJsonXiang" 
-                                    :expand-depth="5" 
-                                    copyable 
-                                    theme="my-theme"
-                                />
-                             </div>
-                        </el-tab-pane>
-                    </el-tabs>
-                </div>
-            
+      <div>
+        <el-table 
+          :data="tableData" 
+          style="width: 98%;margin-left: 1%;margin-top: 0.5%;"
+          :cell-style="{ padding:'5px' }"
+          :header-cell-style="{height: heightAll*0.01+'px',}"
+          :row-style="{ fontSize: '16px',textAlign:'center'}"
+          border >
+          <el-table-column type="index" label="序号" width="80">
+            <template #default="{ $index }">
+              <div style="text-align: center;">
+                {{ $index + 1 }}
               </div>
-            
-        <el-dialog @close="clearAdd" v-model="dialogVisible" title="新增节点" width="70%" destroy-on-close :key="tableKey">
-          <div style="overflow: auto;height: 80vh;">
-                    <el-form size="mini" :key="tableKey" style="margin-top: 1%;width: 98%;"  :model="formAdd" label-position="right" ref="formRefAdd" label-width="120px" :rules="rulesAdd">
-                      <el-row :gutter="48">
-                            <el-col :span="10">
-                              <el-form-item label="服务名称:" prop="name" style="">
-                                  <div style="display: flex;width: 100%;justify-content: space-between;">
-                                    <el-input v-model="formAdd.name" style="width: 100%;"/>
-                                  </div>
-                              </el-form-item>
-                            </el-col>
-                            <el-col :span="6">
-                              <el-form-item label="接口类型:" prop="" style="">
-                                <div style="display: flex;width: 100%;justify-content: space-between;">
-                                  <el-select
-                                    v-model="formAdd.type"
-                                    :disabled="isEdit"
-                                        style="width: 100%;margin-left: 0%;"
-                                    >
-                                        <el-option
-                                        v-for="item in optionsType"
-                                        :key="item.value"
-                                        :label="item.label"
-                                        :value="item.value"
-                                        />
-                                    </el-select>
-                                  <div style="display: flex;">
-                                    
-                                  </div>
-                                </div>
-                                    
-                                </el-form-item>
-                            </el-col>
-                      </el-row>
-                      <el-row :gutter="48">
-                            <el-col :span="10">
-                              <el-form-item label="接口地址:" prop="url" style=""> 
-                                  <el-input
-                                  v-model="formAdd.url"
-                                  style="width: 100%;"
-                                  placeholder=""
-                                  class="input-with-select"
-                                  >
-                                </el-input>
-                              </el-form-item>
-                            </el-col>
-                            <el-col :span="6">
-                                <el-form-item label="请求方式:" prop="" style="">
-                                    <el-select
-                                    v-model="formAdd.rqtype"
-                                    :disabled="isEdit"
-                                        style="width: 100%;margin-left: 0%;"
-                                    >
-                                        <el-option
-                                        v-for="item in optionsRqtype"
-                                        :key="item.value"
-                                        :label="item.label"
-                                        :value="item.value"
-                                        />
-                                    </el-select>
-                                </el-form-item>
-                            </el-col>
-                      </el-row>
-                      <el-row :gutter="48">
-                            <el-col :span="10">
-                              <el-form-item label="所属模型:" prop="mdid" style="">
-                                <el-tree-select
-                                  v-model="formAdd.mdid"
-                                  :data="optionsMdid"
-                                  check-strictly
-                                  :render-after-expand="false"
-                                  style="width: 100%"
-                                />
-                                <!-- <el-select
-                                v-model="formAdd.mdid"
-                                    style="width: 100%;margin-left: 0%;"
-                                >
-                                    <el-option
-                                    v-for="item in optionsMdid"
-                                    :key="item.value"
-                                    :label="item.label"
-                                    :value="item.id"
-                                    />
-                                </el-select> -->
-                      </el-form-item>
-                            </el-col>
-                      </el-row>
-                      <el-form-item label="排序:" prop="dcSort">
-                        <el-input-number v-model="formAdd.sort" :min="1" style="width: 15%;"/>
-                      </el-form-item>
-                      <el-row :gutter="48">
-                            <el-col :span="10">
-                              <el-form-item label="响应类型:" prop="" style="display: flex; align-items: center;">
-                                <el-radio-group v-model="formAdd.rptype" class="ml-4" style="display: inline-flex; align-items: center;">
-                                  <el-radio label="1" size="large" style="display: inline-flex; align-items: center;">
-                                    <span style="position: relative; top: -1px">JSON</span> <!-- 微调文字位置 -->
-                                  </el-radio>
-                                  <el-radio label="2" size="large" style="display: inline-flex; align-items: center;">
-                                    <span style="position: relative; top: -1px">XML</span>
-                                  </el-radio>
-                                  <el-radio label="3" size="large" style="display: inline-flex; align-items: center;">
-                                    <span style="position: relative; top: -1px">HTML</span>
-                                  </el-radio>
-                                </el-radio-group>
-                              </el-form-item>
-                            </el-col>
-                            <el-col :span="6">
-                                <el-form-item label="服务分类:" prop="cateCode" style="">
-                                    <el-cascader v-model="formAdd.cateCode" :options="cascaderOptions" :props="props1" clearable style="width: 100%;"></el-cascader>
-                                </el-form-item>
-                            </el-col>
-                            <!-- <el-col :span="8">
-                                <el-form-item label="请求方式:" prop="name" style="">
-                                    <el-select
-                                    v-model="formJi.type"
-                                    :disabled="isEdit"
-                                        style="width: 100%;margin-left: 0%;"
-                                    >
-                                        <el-option
-                                        v-for="item in optionsType"
-                                        :key="item.value"
-                                        :label="item.label"
-                                        :value="item.value"
-                                        />
-                                    </el-select>
-                                </el-form-item>
-                            </el-col> -->
-                      </el-row>
-                      <el-row :gutter="48">
-                            <el-col :span="13">
-                              <el-form-item label="服务说明:">
-                                  <el-input v-model="formAdd.intro" style="width: 100%;" :rows="3" resize="none" type="textarea"/>
-                              </el-form-item>
-                            </el-col>
-                      </el-row>
-                        
-                    </el-form>
-                    <div style="margin-top: 2%;">
-                        <div style="display: flex;justify-content: space-between;align-items: center;">
-                          <div>
-                            请求参数
-                          </div>
-                          <div style="display: flex;justify-content: flex-end;margin-right: 2%;">
-                            <el-button  @click="addCanAdd" style="margin-top: 1%;" type="success" size="mini" plain>新增参数</el-button>
-                          </div>
-                        </div>
-                        <div>
-                            <el-table 
-                            style="margin-top: 1%;width: 98%;"
-                            :data="tableDataCanAdd" 
-                            :cell-style="{ textAlign: 'center',padding:'2px 0' }"
-                            :header-cell-style="{ textAlign: 'center'}"
-                            :row-style="{ height: heightAll*0.01+'px',fontSize: '16px',textAlign:'center'  }"
-                            border >
-                                <el-table-column prop="itemName" label="参数字段">
-                                    <template #default="scope">
-                                        <div style="width: 100%;">
-                                            <el-input placeholder="请填写参数编码" type="primary" class="noBor" v-model="scope.row.parCode" size="mini" text style="margin-left: 0%;border: transparent;"></el-input>
-                                        </div>
-                                    </template>
-                                </el-table-column>
-                                <el-table-column prop="itemName" label="参数名称">
-                                    <template #default="scope">
-                                        <div style="width: 100%;">
-                                            <el-input placeholder="请填写参数名称" type="primary" class="noBor" v-model="scope.row.parName" size="mini" text style="margin-left: 0%;"></el-input>
-                                        </div>
-                                    </template>
-                                </el-table-column>
-                                <el-table-column prop="itemName" label="参数类型" width="200">
-                                    <template #default="scope">
-                                        <div style="width: 100%;">
-                                            <el-select
-                                            v-model="scope.row.parType"
-                                            class="noBorSel"
-                                            placeholder=""
-                                            style="width: 100%;margin-left: 0%;"
-                                            >
-                                                <el-option
-                                                v-for="item in optionsCan"
-                                                :key="item.value"
-                                                :label="item.label"
-                                                :value="item.value"
-                                                />
-                                    </el-select>
-                                        </div>
-                                    </template>
-                                </el-table-column>
-                                <el-table-column prop="itemName" label="参数说明" >
-                                    <template #default="scope">
-                                        <div style="width: 100%;">
-                                            <el-input type="primary" class="noBor" v-model="scope.row.parNote" size="mini" text style="margin-left: 0%;"></el-input>
-                                        </div>
-                                    </template>
-                                </el-table-column>
-                                <el-table-column prop="address" label="操作" width="100">
-                                    <template #default="scope">
-                                        <div style="width: 100%;">
-                                            <el-button type="danger" @click="delCanAdd(scope.$index)" size="mini" text style="margin-left: 0%;">删除</el-button>
-                                        </div>
-                                    </template>
-                                </el-table-column>
-                            </el-table>
-                            
-                        </div>
-                    </div>
-                    <div style="margin-top: 2%;">
-                        <!-- <div>返回响应</div> -->
-                        <div style="color: #909399;margin-left: 8%;margin-top:1%;">此处填写本服务接口响应信息描述</div>
-                        <el-tabs type="card" style="margin-top: -2%;width: 98%;">
-                            <el-tab-pane label="响应内容">
-                                <div style="display: flex; flex-direction: column;">
-                                   </div>
-                            </el-tab-pane>
-                        </el-tabs>
-                        <div style="overflow: auto;height: 20vh;margin-top: -1%;">
-                          <el-input placeholder="请输入示例" :rows="8" type="textarea" v-model="JsonAdd" size="mini" text style="margin-top: 0%;width: 98%;height: 99%;" ></el-input>
-                        </div>
-                    </div>
-                    <div style="margin-top: 2.5%;margin-left: 0%;padding-bottom: 1%;">
-                    
-                    <el-tabs type="card" style="margin-top: -1.5%;width: 98%;">
-                        <el-tab-pane label="使用说明">
-                             
-                        </el-tab-pane>
-                    </el-tabs>
-                    <el-input placeholder="请输入示例" :rows="8" type="textarea" v-model="exampleAdd" size="mini" text style="margin-top: -1%;width: 98%;" ></el-input>
-                </div>
-                </div>
-                <template #footer>
-                  <span class="dialog-footer">
-                    <el-button size="mini" @click="dialogVisible = false">取消</el-button>
-                    <el-button type="primary" @click="addSer" size="mini">
-                      提交
-                    </el-button>
-                </span>
+            </template>
+          </el-table-column>
+          <el-table-column prop="name" label="服务名称"  width="200">
+          </el-table-column>
+          <el-table-column prop="type" label="接口类型"  width="200">
+          </el-table-column>
+          <el-table-column prop="url" label="接口地址" width="400" show-overflow-tooltip/>
+          <el-table-column prop="rqtype" label="请求方式" width="200"/>
+          <el-table-column prop="rptype" label="响应类型" width="150">
+            <template #default="scope">
+              <div style="text-align: center;display: flex;" v-if="scope.row.rptype=='1'">
+                JSON
+              </div>
+              <div style="text-align: center;display: flex;" v-if="scope.row.rptype=='2'">
+                XML
+              </div>
+              <div style="text-align: center;display: flex;" v-if="scope.row.rptype=='3'">
+                HTML
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column prop="cateCode" label="服务分类" width="140" show-overflow-tooltip>
+          </el-table-column>
+          <el-table-column prop="address" label="操作">
+              <template #default="scope">
+                  <div style="display: flex;justify-content: space-between;width: 100%;">
+                      <!-- <el-button type="danger" text size="mini" style="margin-left: -5%;" @click="handleDelete(scope.row)">注销</el-button> -->
+                      <el-button @click="showDe(scope.row)" type="primary" text size="mini" style="margin-left: 0%;">查看</el-button>
+                      <el-button @click="testSer(scope.row)" type="primary" text size="mini" style="margin-left: 0%;">测试</el-button>
+                      <el-button @click="testSer(scope.row)" type="primary" text size="mini" style="margin-left: 0%;">审核</el-button>
+                  </div>
               </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      
+        <el-dialog @close="clearAdd" v-model="dialogVisible" title="" width="50%" destroy-on-close :key="tableKey">
+          <div style="display: flex;align-items: center;">
+            <div v-if="detailJson.rqtype==='GET'">
+              <el-tag class="ml-2" type="warning">GET</el-tag>
+            </div>
+            <div v-if="detailJson.rqtype==='POST'">
+              <el-tag class="ml-2" type="warning">POST</el-tag>
+            </div>
+            <div style="margin-left: 1%;">
+              {{ detailJson.name }}:
+            </div>
+            <div style="margin-left: 1%;">
+              {{ detailJson.url }}
+            </div>
+          </div>
+          <template #footer>
+            <span class="dialog-footer">
+              <el-button size="mini" @click="dialogVisible = false">取消</el-button>
+              <el-button type="primary" @click="addSer" size="mini">
+                提交
+              </el-button>
+            </span>
+          </template>
         </el-dialog>
         <el-dialog @close="clearFromLev" title="添加目录" v-model="dialogVisibleLevel" width="30%" destroy-on-close :key="tableKey">
           <el-form size="mini" :key="tableKey" style="margin-top: 1%;width: 90%;"  :model="formLev" label-position="right" ref="formRefLev" label-width="120px" :rules="rulesLev">
@@ -491,7 +166,7 @@
 import {getCatalog} from "@/api/service/catalog";
 import { Plus,Search,Filter,Promotion,Check  } from '@element-plus/icons-vue'
 import { reactive } from 'vue'
-import { modelTreeSelect,getSerDe,addService,addParam,editService,editParam,addServiceParam,delService,getTreeDe,addTree,deTree } from "@/api/service/info";
+import { modelTreeSelect,getSerDe,addService,addParam,editService,editParam,addServiceParam,delService,getTreeDe,addTree,deTree,getServiceInfo } from "@/api/service/info";
 import { ref, onMounted, onUnmounted, nextTick,onBeforeMount } from 'vue';
 import JsonViewer from 'vue-json-viewer'
 import 'vue-json-viewer/style.css' 
@@ -686,8 +361,8 @@ const cascaderOptions = ref([])
 const props1 = ref({
   checkStrictly: true,
 })
-const detailJson = ref([])
-
+const detailJson = ref('')
+const parOptions = ref([])
 watch(inputNode, (val) => {
   treeRef.value?.filter(val); // 调用树的过滤方法
 });
@@ -698,6 +373,14 @@ const filterNode = (value, data) => {
 
 const copied = ref(false);
 
+function showDe(row){
+  getSerDe(row.srvId).then(res=>{
+    if(res.code===200){
+      detailJson.value = res.data.ptService
+      dialogVisible.value = true
+    }
+  })
+}
 async function copyUrl(){
   try {
     await navigator.clipboard.writeText(detail.value.url);
@@ -898,29 +581,53 @@ function showAdd(){
   dialogVisible.value = true
 }
 async function handleNodeClick(node,data,event){
-  parTree.value = data.data
-  currentNodeKey.value = data.data.id
-  console.log(data.data.nodeType)
-  isEdit.value = false
-  parId.value = data.data
-  await getSerDe(data.data.id).then(res=>{
-    if(res.data.ptService){
-      detail.value = res.data.ptService
-      tableDataCan.value = res.data.list
-      dataReturn.value = res.data.returnList
-      console.log(tableDataCan.value)
-      dataJsonXiang.value = res.data.ptService.rpcontent
-      formJi.value = res.data.ptService
-      example.value = res.data.ptService.example
-    }
+  // parTree.value = data.data
+  // currentNodeKey.value = data.data.id
+ 
+  // isEdit.value = false
+  // parId.value = data.data
+  // await getSerDe(data.data.id).then(res=>{
+  //   if(res.data.ptService){
+  //     detail.value = res.data.ptService
+  //     tableDataCan.value = res.data.list
+  //     dataReturn.value = res.data.returnList
+  //     console.log(tableDataCan.value)
+  //     dataJsonXiang.value = res.data.ptService.rpcontent
+  //     formJi.value = res.data.ptService
+  //     example.value = res.data.ptService.example
+  //   }
     
+  // })
+  var par = {
+    mdid:data.data.id
+  }
+  console.log(data.data.id)
+  await getServiceInfo(par).then(res=>{
+    if(res.data){
+      tableData.value = res.data.serviceList
+    }
   })
-  detail.value.nodeType = data.data.nodeType
-  
+  parOptions.value.forEach(option => {
+    option.label = option.cateName;
+    option.value = option.cateCode;
+  });
+  console.log(parOptions.value)
+  for(var i = 0; i < parOptions.value.length; i++){
+    for(var i1 = 0; i1 < tableData.value.length; i1++){
+      console.log(i1);
+      if(parOptions.value[i].value === tableData.value[i1].cateCode){
+         tableData.value[i1].cateCode = parOptions.value[i].label
+      }
+    }
+  }
 }
 async function getTreeLeft(){
-  var par
-  await modelTreeSelect().then(res=>{
+  var par = {
+    params:{
+      level:'2'
+    }
+  }
+  await modelTreeSelect(par).then(res=>{
     par = res.data
     data.value = res.data
     
@@ -957,6 +664,7 @@ function renameTreeProperties(tree) {
 }
 function fetchData() {
   getCatalog().then((r) => {
+    parOptions.value = r.data
     cascaderOptions.value = renameTreeProperties(buildTree(r.data))
     console.log(cascaderOptions.value)
   });