diff --git a/kinit-admin/src/components/Dialog/src/Dialog.vue b/kinit-admin/src/components/Dialog/src/Dialog.vue index 25d375b..2794149 100644 --- a/kinit-admin/src/components/Dialog/src/Dialog.vue +++ b/kinit-admin/src/components/Dialog/src/Dialog.vue @@ -9,12 +9,14 @@ const slots = useSlots() const props = defineProps({ modelValue: propTypes.bool.def(false), title: propTypes.string.def('Dialog'), + top: propTypes.string.def('8vh'), fullscreen: propTypes.bool.def(true), - maxHeight: propTypes.oneOfType([String, Number]).def('500px') + height: propTypes.oneOfType([String, Number]).def('500px'), + width: propTypes.oneOfType([String, Number]).def('700px') }) const getBindValue = computed(() => { - const delArr: string[] = ['fullscreen', 'title', 'maxHeight'] + const delArr: string[] = ['fullscreen', 'title', 'height', 'top', 'width'] const attrs = useAttrs() const obj = { ...attrs, ...props } for (const key in obj) { @@ -31,7 +33,7 @@ const toggleFull = () => { isFullscreen.value = !unref(isFullscreen) } -const dialogHeight = ref(isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight) +const dialogHeight = ref(isNumber(props.height) ? `${props.height}px` : props.height) watch( () => isFullscreen.value, @@ -41,7 +43,7 @@ watch( const windowHeight = document.documentElement.offsetHeight dialogHeight.value = `${windowHeight - 55 - 60 - (slots.footer ? 63 : 0)}px` } else { - dialogHeight.value = isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight + dialogHeight.value = isNumber(props.height) ? `${props.height}px` : props.height } }, { @@ -64,6 +66,8 @@ const dialogStyle = computed(() => { lock-scroll draggable :close-on-click-modal="false" + :top="top" + :width="width" > - + { - + @@ -380,7 +375,7 @@ const handleCommand = (command: string) => { v-model="passwordDialogVisible" :title="passwordDialogTitle" width="1000px" - maxHeight="550px" + height="550px" > +import { ElDescriptions, ElDescriptionsItem } from 'element-plus' +import { ref } from 'vue' + +const cronExample = ref([ + { + value: '0 0 10,15,16 * * ?', + label: '每天上午10点,下午3点,4点' + }, + { + value: '0 0/30 9-17 * * ?', + label: '朝九晚五工作时间内每半小时' + }, + { + value: '0 0 12 ? * WED ', + label: '表示每个星期三中午12点' + }, + { + value: '0 0 12 * * ?', + label: '每天中午12点触发' + }, + { + value: '0 15 10 ? * *', + label: '每天上午10:15触发' + }, + { + value: '0 15 10 * * ?', + label: '每天上午10:15触发 (跟上面的一样)' + }, + { + value: '0 15 10 * * ? 2005', + label: '2005年的每天上午10:15触发' + }, + { + value: '0 * 14 * * ?', + label: '在每天下午2点到下午2:59期间的每1分钟触发' + }, + { + value: '0 0/5 14 * * ?', + label: '在每天下午2点到下午2:55期间的每5分钟触发' + }, + { + value: '0 0/5 14,18 * * ?', + label: '在每天下午2点到2:55期间和下午6点到6:55期间的每5分钟触发' + }, + { + value: '0 0-5 14 * * ?', + label: '在每天下午2点到下午2:05期间的每1分钟触发' + }, + { + value: '0 10,44 14 ? 3 WED', + label: '每年三月的星期三的下午2:10和2:44触发' + }, + { + value: '0 15 10 ? * MON-FRI', + label: '周一至周五的上午10:15触发' + }, + { + value: '0 15 10 15 * ?', + label: '每月15日上午10:15触发' + }, + { + value: '0 15 10 L * ?', + label: '每月最后一日的上午10:15触发' + } +]) + + + + + diff --git a/kinit-admin/src/views/vadmin/system/task/components/CronExpression.vue b/kinit-admin/src/views/vadmin/system/task/components/CronExpression.vue new file mode 100644 index 0000000..6ac48b9 --- /dev/null +++ b/kinit-admin/src/views/vadmin/system/task/components/CronExpression.vue @@ -0,0 +1,681 @@ + + + + + diff --git a/kinit-admin/src/views/vadmin/system/task/components/RunDatetimeList.vue b/kinit-admin/src/views/vadmin/system/task/components/RunDatetimeList.vue new file mode 100644 index 0000000..f757c04 --- /dev/null +++ b/kinit-admin/src/views/vadmin/system/task/components/RunDatetimeList.vue @@ -0,0 +1,565 @@ + + + + + diff --git a/kinit-admin/src/views/vadmin/system/task/components/task.data.ts b/kinit-admin/src/views/vadmin/system/task/components/task.data.ts index d2e2788..8ced805 100644 --- a/kinit-admin/src/views/vadmin/system/task/components/task.data.ts +++ b/kinit-admin/src/views/vadmin/system/task/components/task.data.ts @@ -174,7 +174,7 @@ export const schema = reactive([ style: { width: '100%' }, - placeholder: 'cron 表达式,六位或七位,分别表示秒、分钟、小时、天、月、星期几、年' + placeholder: 'cron 表达式,六位或七位,分别表示秒、分钟、小时、天、月、星期几、年(可选)' }, ifshow: (values) => values.exec_strategy === 'cron' }, diff --git a/kinit-admin/src/views/vadmin/system/task/index.vue b/kinit-admin/src/views/vadmin/system/task/index.vue index a267036..f04c5f8 100644 --- a/kinit-admin/src/views/vadmin/system/task/index.vue +++ b/kinit-admin/src/views/vadmin/system/task/index.vue @@ -30,6 +30,7 @@ import { Dialog } from '@/components/Dialog' import { useCache } from '@/hooks/web/useCache' import { useRouter } from 'vue-router' import Write from './components/Write.vue' +import CronExpression from './components/CronExpression.vue' const { wsCache } = useCache() const { t } = useI18n() @@ -67,6 +68,7 @@ watch( } ) +const cronDialogVisible = ref(false) const dialogVisible = ref(false) const dialogTitle = ref('') const loading = ref(false) @@ -98,7 +100,6 @@ getOptions() // 跳转到调度日志页面 const toRecord = (row: any) => { if (row) { - console.log(row) push(`/system/record/task?job_id=${row._id}`) } else { push(`/system/record/task`) @@ -205,7 +206,7 @@ const save = async () => { // 生成 cron 表达式 const generateCronExpression = () => { - ElMessage.info('下一个版本更新') + cronDialogVisible.value = true } getList() @@ -225,7 +226,7 @@ getList() 添加定时任务 调度日志 - 生成 Cron 表达式 + 快速生成 Cron 表达式 {{ t('dialogDemo.close') }} + + + + diff --git a/kinit-api/application/settings.py b/kinit-api/application/settings.py index fba3ddb..fd63ffd 100644 --- a/kinit-api/application/settings.py +++ b/kinit-api/application/settings.py @@ -11,7 +11,7 @@ from fastapi.security import OAuth2PasswordBearer """ 系统版本 """ -VERSION = "1.9.1" +VERSION = "1.9.2" """安全警告: 不要在生产中打开调试运行!""" DEBUG = True diff --git a/kinit-task/main.py b/kinit-task/main.py index 1d2c734..41ad4a1 100644 --- a/kinit-task/main.py +++ b/kinit-task/main.py @@ -113,6 +113,8 @@ class ScheduledTask: logger.info(content) print(content) getattr(self, operation)(**task) + else: + print("意外", message) def start_mongo(self) -> None: """