diff --git a/mayfly_go_web/src/common/syssocket.ts b/mayfly_go_web/src/common/syssocket.ts index f6c1d66c..fc17468c 100644 --- a/mayfly_go_web/src/common/syssocket.ts +++ b/mayfly_go_web/src/common/syssocket.ts @@ -1,9 +1,9 @@ import Config from './config'; -import { ElNotification } from 'element-plus'; +import {ElNotification} from 'element-plus'; import SocketBuilder from './SocketBuilder'; -import { getToken } from '@/common/utils/storage'; +import {getToken} from '@/common/utils/storage'; -import { joinClientParams } from './request'; +import {joinClientParams} from './request'; class SysSocket { /** @@ -19,10 +19,11 @@ class SysSocket { /** * 消息类型 */ - messageTypes = { + messageTypes: any = { 0: 'error', 1: 'success', 2: 'info', + 22: 'info', }; /** @@ -57,12 +58,20 @@ class SysSocket { } const type = this.getMsgType(message.type); + let msg = message.msg + let duration = 0 + if (message.type == 22) { + let obj = JSON.parse(msg); + msg = `文件:${obj['title']} 执行成功: ${obj['executedStatements']} 条` + duration = 2000 + } ElNotification({ - duration: 0, + duration: duration, title: message.title, - message: message.msg, + message: msg, type: type, }); + console.log(message) }) .open((event: any) => console.log(event)) .close(() => { diff --git a/mayfly_go_web/src/components/auth/auth.ts b/mayfly_go_web/src/components/auth/auth.ts index 263b1006..89718864 100644 --- a/mayfly_go_web/src/components/auth/auth.ts +++ b/mayfly_go_web/src/components/auth/auth.ts @@ -14,11 +14,11 @@ export function hasPerm(code: string) { /** * 判断用户是否拥有权限对象里对应的code - * @param perms { save: "xxx:save"} * @returns {"xxx:save": true} key->permission code + * @param permCodes */ export function hasPerms(permCodes: any[]) { - const res = {}; + const res = {} as { [key: string]: boolean }; for (let permCode of permCodes) { if (hasPerm(permCode)) { res[permCode] = true; diff --git a/mayfly_go_web/src/components/pagetable/PageTable.vue b/mayfly_go_web/src/components/pagetable/PageTable.vue index 1fa7525d..0afbcc30 100644 --- a/mayfly_go_web/src/components/pagetable/PageTable.vue +++ b/mayfly_go_web/src/components/pagetable/PageTable.vue @@ -156,8 +156,8 @@ { nowSearchItem.value = searchItem; }; +const pageSizeChange = (val: number) => { + emit('pageSizeChange', val); + handlePageSizeChange(val); +}; +const pageNumChange = (val: number) => { + emit('pageNumChange', val); + handlePageNumChange(val); +}; + let { tableData, total, loading, search, reset, getTableData, handlePageNumChange, handlePageSizeChange } = usePageTable( props.pageable, props.pageApi, @@ -353,6 +362,7 @@ defineExpose({ tableRef: tableRef, search: getTableData, getData, + total, }); diff --git a/mayfly_go_web/src/views/ops/component/TagTree.vue b/mayfly_go_web/src/views/ops/component/TagTree.vue index 7c686200..bffd6ca0 100644 --- a/mayfly_go_web/src/views/ops/component/TagTree.vue +++ b/mayfly_go_web/src/views/ops/component/TagTree.vue @@ -48,7 +48,7 @@ + diff --git a/mayfly_go_web/src/views/ops/db/DbTransferList.vue b/mayfly_go_web/src/views/ops/db/DbTransferList.vue index bef32409..c6e96c85 100644 --- a/mayfly_go_web/src/views/ops/db/DbTransferList.vue +++ b/mayfly_go_web/src/views/ops/db/DbTransferList.vue @@ -36,16 +36,38 @@ + + + @@ -62,6 +84,7 @@ import { SearchItem } from '@/components/SearchForm'; import { getDbDialect } from '@/views/ops/db/dialect'; import { DbTransferRunningStateEnum } from './enums'; import TerminalLog from '@/components/terminal/TerminalLog.vue'; +import DbTransferFile from './DbTransferFile.vue'; const DbTransferEdit = defineAsyncComponent(() => import('./DbTransferEdit.vue')); @@ -71,6 +94,7 @@ const perms = { status: 'db:transfer:status', log: 'db:transfer:log', run: 'db:transfer:run', + files: 'db:transfer:files', }; const searchItems = [SearchItem.input('name', '名称')]; @@ -78,17 +102,17 @@ const searchItems = [SearchItem.input('name', '名称')]; const columns = ref([ TableColumn.new('taskName', '任务名').setMinWidth(150).isSlot(), TableColumn.new('srcDb', '源库').setMinWidth(150).isSlot(), - TableColumn.new('targetDb', '目标库').setMinWidth(150).isSlot(), + // TableColumn.new('targetDb', '目标库').setMinWidth(150).isSlot(), TableColumn.new('runningState', '执行状态').typeTag(DbTransferRunningStateEnum), - TableColumn.new('creator', '创建人'), - TableColumn.new('createTime', '创建时间').isTime(), + TableColumn.new('status', '状态').isSlot(), TableColumn.new('modifier', '修改人'), TableColumn.new('updateTime', '修改时间').isTime(), ]); // 该用户拥有的的操作列按钮权限 -const actionBtns = hasPerms([perms.save, perms.del, perms.status, perms.log, perms.run]); -const actionWidth = ((actionBtns[perms.save] ? 1 : 0) + (actionBtns[perms.log] ? 1 : 0) + (actionBtns[perms.run] ? 1 : 0)) * 55; +const actionBtns = hasPerms([perms.save, perms.del, perms.status, perms.log, perms.run, perms.files]); +const actionWidth = + ((actionBtns[perms.save] ? 1 : 0) + (actionBtns[perms.log] ? 1 : 0) + (actionBtns[perms.run] ? 1 : 0) + (actionBtns[perms.files] ? 1 : 0)) * 55; const actionColumn = TableColumn.new('action', '操作').isSlot().setMinWidth(actionWidth).fixedRight().alignCenter(); const pageTableRef: Ref = ref(null); @@ -120,9 +144,15 @@ const state = reactive({ data: null as any, running: false, }, + filesDialog: { + taskId: 0, + title: '迁移文件列表', + visible: false, + data: null as any, + }, }); -const { selectionData, query, editDialog, logsDialog } = toRefs(state); +const { selectionData, query, editDialog, logsDialog, filesDialog } = toRefs(state); onMounted(async () => { if (Object.keys(actionBtns).length > 0) { @@ -137,10 +167,10 @@ const search = () => { const edit = async (data: any) => { if (!data) { state.editDialog.data = null; - state.editDialog.title = '新增数据库迁移任务'; + state.editDialog.title = '新增数据库迁移任务(迁移不会对源库造成修改)'; } else { state.editDialog.data = data; - state.editDialog.title = '修改数据库迁移任务'; + state.editDialog.title = '修改数据库迁移任务(迁移不会对源库造成修改)'; } state.editDialog.visible = true; }; @@ -184,6 +214,22 @@ const reRun = async (data: any) => { }, 2000); }; +const openFiles = async (data: any) => { + state.filesDialog.visible = true; + state.filesDialog.title = '迁移文件管理'; + state.filesDialog.taskId = data.id; + state.filesDialog.data = data; +}; +const updStatus = async (id: any, status: 1 | -1) => { + try { + await dbApi.updateDbTransferTaskStatus.request({ taskId: id, status }); + ElMessage.success(`${status === 1 ? '启用' : '禁用'}成功`); + search(); + } catch (err) { + // + } +}; + const del = async () => { try { await ElMessageBox.confirm(`确定删除任务?`, '提示', { diff --git a/mayfly_go_web/src/views/ops/db/SqlExec.vue b/mayfly_go_web/src/views/ops/db/SqlExec.vue index 369e5053..dc802d4b 100644 --- a/mayfly_go_web/src/views/ops/db/SqlExec.vue +++ b/mayfly_go_web/src/views/ops/db/SqlExec.vue @@ -1,14 +1,14 @@