作者 fuzui

fix: crontab组件互斥bug

@@ -72,23 +72,14 @@ export default { @@ -72,23 +72,14 @@ export default {
72 // 单选按钮值变化时 72 // 单选按钮值变化时
73 radioChange() { 73 radioChange() {
74 ('day rachange'); 74 ('day rachange');
75 - if (this.radioValue === 1) {  
76 - this.$emit('update', 'day', '*', 'day');  
77 - this.$emit('update', 'week', '?', 'day');  
78 - this.$emit('update', 'month', '*', 'day');  
79 - } else {  
80 - if (this.cron.hour === '*') {  
81 - this.$emit('update', 'hour', '0', 'day');  
82 - }  
83 - if (this.cron.min === '*') {  
84 - this.$emit('update', 'min', '0', 'day');  
85 - }  
86 - if (this.cron.second === '*') {  
87 - this.$emit('update', 'second', '0', 'day');  
88 - } 75 + if (this.radioValue !== 2 && this.cron.week !== '?') {
  76 + this.$emit('update', 'week', '?', 'day')
89 } 77 }
90 78
91 switch (this.radioValue) { 79 switch (this.radioValue) {
  80 + case 1:
  81 + this.$emit('update', 'day', '*');
  82 + break;
92 case 2: 83 case 2:
93 this.$emit('update', 'day', '?'); 84 this.$emit('update', 'day', '?');
94 break; 85 break;
@@ -51,18 +51,10 @@ export default { @@ -51,18 +51,10 @@ export default {
51 methods: { 51 methods: {
52 // 单选按钮值变化时 52 // 单选按钮值变化时
53 radioChange() { 53 radioChange() {
54 - if (this.radioValue === 1) {  
55 - this.$emit('update', 'hour', '*', 'hour');  
56 - this.$emit('update', 'day', '*', 'hour');  
57 - } else {  
58 - if (this.cron.min === '*') {  
59 - this.$emit('update', 'min', '0', 'hour');  
60 - }  
61 - if (this.cron.second === '*') {  
62 - this.$emit('update', 'second', '0', 'hour');  
63 - }  
64 - }  
65 switch (this.radioValue) { 54 switch (this.radioValue) {
  55 + case 1:
  56 + this.$emit('update', 'hour', '*')
  57 + break;
66 case 2: 58 case 2:
67 this.$emit('update', 'hour', this.cycle01 + '-' + this.cycle02); 59 this.$emit('update', 'hour', this.cycle01 + '-' + this.cycle02);
68 break; 60 break;
@@ -2,7 +2,12 @@ @@ -2,7 +2,12 @@
2 <div> 2 <div>
3 <el-tabs type="border-card"> 3 <el-tabs type="border-card">
4 <el-tab-pane label="秒" v-if="shouldHide('second')"> 4 <el-tab-pane label="秒" v-if="shouldHide('second')">
5 - <CrontabSecond @update="updateCrontabValue" :check="checkNumber" ref="cronsecond" /> 5 + <CrontabSecond
  6 + @update="updateCrontabValue"
  7 + :check="checkNumber"
  8 + :cron="crontabValueObj"
  9 + ref="cronsecond"
  10 + />
6 </el-tab-pane> 11 </el-tab-pane>
7 12
8 <el-tab-pane label="分钟" v-if="shouldHide('min')"> 13 <el-tab-pane label="分钟" v-if="shouldHide('min')">
@@ -52,13 +52,9 @@ export default { @@ -52,13 +52,9 @@ export default {
52 methods: { 52 methods: {
53 // 单选按钮值变化时 53 // 单选按钮值变化时
54 radioChange() { 54 radioChange() {
55 - if (this.radioValue !== 1 && this.cron.second === '*') {  
56 - this.$emit('update', 'second', '0', 'min');  
57 - }  
58 switch (this.radioValue) { 55 switch (this.radioValue) {
59 case 1: 56 case 1:
60 this.$emit('update', 'min', '*', 'min'); 57 this.$emit('update', 'min', '*', 'min');
61 - this.$emit('update', 'hour', '*', 'min');  
62 break; 58 break;
63 case 2: 59 case 2:
64 this.$emit('update', 'min', this.cycle01 + '-' + this.cycle02, 'min'); 60 this.$emit('update', 'min', this.cycle01 + '-' + this.cycle02, 'min');
@@ -51,24 +51,10 @@ export default { @@ -51,24 +51,10 @@ export default {
51 methods: { 51 methods: {
52 // 单选按钮值变化时 52 // 单选按钮值变化时
53 radioChange() { 53 radioChange() {
54 - if (this.radioValue === 1) {  
55 - this.$emit('update', 'month', '*');  
56 - this.$emit('update', 'year', '*');  
57 - } else {  
58 - if (this.cron.day === '*') {  
59 - this.$emit('update', 'day', '0', 'month');  
60 - }  
61 - if (this.cron.hour === '*') {  
62 - this.$emit('update', 'hour', '0', 'month');  
63 - }  
64 - if (this.cron.min === '*') {  
65 - this.$emit('update', 'min', '0', 'month');  
66 - }  
67 - if (this.cron.second === '*') {  
68 - this.$emit('update', 'second', '0', 'month');  
69 - }  
70 - }  
71 switch (this.radioValue) { 54 switch (this.radioValue) {
  55 + case 1:
  56 + this.$emit('update', 'month', '*');
  57 + break;
72 case 2: 58 case 2:
73 this.$emit('update', 'month', this.cycle01 + '-' + this.cycle02); 59 this.$emit('update', 'month', this.cycle01 + '-' + this.cycle02);
74 break; 60 break;
@@ -54,7 +54,6 @@ export default { @@ -54,7 +54,6 @@ export default {
54 switch (this.radioValue) { 54 switch (this.radioValue) {
55 case 1: 55 case 1:
56 this.$emit('update', 'second', '*', 'second'); 56 this.$emit('update', 'second', '*', 'second');
57 - this.$emit('update', 'min', '*', 'second');  
58 break; 57 break;
59 case 2: 58 case 2:
60 this.$emit('update', 'second', this.cycle01 + '-' + this.cycle02); 59 this.$emit('update', 'second', this.cycle01 + '-' + this.cycle02);
@@ -67,27 +67,13 @@ export default { @@ -67,27 +67,13 @@ export default {
67 methods: { 67 methods: {
68 // 单选按钮值变化时 68 // 单选按钮值变化时
69 radioChange() { 69 radioChange() {
70 - if (this.radioValue === 1) {  
71 - this.$emit('update', 'week', '*');  
72 - this.$emit('update', 'year', '*');  
73 - } else {  
74 - if (this.cron.month === '*') {  
75 - this.$emit('update', 'month', '0', 'week');  
76 - }  
77 - if (this.cron.day === '*') {  
78 - this.$emit('update', 'day', '0', 'week');  
79 - }  
80 - if (this.cron.hour === '*') {  
81 - this.$emit('update', 'hour', '0', 'week');  
82 - }  
83 - if (this.cron.min === '*') {  
84 - this.$emit('update', 'min', '0', 'week');  
85 - }  
86 - if (this.cron.second === '*') {  
87 - this.$emit('update', 'second', '0', 'week');  
88 - } 70 + if (this.radioValue !== 2 && this.cron.day !== '?') {
  71 + this.$emit('update', 'day', '?', 'week');
89 } 72 }
90 switch (this.radioValue) { 73 switch (this.radioValue) {
  74 + case 1:
  75 + this.$emit('update', 'week', '*');
  76 + break;
91 case 2: 77 case 2:
92 this.$emit('update', 'week', '?'); 78 this.$emit('update', 'week', '?');
93 break; 79 break;
@@ -105,7 +91,6 @@ export default { @@ -105,7 +91,6 @@ export default {
105 break; 91 break;
106 } 92 }
107 }, 93 },
108 - // 根据互斥事件,更改radio的值  
109 94
110 // 周期两个值变化时 95 // 周期两个值变化时
111 cycleChange() { 96 cycleChange() {
@@ -59,21 +59,6 @@ export default { @@ -59,21 +59,6 @@ export default {
59 methods: { 59 methods: {
60 // 单选按钮值变化时 60 // 单选按钮值变化时
61 radioChange() { 61 radioChange() {
62 - if (this.cron.month === '*') {  
63 - this.$emit('update', 'month', '0', 'year');  
64 - }  
65 - if (this.cron.day === '*') {  
66 - this.$emit('update', 'day', '0', 'year');  
67 - }  
68 - if (this.cron.hour === '*') {  
69 - this.$emit('update', 'hour', '0', 'year');  
70 - }  
71 - if (this.cron.min === '*') {  
72 - this.$emit('update', 'min', '0', 'year');  
73 - }  
74 - if (this.cron.second === '*') {  
75 - this.$emit('update', 'second', '0', 'year');  
76 - }  
77 switch (this.radioValue) { 62 switch (this.radioValue) {
78 case 1: 63 case 1:
79 this.$emit('update', 'year', ''); 64 this.$emit('update', 'year', '');