Blame view

ant-design-vue-jeecg/src/components/jeecg/JEasyCron/tabs/day.vue 3.4 KB
肖超群 authored
1
2
3
4
5
6
7
8
9
10
11
12
13
<template>
  <div class="config-list">
    <a-radio-group v-model="type">
      <div class="item">
        <a-radio value="TYPE_NOT_SET" class="choice" :disabled="disableChoice">不设置</a-radio>
        <span class="tip-info">日和周只能设置其中之一</span>
      </div>
      <div class="item">
        <a-radio value="TYPE_EVERY" class="choice" :disabled="disableChoice">每日</a-radio>
      </div>
      <div class="item">
        <a-radio value="TYPE_RANGE" class="choice" :disabled="disableChoice">区间</a-radio>
肖超群 authored
14
15
        <a-input-number :disabled="type!==TYPE_RANGE || disableChoice" :max="maxValue" :min="minValue" :precision="0"
                        class="w60" v-model="valueRange.start"/>
肖超群 authored
16
17

肖超群 authored
18
19
        <a-input-number :disabled="type!==TYPE_RANGE || disableChoice" :max="maxValue" :min="minValue" :precision="0"
                        class="w60" v-model="valueRange.end"/>
肖超群 authored
20
21
22
23
24

      </div>
      <div class="item">
        <a-radio value="TYPE_LOOP" class="choice" :disabled="disableChoice">循环</a-radio>
肖超群 authored
25
26
        <a-input-number :disabled="type!==TYPE_LOOP || disableChoice" :max="maxValue" :min="minValue" :precision="0"
                        class="w60" v-model="valueLoop.start"/>
肖超群 authored
27
        日开始,间隔
肖超群 authored
28
29
        <a-input-number :disabled="type!==TYPE_LOOP || disableChoice" :max="maxValue" :min="minValue" :precision="0"
                        class="w60" v-model="valueLoop.interval"/>
肖超群 authored
30
31
32
33
34

      </div>
      <div class="item">
        <a-radio value="TYPE_WORK" class="choice" :disabled="disableChoice">工作日</a-radio>
        本月
肖超群 authored
35
36
        <a-input-number :disabled="type!==TYPE_WORK || disableChoice" :max="maxValue" :min="minValue" :precision="0"
                        class="w60" v-model="valueWork"/>
肖超群 authored
37
38
39
40
41
42
43
44
45
46
        日,最近的工作日
      </div>
      <div class="item">
        <a-radio value="TYPE_LAST" class="choice" :disabled="disableChoice">最后一日</a-radio>
      </div>
      <div class="item">
        <a-radio value="TYPE_SPECIFY" class="choice" :disabled="disableChoice">指定</a-radio>
        <div class="list">
          <a-checkbox-group v-model="valueList">
            <template v-for="i of specifyRange">
肖超群 authored
47
48
49
              <a-checkbox class="list-check-item" :key="`key-${i}`" :value="i"
                          :disabled="type!==TYPE_SPECIFY || disabled">{{ i }}
              </a-checkbox>
肖超群 authored
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
            </template>
          </a-checkbox-group>
        </div>
      </div>
    </a-radio-group>
  </div>
</template>

<script>
import mixin from './mixin'

export default {
  name: 'day',
  mixins: [mixin],
  props: {
    week: {
      type: String,
      default: '?'
    }
  },
  data() {
    return {}
  },
  computed: {
    disableChoice() {
      return (this.week && this.week !== '?') || this.disabled
    }
  },
  watch: {
    value_c(newVal, oldVal) {
      // 数值变化
      this.updateValue()
    },
    week(newVal, oldVal) {
      // console.info('new week: ' + newVal)
      this.updateValue()
    }
  },
  methods: {
    updateValue() {
      this.$emit('change', this.disableChoice ? '?' : this.value_c)
    }
  },
  created() {
    this.DEFAULT_VALUE = '*'
    this.minValue = 1
    this.maxValue = 31
    this.valueRange.start = 1
    this.valueRange.end = 31
    this.valueLoop.start = 1
    this.valueLoop.interval = 1
    this.parseProp(this.prop)
  }
}
</script>

<style lang="less" scoped>
肖超群 authored
107
@import "mixin.less";
肖超群 authored
108
</style>