From 663024ac7fe2c1a60d151e4e645e5e0f553366a4 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期二, 20 九月 2022 10:46:43 +0800
Subject: [PATCH] update 优化 pr235 解决小问题与优化写法
---
ruoyi-ui/src/components/Crontab/week.vue | 107 +++++++++++++++++++++++++++++++++++------------------
1 files changed, 71 insertions(+), 36 deletions(-)
diff --git a/ruoyi-ui/src/components/Crontab/week.vue b/ruoyi-ui/src/components/Crontab/week.vue
index 5ad949d..1cec700 100644
--- a/ruoyi-ui/src/components/Crontab/week.vue
+++ b/ruoyi-ui/src/components/Crontab/week.vue
@@ -2,7 +2,7 @@
<el-form size='small'>
<el-form-item>
<el-radio v-model='radioValue' :label="1">
- 鍛紝鍏佽鐨勯�氶厤绗, - * / L #]
+ 鍛紝鍏佽鐨勯�氶厤绗, - * ? / L #]
</el-radio>
</el-form-item>
@@ -15,8 +15,25 @@
<el-form-item>
<el-radio v-model='radioValue' :label="3">
鍛ㄦ湡浠庢槦鏈�
- <el-input-number v-model='cycle01' :min="1" :max="7" /> -
- <el-input-number v-model='cycle02' :min="1" :max="7" />
+ <el-select clearable v-model="cycle01">
+ <el-option
+ v-for="(item,index) of weekList"
+ :key="index"
+ :label="item.value"
+ :value="item.key"
+ :disabled="item.key === 1"
+ >{{item.value}}</el-option>
+ </el-select>
+ -
+ <el-select clearable v-model="cycle02">
+ <el-option
+ v-for="(item,index) of weekList"
+ :key="index"
+ :label="item.value"
+ :value="item.key"
+ :disabled="item.key < cycle01 && item.key !== 1"
+ >{{item.value}}</el-option>
+ </el-select>
</el-radio>
</el-form-item>
@@ -24,14 +41,18 @@
<el-radio v-model='radioValue' :label="4">
绗�
<el-input-number v-model='average01' :min="1" :max="4" /> 鍛ㄧ殑鏄熸湡
- <el-input-number v-model='average02' :min="1" :max="7" />
+ <el-select clearable v-model="average02">
+ <el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
+ </el-select>
</el-radio>
</el-form-item>
<el-form-item>
<el-radio v-model='radioValue' :label="5">
鏈湀鏈�鍚庝竴涓槦鏈�
- <el-input-number v-model='weekday' :min="1" :max="7" />
+ <el-select clearable v-model="weekday">
+ <el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
+ </el-select>
</el-radio>
</el-form-item>
@@ -39,7 +60,7 @@
<el-radio v-model='radioValue' :label="6">
鎸囧畾
<el-select clearable v-model="checkboxList" placeholder="鍙閫�" multiple style="width:100%">
- <el-option v-for="(item,index) of weekList" :key="index" :value="index+1">{{item}}</el-option>
+ <el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="String(item.key)">{{item.value}}</el-option>
</el-select>
</el-radio>
</el-form-item>
@@ -52,13 +73,42 @@
data() {
return {
radioValue: 2,
- weekday: 1,
- cycle01: 1,
- cycle02: 2,
+ weekday: 2,
+ cycle01: 2,
+ cycle02: 3,
average01: 1,
- average02: 1,
+ average02: 2,
checkboxList: [],
- weekList: ['鍛ㄤ竴', '鍛ㄤ簩', '鍛ㄤ笁', '鍛ㄥ洓', '鍛ㄤ簲', '鍛ㄥ叚', '鍛ㄦ棩'],
+ 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
}
},
@@ -67,45 +117,30 @@
methods: {
// 鍗曢�夋寜閽�煎彉鍖栨椂
radioChange() {
- if (this.radioValue === 1) {
- this.$emit('update', 'week', '*');
- this.$emit('update', 'year', '*');
- } else {
- if (this.cron.month === '*') {
- this.$emit('update', 'month', '0', 'week');
- }
- if (this.cron.day === '*') {
- this.$emit('update', 'day', '0', 'week');
- }
- if (this.cron.hour === '*') {
- this.$emit('update', 'hour', '0', 'week');
- }
- if (this.cron.min === '*') {
- this.$emit('update', 'min', '0', 'week');
- }
- if (this.cron.second === '*') {
- this.$emit('update', 'second', '0', 'week');
- }
+ 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.cycle01 + '-' + this.cycle02);
+ this.$emit('update', 'week', this.cycleTotal);
break;
case 4:
- this.$emit('update', 'week', this.average01 + '#' + this.average02);
+ this.$emit('update', 'week', this.averageTotal);
break;
case 5:
- this.$emit('update', 'week', this.weekday + 'L');
+ this.$emit('update', 'week', this.weekdayCheck + 'L');
break;
case 6:
this.$emit('update', 'week', this.checkboxString);
break;
}
},
- // 鏍规嵁浜掓枼浜嬩欢锛屾洿鏀箁adio鐨勫��
// 鍛ㄦ湡涓や釜鍊煎彉鍖栨椂
cycleChange() {
@@ -133,7 +168,7 @@
},
},
watch: {
- "radioValue": "radioChange",
+ 'radioValue': 'radioChange',
'cycleTotal': 'cycleChange',
'averageTotal': 'averageChange',
'weekdayCheck': 'weekdayChange',
@@ -150,7 +185,7 @@
averageTotal: function () {
this.average01 = this.checkNum(this.average01, 1, 4)
this.average02 = this.checkNum(this.average02, 1, 7)
- return this.average01 + '#' + this.average02;
+ return this.average02 + '#' + this.average01;
},
// 鏈�杩戠殑宸ヤ綔鏃ワ紙鏍煎紡锛�
weekdayCheck: function () {
--
Gitblit v1.9.3