wujingjing
2024-10-08 6869f6a6d3f095fee026fa384c14dd19d35b09db
src/views/project/yw/lowCode/sqlAmis/edit/SqlAmisEdit.vue
@@ -36,17 +36,32 @@
               <!-- <el-table-column label="请求地址" ></el-table-column> -->
            </el-table></Pane
         >
         <Pane :size="60">
         <Pane :size="60" class="pl-2">
            <Splitpanes class="default-theme h100" :horizontal="true">
               <Pane :size="35" class="flex-col flex">
               <Pane :size="45" class="flex-col flex">
                  <!-- #region ====================== 关键词匹配 ======================-->
                  <div class="flex-0 flex justify-between items-center mb-1 ml-1 h-[36px]">
                     <span class="font-bold">关键词</span>
                  </div>
                  <TagInput class="mb-1" v-model="matchList"></TagInput>
                  <!-- #endregion -->
                  <div class="flex-0 flex justify-between items-center mb-1 ml-1 h-[36px]">
                     <span class="font-bold">参数</span>
                     <el-button type="default" @click="addArg">添加参数</el-button>
                     <el-button size="small" type="default" @click="addArg">添加参数</el-button>
                  </div>
                  <el-table class="flex-auto" :data="args" border>
                     <el-table-column prop="name" width="150" label="名称" show-overflow-tooltip>
                     <el-table-column prop="name" width="150" label="参数名" fixed show-overflow-tooltip>
                        <template #default="scope">
                           <el-input v-model="scope.row.name" @input="argsInput"></el-input>
                        </template>
                     </el-table-column>
                     <el-table-column prop="type" width="120" label="类型" show-overflow-tooltip>
                        <template #default="scope">
                           <el-select v-model="scope.row.type">
                              <el-option v-for="item in Object.keys(argTypeMap)" :key="item" :value="item" :label="argTypeMap[item]"></el-option>
                           </el-select>
                        </template>
                     </el-table-column>
                     <el-table-column prop="prompt" width="450" label="提示词" show-overflow-tooltip>
@@ -54,6 +69,12 @@
                           <el-input type="textarea" :rows="2" v-model="scope.row.prompt" @input="argsInput"></el-input>
                        </template>
                     </el-table-column>
                     <el-table-column prop="required" width="56" label="必填" show-overflow-tooltip>
                        <template #default="scope">
                           <el-checkbox v-model="scope.row.required"></el-checkbox>
                        </template>
                     </el-table-column>
                     <el-table-column prop="check" label="缺省值" show-overflow-tooltip>
                        <template #default="scope">
                           <el-input v-model="scope.row.check" @input="argsInput"></el-input>
@@ -68,7 +89,8 @@
                     </el-table-column>
                  </el-table>
               </Pane>
               <Pane :size="65">
               <Pane :size="55">
                  <div class="h-full">
                     <template v-if="currentDockConfig">
                        <div class="flex justify-between items-center my-1 ml-1 h-[36px]">
@@ -168,14 +190,14 @@
import { Codemirror } from 'vue-codemirror';
import { SupervisorPublished } from '../types';
import * as codeExample from './testData';
import { amisDockTypeMap } from './types';
import { amisDockTypeMap, argTypeMap } from './types';
import * as supervisorApi from '/@/api/supervisorAdmin';
import { updateSqlApi } from '/@/api/supervisorAdmin';
import titleBox from '/@/components/titleBox.vue';
import { useCompRef } from '/@/utils/types';
import { computed } from 'vue';
import SqlCodeViewDlg from './optDlg/SqlCodeViewDlg.vue';
import TagInput from '/@/components/form/tagInput/TagInput.vue';
const props = defineProps(['supervisor']);
const emit = defineEmits(['backLastPage', 'updatePublished']);
const log = console.log;
@@ -399,6 +421,7 @@
         def_rs_json: dockConfigList.value.length === 0 ? null : JSON.stringify(dockConfigList.value),
         async_rs_json: asyncRsList.length === 0 ? null : JSON.stringify(asyncRsList),
         args: args.value.length === 0 ? null : JSON.stringify(args.value),
         matchs: !matchList.value || matchList.value.length === 0 ? null : JSON.stringify(matchList.value),
      },
      {
         loading: false,
@@ -485,6 +508,8 @@
   });
};
// 匹配词
const matchList = ref([]);
//#region ====================== 可编辑表格 ======================
const args = ref([]);
const debounceUpdateInput = debounce(() => {
@@ -537,7 +562,7 @@
      ) ?? [];
   dockConfigList.value = xmlJson.def_rs_json ?? null;
   args.value = xmlJson.args ?? [];
   matchList.value = xmlJson.matchs ??[];
   configList.value = parseJSONData(xmlJson.amis_json, originConfig);
   const res = await supervisorApi.getAmisDatabaseList();
   databaseList.value = res.values ?? [];