perf: 优化时间选择器,自动填写分钟和秒钟

pull/243/head
xiaojunnuo 2024-11-01 10:23:27 +08:00
parent 9b4a31fa6a
commit 396dc34a84
7 changed files with 17 additions and 5 deletions

View File

@ -4,6 +4,7 @@
"version": "1.27.0", "version": "1.27.0",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -28,6 +28,7 @@ function createService() {
// dataAxios 是 axios 返回数据中的 data // dataAxios 是 axios 返回数据中的 data
const dataAxios = response.data; const dataAxios = response.data;
// @ts-ignore
if (response.config.unpack === false) { if (response.config.unpack === false) {
//如果不需要解包 //如果不需要解包
return dataAxios; return dataAxios;

View File

@ -48,6 +48,15 @@ const onUpdate = (value: string) => {
if (value === props.modelValue) { if (value === props.modelValue) {
return; return;
} }
const arr: string[] = value.split(" ");
if (arr[0] === "*") {
arr[0] = "0";
}
if (arr[1] === "*") {
arr[1] = "0";
}
value = arr.join(" ");
emit("update:modelValue", value); emit("update:modelValue", value);
errorMessage.value = undefined; errorMessage.value = undefined;
}; };

View File

@ -1,5 +1,3 @@
import { sysResources } from "/@/router/source/modules/sys";
export const certdResources = [ export const certdResources = [
{ {
title: "证书自动化", title: "证书自动化",

View File

@ -98,7 +98,7 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre
vModel: "modelValue", vModel: "modelValue",
placeholder: "0 0 4 * * *" placeholder: "0 0 4 * * *"
}, },
helper: "点击上面的按钮,选择每天几点几分定时执行,后面的分秒都要选择0。\n建议设置为每天触发一次证书未到期之前任务会跳过不会重复执行", helper: "点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次证书未到期之前任务会跳过不会重复执行",
order: 100 order: 100
} }
}, },

View File

@ -58,7 +58,7 @@
name: 'cron-editor', name: 'cron-editor',
vModel: 'modelValue' vModel: 'modelValue'
}, },
helper: '点击上面的按钮,选择每天几点几分定时执行后面的分秒都要选择0。\n建议设置为每天触发一次证书未到期之前任务会跳过不会重复执行', helper: '点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次证书未到期之前任务会跳过不会重复执行',
rules: [{ required: true, message: '此项必填' }] rules: [{ required: true, message: '此项必填' }]
}" }"
/> />

View File

@ -306,8 +306,11 @@ export class PipelineService extends BaseService<PipelineEntity> {
return; return;
} }
cron = cron.trim(); cron = cron.trim();
if (cron.startsWith('* *')) {
cron = cron.replace('* *', '0 0');
}
if (cron.startsWith('*')) { if (cron.startsWith('*')) {
cron = '0' + cron.substring(1, cron.length); cron = cron.replace('*', '0');
} }
const triggerId = trigger.id; const triggerId = trigger.id;
const name = this.buildCronKey(pipelineId, triggerId); const name = this.buildCronKey(pipelineId, triggerId);