|
|
@@ -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>
|