From 258335cc6599dacd6130e1da988a403efe67219d Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期四, 23 九月 2021 09:38:16 +0800 Subject: [PATCH] 新增通用方法简化模态/缓存使用 --- ruoyi-ui/src/views/monitor/job/index.vue | 72 ++++++++++++++---------------------- 1 files changed, 28 insertions(+), 44 deletions(-) diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue index fdabb16..528c98b 100644 --- a/ruoyi-ui/src/views/monitor/job/index.vue +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -240,7 +240,7 @@ </div> </el-dialog> - <el-dialog title="Cron琛ㄨ揪寮忕敓鎴愬櫒" :visible.sync="openCron" append-to-body class="scrollbar" destroy-on-close > + <el-dialog title="Cron琛ㄨ揪寮忕敓鎴愬櫒" :visible.sync="openCron" append-to-body destroy-on-close class="scrollbar"> <crontab @hide="openCron=false" @fill="crontabFill" :expression="expression"></crontab> </el-dialog> @@ -425,29 +425,21 @@ // 浠诲姟鐘舵�佷慨鏀� 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) { @@ -492,13 +484,13 @@ 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(); }); @@ -509,31 +501,23 @@ /** 鍒犻櫎鎸夐挳鎿嶄綔 */ 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() { const queryParams = this.queryParams; - this.$confirm("鏄惁纭瀵煎嚭鎵�鏈夊畾鏃朵换鍔℃暟鎹」?", "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(() => { - this.exportLoading = true; - return exportJob(queryParams); - }).then(response => { - this.download(response.msg); - this.exportLoading = false; - }).catch(() => {}); + this.$modal.confirm('鏄惁纭瀵煎嚭鎵�鏈夊畾鏃朵换鍔℃暟鎹」锛�').then(() => { + this.exportLoading = true; + return exportJob(queryParams); + }).then(response => { + this.download(response.msg); + this.exportLoading = false; + }).catch(() => {}); } } }; -- Gitblit v1.9.3