Browse Source

api服务发布接口接入

yls 1 năm trước cách đây
mục cha
commit
166d0debe5
1 tập tin đã thay đổi với 27 bổ sung11 xóa
  1. 27 11
      src/views/servicePublishApi/Detail.vue

+ 27 - 11
src/views/servicePublishApi/Detail.vue

@@ -42,7 +42,9 @@
                     </el-form-item>
                 </el-form>
                 <span class="detail-part-title">输入参数</span>
-                <EditTable :form-data="formDataSjx.value" :table-data="tableData.value" :is-edit="route.params.type!=='detail'"/>
+                <EditTable :form-data="formDataInParam.value" :table-data="tableDataIn.value" :is-edit="route.params.type!=='detail'"/>
+                <span class="detail-part-title">返回参数</span>
+                <EditTable :form-data="formDataSjxOutParam.value" :table-data="tableDataOut.value" :is-edit="route.params.type!=='detail'"/>
             </div>
         </div>
     </div>
@@ -85,16 +87,23 @@
         {value: 5, label: '空间编辑'},
         {value: 6, label: '其它功能'}
     ])
-    const tableData = reactive({value: []})
-    const formDataSjx = reactive({value: [
-            { fieldName: 'tDataItemName', label: '名称', value: '', isRequired: true, type: 'input', showInTable: true },
-            { fieldName: 'tDataItemDescription', label: '描述', value: '', isRequired: false, type: 'input', showInTable: true },
-            { fieldName: 'tDataItemLength', label: '长度', value: '', isRequired: false, type: 'input' },
-            { fieldName: 'tDataItemDecimals', label: '小数位', value: '', isRequired: false, type: 'input' },
-            { fieldName: 'tDataItemReferenceStandard', label: '参考标准', value: '', isRequired: true, type: 'input' },
-            { fieldName: 'tDataItemRange', label: '值域', value: '', isRequired: true, type: 'input' },
-            { fieldName: 'tDataItemShareCondition', label: '共享条件', value: '', isRequired: true, type: 'input' },
-            { fieldName: 'tDataItemOpenCondition', label: '开放条件', value: '', isRequired: true, type: 'input' },
+    const tableDataIn = reactive({value: []})
+    const tableDataOut = reactive({value: []})
+    const formDataInParam = reactive({value: [
+            { fieldName: 'apiParameter', label: '参数名称', value: '', isRequired: true, type: 'input', showInTable: true },
+            { fieldName: 'apiType', label: '参数类型', value: '', isRequired: false, type: 'input', showInTable: true },
+            { fieldName: 'apiMandatory', label: '是否必填', value: '', isRequired: false, type: 'input', showInTable: true },
+            { fieldName: 'apiIllustrate', label: '说明', value: '', isRequired: false, type: 'input', showInTable: true },
+            { fieldName: 'apiNotes', label: '备注', value: '', isRequired: false, type: 'input', showInTable: true },
+
+        ]})
+    const formDataSjxOutParam = reactive({value: [
+            { fieldName: 'apiParameter', label: '参数名称', value: '', isRequired: true, type: 'input', showInTable: true },
+            { fieldName: 'apiType', label: '参数类型', value: '', isRequired: false, type: 'input', showInTable: true },
+            { fieldName: 'apiMandatory', label: '是否必填', value: '', isRequired: false, type: 'input', showInTable: true },
+            { fieldName: 'apiIllustrate', label: '说明', value: '', isRequired: false, type: 'input', showInTable: true },
+            { fieldName: 'apiNotes', label: '备注', value: '', isRequired: false, type: 'input', showInTable: true },
+
         ]})
     const formRules = reactive({
         basicInfo: {
@@ -124,6 +133,8 @@
                 if(route.params.type==='edit') {
                     // 编辑
                     pForm['id'] = route.params.id
+                    pForm['apiInParam'] = JSON.stringify(tableDataIn.value)
+                    pForm['apiOutParam'] = JSON.stringify(tableDataOut.value)
                     ServicePublishEdit(pForm).then(res => {
                         if(res.code=='200'&&res.data==='保存成功') {
                             ElMessage({type:'success', message: '修改成功'})
@@ -134,6 +145,8 @@
                     // 新增
                     pForm['id'] = null
                     pForm['state'] = 1
+                    pForm['apiInParam'] = JSON.stringify(tableDataIn.value)
+                    pForm['apiOutParam'] = JSON.stringify(tableDataOut.value)
                     ServicePublishAdd(pForm).then(res => {
                         if(res.code=='200'&&res.data==='保存成功') {
                             ElMessage({type:'success', message: '新增成功'})
@@ -158,6 +171,9 @@
                     form.basicInfo.apiUrl = data.apiUrl
                     form.basicInfo.apiRequest = data.apiRequest
                     form.basicInfo.apiExplain = data.apiExplain
+                    tableDataIn.value = JSON.parse(res.data.apiInParam)
+                    tableDataOut.value = JSON.parse(res.data.apiOutParam)
+                    console.log(tableDataIn.value)
                 } else {
                     ElMessage({type:'error', message: '查询失败'})
                 }