diff --git a/frontend/package.json b/frontend/package.json index 874ecfe5..3d23e514 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "@element-plus/icons-vue": "^2.3.1", - "@vueuse/core": "^11.3.0", + "@vueuse/core": "^12.0.0", "asciinema-player": "^3.8.1", "axios": "^1.6.2", "clipboard": "^2.0.11", @@ -19,7 +19,7 @@ "crypto-js": "^4.2.0", "dayjs": "^1.11.13", "echarts": "^5.5.1", - "element-plus": "^2.8.8", + "element-plus": "^2.9.0", "js-base64": "^3.7.7", "jsencrypt": "^3.3.2", "lodash": "^4.17.21", @@ -28,16 +28,16 @@ "monaco-sql-languages": "^0.12.2", "monaco-themes": "^0.4.4", "nprogress": "^0.2.0", - "pinia": "^2.2.7", - "qrcode.vue": "^3.5.1", + "pinia": "^2.3.0", + "qrcode.vue": "^3.6.0", "screenfull": "^6.0.2", - "sortablejs": "^1.15.3", + "sortablejs": "^1.15.6", "splitpanes": "^3.1.5", "sql-formatter": "^15.4.5", "trzsz": "^1.1.5", "uuid": "^9.0.1", "vue": "^3.5.13", - "vue-i18n": "^10.0.4", + "vue-i18n": "^10.0.5", "vue-router": "^4.5.0", "xterm": "^5.3.0", "xterm-addon-fit": "^0.8.0", @@ -59,9 +59,9 @@ "eslint": "^8.35.0", "eslint-plugin-vue": "^9.31.0", "prettier": "^3.2.5", - "sass": "^1.81.0", + "sass": "^1.82.0", "typescript": "^5.7.2", - "vite": "^6.0.1", + "vite": "^6.0.3", "vue-eslint-parser": "^9.4.3" }, "browserslist": [ diff --git a/frontend/src/common/openApi.ts b/frontend/src/common/openApi.ts index fc6322e8..eb5a116c 100644 --- a/frontend/src/common/openApi.ts +++ b/frontend/src/common/openApi.ts @@ -7,7 +7,7 @@ export default { getPublicKey: () => request.get('/common/public-key'), getConfigValue: (params: any) => request.get('/sys/configs/value', params), getServerConf: () => request.get('/sys/configs/server'), - oauth2LoginConfig: () => request.get('/auth/oauth2-config'), + oauth2LoginConfig: () => request.get('/auth/oauth2/config'), changePwd: (param: any) => request.post('/sys/accounts/change-pwd', param), captcha: () => request.get('/sys/captcha'), logout: () => request.post('/auth/accounts/logout'), diff --git a/frontend/src/common/sysmsgs.ts b/frontend/src/common/sysmsgs.ts new file mode 100644 index 00000000..009b81b6 --- /dev/null +++ b/frontend/src/common/sysmsgs.ts @@ -0,0 +1,47 @@ +import { buildProgressProps } from '@/components/progress-notify/progress-notify'; +import syssocket from './syssocket'; +import { h, reactive } from 'vue'; +import { ElNotification } from 'element-plus'; +import ProgressNotify from '@/components/progress-notify/progress-notify.vue'; + +export function initSysMsgs() { + registerDbSqlExecProgress(); +} + +const sqlExecNotifyMap: Map = new Map(); + +function registerDbSqlExecProgress() { + syssocket.registerMsgHandler('execSqlFileProgress', function (message: any) { + const content = JSON.parse(message.msg); + const id = content.id; + let progress = sqlExecNotifyMap.get(id); + if (content.terminated) { + if (progress != undefined) { + progress.notification?.close(); + sqlExecNotifyMap.delete(id); + progress = undefined; + } + return; + } + + if (progress == undefined) { + progress = { + props: reactive(buildProgressProps()), + notification: undefined, + }; + } + + progress.props.progress.title = content.title; + progress.props.progress.executedStatements = content.executedStatements; + if (!sqlExecNotifyMap.has(id)) { + progress.notification = ElNotification({ + duration: 0, + title: message.title, + message: h(ProgressNotify, progress.props), + type: syssocket.getMsgType(message.type), + showClose: false, + }); + sqlExecNotifyMap.set(id, progress); + } + }); +} diff --git a/frontend/src/common/syssocket.ts b/frontend/src/common/syssocket.ts index fc17468c..e7b6148c 100644 --- a/frontend/src/common/syssocket.ts +++ b/frontend/src/common/syssocket.ts @@ -1,9 +1,9 @@ import Config from './config'; -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'; +import { ElNotification } from 'element-plus'; class SysSocket { /** @@ -23,7 +23,6 @@ class SysSocket { 0: 'error', 1: 'success', 2: 'info', - 22: 'info', }; /** @@ -57,21 +56,16 @@ class SysSocket { return; } + // 默认通知处理 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 - } + let msg = message.msg; + let duration = 0; ElNotification({ duration: duration, title: message.title, message: msg, type: type, }); - console.log(message) }) .open((event: any) => console.log(event)) .close(() => { diff --git a/frontend/src/components/progress-notify/progress-notify.vue b/frontend/src/components/progress-notify/progress-notify.vue index a0dcf230..09527e6b 100644 --- a/frontend/src/components/progress-notify/progress-notify.vue +++ b/frontend/src/components/progress-notify/progress-notify.vue @@ -1,5 +1,5 @@