| | |
| | | </el-table></Pane |
| | | > |
| | | <Pane :size="60"> |
| | | <Splitpanes class="default-theme h100" :horizontal="true" v-if="currentSql"> |
| | | <Splitpanes class="default-theme h100" :horizontal="true" > |
| | | <Pane :size="35" class="flex-col flex"> |
| | | <div class="flex-0 flex justify-between items-center mb-1 ml-1 h-[36px]"> |
| | | <span class="font-bold">参数</span> |
| | |
| | | </Pane> |
| | | <Pane :size="65"> |
| | | <div class=" h-full"> |
| | | <template v-if="currentSql"> |
| | | <template v-if="currentDockConfig"> |
| | | <div class=" flex justify-between items-center my-1 ml-1 h-[36px]"> |
| | | <span class="font-bold">SQL</span> |
| | | |
| | | <el-select class="w-52 font-bold" v-model="currentDockConfig.type"> |
| | | <el-option v-for="item in Object.keys(amisDockTypeMap)" :key="item" :value="(item)" :label="amisDockTypeMap[item]"></el-option> |
| | | </el-select> |
| | | |
| | | <el-select class="w-40" v-model="currentSql.database" @change="databaseSelectChange"> |
| | | <el-select class="w-40" v-model="currentDockConfig.database" @change="databaseSelectChange"> |
| | | <el-option v-for="item in databaseList" :key="item.id" :value="item.id" :label="item.title"></el-option> |
| | | </el-select> |
| | | </div> |
| | | <codemirror |
| | | class=" overflow-auto" |
| | | class="overflow-auto" |
| | | style="height: calc(100% - 36px);" |
| | | v-model="currentSql.sql" |
| | | v-model="currentDockConfig.sql" |
| | | :autofocus="true" |
| | | :indent-with-tab="true" |
| | | :tab-size="2" |
| | |
| | | import { sql } from '@codemirror/lang-sql'; |
| | | import { xml } from '@codemirror/lang-xml'; |
| | | import { vscodeDark } from '@uiw/codemirror-theme-vscode'; |
| | | import _, { debounce } from 'lodash'; |
| | | import { onMounted, ref } from 'vue'; |
| | | import { Codemirror } from 'vue-codemirror'; |
| | | import * as codeExample from './testData'; |
| | | import titleBox from '/@/components/titleBox.vue'; |
| | | import { Pane, Splitpanes } from 'splitpanes'; |
| | | import 'splitpanes/dist/splitpanes.css'; |
| | | import type { TableInstance } from 'element-plus'; |
| | | import { ElMessage } from 'element-plus'; |
| | | import _, { debounce } from 'lodash'; |
| | | import { Pane, Splitpanes } from 'splitpanes'; |
| | | import 'splitpanes/dist/splitpanes.css'; |
| | | import { v4 as uuid } from 'uuid'; |
| | | import { onMounted, ref } from 'vue'; |
| | | import { Codemirror } from 'vue-codemirror'; |
| | | import { SupervisorPublished } from '../types'; |
| | | import * as codeExample from './testData'; |
| | | import * as supervisorApi from '/@/api/supervisorAdmin'; |
| | | import { updateSqlApi } from '/@/api/supervisorAdmin'; |
| | | import titleBox from '/@/components/titleBox.vue'; |
| | | import { useCompRef } from '/@/utils/types'; |
| | | import { SupervisorPublished } from '../types'; |
| | | import { amisDockTypeMap } from './types'; |
| | | |
| | | const props = defineProps(['supervisor']); |
| | | const emit = defineEmits(['backLastPage', 'updatePublished']); |
| | |
| | | let defaultSelectDatabase = null; |
| | | const databaseSelectChange = (val) => { |
| | | defaultSelectDatabase = val; |
| | | if(currentSql.value){ |
| | | currentSql.value.database = val; |
| | | if(currentDockConfig.value){ |
| | | currentDockConfig.value.database = val; |
| | | } |
| | | updateSqlAndRs(currentSql.value.id,currentSql.value) |
| | | updateSqlAndRs(currentDockConfig.value.id,currentDockConfig.value) |
| | | }; |
| | | const backLastPage = () => { |
| | | // setTimeout(() => { |
| | |
| | | const currentRs = ref<AmisDockConfig>(null); |
| | | const dockRowChange = (row) => { |
| | | currentRs.value = row; |
| | | currentSql.value = dockConfigList.value.find((item) => item.id === currentRs.value.recordId) ?? { |
| | | currentDockConfig.value = dockConfigList.value.find((item) => item.id === currentRs.value.recordId) ?? { |
| | | id: row.recordId, |
| | | type: AmisDockType.Sql, |
| | | sql: '', |
| | | database: defaultSelectDatabase ?? databaseList.value[0]?.id ?? null, |
| | | }; |
| | | }; |
| | | const currentSql = ref(null); |
| | | const currentDockConfig = ref(null); |
| | | /** @description 路径分隔符 */ |
| | | const PATH_SEPARATOR = '/'; |
| | | /** @description 1 退出所有循环 -1退出当次循环 0或其他值继续 */ |
| | |
| | | |
| | | const sqlCodeChange = debounce((val) => { |
| | | if (!currentRs.value.recordId) return; |
| | | if (currentSql.value) { |
| | | if (!currentSql.value.database) { |
| | | if (currentDockConfig.value) { |
| | | if (!currentDockConfig.value.database) { |
| | | ElMessage.warning('请先选择数据库'); |
| | | return; |
| | | } |
| | | } |
| | | updateSqlAndRs(currentSql.value.id, currentSql.value); |
| | | updateSqlAndRs(currentDockConfig.value.id, currentDockConfig.value); |
| | | }, 1000); |
| | | const dockConfigList = ref([]); |
| | | const rsTableRef = ref<TableInstance>(null); |