diff --git a/.env.production b/.env.production
index d3b3c68..3069647 100644
--- a/.env.production
+++ b/.env.production
@@ -8,10 +8,10 @@ VITE_PUBLIC_PATH = /admin/
VITE_APP_ENV = 'production'
# 多麦管理系统/生产环境
-VITE_APP_BASE_API = 'https://www.saas.duomailianmeng.com/srv'
+VITE_APP_BASE_API = 'https://www.saas.duomailianmeng.com/service/admin'
# 接口前缀
-# VITE_GLOB_API_URL_PREFIX = /srv
+# VITE_GLOB_API_URL_PREFIX = /admin
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip
\ No newline at end of file
diff --git a/src/api/monitor/job.js b/src/api/monitor/job.js
index 3815569..334105a 100644
--- a/src/api/monitor/job.js
+++ b/src/api/monitor/job.js
@@ -1,9 +1,9 @@
import request from '@/utils/request'
-// 查询定时任务调度列表
+// 查询定时任务列表
export function listJob(query) {
return request({
- url: '/monitor/job/list',
+ url: '/task/list',
method: 'get',
params: query
})
@@ -17,55 +17,49 @@ export function getJob(jobId) {
})
}
-// 新增定时任务调度
+// 添加定时任务
export function addJob(data) {
return request({
- url: '/monitor/job',
+ url: '/task/add',
method: 'post',
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
data: data
})
}
-// 修改定时任务调度
+// 修改定时任务
export function updateJob(data) {
return request({
- url: '/monitor/job',
- method: 'put',
+ url: '/task/update',
+ method: 'post',
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
data: data
})
}
-// 删除定时任务调度
+// 删除定时任务
export function delJob(jobId) {
return request({
- url: '/monitor/job/' + jobId,
+ url: `/task/remove/${jobId}`,
method: 'delete'
})
}
-// 任务状态修改
-export function changeJobStatus(jobId, status) {
- const data = {
- jobId,
- status
- }
+// 切换定时任务状态
+export function changeJobStatus(query) {
return request({
- url: '/monitor/job/changeStatus',
- method: 'put',
- data: data
+ url: '/task/changeStatus',
+ method: 'get',
+ params: query
})
}
-// 定时任务立即执行一次
-export function runJob(jobId, jobGroup) {
- const data = {
- jobId,
- jobGroup
- }
+// 立即运行任务
+export function runJob(query) {
return request({
- url: '/monitor/job/run',
- method: 'put',
- data: data
+ url: '/task/run',
+ method: 'get',
+ params: query
})
}
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index b4255dd..89fc3c2 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -84,6 +84,76 @@ export const constantRoutes = [
}
]
},
+ {
+ name: "System",
+ path: "/system",
+ hidden: true,
+ redirect: "noRedirect",
+ component: Layout,
+ alwaysShow: true,
+ meta: {
+ title: "系统管理",
+ icon: "system",
+ noCache: false,
+ link: null
+ },
+ children: [
+ {
+ name: "User",
+ path: "user",
+ hidden: false,
+ component: () => import('@/views/system/user/index'),
+ meta: {
+ title: "用户管理",
+ icon: "user",
+ noCache: false,
+ link: null
+ }
+ },
+
+ {
+ name: "Apply",
+ path: "apply",
+ hidden: false,
+ component: () => import('@/views/system/apply/index'),
+ meta: {
+ title: "提报管理",
+ icon: "excel",
+ noCache: false,
+ link: null
+ }
+ }
+ ]
+},
+{
+ name: "Monitor",
+ path: "/monitor",
+ hidden: true,
+ redirect: "noRedirect",
+ component: Layout,
+ alwaysShow: true,
+ meta: {
+ title: "系统监控",
+ icon: "monitor",
+ noCache: false,
+ link: null
+ },
+ children: [
+
+ {
+ name: "Job",
+ path: "job",
+ hidden: true,
+ component: () => import('@/views/monitor/job/index'),
+ meta: {
+ title: "定时任务",
+ icon: "job",
+ noCache: false,
+ link: null
+ }
+ }
+ ]
+}
]
diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js
index d1350da..1d2153f 100644
--- a/src/store/modules/permission.js
+++ b/src/store/modules/permission.js
@@ -7,8 +7,8 @@ import InnerLink from '@/layout/components/InnerLink'
// 匹配views里面所有的.vue文件
const modules = import.meta.glob('./../../views/**/*.vue')
-const route2r = '[{"name":"System","path":"/system","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统管理","icon":"system","noCache":false,"link":null},"children":[{"name":"User","path":"user","hidden":false,"component":"system/user/index","meta":{"title":"用户管理","icon":"user","noCache":false,"link":null}},{"name":"Role","path":"role","hidden":false,"component":"system/role/index","meta":{"title":"角色管理","icon":"peoples","noCache":false,"link":null}},{"name":"Apply","path":"apply","hidden":false,"component":"system/apply/index","meta":{"title":"提报管理","icon":"excel","noCache":false,"link":null}},{"name":"Menu","path":"menu","hidden":false,"component":"system/menu/index","meta":{"title":"菜单管理","icon":"tree-table","noCache":false,"link":null}},{"name":"Dept","path":"dept","hidden":false,"component":"system/dept/index","meta":{"title":"部门管理","icon":"tree","noCache":false,"link":null}},{"name":"Post","path":"post","hidden":false,"component":"system/post/index","meta":{"title":"岗位管理","icon":"post","noCache":false,"link":null}},{"name":"Dict","path":"dict","hidden":false,"component":"system/dict/index","meta":{"title":"字典管理","icon":"dict","noCache":false,"link":null}},{"name":"Config","path":"config","hidden":false,"component":"system/config/index","meta":{"title":"参数设置","icon":"edit","noCache":false,"link":null}},{"name":"Notice","path":"notice","hidden":false,"component":"system/notice/index","meta":{"title":"通知公告","icon":"message","noCache":false,"link":null}},{"name":"Log","path":"log","hidden":false,"redirect":"noRedirect","component":"ParentView","alwaysShow":true,"meta":{"title":"日志管理","icon":"log","noCache":false,"link":null},"children":[{"name":"Operlog","path":"operlog","hidden":false,"component":"monitor/operlog/index","meta":{"title":"操作日志","icon":"form","noCache":false,"link":null}},{"name":"Logininfor","path":"logininfor","hidden":false,"component":"monitor/logininfor/index","meta":{"title":"登录日志","icon":"logininfor","noCache":false,"link":null}}]}]},{"name":"Monitor","path":"/monitor","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统监控","icon":"monitor","noCache":false,"link":null},"children":[{"name":"Online","path":"online","hidden":false,"component":"monitor/online/index","meta":{"title":"在线用户","icon":"online","noCache":false,"link":null}},{"name":"Job","path":"job","hidden":false,"component":"monitor/job/index","meta":{"title":"定时任务","icon":"job","noCache":false,"link":null}},{"name":"Druid","path":"druid","hidden":false,"component":"monitor/druid/index","meta":{"title":"数据监控","icon":"druid","noCache":false,"link":null}},{"name":"Server","path":"server","hidden":false,"component":"monitor/server/index","meta":{"title":"服务监控","icon":"server","noCache":false,"link":null}},{"name":"Cache","path":"cache","hidden":false,"component":"monitor/cache/index","meta":{"title":"缓存监控","icon":"redis","noCache":false,"link":null}},{"name":"CacheList","path":"cacheList","hidden":false,"component":"monitor/cache/list","meta":{"title":"缓存列表","icon":"redis-list","noCache":false,"link":null}}]},{"name":"Tool","path":"/tool","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统工具","icon":"tool","noCache":false,"link":null},"children":[{"name":"Build","path":"build","hidden":false,"component":"tool/build/index","meta":{"title":"表单构建","icon":"build","noCache":false,"link":null}},{"name":"Gen","path":"gen","hidden":false,"component":"tool/gen/index","meta":{"title":"代码生成","icon":"code","noCache":false,"link":null}},{"name":"Swagger","path":"swagger","hidden":false,"component":"tool/swagger/index","meta":{"title":"系统接口","icon":"swagger","noCache":false,"link":null}}]}]'
-const dwx = JSON.parse(route2r)
+const routerjson = '[{"name":"System","path":"/system","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统管理","icon":"system","noCache":false,"link":null},"children":[{"name":"User","path":"user","hidden":false,"component":"system/user/index","meta":{"title":"用户管理","icon":"user","noCache":false,"link":null}},{"name":"Apply","path":"apply","hidden":false,"component":"system/apply/index","meta":{"title":"提报管理","icon":"excel","noCache":false,"link":null}}]},{"name":"Monitor","path":"/monitor","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统监控","icon":"monitor","noCache":false,"link":null},"children":[{"name":"Job","path":"job","hidden":false,"component":"monitor/job/index","meta":{"title":"定时任务","icon":"job","noCache":false,"link":null}}]}]'
+const dwx = JSON.parse(routerjson)
const usePermissionStore = defineStore(
'permission',
{
diff --git a/src/views/monitor/job/index.vue b/src/views/monitor/job/index.vue
index c514839..61ce5f2 100644
--- a/src/views/monitor/job/index.vue
+++ b/src/views/monitor/job/index.vue
@@ -2,32 +2,17 @@
-
+
-
+
+
+
+
@@ -38,104 +23,68 @@
- 新增
+ 新增定时任务
- 修改
+ 修改
- 删除
+ 删除
- 导出
+ 导出
- 日志
+ 日志
-
+
-
+
+
+
+
-
+
-
-
-
+
-
+ {{ scope.row.createTime.replace("T", " ") }}
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
-
+
@@ -146,24 +95,12 @@
-
-
-
-
-
-
-
-
+
- 调用方法
-
+ 任务全类名
+
-
+
@@ -193,31 +130,24 @@
- {{ dict.label }}
+ {{ dict.label
+ }}
-
-
- 立即执行
- 执行一次
- 放弃执行
-
+
+
-
+
@@ -228,9 +158,9 @@
-
-
-
+
+
+
@@ -251,7 +181,7 @@
{{ parseTime(form.nextValidTime) }}
- {{ form.invokeTarget }}
+ {{ form.jobClazz }}
@@ -289,7 +219,7 @@ import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } f
import Crontab from '@/components/Crontab'
const router = useRouter();
const { proxy } = getCurrentInstance();
-const { sys_job_group, sys_job_status } = proxy.useDict("sys_job_group", "sys_job_status");
+// const { sys_job_group, sys_job_status } = proxy.useDict("sys_job_group", "sys_job_status");
const jobList = ref([]);
const open = ref(false);
@@ -303,198 +233,221 @@ const title = ref("");
const openView = ref(false);
const openCron = ref(false);
const expression = ref("");
+const jobStatusList = ref([
+ { label: '正常', value: 0 },
+ { label: '暂停', value: 1 }
+])
const data = reactive({
- form: {},
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- jobName: undefined,
- jobGroup: undefined,
- status: undefined
- },
- rules: {
- jobName: [{ required: true, message: "任务名称不能为空", trigger: "blur" }],
- invokeTarget: [{ required: true, message: "调用目标字符串不能为空", trigger: "blur" }],
- cronExpression: [{ required: true, message: "cron执行表达式不能为空", trigger: "change" }]
- }
+ form: {},
+ queryParams: {
+ pageNum: 1,
+ pageSize: 10,
+ jobName: undefined,
+ jobStatus: undefined
+ },
+ rules: {
+ jobName: [{ required: true, message: "任务名称不能为空", trigger: "blur" }],
+ jobClazz: [{ required: true, message: "任务全类名不能为空", trigger: "blur" }],
+ cronExpression: [{ required: true, message: "cron执行表达式不能为空", trigger: "change" }]
+ }
});
const { queryParams, form, rules } = toRefs(data);
/** 查询定时任务列表 */
function getList() {
- loading.value = true;
- listJob(queryParams.value).then(response => {
- jobList.value = response.rows;
- total.value = response.total;
- loading.value = false;
- });
+ loading.value = true;
+ listJob(queryParams.value).then(response => {
+ console.log("定时任务列表", response)
+ jobList.value = response.data.records.map(item => {
+ item._isInit = true;
+ return item;
+ });
+ // 数据加载完成后,延迟将_isInit设为false
+ setTimeout(() => {
+ jobList.value.forEach(item => {
+ item._isInit = false;
+ });
+ }, 0);
+ total.value = response.data.total;
+ loading.value = false;
+ });
}
/** 任务组名字典翻译 */
function jobGroupFormat(row, column) {
- return proxy.selectDictLabel(sys_job_group.value, row.jobGroup);
+ return proxy.selectDictLabel(sys_job_group.value, row.jobGroup);
}
/** 取消按钮 */
function cancel() {
- open.value = false;
- reset();
+ open.value = false;
+ reset();
}
/** 表单重置 */
function reset() {
- form.value = {
- jobId: undefined,
- jobName: undefined,
- jobGroup: undefined,
- invokeTarget: undefined,
- cronExpression: undefined,
- misfirePolicy: 1,
- concurrent: 1,
- status: "0"
- };
- proxy.resetForm("jobRef");
+ form.value = {
+ id: undefined,
+ jobName: undefined,
+ jobGroup: undefined,
+ jobClazz: undefined,
+ cronExpression: undefined,
+ remark: undefined,
+ };
+ proxy.resetForm("jobRef");
}
/** 搜索按钮操作 */
function handleQuery() {
- queryParams.value.pageNum = 1;
- getList();
+ queryParams.value.pageNum = 1;
+ getList();
}
/** 重置按钮操作 */
function resetQuery() {
- proxy.resetForm("queryRef");
- handleQuery();
+ proxy.resetForm("queryRef");
+ handleQuery();
}
// 多选框选中数据
function handleSelectionChange(selection) {
- ids.value = selection.map(item => item.jobId);
- single.value = selection.length != 1;
- multiple.value = !selection.length;
+ ids.value = selection.map(item => item.jobId);
+ single.value = selection.length != 1;
+ multiple.value = !selection.length;
}
// 更多操作触发
function handleCommand(command, row) {
- switch (command) {
- case "handleRun":
- handleRun(row);
- break;
- case "handleView":
- handleView(row);
- break;
- case "handleJobLog":
- handleJobLog(row);
- break;
- default:
- break;
- }
+ switch (command) {
+ case "handleRun":
+ handleRun(row);
+ break;
+ case "handleView":
+ handleView(row);
+ break;
+ case "handleJobLog":
+ handleJobLog(row);
+ break;
+ default:
+ break;
+ }
}
// 任务状态修改
function handleStatusChange(row) {
- let text = row.status === "0" ? "启用" : "停用";
- proxy.$modal.confirm('确认要"' + text + '""' + row.jobName + '"任务吗?').then(function () {
- return changeJobStatus(row.jobId, row.status);
- }).then(() => {
- proxy.$modal.msgSuccess(text + "成功");
- }).catch(function () {
- row.status = row.status === "0" ? "1" : "0";
- });
+ if (row._isInit) return;
+ const params = {
+ jobId: row.id,
+ targetStatus: row.jobStatus
+ };
+ let text = row.jobStatus === 0 ? "启用" : "停用";
+ proxy.$modal.confirm('确认要"' + text + '""' + row.jobName + '"任务吗?').then(function () {
+ return changeJobStatus(params);
+ }).then(() => {
+ proxy.$modal.msgSuccess(text + "成功");
+ }).catch(function () {
+ row.jobStatus = row.jobStatus === 0 ? 1 : 0;
+ });
}
-/* 立即执行一次 */
+/* 立即运行任务 */
function handleRun(row) {
- proxy.$modal.confirm('确认要立即执行一次"' + row.jobName + '"任务吗?').then(function () {
- return runJob(row.jobId, row.jobGroup);
- }).then(() => {
- proxy.$modal.msgSuccess("执行成功");})
- .catch(() => {});
+ const params = {
+ jobId: row.id
+ };
+ proxy.$modal.confirm('确认要立即运行"' + row.jobName + '"任务吗?').then(function () {
+ return runJob(params);
+ }).then(() => {
+ proxy.$modal.msgSuccess("执行成功");
+ })
+ .catch(() => { });
}
/** 任务详细信息 */
function handleView(row) {
- getJob(row.jobId).then(response => {
- form.value = response.data;
- openView.value = true;
- });
+ getJob(row.jobId).then(response => {
+ form.value = response.data;
+ openView.value = true;
+ });
}
/** cron表达式按钮操作 */
function handleShowCron() {
- expression.value = form.value.cronExpression;
- openCron.value = true;
+ expression.value = form.value.cronExpression;
+ openCron.value = true;
}
/** 确定后回传值 */
function crontabFill(value) {
- form.value.cronExpression = value;
+ form.value.cronExpression = value;
}
/** 任务日志列表查询 */
function handleJobLog(row) {
- const jobId = row.jobId || 0;
- router.push('/monitor/job-log/index/' + jobId)
+ const jobId = row.jobId || 0;
+ router.push('/monitor/job-log/index/' + jobId)
}
/** 新增按钮操作 */
function handleAdd() {
- reset();
- open.value = true;
- title.value = "添加任务";
+ reset();
+ form.value.id = undefined;
+ open.value = true;
+ title.value = "添加任务";
}
/** 修改按钮操作 */
function handleUpdate(row) {
- reset();
- const jobId = row.jobId || ids.value;
- getJob(jobId).then(response => {
- form.value = response.data;
- open.value = true;
- title.value = "修改任务";
- });
+ reset();
+ form.value.id = row.id;
+ form.value.jobName = row.jobName;
+ form.value.jobClazz = row.jobClazz;
+ form.value.jobStatus = row.jobStatus;
+ form.value.cronExpression = row.cronExpression;
+ form.value.remark = row.remark;
+ open.value = true;
+ title.value = "修改任务";
}
-
+const currentJobId = ref(null);
/** 提交按钮 */
function submitForm() {
- proxy.$refs["jobRef"].validate(valid => {
- if (valid) {
- if (form.value.jobId != undefined) {
- updateJob(form.value).then(response => {
- proxy.$modal.msgSuccess("修改成功");
- open.value = false;
- getList();
- });
- } else {
- addJob(form.value).then(response => {
- proxy.$modal.msgSuccess("新增成功");
- open.value = false;
- getList();
- });
+ proxy.$refs["jobRef"].validate(valid => {
+ if (valid) {
+ if (form.value.id != undefined) {
+ updateJob(form.value).then(response => {
+ proxy.$modal.msgSuccess("修改成功");
+ open.value = false;
+ getList();
+ });
+ } else {
+ addJob(form.value).then(response => {
+ proxy.$modal.msgSuccess("新增成功");
+ open.value = false;
+ getList();
+ });
+ }
}
- }
- });
+ });
}
/** 删除按钮操作 */
function handleDelete(row) {
- const jobIds = row.jobId || ids.value;
- proxy.$modal.confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?').then(function () {
- return delJob(jobIds);
- }).then(() => {
- getList();
- proxy.$modal.msgSuccess("删除成功");
- }).catch(() => {});
+ const jobIds = row.id || ids.value;
+ proxy.$modal.confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?').then(function () {
+ return delJob(jobIds);
+ }).then(() => {
+ getList();
+ proxy.$modal.msgSuccess("删除成功");
+ }).catch(() => { });
}
/** 导出按钮操作 */
function handleExport() {
- proxy.download("monitor/job/export", {
- ...queryParams.value,
- }, `job_${new Date().getTime()}.xlsx`);
+ proxy.download("monitor/job/export", {
+ ...queryParams.value,
+ }, `job_${new Date().getTime()}.xlsx`);
}
getList();
diff --git a/src/views/system/apply/index.vue b/src/views/system/apply/index.vue
index c4b9e52..d122774 100644
--- a/src/views/system/apply/index.vue
+++ b/src/views/system/apply/index.vue
@@ -146,7 +146,7 @@ import { onMounted } from "vue";
const router = useRouter();
const { proxy } = getCurrentInstance();
-const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
+// const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const applyList = ref([]);
const roleList = ref([]);
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index c4227be..fe5645d 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -17,18 +17,17 @@
-
-
+
-
-
+
-
+
@@ -72,12 +71,23 @@
:show-overflow-tooltip="true" />
-
+ width="200" />
+
+
+ {{ scope.row.serviceRate }}%
+
+
+
+
+ {{ scope.row.autoApply ? '开启' : '关闭' }}
+
+
+
-
+
@@ -85,7 +95,8 @@
{{ parseTime(scope.row.createTime) }}
-
+
{{ dict.label
- }}
+ }}
@@ -244,7 +255,7 @@ import "splitpanes/dist/splitpanes.css"
const router = useRouter();
const appStore = useAppStore()
const { proxy } = getCurrentInstance();
-const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex");
+// const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex");
const userList = ref([]);
const open = ref(false);
@@ -262,6 +273,10 @@ const enabledDeptOptions = ref(undefined);
const initPassword = ref(undefined);
const postOptions = ref([]);
const roleOptions = ref([]);
+const statusList = ref([
+ { value: 0, label: "正常" },
+ { value: 1, label: "停用" }
+]);
/*** 用户导入参数 */
const upload = reactive({
// 是否显示弹出层(用户导入)
@@ -333,7 +348,8 @@ const filterNode = (value, data) => {
/** 查询用户列表 */
function getList() {
loading.value = true;
- listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => {
+ console.log('查询', queryParams.value)
+ listUser(proxy.addDateRange(queryParams.value)).then(res => {
loading.value = false;
userList.value = res.data.records.map(item => {
item._isInit = true;
@@ -379,6 +395,9 @@ function handleNodeClick(data) {
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
+ console.log('搜索', dateRange.value)
+ queryParams.value.startDate = dateRange.value[0];
+ queryParams.value.endDate = dateRange.value[1];
getList();
};
@@ -411,7 +430,7 @@ function handleExport() {
/** 用户状态修改 */
function handleStatusChange(row) {
- if(row._isInit) return;
+ if (row._isInit) return;
console.log('用户状态修改', row.id, row.memberStatus)
let text = row.memberStatus === 0 ? "启用" : "停用";
proxy.$modal.confirm('确认要"' + text + '""' + row.nickname + '"用户吗?').then(function () {