UNPKG

star-horse-crontab

Version:

Cron表达式 Vue3 实现

1,290 lines (1,279 loc) 125 kB
import { defineComponent, ref, computed, watch, onMounted, resolveComponent, createBlock, openBlock, withCtx, createVNode, unref, isRef, createTextVNode, createElementVNode, createElementBlock, Fragment, renderList, toDisplayString, reactive, onBeforeMount, isVNode, render, Transition, createCommentVNode, normalizeStyle, normalizeClass, renderSlot, getCurrentInstance, nextTick } from 'vue'; const _sfc_main$9 = /* @__PURE__ */ defineComponent({ __name: "Crontab-Second", props: { check: { type: Function }, cron: { type: Object }, radioParent: {} }, emits: ["update"], setup(__props, { expose: __expose, emit: __emit }) { let radioValue = ref(1); let cycle01 = ref(1); let cycle02 = ref(2); let average01 = ref(1); let average02 = ref(1); let checkboxList = ref([]); const props = __props; let checkNum = ref(props.check); const emits = __emit; const cycleTotalFun = () => { cycle01.value = checkNum.value?.(cycle01.value, 0, 59); cycle02.value = checkNum.value?.(cycle02.value, 0, 59); return cycle01.value + "-" + cycle02.value; }; const averageTotalFun = () => { average01.value = checkNum.value?.(average01.value, 0, 59); average02.value = checkNum.value?.(average02.value, 1, 59); return average01.value + "/" + average02.value; }; const checkboxStringFun = () => { let str = checkboxList.value.join(); return str == "" ? "*" : str; }; let cycleTotal = computed(() => cycleTotalFun()); let averageTotal = computed(() => averageTotalFun()); let checkboxString = computed(() => checkboxStringFun()); const radioChange = () => { switch (radioValue.value) { case 1: emits("update", "second", "*", "second"); emits("update", "min", "*", "second"); break; case 2: emits("update", "second", cycle01.value + "-" + cycle02.value); break; case 3: emits("update", "second", average01.value + "/" + average02.value); break; case 4: emits("update", "second", checkboxString.value); break; } }; const cycleChange = () => { if (radioValue.value == 2) { emits("update", "second", cycleTotal.value); } }; const averageChange = () => { if (radioValue.value == 3) { emits("update", "second", averageTotal.value); } }; const checkboxChange = () => { if (radioValue.value == 4) { emits("update", "second", checkboxString.value); } }; watch( () => radioValue.value, (_val) => radioChange(), { immediate: true, deep: true } ); watch( () => cycleTotal.value, (_val) => cycleChange(), { immediate: true, deep: true } ); watch( () => averageTotal.value, (_val) => averageChange(), { immediate: true, deep: true } ); watch( () => checkboxString.value, (_val) => checkboxChange(), { immediate: true, deep: true } ); onMounted(() => { }); __expose({ cycle01, cycle02, average01, average02, checkboxList, radioValue }); return (_ctx, _cache) => { const _component_el_radio = resolveComponent("el-radio"); const _component_el_form_item = resolveComponent("el-form-item"); const _component_el_input_number = resolveComponent("el-input-number"); const _component_el_option = resolveComponent("el-option"); const _component_el_select = resolveComponent("el-select"); const _component_el_form = resolveComponent("el-form"); return openBlock(), createBlock(_component_el_form, null, { default: withCtx(() => [ createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 1, border: "" }, { default: withCtx(() => _cache[9] || (_cache[9] = [ createTextVNode(" 秒,允许的通配符[, - * /] ") ])), _: 1 }, 8, ["modelValue"]) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 2, border: "" }, { default: withCtx(() => _cache[10] || (_cache[10] = [ createTextVNode("周期") ])), _: 1 }, 8, ["modelValue"]), _cache[11] || (_cache[11] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "从", -1)), createVNode(_component_el_input_number, { modelValue: unref(cycle01), "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(cycle01) ? cycle01.value = $event : cycle01 = $event), min: 0, max: 60 }, null, 8, ["modelValue"]), _cache[12] || (_cache[12] = createElementVNode("span", { style: { "margin-left": "5px", "margin-right": "5px" } }, "至", -1)), createVNode(_component_el_input_number, { modelValue: unref(cycle02), "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(cycle02) ? cycle02.value = $event : cycle02 = $event), min: 1, max: 60 }, null, 8, ["modelValue"]), _cache[13] || (_cache[13] = createElementVNode("span", { style: { "margin-left": "5px", "margin-right": "5px" } }, "秒", -1)) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 3, border: "" }, { default: withCtx(() => _cache[14] || (_cache[14] = [ createTextVNode("循环") ])), _: 1 }, 8, ["modelValue"]), _cache[15] || (_cache[15] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "从", -1)), createVNode(_component_el_input_number, { modelValue: unref(average01), "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(average01) ? average01.value = $event : average01 = $event), min: 0, max: 60 }, null, 8, ["modelValue"]), _cache[16] || (_cache[16] = createElementVNode("span", { style: { "margin-left": "5px", "margin-right": "5px" } }, " 秒开始,每", -1)), createVNode(_component_el_input_number, { modelValue: unref(average02), "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(average02) ? average02.value = $event : average02 = $event), min: 0, max: 60 }, null, 8, ["modelValue"]), _cache[17] || (_cache[17] = createElementVNode("span", { style: { "margin-left": "5px", "margin-right": "5px" } }, "秒执行一次", -1)) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 4, border: "" }, { default: withCtx(() => _cache[18] || (_cache[18] = [ createTextVNode(" 指定") ])), _: 1 }, 8, ["modelValue"]), createVNode(_component_el_select, { clearable: "", filterable: "", modelValue: unref(checkboxList), "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(checkboxList) ? checkboxList.value = $event : checkboxList = $event), placeholder: "请选择秒", multiple: "", "collapse-tags": "" }, { default: withCtx(() => [ (openBlock(), createElementBlock(Fragment, null, renderList(60, (item) => { return createVNode(_component_el_option, { label: item - 1, key: item, value: item - 1 }, null, 8, ["label", "value"]); }), 64)) ]), _: 1 }, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }); }; } }); const _export_sfc$1 = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; const CrontabSecond = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__scopeId", "data-v-0ccbec69"]]); const _sfc_main$8 = /* @__PURE__ */ defineComponent({ __name: "Crontab-Min", props: { check: { type: Function }, cron: { type: Object } }, emits: ["update"], setup(__props, { expose: __expose, emit: __emit }) { let radioValue = ref(1); let cycle01 = ref(1); let cycle02 = ref(2); let average01 = ref(1); let average02 = ref(1); let checkboxList = ref([]); const props = __props; let checkNum = ref(props.check); const emits = __emit; const cycleTotalFun = () => { cycle01.value = checkNum.value?.(cycle01.value, 0, 59); cycle02.value = checkNum.value?.(cycle02.value, 0, 59); return cycle01.value + "-" + cycle02.value; }; const averageTotalFun = () => { average01.value = checkNum.value?.(average01.value, 0, 59); average02.value = checkNum.value?.(average02.value, 1, 59); return average01.value + "/" + average02.value; }; const checkboxStringFun = () => { let str = checkboxList.value.join(); return str == "" ? "*" : str; }; let cycleTotal = computed(() => cycleTotalFun()); let averageTotal = computed(() => averageTotalFun()); let checkboxString = computed(() => checkboxStringFun()); const radioChange = () => { if (radioValue.value !== 1 && props.cron?.second === "*") { emits("update", "second", "0", "min"); } switch (radioValue.value) { case 1: emits("update", "min", "*", "min"); emits("update", "hour", "*", "min"); break; case 2: emits("update", "min", cycle01.value + "-" + cycle02.value, "min"); break; case 3: emits("update", "min", average01.value + "/" + average02.value, "min"); break; case 4: emits("update", "min", checkboxString.value, "min"); break; } }; const cycleChange = () => { if (radioValue.value == 2) { emits("update", "min", cycleTotal.value, "min"); } }; const averageChange = () => { if (radioValue.value == 3) { emits("update", "min", averageTotal.value, "min"); } }; const checkboxChange = () => { if (radioValue.value == 4) { emits("update", "min", checkboxString.value, "min"); } }; watch( () => radioValue.value, (_val) => radioChange(), { immediate: true, deep: true } ); watch( () => cycleTotal.value, (_val) => cycleChange(), { immediate: true, deep: true } ); watch( () => averageTotal.value, (_val) => averageChange(), { immediate: true, deep: true } ); watch( () => checkboxString.value, (_val) => checkboxChange(), { immediate: true, deep: true } ); __expose({ cycle01, cycle02, average01, average02, checkboxList, radioValue }); return (_ctx, _cache) => { const _component_el_radio = resolveComponent("el-radio"); const _component_el_form_item = resolveComponent("el-form-item"); const _component_el_input_number = resolveComponent("el-input-number"); const _component_el_option = resolveComponent("el-option"); const _component_el_select = resolveComponent("el-select"); const _component_el_form = resolveComponent("el-form"); return openBlock(), createBlock(_component_el_form, null, { default: withCtx(() => [ createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 1, border: "" }, { default: withCtx(() => _cache[9] || (_cache[9] = [ createTextVNode(" 分钟,允许的通配符[, - * /] ") ])), _: 1 }, 8, ["modelValue"]) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 2, border: "" }, { default: withCtx(() => _cache[10] || (_cache[10] = [ createTextVNode("周期") ])), _: 1 }, 8, ["modelValue"]), _cache[11] || (_cache[11] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "从", -1)), createVNode(_component_el_input_number, { modelValue: unref(cycle01), "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(cycle01) ? cycle01.value = $event : cycle01 = $event), min: 0, max: 60 }, null, 8, ["modelValue"]), _cache[12] || (_cache[12] = createElementVNode("span", { style: { "margin-left": "5px", "margin-right": "5px" } }, "至", -1)), createVNode(_component_el_input_number, { modelValue: unref(cycle02), "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(cycle02) ? cycle02.value = $event : cycle02 = $event), min: 0, max: 60 }, null, 8, ["modelValue"]), _cache[13] || (_cache[13] = createElementVNode("span", { style: { "margin-left": "5px", "margin-right": "5px" } }, "分钟", -1)) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 3, border: "" }, { default: withCtx(() => _cache[14] || (_cache[14] = [ createTextVNode(" 循环") ])), _: 1 }, 8, ["modelValue"]), _cache[15] || (_cache[15] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "从", -1)), createVNode(_component_el_input_number, { modelValue: unref(average01), "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(average01) ? average01.value = $event : average01 = $event), min: 0, max: 60 }, null, 8, ["modelValue"]), _cache[16] || (_cache[16] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, " 分钟开始,每", -1)), createVNode(_component_el_input_number, { modelValue: unref(average02), "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(average02) ? average02.value = $event : average02 = $event), min: 0, max: 60 }, null, 8, ["modelValue"]), _cache[17] || (_cache[17] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, " 分钟执行一次", -1)) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 4, border: "" }, { default: withCtx(() => _cache[18] || (_cache[18] = [ createTextVNode(" 指定 ") ])), _: 1 }, 8, ["modelValue"]), createVNode(_component_el_select, { clearable: "", filterable: "", "collapse-tags": "", modelValue: unref(checkboxList), "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(checkboxList) ? checkboxList.value = $event : checkboxList = $event), placeholder: "请选择分", multiple: "" }, { default: withCtx(() => [ (openBlock(), createElementBlock(Fragment, null, renderList(60, (item) => { return createVNode(_component_el_option, { key: item, value: item - 1, label: item - 1 }, null, 8, ["value", "label"]); }), 64)) ]), _: 1 }, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }); }; } }); const CrontabMin = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__scopeId", "data-v-d3c12d45"]]); const _sfc_main$7 = /* @__PURE__ */ defineComponent({ __name: "Crontab-Hour", props: { check: { type: Function }, cron: { type: Object } }, emits: ["update"], setup(__props, { expose: __expose, emit: __emit }) { let radioValue = ref(1); let cycle01 = ref(1); let cycle02 = ref(2); let average01 = ref(1); let average02 = ref(1); let checkboxList = ref([]); const props = __props; let checkNum = ref(props.check); const emits = __emit; const cycleTotalFun = () => { cycle01.value = checkNum.value?.(cycle01.value, 0, 23); cycle02.value = checkNum.value?.(cycle02.value, 0, 23); return cycle01.value + "-" + cycle02.value; }; const averageTotalFun = () => { average01.value = checkNum.value?.(average01.value, 0, 23); average02.value = checkNum.value?.(average02.value, 1, 23); return average01.value + "/" + average02.value; }; const checkboxStringFun = () => { let str = checkboxList.value.join(); return str == "" ? "*" : str; }; let cycleTotal = computed(() => cycleTotalFun()); let averageTotal = computed(() => averageTotalFun()); let checkboxString = computed(() => checkboxStringFun()); const radioChange = () => { if (radioValue.value === 1) { emits("update", "hour", "*", "hour"); emits("update", "day", "*", "hour"); } else { if (props.cron?.min === "*") { emits("update", "min", "0", "hour"); } if (props.cron?.second === "*") { emits("update", "second", "0", "hour"); } } switch (radioValue.value) { case 2: emits("update", "hour", cycle01.value + "-" + cycle02.value); break; case 3: emits("update", "hour", average01.value + "/" + average02.value); break; case 4: emits("update", "hour", checkboxString.value); break; } }; const cycleChange = () => { if (radioValue.value == 2) { emits("update", "hour", cycleTotal.value); } }; const averageChange = () => { if (radioValue.value == 3) { emits("update", "hour", averageTotal.value); } }; const checkboxChange = () => { if (radioValue.value == 4) { emits("update", "hour", checkboxString.value); } }; watch( () => radioValue.value, (_val) => radioChange(), { immediate: true, deep: true } ); watch( () => cycleTotal.value, (_val) => cycleChange(), { immediate: true, deep: true } ); watch( () => averageTotal.value, (_val) => averageChange(), { immediate: true, deep: true } ); watch( () => checkboxString.value, (_val) => checkboxChange(), { immediate: true, deep: true } ); __expose({ cycle01, cycle02, average01, average02, checkboxList, radioValue }); return (_ctx, _cache) => { const _component_el_radio = resolveComponent("el-radio"); const _component_el_form_item = resolveComponent("el-form-item"); const _component_el_input_number = resolveComponent("el-input-number"); const _component_el_option = resolveComponent("el-option"); const _component_el_select = resolveComponent("el-select"); const _component_el_form = resolveComponent("el-form"); return openBlock(), createBlock(_component_el_form, null, { default: withCtx(() => [ createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 1, border: "" }, { default: withCtx(() => _cache[9] || (_cache[9] = [ createTextVNode(" 小时,允许的通配符[, - * /] ") ])), _: 1 }, 8, ["modelValue"]) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 2, border: "" }, { default: withCtx(() => _cache[10] || (_cache[10] = [ createTextVNode(" 周期 ") ])), _: 1 }, 8, ["modelValue"]), _cache[11] || (_cache[11] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "从", -1)), createVNode(_component_el_input_number, { modelValue: unref(cycle01), "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(cycle01) ? cycle01.value = $event : cycle01 = $event), min: 0, max: 60 }, null, 8, ["modelValue"]), _cache[12] || (_cache[12] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "至", -1)), createVNode(_component_el_input_number, { modelValue: unref(cycle02), "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(cycle02) ? cycle02.value = $event : cycle02 = $event), min: 0, max: 60 }, null, 8, ["modelValue"]), _cache[13] || (_cache[13] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "小时", -1)) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 3, border: "" }, { default: withCtx(() => _cache[14] || (_cache[14] = [ createTextVNode("循环") ])), _: 1 }, 8, ["modelValue"]), _cache[15] || (_cache[15] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "从", -1)), createVNode(_component_el_input_number, { modelValue: unref(average01), "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(average01) ? average01.value = $event : average01 = $event), min: 0, max: 60 }, null, 8, ["modelValue"]), _cache[16] || (_cache[16] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "小时开始,每", -1)), createVNode(_component_el_input_number, { modelValue: unref(average02), "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(average02) ? average02.value = $event : average02 = $event), min: 0, max: 60 }, null, 8, ["modelValue"]), _cache[17] || (_cache[17] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "小时执行一次", -1)) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 4, border: "" }, { default: withCtx(() => _cache[18] || (_cache[18] = [ createTextVNode(" 指定 ") ])), _: 1 }, 8, ["modelValue"]), createVNode(_component_el_select, { clearable: "", filterable: "", "collapse-tags": "", modelValue: unref(checkboxList), "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(checkboxList) ? checkboxList.value = $event : checkboxList = $event), placeholder: "请选择小时", multiple: "" }, { default: withCtx(() => [ (openBlock(), createElementBlock(Fragment, null, renderList(24, (item) => { return createVNode(_component_el_option, { key: item, value: item - 1, label: item - 1 }, null, 8, ["value", "label"]); }), 64)) ]), _: 1 }, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }); }; } }); const CrontabHour = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__scopeId", "data-v-267ed17e"]]); const _sfc_main$6 = /* @__PURE__ */ defineComponent({ __name: "Crontab-Day", props: { check: { type: Function }, cron: { type: Object } }, emits: ["update"], setup(__props, { expose: __expose, emit: __emit }) { let radioValue = ref(1); let workday = ref(1); let cycle01 = ref(1); let cycle02 = ref(2); let average01 = ref(1); let average02 = ref(1); let checkboxList = ref([]); const props = __props; let checkNum = ref(props.check); const emits = __emit; const cycleTotalFun = () => { cycle01.value = checkNum.value?.(cycle01.value, 1, 31); cycle02.value = checkNum.value?.(cycle02.value, 1, 31); return cycle01.value + "-" + cycle02.value; }; const averageTotalFun = () => { average01.value = checkNum.value?.(average01.value, 1, 31); average02.value = checkNum.value?.(average02.value, 1, 31); return average01.value + "/" + average02.value; }; const workdayCheckFun = () => { workday.value = checkNum.value?.(workday.value, 1, 31); return workday.value; }; const checkboxStringFun = () => { let str = checkboxList.value.join(); return str == "" ? "*" : str; }; let cycleTotal = computed(() => cycleTotalFun()); let averageTotal = computed(() => averageTotalFun()); let workdayCheck = computed(() => workdayCheckFun()); let checkboxString = computed(() => checkboxStringFun()); const radioChange = () => { if (radioValue.value === 1) { emits("update", "day", "*", "day"); emits("update", "week", "?", "day"); emits("update", "month", "*", "day"); } else { if (props.cron?.hour === "*") { emits("update", "hour", "0", "day"); } if (props.cron?.min === "*") { emits("update", "min", "0", "day"); } if (props.cron?.second === "*") { emits("update", "second", "0", "day"); } } switch (radioValue.value) { case 2: emits("update", "day", "?"); break; case 3: emits("update", "day", cycle01.value + "-" + cycle02.value); break; case 4: emits("update", "day", average01.value + "/" + average02.value); break; case 5: emits("update", "day", workday.value + "W"); break; case 6: emits("update", "day", "L"); break; case 7: emits("update", "day", checkboxString.value); break; } }; const cycleChange = () => { if (radioValue.value == 3) { emits("update", "day", cycleTotal.value); } }; const averageChange = () => { if (radioValue.value == 4) { emits("update", "day", averageTotal.value); } }; const workdayChange = () => { if (radioValue.value == 5) { emits("update", "day", workday.value + "W"); } }; const checkboxChange = () => { if (radioValue.value == 7) { emits("update", "day", checkboxString.value); } }; watch( () => radioValue.value, (_val) => radioChange(), { immediate: true, deep: true } ); watch( () => cycleTotal.value, (_val) => cycleChange(), { immediate: true, deep: true } ); watch( () => averageTotal.value, (_val) => averageChange(), { immediate: true, deep: true } ); watch( () => workdayCheck.value, (_val) => workdayChange(), { immediate: true, deep: true } ); watch( () => checkboxString.value, (_val) => checkboxChange(), { immediate: true, deep: true } ); __expose({ cycle01, cycle02, average01, average02, checkboxList, workday, radioValue }); return (_ctx, _cache) => { const _component_el_radio = resolveComponent("el-radio"); const _component_el_form_item = resolveComponent("el-form-item"); const _component_el_input_number = resolveComponent("el-input-number"); const _component_el_option = resolveComponent("el-option"); const _component_el_select = resolveComponent("el-select"); const _component_el_form = resolveComponent("el-form"); return openBlock(), createBlock(_component_el_form, null, { default: withCtx(() => [ createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 1, border: "" }, { default: withCtx(() => _cache[13] || (_cache[13] = [ createTextVNode(" 日,允许的通配符[, - * / L M] ") ])), _: 1 }, 8, ["modelValue"]) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 2, border: "" }, { default: withCtx(() => _cache[14] || (_cache[14] = [ createTextVNode(" 不指定 ") ])), _: 1 }, 8, ["modelValue"]) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 3, border: "" }, { default: withCtx(() => _cache[15] || (_cache[15] = [ createTextVNode(" 周期 ") ])), _: 1 }, 8, ["modelValue"]), _cache[16] || (_cache[16] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "从", -1)), createVNode(_component_el_input_number, { modelValue: unref(cycle01), "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(cycle01) ? cycle01.value = $event : cycle01 = $event), min: 0, max: 31 }, null, 8, ["modelValue"]), _cache[17] || (_cache[17] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "至", -1)), createVNode(_component_el_input_number, { modelValue: unref(cycle02), "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(cycle02) ? cycle02.value = $event : cycle02 = $event), min: 0, max: 31 }, null, 8, ["modelValue"]), _cache[18] || (_cache[18] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "日", -1)) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 4, border: "" }, { default: withCtx(() => _cache[19] || (_cache[19] = [ createTextVNode("循环") ])), _: 1 }, 8, ["modelValue"]), _cache[20] || (_cache[20] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "从", -1)), createVNode(_component_el_input_number, { modelValue: unref(average01), "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(average01) ? average01.value = $event : average01 = $event), min: 0, max: 31 }, null, 8, ["modelValue"]), _cache[21] || (_cache[21] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "号开始,每", -1)), createVNode(_component_el_input_number, { modelValue: unref(average02), "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(average02) ? average02.value = $event : average02 = $event), min: 0, max: 31 }, null, 8, ["modelValue"]), _cache[22] || (_cache[22] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "日执行一次", -1)) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 5, border: "" }, { default: withCtx(() => _cache[23] || (_cache[23] = [ createTextVNode("工作日") ])), _: 1 }, 8, ["modelValue"]), _cache[24] || (_cache[24] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "每月", -1)), createVNode(_component_el_input_number, { modelValue: unref(workday), "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => isRef(workday) ? workday.value = $event : workday = $event), min: 0, max: 31 }, null, 8, ["modelValue"]), _cache[25] || (_cache[25] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "号最近的那个工作日", -1)) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 6, border: "" }, { default: withCtx(() => _cache[26] || (_cache[26] = [ createTextVNode(" 本月最后一天 ") ])), _: 1 }, 8, ["modelValue"]) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 7, border: "" }, { default: withCtx(() => _cache[27] || (_cache[27] = [ createTextVNode(" 指定 ") ])), _: 1 }, 8, ["modelValue"]), createVNode(_component_el_select, { clearable: "", filterable: "", "collapse-tags": "", modelValue: unref(checkboxList), "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => isRef(checkboxList) ? checkboxList.value = $event : checkboxList = $event), placeholder: "请选择日期", multiple: "" }, { default: withCtx(() => [ (openBlock(), createElementBlock(Fragment, null, renderList(31, (item) => { return createVNode(_component_el_option, { key: item, value: item, label: item }, null, 8, ["value", "label"]); }), 64)) ]), _: 1 }, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }); }; } }); const CrontabDay = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["__scopeId", "data-v-9017a582"]]); const _sfc_main$5 = /* @__PURE__ */ defineComponent({ __name: "Crontab-Month", props: { check: { type: Function }, cron: { type: Object } }, emits: ["update"], setup(__props, { expose: __expose, emit: __emit }) { let radioValue = ref(1); let cycle01 = ref(1); let cycle02 = ref(2); let average01 = ref(1); let average02 = ref(1); let checkboxList = ref([]); const props = __props; let checkNum = ref(props.check); const emits = __emit; const cycleTotalFun = () => { cycle01.value = checkNum.value?.(cycle01.value, 1, 12); cycle02.value = checkNum.value?.(cycle02.value, 1, 12); return cycle01.value + "-" + cycle02.value; }; const averageTotalFun = () => { average01.value = checkNum.value?.(average01.value, 1, 12); average02.value = checkNum.value?.(average02.value, 1, 12); return average01.value + "/" + average02.value; }; const checkboxStringFun = () => { let str = checkboxList.value.join(); return str == "" || str == "0" ? "*" : str; }; let cycleTotal = computed(() => cycleTotalFun()); let averageTotal = computed(() => averageTotalFun()); let checkboxString = computed(() => checkboxStringFun()); const radioChange = () => { if (radioValue.value === 1) { emits("update", "month", "*"); emits("update", "year", "*"); } else { if (props.cron?.day === "*") { emits("update", "day", "0", "month"); } if (props.cron?.hour === "*") { emits("update", "hour", "0", "month"); } if (props.cron?.min === "*") { emits("update", "min", "0", "month"); } if (props.cron?.second === "*") { emits("update", "second", "0", "month"); } } switch (radioValue.value) { case 2: emits("update", "month", cycle01.value + "-" + cycle02.value); break; case 3: emits("update", "month", average01.value + "/" + average02.value); break; case 4: emits("update", "month", checkboxString.value); break; } }; const cycleChange = () => { if (radioValue.value == 2) { emits("update", "month", cycleTotal.value); } }; const averageChange = () => { if (radioValue.value == 3) { emits("update", "month", averageTotal.value); } }; const checkboxChange = () => { if (radioValue.value == 4) { emits("update", "month", checkboxString.value); } }; watch( () => radioValue.value, (_val) => radioChange(), { immediate: true, deep: true } ); watch( () => cycleTotal.value, (_val) => cycleChange(), { immediate: true, deep: true } ); watch( () => averageTotal.value, (_val) => averageChange(), { immediate: true, deep: true } ); watch( () => checkboxString.value, (_val) => checkboxChange(), { immediate: true, deep: true } ); __expose({ cycle01, cycle02, average01, average02, checkboxList, radioValue }); return (_ctx, _cache) => { const _component_el_radio = resolveComponent("el-radio"); const _component_el_form_item = resolveComponent("el-form-item"); const _component_el_input_number = resolveComponent("el-input-number"); const _component_el_option = resolveComponent("el-option"); const _component_el_select = resolveComponent("el-select"); const _component_el_form = resolveComponent("el-form"); return openBlock(), createBlock(_component_el_form, null, { default: withCtx(() => [ createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 1, border: "" }, { default: withCtx(() => _cache[9] || (_cache[9] = [ createTextVNode(" 月,允许的通配符[, - * /] ") ])), _: 1 }, 8, ["modelValue"]) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 2 }, { default: withCtx(() => _cache[10] || (_cache[10] = [ createTextVNode(" 周期 ") ])), _: 1 }, 8, ["modelValue"]), _cache[11] || (_cache[11] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "从", -1)), createVNode(_component_el_input_number, { modelValue: unref(cycle01), "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(cycle01) ? cycle01.value = $event : cycle01 = $event), min: 1, max: 12 }, null, 8, ["modelValue"]), _cache[12] || (_cache[12] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "至", -1)), createVNode(_component_el_input_number, { modelValue: unref(cycle02), "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(cycle02) ? cycle02.value = $event : cycle02 = $event), min: 1, max: 12 }, null, 8, ["modelValue"]), _cache[13] || (_cache[13] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "月", -1)) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 3, border: "" }, { default: withCtx(() => _cache[14] || (_cache[14] = [ createTextVNode("循环") ])), _: 1 }, 8, ["modelValue"]), _cache[15] || (_cache[15] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "从", -1)), createVNode(_component_el_input_number, { modelValue: unref(average01), "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(average01) ? average01.value = $event : average01 = $event), min: 1, max: 12 }, null, 8, ["modelValue"]), _cache[16] || (_cache[16] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "月开始,每", -1)), createVNode(_component_el_input_number, { modelValue: unref(average02), "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(average02) ? average02.value = $event : average02 = $event), min: 1, max: 12 }, null, 8, ["modelValue"]), _cache[17] || (_cache[17] = createElementVNode("span", { style: { "margin-left": "10px", "margin-right": "5px" } }, "月执行一次", -1)) ]), _: 1 }), createVNode(_component_el_form_item, null, { default: withCtx(() => [ createVNode(_component_el_radio, { modelValue: unref(radioValue), "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(radioValue) ? radioValue.value = $event : radioValue = $event), label: 4, border: "" }, { default: withCtx(() => _cache[18] || (_cache[18] = [ createTextVNode(" 指定 ") ])), _: 1 }, 8, ["modelValue"]),