新增通用方法简化模态/缓存使用

This commit is contained in:
RuoYi
2021-09-23 09:38:16 +08:00
parent 3b42abef44
commit 258335cc65
32 changed files with 447 additions and 466 deletions

View File

@ -74,8 +74,6 @@ export default {
name: "Server",
data() {
return {
// 加载层信息
loading: [],
// 统计命令信息
commandstats: null,
// 使用内存
@ -93,7 +91,7 @@ export default {
getList() {
getCache().then((response) => {
this.cache = response.data;
this.loading.close();
this.$modal.closeLoading();
this.commandstats = echarts.init(this.$refs.commandstats, "macarons");
this.commandstats.setOption({
@ -141,12 +139,7 @@ export default {
},
// 打开加载层
openLoading() {
this.loading = this.$loading({
lock: true,
text: "拼命读取中",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
});
this.$modal.loading("正在加载缓存监控数据,请稍后!");
},
},
};

View File

@ -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 @@ 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) {
@ -492,13 +484,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();
});
@ -509,31 +501,23 @@ 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() {
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(() => {});
}
}
};

View File

@ -275,44 +275,32 @@ 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() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有调度日志数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportJobLog(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
this.$modal.confirm('是否确认导出所有调度日志数据项').then(() => {
this.exportLoading = true;
return exportJobLog(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}
}
};

View File

@ -198,44 +198,32 @@ 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() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有操作日志数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportLogininfor(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
this.$modal.confirm('是否确认导出所有操作日志数据项').then(() => {
this.exportLoading = true;
return exportLogininfor(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}
}
};

View File

@ -111,16 +111,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(() => {});
}
}
};

View File

@ -285,44 +285,32 @@ 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() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有操作日志数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportOperlog(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
this.$modal.confirm('是否确认导出所有操作日志数据项').then(() => {
this.exportLoading = true;
return exportOperlog(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}
}
};

View File

@ -153,7 +153,7 @@
</tr>
</thead>
<tbody v-if="server.sysFiles">
<tr v-for="sysFile in server.sysFiles">
<tr v-for="(sysFile, index) in sysFiles" :key="index">
<td><div class="cell">{{ sysFile.dirName }}</div></td>
<td><div class="cell">{{ sysFile.sysTypeName }}</div></td>
<td><div class="cell">{{ sysFile.typeName }}</div></td>
@ -178,8 +178,6 @@ export default {
name: "Server",
data() {
return {
// 加载层信息
loading: [],
// 服务器信息
server: []
};
@ -193,17 +191,12 @@ export default {
getList() {
getServer().then(response => {
this.server = response.data;
this.loading.close();
this.$modal.closeLoading();
});
},
// 打开加载层
openLoading() {
this.loading = this.$loading({
lock: true,
text: "拼命读取中",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)"
});
this.$modal.loading("正在加载服务监控数据,请稍后!");
}
}
};