diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index-tree.vue.vm index c2383c0572da792949c5cb8f99104b5fe7fcbee2..5acbc614f513b550dc4622bd6790e7a696bc5558 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index-tree.vue.vm +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index-tree.vue.vm @@ -448,13 +448,13 @@ export default { #end if (this.form.${pkColumn.javaField} != null) { update${BusinessName}(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { add${BusinessName}(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -464,16 +464,12 @@ export default { }, /** 删除按钮操作 */ handleDelete(row) { - this.$confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return del${BusinessName}(row.${pkColumn.javaField}); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() { + return del${BusinessName}(row.${pkColumn.javaField}); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); } } }; diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm index 78d15eb7d2641963dc40f3c597ea629836b387bd..0c57d50874a34751507dde1a4c314c443a6028fa 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm @@ -500,13 +500,13 @@ export default { #end if (this.form.${pkColumn.javaField} != null) { update${BusinessName}(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { add${BusinessName}(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -517,16 +517,12 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids; - this.$confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return del${BusinessName}(${pkColumn.javaField}s); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(function() { + return del${BusinessName}(${pkColumn.javaField}s); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); }, #if($table.sub) /** ${subTable.functionName}序号 */ diff --git a/ruoyi-ui/src/layout/components/Settings/index.vue b/ruoyi-ui/src/layout/components/Settings/index.vue index 0a6becacb249eefcce884f858b5c12c46350762f..4dff1d0c535bfaf3e57db498fcd69f1842e547f4 100644 --- a/ruoyi-ui/src/layout/components/Settings/index.vue +++ b/ruoyi-ui/src/layout/components/Settings/index.vue @@ -162,14 +162,8 @@ export default { this.sideTheme = val; }, saveSetting() { - const loading = this.$loading({ - lock: true, - fullscreen: false, - text: "正在保存到本地,请稍后...", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)" - }); - localStorage.setItem( + this.$modal.loading("正在保存到本地,请稍后..."); + this.$cache.local.set( "layout-setting", `{ "topNav":${this.topNav}, @@ -181,17 +175,11 @@ export default { "theme":"${this.theme}" }` ); - setTimeout(loading.close(), 1000) + setTimeout(this.$modal.closeLoading(), 1000) }, resetSetting() { - this.$loading({ - lock: true, - fullscreen: false, - text: "正在清除设置缓存并刷新,请稍后...", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)" - }); - localStorage.removeItem("layout-setting") + this.$modal.loading("正在清除设置缓存并刷新,请稍后..."); + this.$cache.local.remove("layout-setting") setTimeout("window.location.reload()", 1000) } } diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js index cf6dd9b26270251da2155c2ba41c551565684954..83b079101ec872ee0fd5c0081b98db0f03dfb562 100644 --- a/ruoyi-ui/src/main.js +++ b/ruoyi-ui/src/main.js @@ -11,6 +11,7 @@ import App from './App' import store from './store' import router from './router' import directive from './directive' //directive +import plugins from './plugins' // plugins import { download } from '@/utils/request' import './assets/icons' // icon @@ -18,6 +19,7 @@ import './permission' // permission control import { getDicts } from "@/api/system/dict/data"; import { getConfigKey } from "@/api/system/config"; import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"; +// 分页组件 import Pagination from "@/components/Pagination"; // 自定义表格工具组件 import RightToolbar from "@/components/RightToolbar" @@ -45,18 +47,6 @@ Vue.prototype.selectDictLabels = selectDictLabels Vue.prototype.download = download Vue.prototype.handleTree = handleTree -Vue.prototype.msgSuccess = function (msg) { - this.$message({ showClose: true, message: msg, type: "success" }); -} - -Vue.prototype.msgError = function (msg) { - this.$message({ showClose: true, message: msg, type: "error" }); -} - -Vue.prototype.msgInfo = function (msg) { - this.$message.info(msg); -} - // 全局组件挂载 Vue.component('DictTag', DictTag) Vue.component('Pagination', Pagination) @@ -66,6 +56,7 @@ Vue.component('FileUpload', FileUpload) Vue.component('ImageUpload', ImageUpload) Vue.use(directive) +Vue.use(plugins) Vue.use(VueMeta) DictData.install() diff --git a/ruoyi-ui/src/plugins/cache.js b/ruoyi-ui/src/plugins/cache.js new file mode 100644 index 0000000000000000000000000000000000000000..6f71b8e5cb38e74fc2f45a04920a38ba5f6b09e8 --- /dev/null +++ b/ruoyi-ui/src/plugins/cache.js @@ -0,0 +1,77 @@ +const sessionCache = { + set (key, value) { + if (!sessionStorage) { + return + } + if (key != null && value != null) { + sessionStorage.setItem(key, value) + } + }, + get (key) { + if (!sessionStorage) { + return null + } + if (key == null) { + return null + } + return sessionStorage.getItem(key) + }, + setJSON (key, jsonValue) { + if (jsonValue != null) { + this.set(key, JSON.stringify(jsonValue)) + } + }, + getJSON (key) { + const value = this.get(key) + if (value != null) { + return JSON.parse(value) + } + }, + remove (key) { + sessionStorage.removeItem(key); + } +} +const localCache = { + set (key, value) { + if (!localStorage) { + return + } + if (key != null && value != null) { + localStorage.setItem(key, value) + } + }, + get (key) { + if (!localStorage) { + return null + } + if (key == null) { + return null + } + return localStorage.getItem(key) + }, + setJSON (key, jsonValue) { + if (jsonValue != null) { + this.set(key, JSON.stringify(jsonValue)) + } + }, + getJSON (key) { + const value = this.get(key) + if (value != null) { + return JSON.parse(value) + } + }, + remove (key) { + localStorage.removeItem(key); + } +} + +export default { + /** + * 会话级缓存 + */ + session: sessionCache, + /** + * 本地缓存 + */ + local: localCache +} diff --git a/ruoyi-ui/src/plugins/index.js b/ruoyi-ui/src/plugins/index.js new file mode 100644 index 0000000000000000000000000000000000000000..15d829b18ba094252e750b77d36f93eca9f6fdf7 --- /dev/null +++ b/ruoyi-ui/src/plugins/index.js @@ -0,0 +1,11 @@ +import cache from './cache' +import modal from './modal' + +export default { + install(Vue) { + // 缓存对象 + Vue.prototype.$cache = cache + // 模态框对象 + Vue.prototype.$modal = modal + } +} diff --git a/ruoyi-ui/src/plugins/modal.js b/ruoyi-ui/src/plugins/modal.js new file mode 100644 index 0000000000000000000000000000000000000000..7df61a8904ee28f7a987a7a8973b41c90679f10b --- /dev/null +++ b/ruoyi-ui/src/plugins/modal.js @@ -0,0 +1,75 @@ +import { Message, MessageBox, Notification, Loading } from 'element-ui' + +let loadingInstance; + +export default { + // 消息提示 + msg(content) { + Message.info(content) + }, + // 错误消息 + msgError(content) { + Message.error(content) + }, + // 成功消息 + msgSuccess(content) { + Message.success(content) + }, + // 警告消息 + msgWarning(content) { + Message.warning(content) + }, + // 弹出提示 + alert(content) { + MessageBox.alert(content, "系统提示") + }, + // 错误提示 + alertError(content) { + MessageBox.alert(content, "系统提示", { type: 'error' }) + }, + // 成功提示 + alertSuccess(content) { + MessageBox.alert(content, "系统提示", { type: 'success' }) + }, + // 警告提示 + alertWarning(content) { + MessageBox.alert(content, "系统提示", { type: 'warning' }) + }, + // 通知提示 + notify(content) { + Notification.info(content) + }, + // 错误通知 + notifyError(content) { + Notification.error(content); + }, + // 成功通知 + notifySuccess(content) { + Notification.success(content) + }, + // 警告通知 + notifyWarning(content) { + Notification.warning(content) + }, + // 确认窗体 + confirm(content) { + return MessageBox.confirm(content, "系统提示", { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: "warning", + }) + }, + // 打开遮罩层 + loading(content) { + loadingInstance = Loading.service({ + lock: true, + text: content, + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }) + }, + // 关闭遮罩层 + closeLoading() { + loadingInstance.close(); + } +} diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue index b2afcecf8d83f37fc00490d9a265484795d18b5f..0f632347d56fb593b54923976db7c891fe31005a 100644 --- a/ruoyi-ui/src/views/monitor/job/index.vue +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -422,29 +422,21 @@ export default { // 任务状态修改 handleStatusChange(row) { let text = row.status === "0" ? "启用" : "停用"; - this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return changeJobStatus(row.jobId, row.status); - }).then(() => { - this.msgSuccess(text + "成功"); - }).catch(function() { - row.status = row.status === "0" ? "1" : "0"; - }); + this.$modal.confirm('确认要"' + text + '""' + row.jobName + '"任务吗?').then(function() { + return changeJobStatus(row.jobId, row.status); + }).then(() => { + this.$modal.msgSuccess(text + "成功"); + }).catch(function() { + row.status = row.status === "0" ? "1" : "0"; + }); }, /* 立即执行一次 */ handleRun(row) { - this.$confirm('确认要立即执行一次"' + row.jobName + '"任务吗?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return runJob(row.jobId, row.jobGroup); - }).then(() => { - this.msgSuccess("执行成功"); - }).catch(() => {}); + this.$modal.confirm('确认要立即执行一次"' + row.jobName + '"任务吗?').then(function() { + return runJob(row.jobId, row.jobGroup); + }).then(() => { + this.$modal.msgSuccess("执行成功"); + }).catch(() => {}); }, /** 任务详细信息 */ handleView(row) { @@ -489,13 +481,13 @@ export default { if (valid) { if (this.form.jobId != undefined) { updateJob(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { addJob(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -506,16 +498,12 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const jobIds = row.jobId || this.ids; - this.$confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delJob(jobIds); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?').then(function() { + return delJob(jobIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue index ab90e02e52f56d784eeef9ea1e1aafcadc452d57..f2754d7031af152b5c37a8ae2cfc0f7082f961f0 100644 --- a/ruoyi-ui/src/views/monitor/job/log.vue +++ b/ruoyi-ui/src/views/monitor/job/log.vue @@ -272,29 +272,21 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const jobLogIds = this.ids; - this.$confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delJobLog(jobLogIds); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?').then(function() { + return delJobLog(jobLogIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); }, /** 清空按钮操作 */ handleClean() { - this.$confirm("是否确认清空所有调度日志数据项?", "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return cleanJobLog(); - }).then(() => { - this.getList(); - this.msgSuccess("清空成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认清空所有调度日志数据项?').then(function() { + return cleanJobLog(); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("清空成功"); + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { diff --git a/ruoyi-ui/src/views/monitor/online/index.vue b/ruoyi-ui/src/views/monitor/online/index.vue index 90e6e19c366815358697c44a1496ca86800615a5..a20c880f7f741191c01f1d7a8eb7298646c61ff4 100644 --- a/ruoyi-ui/src/views/monitor/online/index.vue +++ b/ruoyi-ui/src/views/monitor/online/index.vue @@ -107,16 +107,12 @@ export default { }, /** 强退按钮操作 */ handleForceLogout(row) { - this.$confirm('是否确认强退名称为"' + row.userName + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return forceLogout(row.tokenId); - }).then(() => { - this.getList(); - this.msgSuccess("强退成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认强退名称为"' + row.userName + '"的数据项?').then(function() { + return forceLogout(row.tokenId); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("强退成功"); + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue index 3838344a5eb33bb81c3cdeb0aa745527f0befa83..3059591622256eafbb2d98876882270e7976ad1a 100644 --- a/ruoyi-ui/src/views/system/config/index.vue +++ b/ruoyi-ui/src/views/system/config/index.vue @@ -305,13 +305,13 @@ export default { if (valid) { if (this.form.configId != undefined) { updateConfig(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { addConfig(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -322,15 +322,11 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const configIds = row.configId || this.ids; - this.$confirm('是否确认删除参数编号为"' + configIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { + this.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?').then(function() { return delConfig(configIds); }).then(() => { this.getList(); - this.msgSuccess("删除成功"); + this.$modal.msgSuccess("删除成功"); }).catch(() => {}); }, /** 导出按钮操作 */ @@ -342,7 +338,7 @@ export default { /** 刷新缓存按钮操作 */ handleRefreshCache() { refreshCache().then(() => { - this.msgSuccess("刷新成功"); + this.$modal.msgSuccess("刷新成功"); }); } } diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue index d6a7790d6674293c55804b28856c50674b96cf0a..ba5752dbdee2245c83199ebe8523dfe804d239e9 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -305,13 +305,13 @@ export default { if (valid) { if (this.form.deptId != undefined) { updateDept(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { addDept(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -321,16 +321,12 @@ export default { }, /** 删除按钮操作 */ handleDelete(row) { - this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delDept(row.deptId); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() { + return delDept(row.deptId); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue index a13d7ef08e095369aabef0d6548b65a8f2d67d53..45327c026de996c3389ebbcbdfcf64ac655d63a7 100644 --- a/ruoyi-ui/src/views/system/dict/data.vue +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -351,13 +351,13 @@ export default { if (valid) { if (this.form.dictCode != undefined) { updateData(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { addData(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -368,16 +368,12 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const dictCodes = row.dictCode || this.ids; - this.$confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delData(dictCodes); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() { + return delData(dictCodes); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue index 4d9df78726167382b3d40bb7284db9ce6ade0cea..17cb5513e4fa0a46d89b76eaee50b0ed1ec83c61 100644 --- a/ruoyi-ui/src/views/system/dict/index.vue +++ b/ruoyi-ui/src/views/system/dict/index.vue @@ -309,13 +309,13 @@ export default { if (valid) { if (this.form.dictId != undefined) { updateType(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { addType(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -326,16 +326,12 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const dictIds = row.dictId || this.ids; - this.$confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delType(dictIds); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() { + return delType(dictIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { @@ -346,7 +342,7 @@ export default { /** 刷新缓存按钮操作 */ handleRefreshCache() { refreshCache().then(() => { - this.msgSuccess("刷新成功"); + this.$modal.msgSuccess("刷新成功"); }); } } diff --git a/ruoyi-ui/src/views/system/logininfor/index.vue b/ruoyi-ui/src/views/system/logininfor/index.vue index edf84223c2d890c22b8d6a5147e80dec3fd1d8c9..7155b85005b8883bd2ca80c144d5b7efb33e8229 100644 --- a/ruoyi-ui/src/views/system/logininfor/index.vue +++ b/ruoyi-ui/src/views/system/logininfor/index.vue @@ -192,29 +192,21 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const infoIds = row.infoId || this.ids; - this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delLogininfor(infoIds); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?').then(function() { + return delLogininfor(infoIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); }, /** 清空按钮操作 */ handleClean() { - this.$confirm('是否确认清空所有登录日志数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return cleanLogininfor(); - }).then(() => { - this.getList(); - this.msgSuccess("清空成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认清空所有登录日志数据项?').then(function() { + return cleanLogininfor(); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("清空成功"); + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue index 540e5880762aff910d567f82aa2b6d1b8e909cf9..e23904308dbf0e1726cc6929d38fe625c73c1c3f 100644 --- a/ruoyi-ui/src/views/system/menu/index.vue +++ b/ruoyi-ui/src/views/system/menu/index.vue @@ -425,13 +425,13 @@ export default { if (valid) { if (this.form.menuId != undefined) { updateMenu(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { addMenu(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -441,16 +441,12 @@ export default { }, /** 删除按钮操作 */ handleDelete(row) { - this.$confirm('是否确认删除名称为"' + row.menuName + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delMenu(row.menuId); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?').then(function() { + return delMenu(row.menuId); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/system/notice/index.vue b/ruoyi-ui/src/views/system/notice/index.vue index 87ecafb5d4bd50e687245c3fc12c0087b7e8f4bb..edee9191d06dd538c7118f13d1a4283c97ceceb2 100644 --- a/ruoyi-ui/src/views/system/notice/index.vue +++ b/ruoyi-ui/src/views/system/notice/index.vue @@ -285,13 +285,13 @@ export default { if (valid) { if (this.form.noticeId != undefined) { updateNotice(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { addNotice(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -302,16 +302,12 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const noticeIds = row.noticeId || this.ids - this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delNotice(noticeIds); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?').then(function() { + return delNotice(noticeIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/system/operlog/index.vue b/ruoyi-ui/src/views/system/operlog/index.vue index db8838b0649ad585de36306780245feea7b28cea..f94bd27c40b47de1e5952e2a6f7b01bbe6473022 100644 --- a/ruoyi-ui/src/views/system/operlog/index.vue +++ b/ruoyi-ui/src/views/system/operlog/index.vue @@ -281,29 +281,21 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const operIds = row.operId || this.ids; - this.$confirm('是否确认删除日志编号为"' + operIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delOperlog(operIds); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除日志编号为"' + operIds + '"的数据项?').then(function() { + return delOperlog(operIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); }, /** 清空按钮操作 */ handleClean() { - this.$confirm('是否确认清空所有操作日志数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return cleanOperlog(); - }).then(() => { - this.getList(); - this.msgSuccess("清空成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认清空所有操作日志数据项?').then(function() { + return cleanOperlog(); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("清空成功"); + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue index 9df34d0ede17daa18473547cd9153539babb3e86..49c372babc0d9b8f1ea2b2707c00c2219fe1fe58 100644 --- a/ruoyi-ui/src/views/system/post/index.vue +++ b/ruoyi-ui/src/views/system/post/index.vue @@ -276,13 +276,13 @@ export default { if (valid) { if (this.form.postId != undefined) { updatePost(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { addPost(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -293,16 +293,12 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const postIds = row.postId || this.ids; - this.$confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delPost(postIds); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?').then(function() { + return delPost(postIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { diff --git a/ruoyi-ui/src/views/system/role/authUser.vue b/ruoyi-ui/src/views/system/role/authUser.vue index 661c3690bb5b6bdcf10ccdf64aaf30b95754f196..e18ea8b311431a14fe573d1e8a996d765821eefa 100644 --- a/ruoyi-ui/src/views/system/role/authUser.vue +++ b/ruoyi-ui/src/views/system/role/authUser.vue @@ -178,30 +178,22 @@ export default { /** 取消授权按钮操作 */ cancelAuthUser(row) { const roleId = this.queryParams.roleId; - this.$confirm('确认要取消该用户"' + row.userName + '"角色吗?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { + this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function() { return authUserCancel({ userId: row.userId, roleId: roleId }); }).then(() => { this.getList(); - this.msgSuccess("取消授权成功"); + this.$modal.msgSuccess("取消授权成功"); }).catch(() => {}); }, /** 批量取消授权按钮操作 */ cancelAuthUserAll(row) { const roleId = this.queryParams.roleId; const userIds = this.userIds.join(","); - this.$confirm('是否取消选中用户授权数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(() => { - return authUserCancelAll({ roleId: roleId, userIds: userIds }); + this.$modal.confirm('是否取消选中用户授权数据项?').then(function() { + return authUserCancelAll({ roleId: roleId, userIds: userIds }); }).then(() => { this.getList(); - this.msgSuccess("取消授权成功"); + this.$modal.msgSuccess("取消授权成功"); }).catch(() => {}); } } diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index 6637dbc8cadab0d96e310c2a5ec4added7dc1cc7..f44b4a54bb3108c2c7d9cde42798e57f32903f94 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -410,17 +410,13 @@ export default { // 角色状态修改 handleStatusChange(row) { let text = row.status === "0" ? "启用" : "停用"; - this.$confirm('确认要"' + text + '""' + row.roleName + '"角色吗?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return changeRoleStatus(row.roleId, row.status); - }).then(() => { - this.msgSuccess(text + "成功"); - }).catch(function() { - row.status = row.status === "0" ? "1" : "0"; - }); + this.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?').then(function() { + return changeRoleStatus(row.roleId, row.status); + }).then(() => { + this.$modal.msgSuccess(text + "成功"); + }).catch(function() { + row.status = row.status === "0" ? "1" : "0"; + }); }, // 取消按钮 cancel() { @@ -576,14 +572,14 @@ export default { if (this.form.roleId != undefined) { this.form.menuIds = this.getMenuAllCheckedKeys(); updateRole(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { this.form.menuIds = this.getMenuAllCheckedKeys(); addRole(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -596,7 +592,7 @@ export default { if (this.form.roleId != undefined) { this.form.deptIds = this.getDeptAllCheckedKeys(); dataScope(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.openDataScope = false; this.getList(); }); @@ -605,16 +601,12 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const roleIds = row.roleId || this.ids; - this.$confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delRole(roleIds); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?').then(function() { + return delRole(roleIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { diff --git a/ruoyi-ui/src/views/system/role/selectUser.vue b/ruoyi-ui/src/views/system/role/selectUser.vue index 3229462d6c05882ba14b9b1c43af9bd21abd2e25..a9e2ce0ffb78a945db12d7400c5085b01ef9345a 100644 --- a/ruoyi-ui/src/views/system/role/selectUser.vue +++ b/ruoyi-ui/src/views/system/role/selectUser.vue @@ -124,7 +124,7 @@ export default { const roleId = this.queryParams.roleId; const userIds = this.userIds.join(","); authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => { - this.msgSuccess(res.msg); + this.$modal.msgSuccess(res.msg); if (res.code === 200) { this.visible = false; this.$emit("ok"); diff --git a/ruoyi-ui/src/views/system/user/authRole.vue b/ruoyi-ui/src/views/system/user/authRole.vue index e0cd7bceb778539ccc4005a0a0acd3558ae839a8..a4bcbe3f4a43c5d0841b1e42ba80e4fee9201366 100644 --- a/ruoyi-ui/src/views/system/user/authRole.vue +++ b/ruoyi-ui/src/views/system/user/authRole.vue @@ -103,7 +103,7 @@ export default { const userId = this.form.userId; const roleIds = this.roleIds.join(","); updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => { - this.msgSuccess("授权成功"); + this.$modal.msgSuccess("授权成功"); this.close(); }); }, diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 8b42546375ca07d01a7bb448c085f2b521f37b47..861e0e6ed00d5677948f6fb42afd9cd41858302d 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -500,17 +500,13 @@ export default { // 用户状态修改 handleStatusChange(row) { let text = row.status === "0" ? "启用" : "停用"; - this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return changeUserStatus(row.userId, row.status); - }).then(() => { - this.msgSuccess(text + "成功"); - }).catch(function() { - row.status = row.status === "0" ? "1" : "0"; - }); + this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() { + return changeUserStatus(row.userId, row.status); + }).then(() => { + this.$modal.msgSuccess(text + "成功"); + }).catch(function() { + row.status = row.status === "0" ? "1" : "0"; + }); }, // 取消按钮 cancel() { @@ -603,7 +599,7 @@ export default { inputErrorMessage: "用户密码长度必须介于 5 和 20 之间", }).then(({ value }) => { resetUserPwd(row.userId, value).then(response => { - this.msgSuccess("修改成功,新密码是:" + value); + this.$modal.msgSuccess("修改成功,新密码是:" + value); }); }).catch(() => {}); }, @@ -618,13 +614,13 @@ export default { if (valid) { if (this.form.userId != undefined) { updateUser(this.form).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { addUser(this.form).then(response => { - this.msgSuccess("新增成功"); + this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); }); @@ -635,16 +631,12 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const userIds = row.userId || this.ids; - this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delUser(userIds); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() { + return delUser(userIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { diff --git a/ruoyi-ui/src/views/system/user/profile/resetPwd.vue b/ruoyi-ui/src/views/system/user/profile/resetPwd.vue index a7d1c902eabedf805e5e57728af2cf3b2d24bff9..e01926846e5e05d4633af1730e998ce0abedd0c7 100644 --- a/ruoyi-ui/src/views/system/user/profile/resetPwd.vue +++ b/ruoyi-ui/src/views/system/user/profile/resetPwd.vue @@ -57,7 +57,7 @@ export default { if (valid) { updateUserPwd(this.user.oldPassword, this.user.newPassword).then( response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); } ); } diff --git a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue index be50204e240af5683d644be93c3ed9c222f7c99a..ce9346276a47c0cc2b1144b275a0dee33b9ec980 100644 --- a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue +++ b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue @@ -110,7 +110,7 @@ export default { // 上传预处理 beforeUpload(file) { if (file.type.indexOf("image/") == -1) { - this.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"); + this.$modal.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"); } else { const reader = new FileReader(); reader.readAsDataURL(file); @@ -128,7 +128,7 @@ export default { this.open = false; this.options.img = response.imgUrl; store.commit('SET_AVATAR', this.options.img); - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); this.visible = false; }); }); diff --git a/ruoyi-ui/src/views/system/user/profile/userInfo.vue b/ruoyi-ui/src/views/system/user/profile/userInfo.vue index 621a1a3a9ef5e1d5031ec9364d4b599bbd4e137c..978cddf45b8a2837c1759fbd94f330b3e71c2595 100644 --- a/ruoyi-ui/src/views/system/user/profile/userInfo.vue +++ b/ruoyi-ui/src/views/system/user/profile/userInfo.vue @@ -62,7 +62,7 @@ export default { this.$refs["form"].validate(valid => { if (valid) { updateUserProfile(this.user).then(response => { - this.msgSuccess("修改成功"); + this.$modal.msgSuccess("修改成功"); }); } }); diff --git a/ruoyi-ui/src/views/tool/gen/editTable.vue b/ruoyi-ui/src/views/tool/gen/editTable.vue index 3929857eca3169e91f6530597a9855c759c04d03..622de0fbe2ef9f43e3f49b97e45220de6d775219 100644 --- a/ruoyi-ui/src/views/tool/gen/editTable.vue +++ b/ruoyi-ui/src/views/tool/gen/editTable.vue @@ -192,13 +192,13 @@ export default { parentMenuId: genTable.parentMenuId }; updateGenTable(genTable).then(res => { - this.msgSuccess(res.msg); + this.$modal.msgSuccess(res.msg); if (res.code === 200) { this.close(); } }); } else { - this.msgError("表单校验未通过,请重新检查提交内容"); + this.$modal.msgError("表单校验未通过,请重新检查提交内容"); } }); }, diff --git a/ruoyi-ui/src/views/tool/gen/importTable.vue b/ruoyi-ui/src/views/tool/gen/importTable.vue index e48a5f351b0a7314cee53e6f43ecc1f7d489a6e5..1ed4a4b495a2516a593d9cfb0270f49f9d9a2976 100644 --- a/ruoyi-ui/src/views/tool/gen/importTable.vue +++ b/ruoyi-ui/src/views/tool/gen/importTable.vue @@ -104,8 +104,13 @@ export default { }, /** 导入按钮操作 */ handleImportTable() { - importTable({ tables: this.tables.join(",") }).then(res => { - this.msgSuccess(res.msg); + const tableNames = this.tables.join(","); + if (tableNames == "") { + this.$modal.msgError("请选择要导入的表"); + return; + } + importTable({ tables: tableNames }).then(res => { + this.$modal.msgSuccess(res.msg); if (res.code === 200) { this.visible = false; this.$emit("ok"); diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue index ab9bb75c367eafc9cb230c9641c83a847263c316..fcc9f624c930bea35cbe2bcebd523be1c13535fe 100644 --- a/ruoyi-ui/src/views/tool/gen/index.vue +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -262,12 +262,12 @@ export default { handleGenTable(row) { const tableNames = row.tableName || this.tableNames; if (tableNames == "") { - this.msgError("请选择要生成的数据"); + this.$modal.msgError("请选择要生成的数据"); return; } if(row.genType === "1") { genCode(row.tableName).then(response => { - this.msgSuccess("成功生成到自定义路径:" + row.genPath); + this.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath); }); } else { downLoadZip("/code/gen/batchGenCode?tables=" + tableNames, "ruoyi"); @@ -276,14 +276,10 @@ export default { /** 同步数据库操作 */ handleSynchDb(row) { const tableName = row.tableName; - this.$confirm('确认要强制同步"' + tableName + '"表结构吗?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return synchDb(tableName); + this.$modal.confirm('确认要强制同步"' + tableName + '"表结构吗?').then(function() { + return synchDb(tableName); }).then(() => { - this.msgSuccess("同步成功"); + this.$modal.msgSuccess("同步成功"); }).catch(() => {}); }, /** 打开导入表弹窗 */ @@ -326,15 +322,11 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const tableIds = row.tableId || this.ids; - this.$confirm('是否确认删除表编号为"' + tableIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return delTable(tableIds); + this.$modal.confirm('是否确认删除表编号为"' + tableIds + '"的数据项?').then(function() { + return delTable(tableIds); }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); + this.getList(); + this.$modal.msgSuccess("删除成功"); }).catch(() => {}); } }