This commit is contained in:
xiaojunnuo
2024-11-25 00:53:36 +08:00
parent c96fcb7afc
commit dd2b0a1595
13 changed files with 49 additions and 52 deletions
@@ -13,8 +13,9 @@
@error="onError"
/>
</div>
<div class="mt-5">
<div class="mt-5 flex">
<a-input :disabled="true" :readonly="readonly" :value="modelValue" @change="onChange"></a-input>
<fs-icon icon="ion:close-circle" class="pointer fs-16 ml-5 color-gray" title="清除选择" @click="onClear"></fs-icon>
</div>
<div class="helper">下次触发时间{{ nextTime }}</div>
<div class="fs-helper">{{ errorMessage }}</div>
@@ -35,8 +36,12 @@ const props = defineProps<{
}>();
const period = ref<string>("");
if (props.modelValue == null) {
if (props.modelValue == null || props.modelValue.endsWith("* * *")) {
period.value = "day";
} else if (props.modelValue.endsWith("* *")) {
period.value = "month";
} else if (props.modelValue.endsWith("*")) {
period.value = "year";
}
const emit = defineEmits<{
"update:modelValue": any;
@@ -74,6 +79,13 @@ const onError = (error: any) => {
errorMessage.value = error;
};
const onClear = () => {
if (props.disabled) {
return;
}
onUpdate("");
};
const nextTime = computed(() => {
if (props.modelValue == null) {
return "请先设置正确的cron表达式";