sh-view 2.0.8 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/package.json +9 -13
  2. package/packages/components/global-components/sh-alert/index.vue +175 -173
  3. package/packages/components/global-components/sh-badge/index.vue +57 -43
  4. package/packages/components/global-components/sh-card/index.vue +24 -16
  5. package/packages/components/global-components/sh-code-editor/index.vue +250 -260
  6. package/packages/components/global-components/sh-col/index.vue +44 -36
  7. package/packages/components/global-components/sh-corner/index.vue +230 -228
  8. package/packages/components/global-components/sh-count-to/index.vue +60 -51
  9. package/packages/components/global-components/sh-drawer/index.vue +216 -183
  10. package/packages/components/global-components/sh-drawer/scrollbar.js +44 -42
  11. package/packages/components/global-components/sh-empty/index.vue +0 -1
  12. package/packages/components/global-components/sh-form/form.vue +110 -0
  13. package/packages/components/global-components/sh-form/js/props.js +76 -63
  14. package/packages/components/global-components/sh-form/js/useForm.js +236 -0
  15. package/packages/components/global-components/sh-form/query.vue +70 -0
  16. package/packages/components/global-components/sh-header/index.vue +35 -50
  17. package/packages/components/global-components/sh-icon/css/index.scss +44 -0
  18. package/packages/components/global-components/sh-icon/index.vue +24 -11
  19. package/packages/components/global-components/sh-image/index.vue +47 -38
  20. package/packages/components/global-components/sh-list/index.vue +42 -37
  21. package/packages/components/global-components/sh-loading/index.vue +12 -8
  22. package/packages/components/global-components/sh-modal/index.vue +49 -40
  23. package/packages/components/global-components/sh-noticebar/index.vue +68 -54
  24. package/packages/components/global-components/sh-poptip/index.vue +247 -130
  25. package/packages/components/global-components/sh-progress/index.vue +71 -69
  26. package/packages/components/global-components/sh-pull-refresh/index.vue +156 -157
  27. package/packages/components/global-components/sh-result/index.vue +37 -28
  28. package/packages/components/global-components/sh-row/index.vue +21 -18
  29. package/packages/components/global-components/sh-split/index.vue +115 -109
  30. package/packages/components/global-components/sh-table/components/importModal.vue +95 -86
  31. package/packages/components/global-components/sh-table/components/sh-column.vue +54 -0
  32. package/packages/components/global-components/sh-table/{index.vue → grid.vue} +34 -145
  33. package/packages/components/global-components/sh-table/js/tableMethods.js +175 -0
  34. package/packages/components/global-components/sh-table/js/useTable.js +592 -0
  35. package/packages/components/global-components/sh-table/table.vue +269 -0
  36. package/packages/components/global-components/sh-tabs/index.vue +118 -93
  37. package/packages/components/global-components/sh-tag/index.vue +52 -51
  38. package/packages/components/global-components/sh-toolbar/index.vue +53 -47
  39. package/packages/components/global-components/sh-tree/components/table-tree.vue +152 -139
  40. package/packages/components/global-components/sh-tree/index.vue +218 -195
  41. package/packages/components/global-components/sh-tree/mixin/treeProps.js +118 -120
  42. package/packages/components/global-components/sh-upload/index.vue +308 -51
  43. package/packages/components/global-components/sh-water-fall/index.vue +4 -11
  44. package/packages/components/index.js +5 -3
  45. package/packages/components/other-components/sh-cron-modal/components/cron-content.vue +294 -287
  46. package/packages/components/other-components/sh-cron-modal/css/index.scss +0 -5
  47. package/packages/components/other-components/sh-cron-modal/index.vue +81 -67
  48. package/packages/components/other-components/sh-cron-modal/mixin/cron-emits.js +1 -0
  49. package/packages/components/other-components/sh-cron-modal/mixin/cron-hooks.js +179 -0
  50. package/packages/components/other-components/sh-cron-modal/mixin/cron-props.js +9 -0
  51. package/packages/components/other-components/sh-cron-modal/tabs/cron-day-box.vue +101 -92
  52. package/packages/components/other-components/sh-cron-modal/tabs/cron-hour-box.vue +68 -56
  53. package/packages/components/other-components/sh-cron-modal/tabs/cron-minute-box.vue +68 -56
  54. package/packages/components/other-components/sh-cron-modal/tabs/cron-month-box.vue +68 -56
  55. package/packages/components/other-components/sh-cron-modal/tabs/cron-second-box.vue +68 -56
  56. package/packages/components/other-components/sh-cron-modal/tabs/cron-week-box.vue +126 -115
  57. package/packages/components/other-components/sh-cron-modal/tabs/cron-year-box.vue +59 -46
  58. package/packages/components/other-components/sh-menu/index.vue +75 -60
  59. package/packages/components/other-components/sh-menu/menu-group-content.vue +71 -59
  60. package/packages/components/other-components/sh-menu/menu-item-content.vue +71 -61
  61. package/packages/components/other-components/sh-menu-card/index.vue +81 -59
  62. package/packages/components/other-components/sh-menu-card/menu-box.vue +87 -68
  63. package/packages/components/other-components/sh-preview/components/sh-excel.vue +182 -0
  64. package/packages/components/other-components/sh-preview/components/sh-word.vue +73 -0
  65. package/packages/components/other-components/sh-preview/index.vue +86 -85
  66. package/packages/components/other-components/sh-preview/js/data-hook.js +37 -0
  67. package/packages/components/other-components/sh-preview/js/data-props.js +11 -0
  68. package/packages/components/other-components/sh-system-tip/index.vue +115 -113
  69. package/packages/css/index.js +4 -4
  70. package/packages/{assets/css → css}/main.scss +2 -50
  71. package/packages/{assets/css → css}/theme.scss +35 -16
  72. package/packages/directive/module/prevent-click.js +1 -1
  73. package/packages/directive/module/resize.js +11 -154
  74. package/packages/index.js +39 -39
  75. package/packages/mixin/index.js +86 -87
  76. package/packages/vxeTable/css/index.scss +3 -0
  77. package/packages/vxeTable/render/cell/vxe-render-checkbox.vue +14 -5
  78. package/packages/vxeTable/render/cell/vxe-render-checkgroup.vue +43 -36
  79. package/packages/vxeTable/render/cell/vxe-render-code.vue +14 -5
  80. package/packages/vxeTable/render/cell/vxe-render-goption.vue +34 -24
  81. package/packages/vxeTable/render/cell/vxe-render-href.vue +21 -11
  82. package/packages/vxeTable/render/cell/vxe-render-img.vue +16 -10
  83. package/packages/vxeTable/render/cell/vxe-render-input.vue +83 -67
  84. package/packages/vxeTable/render/cell/vxe-render-money.vue +14 -6
  85. package/packages/vxeTable/render/cell/vxe-render-progress.vue +28 -19
  86. package/packages/vxeTable/render/cell/vxe-render-radio.vue +14 -5
  87. package/packages/vxeTable/render/cell/vxe-render-radiogroup.vue +43 -36
  88. package/packages/vxeTable/render/cell/vxe-render-select.vue +44 -36
  89. package/packages/vxeTable/render/cell/vxe-render-switch.vue +14 -5
  90. package/packages/vxeTable/render/cell/vxe-render-table.vue +51 -78
  91. package/packages/vxeTable/render/cell/vxe-render-textarea.vue +14 -5
  92. package/packages/vxeTable/render/cell/vxe-render-time.vue +23 -13
  93. package/packages/vxeTable/render/cell/vxe-render-tree.vue +23 -27
  94. package/packages/vxeTable/render/cell/vxe-render-upload.vue +11 -7
  95. package/packages/vxeTable/render/filters/vxe-filter-input.vue +25 -43
  96. package/packages/vxeTable/render/footer/vxe-footer-input.vue +23 -13
  97. package/packages/vxeTable/render/footer/vxe-footer-money.vue +30 -20
  98. package/packages/vxeTable/render/globalRenders.jsx +1 -1
  99. package/packages/vxeTable/render/header/vxe-header-money.vue +31 -21
  100. package/packages/vxeTable/render/mixin/cell-hooks.js +162 -0
  101. package/packages/vxeTable/render/mixin/cell-props.js +23 -0
  102. package/packages/vxeTable/render/mixin/filter-hooks.js +28 -0
  103. package/packages/components/global-components/sh-form/components/form-item.vue +0 -25
  104. package/packages/components/global-components/sh-form/css/index.scss +0 -55
  105. package/packages/components/global-components/sh-form/index.vue +0 -114
  106. package/packages/components/global-components/sh-form/js/methods.js +0 -146
  107. package/packages/components/global-components/sh-form/mixin/defaultData.js +0 -32
  108. package/packages/components/global-components/sh-icon/css/default/index.scss +0 -27
  109. package/packages/components/global-components/sh-icon/css/font/index.scss +0 -16
  110. package/packages/components/global-components/sh-icon/icon-default.vue +0 -32
  111. package/packages/components/global-components/sh-icon/icon-font.vue +0 -32
  112. package/packages/components/global-components/sh-poptip/popper.js +0 -115
  113. package/packages/components/global-components/sh-query/index.vue +0 -317
  114. package/packages/components/global-components/sh-table/js/methods.js +0 -549
  115. package/packages/components/global-components/sh-table/mixin/defaultData.js +0 -94
  116. package/packages/components/global-components/sh-upload/js/mixin.js +0 -257
  117. package/packages/components/other-components/sh-cron-modal/mixin/cron-box.js +0 -169
  118. package/packages/vxeTable/render/mixin/cell-mixin.js +0 -206
  119. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.svg → ionicons.svg} +0 -0
  120. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.ttf → ionicons.ttf} +0 -0
  121. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.woff → ionicons.woff} +0 -0
  122. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.woff2 → ionicons.woff2} +0 -0
  123. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.js → iconfont.js} +0 -0
  124. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.json → iconfont.json} +0 -0
  125. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.ttf → iconfont.ttf} +0 -0
  126. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.woff → iconfont.woff} +0 -0
  127. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.woff2 → iconfont.woff2} +0 -0
  128. /package/packages/{assets/css → css}/animated.scss +0 -0
  129. /package/packages/{assets/css → css}/loader.scss +0 -0
@@ -1,67 +1,81 @@
1
- <template>
2
- <sh-modal v-bind="modalConfig" @close="onModalClose" @confirm="onModalConfim">
3
- <cron-content v-model="cronValue" :disabled="disabled"></cron-content>
4
- </sh-modal>
5
- </template>
6
-
7
- <script>
8
- import cronContent from './components/cron-content.vue'
9
- export default {
10
- name: 'ShCronModal',
11
- components: {
12
- cronContent
13
- },
14
- props: {
15
- modelValue: {
16
- type: String,
17
- default: ''
18
- },
19
- visible: {
20
- type: Boolean
21
- },
22
- disabled: {
23
- type: Boolean
24
- }
25
- },
26
- emits: ['update:modelValue', 'update:visible', 'submit'],
27
- data() {
28
- return {
29
- cronValue: '',
30
- modalConfig: {
31
- loading: false,
32
- width: '70%',
33
- title: 'cron表达式',
34
- visible: this.visible
35
- }
36
- }
37
- },
38
- watch: {
39
- modelValue(nv) {
40
- this.cronValue = this.modelValue
41
- },
42
- visible() {
43
- this.modalConfig.visible = this.visible
44
- this.cronValue = this.modelValue
45
- }
46
- },
47
- methods: {
48
- emitValue() {
49
- this.$emit('update:modelValue', this.cronValue)
50
- this.$emit('submit', this.cronValue)
51
- },
52
- // 提交
53
- async onModalConfim() {
54
- this.emitValue()
55
- this.onModalClose()
56
- },
57
- // 关闭
58
- onModalClose() {
59
- this.$emit('update:visible', false)
60
- }
61
- }
62
- }
63
- </script>
64
-
65
- <style lang="scss">
66
- @import './css/index.scss';
67
- </style>
1
+ <template>
2
+ <sh-modal v-bind="modalConfig" @close="onModalClose" @confirm="onModalConfim">
3
+ <cron-content v-model="cronValue" :disabled="disabled"></cron-content>
4
+ </sh-modal>
5
+ </template>
6
+
7
+ <script>
8
+ import { defineComponent, computed, getCurrentInstance, ref, reactive, watch, onBeforeMount } from 'vue'
9
+ import cronContent from './components/cron-content.vue'
10
+ export default defineComponent({
11
+ name: 'ShCronModal',
12
+ components: {
13
+ cronContent
14
+ },
15
+ props: {
16
+ modelValue: {
17
+ type: String,
18
+ default: ''
19
+ },
20
+ visible: {
21
+ type: Boolean
22
+ },
23
+ disabled: {
24
+ type: Boolean
25
+ }
26
+ },
27
+ emits: ['update:modelValue', 'update:visible', 'submit'],
28
+ setup(props, context) {
29
+ const { proxy } = getCurrentInstance()
30
+ const { $vUtils } = proxy
31
+ const { emit, slots } = context
32
+
33
+ const cronValue = ref('')
34
+ const modalConfig = reactive({
35
+ loading: false,
36
+ width: '70%',
37
+ title: 'cron表达式',
38
+ visible: props.visible
39
+ })
40
+
41
+ const emitValue = () => {
42
+ emit('update:modelValue', cronValue.value)
43
+ emit('submit', cronValue.value)
44
+ }
45
+ // 提交
46
+ const onModalConfim = () => {
47
+ emitValue()
48
+ onModalClose()
49
+ }
50
+ // 关闭
51
+ const onModalClose = () => {
52
+ emit('update:visible', false)
53
+ }
54
+
55
+ watch(
56
+ () => props.modelValue,
57
+ nv => {
58
+ cronValue.value = nv
59
+ }
60
+ )
61
+ watch(
62
+ () => props.visible,
63
+ nv => {
64
+ modalConfig.visible = nv
65
+ cronValue.value = props.modelValue
66
+ }
67
+ )
68
+
69
+ return {
70
+ modalConfig,
71
+ cronValue,
72
+ onModalClose,
73
+ onModalConfim
74
+ }
75
+ }
76
+ })
77
+ </script>
78
+
79
+ <style lang="scss">
80
+ @import './css/index.scss';
81
+ </style>
@@ -0,0 +1 @@
1
+ export default ['update:modelValue', 'change']
@@ -0,0 +1,179 @@
1
+ import { computed, ref, reactive } from 'vue'
2
+
3
+ const TypeEnum = {
4
+ unset: 'UNSET',
5
+ every: 'EVERY',
6
+ range: 'RANGE',
7
+ loop: 'LOOP',
8
+ work: 'WORK',
9
+ last: 'LAST',
10
+ specify: 'SPECIFY'
11
+ }
12
+
13
+ export default function (props, context, proxy, state) {
14
+ const { emit, slots } = context
15
+ const { $vUtils } = proxy
16
+
17
+ const type = ref(TypeEnum.every)
18
+ const defaultValue = ref(state.defaultValue)
19
+ const minValue = ref(state.minValue)
20
+ const maxValue = ref(state.maxValue)
21
+ const valueRange = reactive(state.valueRange)
22
+ const valueLoop = reactive(state.valueLoop)
23
+ const valueWork = ref(1)
24
+ const valueList = ref([])
25
+
26
+ const beforeRadioAttrs = computed(() => {
27
+ return {
28
+ class: ['choice'],
29
+ disabled: props.disabled
30
+ }
31
+ })
32
+ const inputNumberAttrs = computed(() => {
33
+ return {
34
+ class: ['cron-item-input'],
35
+ type: 'integer',
36
+ size: 'mini'
37
+ }
38
+ })
39
+ const typeRangeAttrs = computed(() => {
40
+ return {
41
+ ...inputNumberAttrs.value,
42
+ disabled: type.value !== TypeEnum.range || props.disabled
43
+ }
44
+ })
45
+ const typeLoopAttrs = computed(() => {
46
+ return {
47
+ ...inputNumberAttrs.value,
48
+ disabled: type.value !== TypeEnum.loop || props.disabled
49
+ }
50
+ })
51
+ const typeSpecifyAttrs = computed(() => {
52
+ return {
53
+ class: ['list-check-item'],
54
+ disabled: type.value !== TypeEnum.specify || props.disabled
55
+ }
56
+ })
57
+ const specifyRange = computed(() => {
58
+ let range = []
59
+ if (maxValue.value != null) {
60
+ for (let i = minValue.value; i <= maxValue.value; i++) {
61
+ range.push(i)
62
+ }
63
+ }
64
+ return range
65
+ })
66
+ // 根据不同的类型计算出的value
67
+ const computeValue = computed(() => {
68
+ let valueArray = []
69
+ switch (type.value) {
70
+ case TypeEnum.unset:
71
+ valueArray.push('?')
72
+ break
73
+ case TypeEnum.every:
74
+ valueArray.push('*')
75
+ break
76
+ case TypeEnum.range:
77
+ valueArray.push(`${valueRange.start}-${valueRange.end}`)
78
+ break
79
+ case TypeEnum.loop:
80
+ valueArray.push(`${valueLoop.start}/${valueLoop.interval}`)
81
+ break
82
+ case TypeEnum.work:
83
+ valueArray.push(`${valueWork.value}W`)
84
+ break
85
+ case TypeEnum.last:
86
+ valueArray.push('L')
87
+ break
88
+ case TypeEnum.specify:
89
+ if (valueList.value.length === 0) {
90
+ valueList.value.push(minValue)
91
+ }
92
+ valueArray.push(valueList.value.join(','))
93
+ break
94
+ default:
95
+ valueArray.push(defaultValue.value)
96
+ break
97
+ }
98
+ return valueArray.length > 0 ? valueArray.join('') : defaultValue.value
99
+ })
100
+ const parseValue = value => {
101
+ if (value === computeValue.value) {
102
+ return
103
+ }
104
+ try {
105
+ if (!value || value === defaultValue.value) {
106
+ type.value = TypeEnum.every
107
+ } else if (value.indexOf('?') >= 0) {
108
+ type.value = TypeEnum.unset
109
+ } else if (value.indexOf('-') >= 0) {
110
+ type.value = TypeEnum.range
111
+ const values = value.split('-')
112
+ if (values.length >= 2) {
113
+ valueRange.start = parseInt(values[0])
114
+ valueRange.end = parseInt(values[1])
115
+ }
116
+ } else if (value.indexOf('/') >= 0) {
117
+ type.value = TypeEnum.loop
118
+ const values = value.split('/')
119
+ if (values.length >= 2) {
120
+ valueLoop.start = value[0] === '*' ? 0 : parseInt(values[0])
121
+ valueLoop.interval = parseInt(values[1])
122
+ }
123
+ } else if (value.indexOf('W') >= 0) {
124
+ type.value = TypeEnum.work
125
+ const values = value.split('W')
126
+ if (!values[0] && !isNaN(values[0])) {
127
+ valueWork.value = parseInt(values[0])
128
+ }
129
+ } else if (value.indexOf('L') >= 0) {
130
+ type.value = TypeEnum.last
131
+ } else if (value.indexOf(',') >= 0 || !isNaN(value)) {
132
+ type.value = TypeEnum.specify
133
+ valueList.value = value.split(',').map(item => parseInt(item))
134
+ } else {
135
+ type.value = TypeEnum.every
136
+ }
137
+ } catch (e) {
138
+ type.value = TypeEnum.every
139
+ }
140
+ }
141
+ const updateValue = value => {
142
+ emit('change', value)
143
+ emit('update:modelValue', value)
144
+ }
145
+
146
+ watch(
147
+ () => props.modelValue,
148
+ val => {
149
+ if (val !== computeValue.value) {
150
+ parseValue(val)
151
+ }
152
+ },
153
+ { immediate: true }
154
+ )
155
+
156
+ watch(
157
+ () => computeValue.value,
158
+ val => {
159
+ updateValue(v)
160
+ }
161
+ )
162
+
163
+ return {
164
+ TypeEnum,
165
+ type,
166
+ valueRange,
167
+ valueLoop,
168
+ valueWork,
169
+ valueList,
170
+ specifyRange,
171
+ computeValue,
172
+ inputNumberAttrs,
173
+ beforeRadioAttrs,
174
+ typeRangeAttrs,
175
+ typeLoopAttrs,
176
+ typeSpecifyAttrs,
177
+ updateValue
178
+ }
179
+ }
@@ -0,0 +1,9 @@
1
+ export default {
2
+ modelValue: {
3
+ type: String,
4
+ default: '*'
5
+ },
6
+ disabled: {
7
+ type: Boolean
8
+ }
9
+ }
@@ -1,92 +1,101 @@
1
- <template>
2
- <div class="sh-cron-config-list">
3
- <vxe-radio-group v-model="type">
4
- <div class="item">
5
- <vxe-radio :value="TypeEnum.unset" v-bind="beforeRadioAttrs">不设置</vxe-radio>
6
- <span class="tip-info">日和周只能设置其中之一</span>
7
- </div>
8
- <div class="item">
9
- <vxe-radio :label="TypeEnum.every" v-bind="beforeRadioAttrs">每日</vxe-radio>
10
- </div>
11
- <div class="item">
12
- <vxe-radio :label="TypeEnum.range" v-bind="beforeRadioAttrs">区间</vxe-radio>
13
- <span> 从 </span>
14
- <vxe-input v-model="valueRange.start" v-bind="typeRangeAttrs" />
15
- <span> 日 至 </span>
16
- <vxe-input v-model="valueRange.end" v-bind="typeRangeAttrs" />
17
- <span> 日 </span>
18
- </div>
19
- <div class="item">
20
- <vxe-radio :label="TypeEnum.loop" v-bind="beforeRadioAttrs">循环</vxe-radio>
21
- <span> 从 </span>
22
- <vxe-input v-model="valueLoop.start" v-bind="typeLoopAttrs" />
23
- <span> 日开始,间隔 </span>
24
- <vxe-input v-model="valueLoop.interval" v-bind="typeLoopAttrs" />
25
- <span> 日 </span>
26
- </div>
27
- <div class="item">
28
- <vxe-radio :label="TypeEnum.work" v-bind="beforeRadioAttrs">工作日</vxe-radio>
29
- <span> 本月 </span>
30
- <vxe-input v-model="valueWork" v-bind="typeWorkAttrs" />
31
- <span> 日,最近的工作日 </span>
32
- </div>
33
- <div class="item">
34
- <vxe-radio :label="TypeEnum.last" v-bind="beforeRadioAttrs">最后一日</vxe-radio>
35
- </div>
36
- <div class="item">
37
- <vxe-radio :label="TypeEnum.specify" v-bind="beforeRadioAttrs">指定</vxe-radio>
38
- <div class="list">
39
- <vxe-checkbox-group v-model="valueList">
40
- <template v-for="i in specifyRange" :key="i">
41
- <vxe-checkbox :label="i" v-bind="typeSpecifyAttrs">{{ i }}</vxe-checkbox>
42
- </template>
43
- </vxe-checkbox-group>
44
- </div>
45
- </div>
46
- </vxe-radio-group>
47
- </div>
48
- </template>
49
-
50
- <script>
51
- import cronMixin from '../mixin/cron-box'
52
-
53
- export default {
54
- name: 'CronDayBox',
55
- mixins: [cronMixin],
56
- props: {
57
- week: {
58
- type: String,
59
- default: '?'
60
- }
61
- },
62
- data() {
63
- return {
64
- defaultValue: '*',
65
- valueWork: 1,
66
- minValue: 1,
67
- maxValue: 31,
68
- valueRange: { start: 1, end: 31 },
69
- valueLoop: { start: 1, interval: 1 }
70
- }
71
- },
72
- computed: {
73
- disabledChoice() {
74
- return (this.week && this.week !== '?') || this.disabled
75
- },
76
- typeWorkAttrs() {
77
- return {
78
- ...this.inputNumberAttrs,
79
- disabled: this.type !== this.TypeEnum.work || this.disabled || this.disabledChoice
80
- }
81
- }
82
- },
83
- watch: {
84
- week() {
85
- this.updateValue(this.disabledChoice ? '?' : this.computeValue)
86
- }
87
- },
88
- methods: {}
89
- }
90
- </script>
91
-
92
- <style scoped></style>
1
+ <template>
2
+ <div class="sh-cron-config-list">
3
+ <vxe-radio-group v-model="type">
4
+ <div class="item">
5
+ <vxe-radio :value="TypeEnum.unset" v-bind="beforeRadioAttrs">不设置</vxe-radio>
6
+ <span class="tip-info">日和周只能设置其中之一</span>
7
+ </div>
8
+ <div class="item">
9
+ <vxe-radio :label="TypeEnum.every" v-bind="beforeRadioAttrs">每日</vxe-radio>
10
+ </div>
11
+ <div class="item">
12
+ <vxe-radio :label="TypeEnum.range" v-bind="beforeRadioAttrs">区间</vxe-radio>
13
+ <span> 从 </span>
14
+ <vxe-input v-model="valueRange.start" v-bind="typeRangeAttrs" />
15
+ <span> 日 至 </span>
16
+ <vxe-input v-model="valueRange.end" v-bind="typeRangeAttrs" />
17
+ <span> 日 </span>
18
+ </div>
19
+ <div class="item">
20
+ <vxe-radio :label="TypeEnum.loop" v-bind="beforeRadioAttrs">循环</vxe-radio>
21
+ <span> 从 </span>
22
+ <vxe-input v-model="valueLoop.start" v-bind="typeLoopAttrs" />
23
+ <span> 日开始,间隔 </span>
24
+ <vxe-input v-model="valueLoop.interval" v-bind="typeLoopAttrs" />
25
+ <span> 日 </span>
26
+ </div>
27
+ <div class="item">
28
+ <vxe-radio :label="TypeEnum.work" v-bind="beforeRadioAttrs">工作日</vxe-radio>
29
+ <span> 本月 </span>
30
+ <vxe-input v-model="valueWork" v-bind="typeWorkAttrs" />
31
+ <span> 日,最近的工作日 </span>
32
+ </div>
33
+ <div class="item">
34
+ <vxe-radio :label="TypeEnum.last" v-bind="beforeRadioAttrs">最后一日</vxe-radio>
35
+ </div>
36
+ <div class="item">
37
+ <vxe-radio :label="TypeEnum.specify" v-bind="beforeRadioAttrs">指定</vxe-radio>
38
+ <div class="list">
39
+ <vxe-checkbox-group v-model="valueList">
40
+ <template v-for="i in specifyRange" :key="i">
41
+ <vxe-checkbox :label="i" v-bind="typeSpecifyAttrs">{{ i }}</vxe-checkbox>
42
+ </template>
43
+ </vxe-checkbox-group>
44
+ </div>
45
+ </div>
46
+ </vxe-radio-group>
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ import { defineComponent, computed, getCurrentInstance, watch, emits } from 'vue'
52
+ import cronProps from '../mixin/cron-props'
53
+ import cronEmits from '../mixin/cron-emits'
54
+ import cronHooks from '../mixin/cron-hooks'
55
+ export default defineComponent({
56
+ name: 'CronDayBox',
57
+ props: {
58
+ ...cronProps,
59
+ week: {
60
+ type: String,
61
+ default: '?'
62
+ }
63
+ },
64
+ emits: cronEmits,
65
+ setup(props, context) {
66
+ const { proxy } = getCurrentInstance()
67
+ const { $vUtils } = proxy
68
+ const { emit, slots } = context
69
+
70
+ const useCron = cronHooks(props, context, proxy, {
71
+ defaultValue: '*',
72
+ minValue: 1,
73
+ maxValue: 31,
74
+ valueRange: { start: 1, end: 31 },
75
+ valueLoop: { start: 1, interval: 1 }
76
+ })
77
+
78
+ const disabledChoice = computed(() => (props.week && props.week !== '?') || props.disabled)
79
+ const typeWorkAttrs = computed(() => {
80
+ return {
81
+ ...useCron.inputNumberAttrs,
82
+ disabled: useCron.type.value !== useCron.TypeEnum.work || props.disabled || disabledChoice.value
83
+ }
84
+ })
85
+
86
+ watch(
87
+ () => props.week,
88
+ () => {
89
+ useCron.updateValue(disabledChoice.value ? '?' : useCron.computeValue.value)
90
+ }
91
+ )
92
+
93
+ return {
94
+ ...useCron,
95
+ typeWorkAttrs
96
+ }
97
+ }
98
+ })
99
+ </script>
100
+
101
+ <style scoped></style>
@@ -1,56 +1,68 @@
1
- <template>
2
- <div class="sh-cron-config-list">
3
- <vxe-radio-group v-model="type">
4
- <div class="item">
5
- <vxe-radio :label="TypeEnum.every" v-bind="beforeRadioAttrs">每时</vxe-radio>
6
- </div>
7
- <div class="item">
8
- <vxe-radio :label="TypeEnum.range" v-bind="beforeRadioAttrs">区间</vxe-radio>
9
- <span> 从 </span>
10
- <vxe-input v-model="valueRange.start" v-bind="typeRangeAttrs" />
11
- <span> 时 至 </span>
12
- <vxe-input v-model="valueRange.end" v-bind="typeRangeAttrs" />
13
- <span> 时 </span>
14
- </div>
15
- <div class="item">
16
- <vxe-radio :label="TypeEnum.loop" v-bind="beforeRadioAttrs">循环</vxe-radio>
17
- <span> 从 </span>
18
- <vxe-input v-model="valueLoop.start" v-bind="typeLoopAttrs" />
19
- <span> 时开始,间隔 </span>
20
- <vxe-input v-model="valueLoop.interval" v-bind="typeLoopAttrs" />
21
- <span> 时 </span>
22
- </div>
23
- <div class="item">
24
- <vxe-radio :label="TypeEnum.specify" v-bind="beforeRadioAttrs">指定</vxe-radio>
25
- <div class="list">
26
- <vxe-checkbox-group v-model="valueList">
27
- <template v-for="i in specifyRange" :key="i">
28
- <vxe-checkbox :label="i" v-bind="typeSpecifyAttrs">{{ i }}</vxe-checkbox>
29
- </template>
30
- </vxe-checkbox-group>
31
- </div>
32
- </div>
33
- </vxe-radio-group>
34
- </div>
35
- </template>
36
-
37
- <script>
38
- import cronMixin from '../mixin/cron-box'
39
-
40
- export default {
41
- name: 'CronHourBox',
42
- mixins: [cronMixin],
43
- data() {
44
- return {
45
- defaultValue: '*',
46
- minValue: 0,
47
- maxValue: 23,
48
- valueRange: { start: 0, end: 23 },
49
- valueLoop: { start: 0, interval: 1 }
50
- }
51
- },
52
- methods: {}
53
- }
54
- </script>
55
-
56
- <style scoped></style>
1
+ <template>
2
+ <div class="sh-cron-config-list">
3
+ <vxe-radio-group v-model="type">
4
+ <div class="item">
5
+ <vxe-radio :label="TypeEnum.every" v-bind="beforeRadioAttrs">每时</vxe-radio>
6
+ </div>
7
+ <div class="item">
8
+ <vxe-radio :label="TypeEnum.range" v-bind="beforeRadioAttrs">区间</vxe-radio>
9
+ <span> 从 </span>
10
+ <vxe-input v-model="valueRange.start" v-bind="typeRangeAttrs" />
11
+ <span> 时 至 </span>
12
+ <vxe-input v-model="valueRange.end" v-bind="typeRangeAttrs" />
13
+ <span> 时 </span>
14
+ </div>
15
+ <div class="item">
16
+ <vxe-radio :label="TypeEnum.loop" v-bind="beforeRadioAttrs">循环</vxe-radio>
17
+ <span> 从 </span>
18
+ <vxe-input v-model="valueLoop.start" v-bind="typeLoopAttrs" />
19
+ <span> 时开始,间隔 </span>
20
+ <vxe-input v-model="valueLoop.interval" v-bind="typeLoopAttrs" />
21
+ <span> 时 </span>
22
+ </div>
23
+ <div class="item">
24
+ <vxe-radio :label="TypeEnum.specify" v-bind="beforeRadioAttrs">指定</vxe-radio>
25
+ <div class="list">
26
+ <vxe-checkbox-group v-model="valueList">
27
+ <template v-for="i in specifyRange" :key="i">
28
+ <vxe-checkbox :label="i" v-bind="typeSpecifyAttrs">{{ i }}</vxe-checkbox>
29
+ </template>
30
+ </vxe-checkbox-group>
31
+ </div>
32
+ </div>
33
+ </vxe-radio-group>
34
+ </div>
35
+ </template>
36
+
37
+ <script>
38
+ import { defineComponent, computed, getCurrentInstance, watch } from 'vue'
39
+ import cronProps from '../mixin/cron-props'
40
+ import cronEmits from '../mixin/cron-emits'
41
+ import cronHooks from '../mixin/cron-hooks'
42
+ export default defineComponent({
43
+ name: 'CronHourBox',
44
+ props: {
45
+ ...cronProps
46
+ },
47
+ emits: cronEmits,
48
+ setup(props, context) {
49
+ const { proxy } = getCurrentInstance()
50
+ const { $vUtils } = proxy
51
+ const { emit, slots } = context
52
+
53
+ const useCron = cronHooks(props, context, proxy, {
54
+ defaultValue: '*',
55
+ minValue: 0,
56
+ maxValue: 23,
57
+ valueRange: { start: 0, end: 23 },
58
+ valueLoop: { start: 0, interval: 1 }
59
+ })
60
+
61
+ return {
62
+ ...useCron
63
+ }
64
+ }
65
+ })
66
+ </script>
67
+
68
+ <style scoped></style>