houyaf vor 3 Jahren
Ursprung
Commit
b543a172b0
2 geänderte Dateien mit 37 neuen und 3 gelöschten Zeilen
  1. 13 0
      src/api/paas/apiGatewayApi.ts
  2. 24 3
      src/views/paas/atu/index.vue

+ 13 - 0
src/api/paas/apiGatewayApi.ts

@@ -40,6 +40,19 @@ export function updateX(apiCode: string, data: any) {
 }
 
 /**
+ * 更新Atu
+ * @param data
+ * @returns
+ */
+export function patchX(apiCode: string, data: any) {
+  return apiRequest({
+    url: `/x/${apiCode}`,
+    method: 'PUT',
+    data,
+  })
+}
+
+/**
  * 删除Atu
  * @param apiId
  * @param atuId

+ 24 - 3
src/views/paas/atu/index.vue

@@ -10,6 +10,7 @@ import ModelObjectSelector from './components/ModelObjectSelector.vue'
 import useSettingsStore from '@/store/modules/settings'
 import { getApiById } from '@/api/paas/apiApi'
 import { deleteAtuById, getAtuByList } from '@/api/paas/apiTransUnitApi'
+import { createX, deleteX, getX, patchX, updateX } from '@/api/paas/apiGatewayApi'
 
 const settingsStore = useSettingsStore()
 const route = useRoute()
@@ -23,6 +24,7 @@ const state = reactive({
   loading: false,
   apiTitle: '',
   apiCode: '',
+  apiType: 0,
   keywords: '',
   atuList: [],
   dialogState: 1,
@@ -47,6 +49,7 @@ const getData = async () => {
   const { data } = await getApiById(modId, apiId)
   state.apiTitle = data.apiTitle
   state.apiCode = data.apiCode
+  state.apiType = data.apiType
   await getAtuData()
 }
 
@@ -76,12 +79,30 @@ const onDelete = (data: { apiId: number; atuId: number; objectTitle: string }) =
   })
 }
 
-const onGenerateData = () => {
+const onGenerateParams = () => {
   state.result = '生成参数'
 }
 
-const onExecute = () => {
+const onExecute = async () => {
+  const apiType = state.apiType
+  const apiCode = state.apiCode
+  const params = {}
 
+  if (apiType === 1) {
+    await getX(apiCode, params)
+  }
+  else if (apiType === 2) {
+    await createX(apiCode, params)
+  }
+  else if (apiType === 3) {
+    await updateX(apiCode, params)
+  }
+  else if (apiType === 4) {
+    await patchX(apiCode, params)
+  }
+  else if (apiType === 5) {
+    await deleteX(apiCode, params)
+  }
 }
 // 选择对象模型回调
 const onObjectSelSuccess = () => {
@@ -160,7 +181,7 @@ function goBack() {
         <div class="form">
           <tool-header>
             <template #right>
-              <el-button type="primary" @click="onGenerateData">
+              <el-button type="primary" @click="onGenerateParams">
                 生成参数
               </el-button>
             </template>