vue-cron-picker
Version:
CRON表达式选择器
2,263 lines (2,205 loc) • 86 kB
JavaScript
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script$8 = {
data() {
return {
radioValue: 1,
cycle01: 1,
cycle02: 2,
average01: 0,
average02: 1,
checkboxList: [],
checkNum: this.$options.propsData.check
};
},
name: 'crontab-second',
props: ['check', 'radioParent'],
methods: {
// 单选按钮值变化时
radioChange() {
switch (this.radioValue) {
case 1:
this.$emit('update', 'second', '*', 'second');
break;
case 2:
this.$emit('update', 'second', this.cycleTotal);
break;
case 3:
this.$emit('update', 'second', this.averageTotal);
break;
case 4:
this.$emit('update', 'second', this.checkboxString);
break;
}
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
this.$emit('update', 'second', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
this.$emit('update', 'second', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
this.$emit('update', 'second', this.checkboxString);
}
}
},
watch: {
'radioValue': 'radioChange',
'cycleTotal': 'cycleChange',
'averageTotal': 'averageChange',
'checkboxString': 'checkboxChange',
radioParent() {
this.radioValue = this.radioParent;
}
},
computed: {
// 计算两个周期值
cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, 0, 58);
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59);
return cycle01 + '-' + cycle02;
},
// 计算平均用到的值
averageTotal: function () {
const average01 = this.checkNum(this.average01, 0, 58);
const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0);
return average01 + '/' + average02;
},
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
}
}
};
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
if (typeof shadowMode !== 'boolean') {
createInjectorSSR = createInjector;
createInjector = shadowMode;
shadowMode = false;
}
// Vue.extend constructor export interop.
const options = typeof script === 'function' ? script.options : script;
// render functions
if (template && template.render) {
options.render = template.render;
options.staticRenderFns = template.staticRenderFns;
options._compiled = true;
// functional template
if (isFunctionalTemplate) {
options.functional = true;
}
}
// scopedId
if (scopeId) {
options._scopeId = scopeId;
}
let hook;
if (moduleIdentifier) {
// server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__;
}
// inject component styles
if (style) {
style.call(this, createInjectorSSR(context));
}
// register component module identifier for async chunk inference
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier);
}
};
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook;
}
else if (style) {
hook = shadowMode
? function (context) {
style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
}
: function (context) {
style.call(this, createInjector(context));
};
}
if (hook) {
if (options.functional) {
// register for functional component in vue file
const originalRender = options.render;
options.render = function renderWithStyleInjection(h, context) {
hook.call(context);
return originalRender(h, context);
};
}
else {
// inject component registration as beforeCreate hook
const existing = options.beforeCreate;
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
}
}
return script;
}
/* script */
const __vue_script__$8 = script$8;
/* template */
var __vue_render__$8 = function () {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('el-form', {
attrs: {
"size": "small"
}
}, [_c('el-form-item', [_c('el-radio', {
attrs: {
"label": 1
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t秒,允许的通配符[, - * /]\n\t\t")])], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 2
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t周期从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 0,
"max": 58
},
model: {
value: _vm.cycle01,
callback: function ($$v) {
_vm.cycle01 = $$v;
},
expression: "cycle01"
}
}), _vm._v(" -\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": _vm.cycle01 ? _vm.cycle01 + 1 : 1,
"max": 59
},
model: {
value: _vm.cycle02,
callback: function ($$v) {
_vm.cycle02 = $$v;
},
expression: "cycle02"
}
}), _vm._v(" 秒\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 3
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 0,
"max": 58
},
model: {
value: _vm.average01,
callback: function ($$v) {
_vm.average01 = $$v;
},
expression: "average01"
}
}), _vm._v(" 秒开始,每\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 59 - _vm.average01 || 0
},
model: {
value: _vm.average02,
callback: function ($$v) {
_vm.average02 = $$v;
},
expression: "average02"
}
}), _vm._v(" 秒执行一次\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 4
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t指定\n\t\t\t"), _c('el-select', {
staticStyle: {
"width": "100%"
},
attrs: {
"clearable": "",
"placeholder": "可多选",
"multiple": ""
},
model: {
value: _vm.checkboxList,
callback: function ($$v) {
_vm.checkboxList = $$v;
},
expression: "checkboxList"
}
}, _vm._l(60, function (item) {
return _c('el-option', {
key: item,
attrs: {
"value": item - 1
}
}, [_vm._v(_vm._s(item - 1))]);
}), 1)], 1)], 1)], 1);
};
var __vue_staticRenderFns__$8 = [];
/* style */
const __vue_inject_styles__$8 = undefined;
/* scoped */
const __vue_scope_id__$8 = undefined;
/* module identifier */
const __vue_module_identifier__$8 = undefined;
/* functional template */
const __vue_is_functional_template__$8 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
const __vue_component__$8 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$8,
staticRenderFns: __vue_staticRenderFns__$8
}, __vue_inject_styles__$8, __vue_script__$8, __vue_scope_id__$8, __vue_is_functional_template__$8, __vue_module_identifier__$8, false, undefined, undefined, undefined);
var CrontabSecond = __vue_component__$8;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script$7 = {
data() {
return {
radioValue: 1,
cycle01: 1,
cycle02: 2,
average01: 0,
average02: 1,
checkboxList: [],
checkNum: this.$options.propsData.check
};
},
name: 'crontab-min',
props: ['check', 'cron'],
methods: {
// 单选按钮值变化时
radioChange() {
switch (this.radioValue) {
case 1:
this.$emit('update', 'min', '*', 'min');
break;
case 2:
this.$emit('update', 'min', this.cycleTotal, 'min');
break;
case 3:
this.$emit('update', 'min', this.averageTotal, 'min');
break;
case 4:
this.$emit('update', 'min', this.checkboxString, 'min');
break;
}
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
this.$emit('update', 'min', this.cycleTotal, 'min');
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
this.$emit('update', 'min', this.averageTotal, 'min');
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
this.$emit('update', 'min', this.checkboxString, 'min');
}
}
},
watch: {
'radioValue': 'radioChange',
'cycleTotal': 'cycleChange',
'averageTotal': 'averageChange',
'checkboxString': 'checkboxChange'
},
computed: {
// 计算两个周期值
cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, 0, 58);
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59);
return cycle01 + '-' + cycle02;
},
// 计算平均用到的值
averageTotal: function () {
const average01 = this.checkNum(this.average01, 0, 58);
const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0);
return average01 + '/' + average02;
},
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
}
}
};
/* script */
const __vue_script__$7 = script$7;
/* template */
var __vue_render__$7 = function () {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('el-form', {
attrs: {
"size": "small"
}
}, [_c('el-form-item', [_c('el-radio', {
attrs: {
"label": 1
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t分钟,允许的通配符[, - * /]\n\t\t")])], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 2
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t周期从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 0,
"max": 58
},
model: {
value: _vm.cycle01,
callback: function ($$v) {
_vm.cycle01 = $$v;
},
expression: "cycle01"
}
}), _vm._v(" -\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": _vm.cycle01 ? _vm.cycle01 + 1 : 1,
"max": 59
},
model: {
value: _vm.cycle02,
callback: function ($$v) {
_vm.cycle02 = $$v;
},
expression: "cycle02"
}
}), _vm._v(" 分钟\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 3
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 0,
"max": 58
},
model: {
value: _vm.average01,
callback: function ($$v) {
_vm.average01 = $$v;
},
expression: "average01"
}
}), _vm._v(" 分钟开始,每\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 59 - _vm.average01 || 0
},
model: {
value: _vm.average02,
callback: function ($$v) {
_vm.average02 = $$v;
},
expression: "average02"
}
}), _vm._v(" 分钟执行一次\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 4
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t指定\n\t\t\t"), _c('el-select', {
staticStyle: {
"width": "100%"
},
attrs: {
"clearable": "",
"placeholder": "可多选",
"multiple": ""
},
model: {
value: _vm.checkboxList,
callback: function ($$v) {
_vm.checkboxList = $$v;
},
expression: "checkboxList"
}
}, _vm._l(60, function (item) {
return _c('el-option', {
key: item,
attrs: {
"value": item - 1
}
}, [_vm._v(_vm._s(item - 1))]);
}), 1)], 1)], 1)], 1);
};
var __vue_staticRenderFns__$7 = [];
/* style */
const __vue_inject_styles__$7 = undefined;
/* scoped */
const __vue_scope_id__$7 = undefined;
/* module identifier */
const __vue_module_identifier__$7 = undefined;
/* functional template */
const __vue_is_functional_template__$7 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
const __vue_component__$7 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$7,
staticRenderFns: __vue_staticRenderFns__$7
}, __vue_inject_styles__$7, __vue_script__$7, __vue_scope_id__$7, __vue_is_functional_template__$7, __vue_module_identifier__$7, false, undefined, undefined, undefined);
var CrontabMin = __vue_component__$7;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script$6 = {
data() {
return {
radioValue: 1,
cycle01: 0,
cycle02: 1,
average01: 0,
average02: 1,
checkboxList: [],
checkNum: this.$options.propsData.check
};
},
name: 'crontab-hour',
props: ['check', 'cron'],
methods: {
// 单选按钮值变化时
radioChange() {
switch (this.radioValue) {
case 1:
this.$emit('update', 'hour', '*');
break;
case 2:
this.$emit('update', 'hour', this.cycleTotal);
break;
case 3:
this.$emit('update', 'hour', this.averageTotal);
break;
case 4:
this.$emit('update', 'hour', this.checkboxString);
break;
}
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
this.$emit('update', 'hour', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
this.$emit('update', 'hour', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
this.$emit('update', 'hour', this.checkboxString);
}
}
},
watch: {
'radioValue': 'radioChange',
'cycleTotal': 'cycleChange',
'averageTotal': 'averageChange',
'checkboxString': 'checkboxChange'
},
computed: {
// 计算两个周期值
cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, 0, 22);
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23);
return cycle01 + '-' + cycle02;
},
// 计算平均用到的值
averageTotal: function () {
const average01 = this.checkNum(this.average01, 0, 22);
const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0);
return average01 + '/' + average02;
},
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
}
}
};
/* script */
const __vue_script__$6 = script$6;
/* template */
var __vue_render__$6 = function () {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('el-form', {
attrs: {
"size": "small"
}
}, [_c('el-form-item', [_c('el-radio', {
attrs: {
"label": 1
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t小时,允许的通配符[, - * /]\n\t\t")])], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 2
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t周期从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 0,
"max": 22
},
model: {
value: _vm.cycle01,
callback: function ($$v) {
_vm.cycle01 = $$v;
},
expression: "cycle01"
}
}), _vm._v(" -\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": _vm.cycle01 ? _vm.cycle01 + 1 : 1,
"max": 23
},
model: {
value: _vm.cycle02,
callback: function ($$v) {
_vm.cycle02 = $$v;
},
expression: "cycle02"
}
}), _vm._v(" 小时\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 3
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 0,
"max": 22
},
model: {
value: _vm.average01,
callback: function ($$v) {
_vm.average01 = $$v;
},
expression: "average01"
}
}), _vm._v(" 小时开始,每\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 23 - _vm.average01 || 0
},
model: {
value: _vm.average02,
callback: function ($$v) {
_vm.average02 = $$v;
},
expression: "average02"
}
}), _vm._v(" 小时执行一次\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 4
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t指定\n\t\t\t"), _c('el-select', {
staticStyle: {
"width": "100%"
},
attrs: {
"clearable": "",
"placeholder": "可多选",
"multiple": ""
},
model: {
value: _vm.checkboxList,
callback: function ($$v) {
_vm.checkboxList = $$v;
},
expression: "checkboxList"
}
}, _vm._l(24, function (item) {
return _c('el-option', {
key: item,
attrs: {
"value": item - 1
}
}, [_vm._v(_vm._s(item - 1))]);
}), 1)], 1)], 1)], 1);
};
var __vue_staticRenderFns__$6 = [];
/* style */
const __vue_inject_styles__$6 = undefined;
/* scoped */
const __vue_scope_id__$6 = undefined;
/* module identifier */
const __vue_module_identifier__$6 = undefined;
/* functional template */
const __vue_is_functional_template__$6 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
const __vue_component__$6 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$6,
staticRenderFns: __vue_staticRenderFns__$6
}, __vue_inject_styles__$6, __vue_script__$6, __vue_scope_id__$6, __vue_is_functional_template__$6, __vue_module_identifier__$6, false, undefined, undefined, undefined);
var CrontabHour = __vue_component__$6;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script$5 = {
data() {
return {
radioValue: 1,
workday: 1,
cycle01: 1,
cycle02: 2,
average01: 1,
average02: 1,
checkboxList: [],
checkNum: this.$options.propsData.check
};
},
name: 'crontab-day',
props: ['check', 'cron'],
methods: {
// 单选按钮值变化时
radioChange() {
'day rachange';
if (this.radioValue !== 2 && this.cron.week !== '?') {
this.$emit('update', 'week', '?', 'day');
}
switch (this.radioValue) {
case 1:
this.$emit('update', 'day', '*');
break;
case 2:
this.$emit('update', 'day', '?');
break;
case 3:
this.$emit('update', 'day', this.cycleTotal);
break;
case 4:
this.$emit('update', 'day', this.averageTotal);
break;
case 5:
this.$emit('update', 'day', this.workday + 'W');
break;
case 6:
this.$emit('update', 'day', 'L');
break;
case 7:
this.$emit('update', 'day', this.checkboxString);
break;
}
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '3') {
this.$emit('update', 'day', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '4') {
this.$emit('update', 'day', this.averageTotal);
}
},
// 最近工作日值变化时
workdayChange() {
if (this.radioValue == '5') {
this.$emit('update', 'day', this.workdayCheck + 'W');
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '7') {
this.$emit('update', 'day', this.checkboxString);
}
}
},
watch: {
'radioValue': 'radioChange',
'cycleTotal': 'cycleChange',
'averageTotal': 'averageChange',
'workdayCheck': 'workdayChange',
'checkboxString': 'checkboxChange'
},
computed: {
// 计算两个周期值
cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, 1, 30);
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 31, 31);
return cycle01 + '-' + cycle02;
},
// 计算平均用到的值
averageTotal: function () {
const average01 = this.checkNum(this.average01, 1, 30);
const average02 = this.checkNum(this.average02, 1, 31 - average01 || 0);
return average01 + '/' + average02;
},
// 计算工作日格式
workdayCheck: function () {
const workday = this.checkNum(this.workday, 1, 31);
return workday;
},
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
}
}
};
/* script */
const __vue_script__$5 = script$5;
/* template */
var __vue_render__$5 = function () {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('el-form', {
attrs: {
"size": "small"
}
}, [_c('el-form-item', [_c('el-radio', {
attrs: {
"label": 1
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t日,允许的通配符[, - * ? / L W]\n\t\t")])], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 2
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t不指定\n\t\t")])], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 3
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t周期从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 30
},
model: {
value: _vm.cycle01,
callback: function ($$v) {
_vm.cycle01 = $$v;
},
expression: "cycle01"
}
}), _vm._v(" -\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": _vm.cycle01 ? _vm.cycle01 + 1 : 2,
"max": 31
},
model: {
value: _vm.cycle02,
callback: function ($$v) {
_vm.cycle02 = $$v;
},
expression: "cycle02"
}
}), _vm._v(" 日\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 4
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 30
},
model: {
value: _vm.average01,
callback: function ($$v) {
_vm.average01 = $$v;
},
expression: "average01"
}
}), _vm._v(" 号开始,每\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 31 - _vm.average01 || 1
},
model: {
value: _vm.average02,
callback: function ($$v) {
_vm.average02 = $$v;
},
expression: "average02"
}
}), _vm._v(" 日执行一次\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 5
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t每月\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 31
},
model: {
value: _vm.workday,
callback: function ($$v) {
_vm.workday = $$v;
},
expression: "workday"
}
}), _vm._v(" 号最近的那个工作日\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 6
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t本月最后一天\n\t\t")])], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 7
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t指定\n\t\t\t"), _c('el-select', {
staticStyle: {
"width": "100%"
},
attrs: {
"clearable": "",
"placeholder": "可多选",
"multiple": ""
},
model: {
value: _vm.checkboxList,
callback: function ($$v) {
_vm.checkboxList = $$v;
},
expression: "checkboxList"
}
}, _vm._l(31, function (item) {
return _c('el-option', {
key: item,
attrs: {
"value": item
}
}, [_vm._v(_vm._s(item))]);
}), 1)], 1)], 1)], 1);
};
var __vue_staticRenderFns__$5 = [];
/* style */
const __vue_inject_styles__$5 = undefined;
/* scoped */
const __vue_scope_id__$5 = undefined;
/* module identifier */
const __vue_module_identifier__$5 = undefined;
/* functional template */
const __vue_is_functional_template__$5 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
const __vue_component__$5 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$5,
staticRenderFns: __vue_staticRenderFns__$5
}, __vue_inject_styles__$5, __vue_script__$5, __vue_scope_id__$5, __vue_is_functional_template__$5, __vue_module_identifier__$5, false, undefined, undefined, undefined);
var CrontabDay = __vue_component__$5;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script$4 = {
data() {
return {
radioValue: 1,
cycle01: 1,
cycle02: 2,
average01: 1,
average02: 1,
checkboxList: [],
checkNum: this.check
};
},
name: 'crontab-month',
props: ['check', 'cron'],
methods: {
// 单选按钮值变化时
radioChange() {
switch (this.radioValue) {
case 1:
this.$emit('update', 'month', '*');
break;
case 2:
this.$emit('update', 'month', this.cycleTotal);
break;
case 3:
this.$emit('update', 'month', this.averageTotal);
break;
case 4:
this.$emit('update', 'month', this.checkboxString);
break;
}
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
this.$emit('update', 'month', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
this.$emit('update', 'month', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
this.$emit('update', 'month', this.checkboxString);
}
}
},
watch: {
'radioValue': 'radioChange',
'cycleTotal': 'cycleChange',
'averageTotal': 'averageChange',
'checkboxString': 'checkboxChange'
},
computed: {
// 计算两个周期值
cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, 1, 11);
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 12);
return cycle01 + '-' + cycle02;
},
// 计算平均用到的值
averageTotal: function () {
const average01 = this.checkNum(this.average01, 1, 11);
const average02 = this.checkNum(this.average02, 1, 12 - average01 || 0);
return average01 + '/' + average02;
},
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
}
}
};
/* script */
const __vue_script__$4 = script$4;
/* template */
var __vue_render__$4 = function () {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('el-form', {
attrs: {
"size": "small"
}
}, [_c('el-form-item', [_c('el-radio', {
attrs: {
"label": 1
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t月,允许的通配符[, - * /]\n\t\t")])], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 2
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t周期从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 11
},
model: {
value: _vm.cycle01,
callback: function ($$v) {
_vm.cycle01 = $$v;
},
expression: "cycle01"
}
}), _vm._v(" -\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": _vm.cycle01 ? _vm.cycle01 + 1 : 2,
"max": 12
},
model: {
value: _vm.cycle02,
callback: function ($$v) {
_vm.cycle02 = $$v;
},
expression: "cycle02"
}
}), _vm._v(" 月\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 3
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 11
},
model: {
value: _vm.average01,
callback: function ($$v) {
_vm.average01 = $$v;
},
expression: "average01"
}
}), _vm._v(" 月开始,每\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 12 - _vm.average01 || 0
},
model: {
value: _vm.average02,
callback: function ($$v) {
_vm.average02 = $$v;
},
expression: "average02"
}
}), _vm._v(" 月月执行一次\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 4
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t指定\n\t\t\t"), _c('el-select', {
staticStyle: {
"width": "100%"
},
attrs: {
"clearable": "",
"placeholder": "可多选",
"multiple": ""
},
model: {
value: _vm.checkboxList,
callback: function ($$v) {
_vm.checkboxList = $$v;
},
expression: "checkboxList"
}
}, _vm._l(12, function (item) {
return _c('el-option', {
key: item,
attrs: {
"value": item
}
}, [_vm._v(_vm._s(item))]);
}), 1)], 1)], 1)], 1);
};
var __vue_staticRenderFns__$4 = [];
/* style */
const __vue_inject_styles__$4 = undefined;
/* scoped */
const __vue_scope_id__$4 = undefined;
/* module identifier */
const __vue_module_identifier__$4 = undefined;
/* functional template */
const __vue_is_functional_template__$4 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
const __vue_component__$4 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$4,
staticRenderFns: __vue_staticRenderFns__$4
}, __vue_inject_styles__$4, __vue_script__$4, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, false, undefined, undefined, undefined);
var CrontabMonth = __vue_component__$4;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script$3 = {
data() {
return {
radioValue: 2,
weekday: 2,
cycle01: 2,
cycle02: 3,
average01: 1,
average02: 2,
checkboxList: [],
weekList: [{
key: 2,
value: '星期一'
}, {
key: 3,
value: '星期二'
}, {
key: 4,
value: '星期三'
}, {
key: 5,
value: '星期四'
}, {
key: 6,
value: '星期五'
}, {
key: 7,
value: '星期六'
}, {
key: 1,
value: '星期日'
}],
checkNum: this.$options.propsData.check
};
},
name: 'crontab-week',
props: ['check', 'cron'],
methods: {
// 单选按钮值变化时
radioChange() {
if (this.radioValue !== 2 && this.cron.day !== '?') {
this.$emit('update', 'day', '?', 'week');
}
switch (this.radioValue) {
case 1:
this.$emit('update', 'week', '*');
break;
case 2:
this.$emit('update', 'week', '?');
break;
case 3:
this.$emit('update', 'week', this.cycleTotal);
break;
case 4:
this.$emit('update', 'week', this.averageTotal);
break;
case 5:
this.$emit('update', 'week', this.weekdayCheck + 'L');
break;
case 6:
this.$emit('update', 'week', this.checkboxString);
break;
}
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '3') {
this.$emit('update', 'week', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '4') {
this.$emit('update', 'week', this.averageTotal);
}
},
// 最近工作日值变化时
weekdayChange() {
if (this.radioValue == '5') {
this.$emit('update', 'week', this.weekday + 'L');
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '6') {
this.$emit('update', 'week', this.checkboxString);
}
}
},
watch: {
'radioValue': 'radioChange',
'cycleTotal': 'cycleChange',
'averageTotal': 'averageChange',
'weekdayCheck': 'weekdayChange',
'checkboxString': 'checkboxChange'
},
computed: {
// 计算两个周期值
cycleTotal: function () {
this.cycle01 = this.checkNum(this.cycle01, 1, 7);
this.cycle02 = this.checkNum(this.cycle02, 1, 7);
return this.cycle01 + '-' + this.cycle02;
},
// 计算平均用到的值
averageTotal: function () {
this.average01 = this.checkNum(this.average01, 1, 4);
this.average02 = this.checkNum(this.average02, 1, 7);
return this.average02 + '#' + this.average01;
},
// 最近的工作日(格式)
weekdayCheck: function () {
this.weekday = this.checkNum(this.weekday, 1, 7);
return this.weekday;
},
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
}
}
};
/* script */
const __vue_script__$3 = script$3;
/* template */
var __vue_render__$3 = function () {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('el-form', {
attrs: {
"size": "small"
}
}, [_c('el-form-item', [_c('el-radio', {
attrs: {
"label": 1
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t周,允许的通配符[, - * ? / L #]\n\t\t")])], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 2
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t不指定\n\t\t")])], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 3
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t周期从星期\n\t\t\t"), _c('el-select', {
attrs: {
"clearable": ""
},
model: {
value: _vm.cycle01,
callback: function ($$v) {
_vm.cycle01 = $$v;
},
expression: "cycle01"
}
}, _vm._l(_vm.weekList, function (item, index) {
return _c('el-option', {
key: index,
attrs: {
"label": item.value,
"value": item.key,
"disabled": item.key === 1
}
}, [_vm._v(_vm._s(item.value))]);
}), 1), _vm._v("\n\t\t\t-\n\t\t\t"), _c('el-select', {
attrs: {
"clearable": ""
},
model: {
value: _vm.cycle02,
callback: function ($$v) {
_vm.cycle02 = $$v;
},
expression: "cycle02"
}
}, _vm._l(_vm.weekList, function (item, index) {
return _c('el-option', {
key: index,
attrs: {
"label": item.value,
"value": item.key,
"disabled": item.key < _vm.cycle01 && item.key !== 1
}
}, [_vm._v(_vm._s(item.value))]);
}), 1)], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 4
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t第\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 4
},
model: {
value: _vm.average01,
callback: function ($$v) {
_vm.average01 = $$v;
},
expression: "average01"
}
}), _vm._v(" 周的星期\n\t\t\t"), _c('el-select', {
attrs: {
"clearable": ""
},
model: {
value: _vm.average02,
callback: function ($$v) {
_vm.average02 = $$v;
},
expression: "average02"
}
}, _vm._l(_vm.weekList, function (item, index) {
return _c('el-option', {
key: index,
attrs: {
"label": item.value,
"value": item.key
}
}, [_vm._v(_vm._s(item.value))]);
}), 1)], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 5
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t本月最后一个星期\n\t\t\t"), _c('el-select', {
attrs: {
"clearable": ""
},
model: {
value: _vm.weekday,
callback: function ($$v) {
_vm.weekday = $$v;
},
expression: "weekday"
}
}, _vm._l(_vm.weekList, function (item, index) {
return _c('el-option', {
key: index,
attrs: {
"label": item.value,
"value": item.key
}
}, [_vm._v(_vm._s(item.value))]);
}), 1)], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 6
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t指定\n\t\t\t"), _c('el-select', {
staticStyle: {
"width": "100%"
},
attrs: {
"clearable": "",
"placeholder": "可多选",
"multiple": ""
},
model: {
value: _vm.checkboxList,
callback: function ($$v) {
_vm.checkboxList = $$v;
},
expression: "checkboxList"
}
}, _vm._l(_vm.weekList, function (item, index) {
return _c('el-option', {
key: index,
attrs: {
"label": item.value,
"value": String(item.key)
}
}, [_vm._v(_vm._s(item.value))]);
}), 1)], 1)], 1)], 1);
};
var __vue_staticRenderFns__$3 = [];
/* style */
const __vue_inject_styles__$3 = undefined;
/* scoped */
const __vue_scope_id__$3 = undefined;
/* module identifier */
const __vue_module_identifier__$3 = undefined;
/* functional template */
const __vue_is_functional_template__$3 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
const __vue_component__$3 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$3,
staticRenderFns: __vue_staticRenderFns__$3
}, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, undefined, undefined, undefined);
var CrontabWeek = __vue_component__$3;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script$2 = {
data() {
return {
fullYear: 0,
radioValue: 1,
cycle01: 0,
cycle02: 0,
average01: 0,
average02: 1,
checkboxList: [],
checkNum: this.$options.propsData.check
};
},
name: 'crontab-year',
props: ['check', 'month', 'cron'],
methods: {
// 单选按钮值变化时
radioChange() {
switch (this.radioValue) {
case 1:
this.$emit('update', 'year', '');
break;
case 2:
this.$emit('update', 'year', '*');
break;
case 3:
this.$emit('update', 'year', this.cycleTotal);
break;
case 4:
this.$emit('update', 'year', this.averageTotal);
break;
case 5:
this.$emit('update', 'year', this.checkboxString);
break;
}
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '3') {
this.$emit('update', 'year', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '4') {
this.$emit('update', 'year', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '5') {
this.$emit('update', 'year', this.checkboxString);
}
}
},
watch: {
'radioValue': 'radioChange',
'cycleTotal': 'cycleChange',
'averageTotal': 'averageChange',
'checkboxString': 'checkboxChange'
},
computed: {
// 计算两个周期值
cycleTotal: function () {
const cycle01 = this.checkNum(this.cycle01, this.fullYear, 2098);
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : this.fullYear + 1, 2099);
return cycle01 + '-' + cycle02;
},
// 计算平均用到的值
averageTotal: function () {
const average01 = this.checkNum(this.average01, this.fullYear, 2098);
const average02 = this.checkNum(this.average02, 1, 2099 - average01 || this.fullYear);
return average01 + '/' + average02;
},
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str;
}
},
mounted: function () {
// 仅获取当前年份
this.fullYear = Number(new Date().getFullYear());
this.cycle01 = this.fullYear;
this.average01 = this.fullYear;
}
};
/* script */
const __vue_script__$2 = script$2;
/* template */
var __vue_render__$2 = function () {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('el-form', {
attrs: {
"size": "small"
}
}, [_c('el-form-item', [_c('el-radio', {
attrs: {
"label": 1
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t不填,允许的通配符[, - * /]\n\t\t")])], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 2
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t每年\n\t\t")])], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 3
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t周期从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": _vm.fullYear,
"max": 2098
},
model: {
value: _vm.cycle01,
callback: function ($$v) {
_vm.cycle01 = $$v;
},
expression: "cycle01"
}
}), _vm._v(" -\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": _vm.cycle01 ? _vm.cycle01 + 1 : _vm.fullYear + 1,
"max": 2099
},
model: {
value: _vm.cycle02,
callback: function ($$v) {
_vm.cycle02 = $$v;
},
expression: "cycle02"
}
})], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 4
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t从\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": _vm.fullYear,
"max": 2098
},
model: {
value: _vm.average01,
callback: function ($$v) {
_vm.average01 = $$v;
},
expression: "average01"
}
}), _vm._v(" 年开始,每\n\t\t\t"), _c('el-input-number', {
attrs: {
"min": 1,
"max": 2099 - _vm.average01 || _vm.fullYear
},
model: {
value: _vm.average02,
callback: function ($$v) {
_vm.average02 = $$v;
},
expression: "average02"
}
}), _vm._v(" 年执行一次\n\t\t")], 1)], 1), _vm._v(" "), _c('el-form-item', [_c('el-radio', {
attrs: {
"label": 5
},
model: {
value: _vm.radioValue,
callback: function ($$v) {
_vm.radioValue = $$v;
},
expression: "radioValue"
}
}, [_vm._v("\n\t\t\t指定\n\t\t\t"), _c('el-select', {
attrs: {
"clearable": "",
"placeholder": "可多选",
"multiple": ""
},
model: {
value: _vm.checkboxList,
callback: function ($$v) {
_vm.checkboxList = $$v;
},
expression: "checkboxList"
}
}, _vm._l(9, function (item) {
return _c('el-option', {
key: item,
attrs: {
"value": item - 1 + _vm.fullYear,
"label": item - 1 + _vm.fullYear
}
});
}), 1)], 1)], 1)], 1);
};
var __vue_staticRenderFns__$2 = [];
/* style */
const __vue_inject_styles__$2 = undefined;
/* scoped */
const __vue_scope_id__$2 = undefined;
/* module identifier */
const __vue_module_identifier__$2 = undefined;
/* functional template */
const __vue_is_functional_template__$2 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
render: __vue_render__$2,
staticRenderFns: __vue_staticRenderFns__$2
}, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
var CrontabYear = __vue_component__$2;
//
//
//
//
//
//
//
//
//
//
//
//
var script$1 = {
data() {
return {
dayRule: '',
dayRuleSup: '',
dateArr: [],
resultList: [],
isShow: false
};
},
name: 'crontab-result',
methods: {
// 表达式值变化时,开始去计算结果
expressionChange() {
// 计算开始-隐藏结果
this.isShow = false;
// 获取规则数组[0秒、1分、2时、3日、4月、5星期、6年]
let ruleArr = this.$options.propsData.ex.split(' ');
// 用于记录进入循环的次数
let nums = 0;
// 用于暂时存符号时间规则结果的数组
let resultArr = [];
// 获取当前时间精确至[年、月、日、时、分、秒]
let nTime = new Date();
let nYear = nTime.getFullYear();
let nMonth = nTime.getMonth() + 1;
let nDay = nTime.getDate();
let nHour = nTime.getHours();
let nMin = nTime.getMinutes();
let nSecond = nTime.getSeconds();
// 根据规则获取到近100年可能年数组、月数组等等
this.getSecondArr(ruleArr[0]);
this.getMinArr(ruleArr[1]);
this.getHourArr(ruleArr[2]);
this.getDayArr(ruleArr[3]);
this.getMonthArr(ruleArr[4]);
this.getWeekArr(ruleArr[5]);
this.getYearArr(ruleArr[6], nYear);
// 将获取到的数组赋值-方便使用
let sDate = this.dateArr[0];
let mDate = this.dateArr[1];
let hDate = this.dateArr[2];
let DDate = this.dateArr[3];
let MDate = this.dateArr[4];
let YDate = this.dateArr[5];
// 获取当前时间在数组中的索引
let sIdx = this.getIndex(sDate, nSecond);
let mIdx = this.getIndex(mDate, nMin);
let hIdx = this.getIndex(hDate, nHour);
let DIdx = this.getIndex(DDate, nDay);
let MIdx = this.getIndex(MDate, nMonth);
let YIdx = this.getIndex(YDate, nYear);
// 重置月日时分秒的函数(后面用的比较多)
const resetSecond = function () {
sIdx = 0;
nSecond