chroe: opt cron message style
This commit is contained in:
Generated
+35
@@ -10,6 +10,7 @@
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.1.0",
|
||||
"axios": "^1.7.4",
|
||||
"cron-parser": "^4.9.0",
|
||||
"echarts": "^5.4.3",
|
||||
"element-plus": "^2.4.2",
|
||||
"lodash": "^4.17.21",
|
||||
@@ -1625,6 +1626,18 @@
|
||||
"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/cron-parser": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/cron-parser/-/cron-parser-4.9.0.tgz",
|
||||
"integrity": "sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"luxon": "^3.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-env": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/cross-env/-/cross-env-7.0.3.tgz",
|
||||
@@ -2688,6 +2701,15 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/luxon": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.5.0.tgz",
|
||||
"integrity": "sha512-rh+Zjr6DNfUYR3bPwJEnuwDdqMbxZW7LOQfUN4B54+Cl+0o5zaU9RJ6bcidfDtC1cWCZXQ+nvX8bf6bAji37QQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "0.30.5",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz",
|
||||
@@ -4890,6 +4912,14 @@
|
||||
"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
|
||||
"dev": true
|
||||
},
|
||||
"cron-parser": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/cron-parser/-/cron-parser-4.9.0.tgz",
|
||||
"integrity": "sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==",
|
||||
"requires": {
|
||||
"luxon": "^3.2.1"
|
||||
}
|
||||
},
|
||||
"cross-env": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/cross-env/-/cross-env-7.0.3.tgz",
|
||||
@@ -5649,6 +5679,11 @@
|
||||
"yallist": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"luxon": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.5.0.tgz",
|
||||
"integrity": "sha512-rh+Zjr6DNfUYR3bPwJEnuwDdqMbxZW7LOQfUN4B54+Cl+0o5zaU9RJ6bcidfDtC1cWCZXQ+nvX8bf6bAji37QQ=="
|
||||
},
|
||||
"magic-string": {
|
||||
"version": "0.30.5",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz",
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.1.0",
|
||||
"axios": "^1.7.4",
|
||||
"cron-parser": "^4.9.0",
|
||||
"echarts": "^5.4.3",
|
||||
"element-plus": "^2.4.2",
|
||||
"lodash": "^4.17.21",
|
||||
|
||||
@@ -28,9 +28,9 @@ const router = createRouter({
|
||||
component: () => import('../views/tabsTools/sendTasks/sendTasks.vue')
|
||||
},
|
||||
{
|
||||
path: '/sendmessages',
|
||||
name: 'sendmessages',
|
||||
component: () => import('../views/tabsTools/sendMessage/sensMessage.vue')
|
||||
path: '/cronmessages',
|
||||
name: 'cronmessages',
|
||||
component: () => import('../views/tabsTools/cronMessage/cronMessage.vue')
|
||||
},
|
||||
{
|
||||
path: '/sendlogs',
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import parser from 'cron-parser';
|
||||
|
||||
|
||||
const formatDate = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
};
|
||||
|
||||
function parseCron(cronExpression) {
|
||||
let nextTime = '';
|
||||
try {
|
||||
const interval = parser.parseExpression(cronExpression);
|
||||
const nextDate = interval.next().toDate();
|
||||
nextTime = formatDate(nextDate);
|
||||
} catch (err) {
|
||||
nextTime = '无效的 Cron 表达式';
|
||||
}
|
||||
return nextTime;
|
||||
};
|
||||
|
||||
|
||||
export { parseCron };
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
const menuData = reactive([
|
||||
{ id: '0', title: '数据统计', path: '/statistic' },
|
||||
{ id: '1', title: '发信日志', path: '/sendlogs' },
|
||||
{ id: '2', title: '定时发信', path: '/sendmessages' },
|
||||
{ id: '2', title: '定时发信', path: '/cronmessages' },
|
||||
{ id: '3', title: '发信任务', path: '/sendtasks' },
|
||||
{ id: '4', title: '发信渠道', path: '/sendways' },
|
||||
{ id: '5', title: '设置', path: '/settings' },
|
||||
@@ -102,7 +102,7 @@ export default {
|
||||
}
|
||||
|
||||
.el-menu-item {
|
||||
width: 150px !important;
|
||||
width: 120px !important;
|
||||
font-size: 15px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
+4
-4
@@ -16,7 +16,7 @@
|
||||
<el-table-column label="消息ID" prop="id"/>
|
||||
<el-table-column label="关联ID" prop="task_id" />
|
||||
<el-table-column label="消息名" prop="name" show-overflow-tooltip/>
|
||||
<el-table-column label="Crontab" prop="cron" />
|
||||
<el-table-column label="定时表达式" prop="cron" />
|
||||
<el-table-column label="下次执行" prop="next_time" show-overflow-tooltip/>
|
||||
<!-- <el-table-column label="Crontab">
|
||||
<template #default="scope">
|
||||
@@ -99,7 +99,7 @@ export default {
|
||||
}
|
||||
|
||||
const handleDelete = async (index, row) => {
|
||||
const rsp = await request.post('/sendmessages/delete', { id: row.id });
|
||||
const rsp = await request.post('/cronmessages/delete', { id: row.id });
|
||||
if (rsp.status == 200) {
|
||||
state.tableData.splice(index, 1);
|
||||
}
|
||||
@@ -131,7 +131,7 @@ export default {
|
||||
|
||||
const queryListData = async (page, size, name = '') => {
|
||||
let params = { page: page, size: size, name: name };
|
||||
const rsp = await request.get('/sendmessages/list', { params: params });
|
||||
const rsp = await request.get('/cronmessages/list', { params: params });
|
||||
state.tableData = await rsp.data.data.lists;
|
||||
dealInsEnableStatus(state.tableData)
|
||||
state.total = await rsp.data.data.total;
|
||||
@@ -146,7 +146,7 @@ export default {
|
||||
// 开启暂停定时任务
|
||||
const updateEnableStatus = async (data) => {
|
||||
data.enable = !Boolean(data.enable) ? 0 : 1
|
||||
const rsp = await request.post('/sendmessages/edit', data);
|
||||
const rsp = await request.post('/cronmessages/edit', data);
|
||||
if (await rsp.data.code == 200) {
|
||||
ElMessage({ message: await rsp.data.msg, type: 'success' });
|
||||
data.enable = Boolean(data.enable)
|
||||
+5
-2
@@ -36,7 +36,9 @@
|
||||
<el-input v-model="currTaskInput.title" placeholder="请输入消息标题" size="small" class="msg-input"></el-input>
|
||||
<el-input type="textarea" :rows="5" v-model="currTaskInput.content" placeholder="请输入消息内容" size="small"
|
||||
class="msg-input"></el-input>
|
||||
<el-input v-model="currTaskInput.cron" placeholder="请输入定时crontab表达式(linux形式)" size="small" class="msg-input"></el-input>
|
||||
<el-input v-model="currTaskInput.cron" placeholder="请输入定时crontab表达式(linux形式)" size="small"
|
||||
class="msg-input"></el-input>
|
||||
<el-text v-if="currTaskInput.cron" class="mx-1" size="small">下次执行:{{ parseCron(currTaskInput.cron) }}</el-text>
|
||||
<el-input v-model="currTaskInput.url" placeholder="请输入消息详情url(可选)" size="small" class="msg-input"></el-input>
|
||||
|
||||
</div>
|
||||
@@ -67,6 +69,7 @@ import { usePageState } from '@/store/page_sate.js';
|
||||
import { request } from '@/api/api'
|
||||
import { CONSTANT } from '@/constant'
|
||||
import { CommonUtils } from "@/util/commonUtils.js";
|
||||
import { parseCron } from "@/util/cron.js";
|
||||
import { generateBizUniqueID } from "@/util/uuid.js";
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
@@ -183,7 +186,7 @@ export default defineComponent({
|
||||
|
||||
return {
|
||||
...toRefs(state), handleCancer, handleSubmit, querySearchWayAsync,
|
||||
handleSearchSelect, CONSTANT, CommonUtils,
|
||||
handleSearchSelect, CONSTANT, CommonUtils, parseCron,
|
||||
cliclSendNow
|
||||
};
|
||||
},
|
||||
+3
-3
@@ -28,6 +28,7 @@
|
||||
<el-input type="textarea" :rows="5" v-model="currTaskInput.content" placeholder="请输入消息内容" size="small"
|
||||
class="msg-input"></el-input>
|
||||
<el-input v-model="currTaskInput.cron" placeholder="请输入定时crontab表达式(linux形式)" size="small" class="msg-input"></el-input>
|
||||
<el-text v-if="currTaskInput.cron" class="mx-1" size="small">下次执行:{{ parseCron(currTaskInput.cron) }}</el-text>
|
||||
<el-input v-model="currTaskInput.url" placeholder="请输入消息详情url(可选)" size="small" class="msg-input"></el-input>
|
||||
|
||||
|
||||
@@ -58,8 +59,7 @@ import tableDeleteButton from '@/views/common/tableDeleteButton.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { CONSTANT } from '@/constant'
|
||||
import { CommonUtils } from "@/util/commonUtils.js";
|
||||
import { generateBizUniqueID } from "@/util/uuid.js";
|
||||
|
||||
import { parseCron } from "@/util/cron.js";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -199,7 +199,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state), handleCancer, CONSTANT, CommonUtils,
|
||||
...toRefs(state), handleCancer, CONSTANT, CommonUtils,parseCron,
|
||||
handleSearchSelect, querySearchWayAsync, handleEditCronMsg
|
||||
};
|
||||
},
|
||||
Reference in New Issue
Block a user