| | |
| | | methods: { |
| | | // 单选按钮值变化时 |
| | | radioChange() { |
| | | ('day rachange'); |
| | | ('day rachange') |
| | | if (this.radioValue !== 2 && this.cron.week !== '?') { |
| | | this.$emit('update', 'week', '?', 'day') |
| | | } |
| | | |
| | | switch (this.radioValue) { |
| | | case 1: |
| | | this.$emit('update', 'day', '*'); |
| | | break; |
| | | this.$emit('update', 'day', '*') |
| | | break |
| | | case 2: |
| | | this.$emit('update', 'day', '?'); |
| | | break; |
| | | this.$emit('update', 'day', '?') |
| | | break |
| | | case 3: |
| | | this.$emit('update', 'day', this.cycleTotal); |
| | | break; |
| | | this.$emit('update', 'day', this.cycleTotal) |
| | | break |
| | | case 4: |
| | | this.$emit('update', 'day', this.averageTotal); |
| | | break; |
| | | this.$emit('update', 'day', this.averageTotal) |
| | | break |
| | | case 5: |
| | | this.$emit('update', 'day', this.workday + 'W'); |
| | | break; |
| | | this.$emit('update', 'day', this.workday + 'W') |
| | | break |
| | | case 6: |
| | | this.$emit('update', 'day', 'L'); |
| | | break; |
| | | this.$emit('update', 'day', 'L') |
| | | break |
| | | case 7: |
| | | this.$emit('update', 'day', this.checkboxString); |
| | | break; |
| | | this.$emit('update', 'day', this.checkboxString) |
| | | break |
| | | } |
| | | ('day rachange end'); |
| | | ('day rachange end') |
| | | }, |
| | | // 周期两个值变化时 |
| | | cycleChange() { |
| | | if (this.radioValue == '3') { |
| | | this.$emit('update', 'day', this.cycleTotal); |
| | | this.$emit('update', 'day', this.cycleTotal) |
| | | } |
| | | }, |
| | | // 平均两个值变化时 |
| | | averageChange() { |
| | | if (this.radioValue == '4') { |
| | | this.$emit('update', 'day', this.averageTotal); |
| | | this.$emit('update', 'day', this.averageTotal) |
| | | } |
| | | }, |
| | | // 最近工作日值变化时 |
| | | workdayChange() { |
| | | if (this.radioValue == '5') { |
| | | this.$emit('update', 'day', this.workdayCheck + 'W'); |
| | | this.$emit('update', 'day', this.workdayCheck + 'W') |
| | | } |
| | | }, |
| | | // checkbox值变化时 |
| | | checkboxChange() { |
| | | if (this.radioValue == '7') { |
| | | this.$emit('update', 'day', this.checkboxString); |
| | | this.$emit('update', 'day', this.checkboxString) |
| | | } |
| | | } |
| | | }, |
| | |
| | | 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; |
| | | 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; |
| | | return average01 + '/' + average02 |
| | | }, |
| | | // 计算工作日格式 |
| | | workdayCheck: function () { |
| | | const workday = this.checkNum(this.workday, 1, 31) |
| | | return workday; |
| | | return workday |
| | | }, |
| | | // 计算勾选的checkbox值合集 |
| | | checkboxString: function () { |
| | | let str = this.checkboxList.join(); |
| | | return str == '' ? '*' : str; |
| | | let str = this.checkboxList.join() |
| | | return str == '' ? '*' : str |
| | | } |
| | | } |
| | | } |