|
@@ -1,6 +1,24 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
|
|
+ <!-- SaaS 平台专用:选择租户后,后端会临时切换数据源到该租户库查询其 sys_job_log(租户任务的执行日志实际落在各自租户库) -->
|
|
|
|
|
+ <el-form-item label="租户" prop="tenantId">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="queryParams.tenantId"
|
|
|
|
|
+ placeholder="全部(主库/平台日志)"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 240px"
|
|
|
|
|
+ @change="handleQuery"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="t in tenantOptions"
|
|
|
|
|
+ :key="t.id"
|
|
|
|
|
+ :label="t.tenantCode + ' (ID:' + t.id + ')'"
|
|
|
|
|
+ :value="t.id"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="任务名称" prop="jobName">
|
|
<el-form-item label="任务名称" prop="jobName">
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="queryParams.jobName"
|
|
v-model="queryParams.jobName"
|
|
@@ -186,6 +204,7 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog";
|
|
import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog";
|
|
|
|
|
+import { tenantList } from "@/api/tenant/tenant";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: "JobLog",
|
|
name: "JobLog",
|
|
@@ -215,17 +234,39 @@ export default {
|
|
|
statusOptions: [],
|
|
statusOptions: [],
|
|
|
// 任务组名字典
|
|
// 任务组名字典
|
|
|
jobGroupOptions: [],
|
|
jobGroupOptions: [],
|
|
|
|
|
+ // 租户选项(用于平台后台跨租户查看各租户的调度执行日志)
|
|
|
|
|
+ tenantOptions: [],
|
|
|
// 查询参数
|
|
// 查询参数
|
|
|
queryParams: {
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
jobName: undefined,
|
|
jobName: undefined,
|
|
|
jobGroup: undefined,
|
|
jobGroup: undefined,
|
|
|
- status: undefined
|
|
|
|
|
|
|
+ status: undefined,
|
|
|
|
|
+ tenantId: undefined // SaaS 平台专用:选择后后端会切换到该租户数据源查询 sys_job_log
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
|
|
+ // 支持从“定时任务”页面跳转时携带 ?jobName=xxx (或 jobGroup) 自动筛选对应任务的日志
|
|
|
|
|
+ // 即使当前“任务日志”按钮未传参,未来若加 per-row “日志”按钮可直接 push({path:'/jobLog', query:{jobName: row.jobName}})
|
|
|
|
|
+ const q = this.$route.query || {};
|
|
|
|
|
+ if (q.jobName) {
|
|
|
|
|
+ this.queryParams.jobName = q.jobName;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (q.jobGroup) {
|
|
|
|
|
+ this.queryParams.jobGroup = q.jobGroup;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (q.tenantId) {
|
|
|
|
|
+ this.queryParams.tenantId = Number(q.tenantId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 加载活跃租户列表(用于平台管理员筛选查看不同租户的定时任务执行日志)
|
|
|
|
|
+ // 注意:只有平台总后台(fs-admin)有权限看到全部租户;租户自身后台通常只看到本租户日志(走自身 ds)
|
|
|
|
|
+ tenantList({ status: 1 }).then(response => {
|
|
|
|
|
+ this.tenantOptions = response.rows || response.data || [];
|
|
|
|
|
+ }).catch(() => {});
|
|
|
|
|
+
|
|
|
this.getList();
|
|
this.getList();
|
|
|
this.getDicts("sys_common_status").then(response => {
|
|
this.getDicts("sys_common_status").then(response => {
|
|
|
this.statusOptions = response.data;
|
|
this.statusOptions = response.data;
|
|
@@ -248,7 +289,7 @@ export default {
|
|
|
// 返回按钮
|
|
// 返回按钮
|
|
|
handleClose() {
|
|
handleClose() {
|
|
|
this.$store.dispatch("tagsView/delView", this.$route);
|
|
this.$store.dispatch("tagsView/delView", this.$route);
|
|
|
- this.$router.push({ path: "/monitor/job" });
|
|
|
|
|
|
|
+ this.$router.push({ path: "/job" });
|
|
|
},
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
handleQuery() {
|
|
@@ -258,6 +299,7 @@ export default {
|
|
|
/** 重置按钮操作 */
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
resetQuery() {
|
|
|
this.dateRange = [];
|
|
this.dateRange = [];
|
|
|
|
|
+ this.queryParams.tenantId = undefined;
|
|
|
this.resetForm("queryForm");
|
|
this.resetForm("queryForm");
|
|
|
this.handleQuery();
|
|
this.handleQuery();
|
|
|
},
|
|
},
|
|
@@ -274,12 +316,13 @@ export default {
|
|
|
/** 删除按钮操作 */
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
handleDelete(row) {
|
|
|
const jobLogIds = this.ids;
|
|
const jobLogIds = this.ids;
|
|
|
|
|
+ const tenantId = this.queryParams.tenantId;
|
|
|
this.$confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?', "警告", {
|
|
this.$confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?', "警告", {
|
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
type: "warning"
|
|
|
}).then(function() {
|
|
}).then(function() {
|
|
|
- return delJobLog(jobLogIds);
|
|
|
|
|
|
|
+ return delJobLog(jobLogIds, tenantId);
|
|
|
}).then(() => {
|
|
}).then(() => {
|
|
|
this.getList();
|
|
this.getList();
|
|
|
this.msgSuccess("删除成功");
|
|
this.msgSuccess("删除成功");
|
|
@@ -287,12 +330,14 @@ export default {
|
|
|
},
|
|
},
|
|
|
/** 清空按钮操作 */
|
|
/** 清空按钮操作 */
|
|
|
handleClean() {
|
|
handleClean() {
|
|
|
- this.$confirm("是否确认清空所有调度日志数据项?", "警告", {
|
|
|
|
|
|
|
+ const tenantId = this.queryParams.tenantId;
|
|
|
|
|
+ const tip = tenantId ? ("是否确认清空租户ID=" + tenantId + " 的所有调度日志数据项?") : "是否确认清空当前数据源的所有调度日志数据项?";
|
|
|
|
|
+ this.$confirm(tip, "警告", {
|
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
type: "warning"
|
|
|
}).then(function() {
|
|
}).then(function() {
|
|
|
- return cleanJobLog();
|
|
|
|
|
|
|
+ return cleanJobLog(tenantId);
|
|
|
}).then(() => {
|
|
}).then(() => {
|
|
|
this.getList();
|
|
this.getList();
|
|
|
this.msgSuccess("清空成功");
|
|
this.msgSuccess("清空成功");
|