sh-view 2.6.1 → 2.6.3

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 (28) hide show
  1. package/package.json +1 -1
  2. package/packages/components/global-components/sh-form/form.vue +110 -110
  3. package/packages/components/global-components/sh-form/js/useForm.js +3 -0
  4. package/packages/components/global-components/sh-form/query.vue +70 -70
  5. package/packages/components/global-components/sh-table/components/sh-column.vue +69 -69
  6. package/packages/components/global-components/sh-table/grid.vue +160 -160
  7. package/packages/components/global-components/sh-table/table.vue +218 -218
  8. package/packages/components/other-components/sh-cron-modal/mixin/cron-hooks.js +179 -179
  9. package/packages/components/other-components/sh-cron-modal/tabs/cron-day-box.vue +101 -101
  10. package/packages/components/other-components/sh-cron-modal/tabs/cron-hour-box.vue +68 -68
  11. package/packages/components/other-components/sh-cron-modal/tabs/cron-minute-box.vue +68 -68
  12. package/packages/components/other-components/sh-cron-modal/tabs/cron-month-box.vue +68 -68
  13. package/packages/components/other-components/sh-cron-modal/tabs/cron-second-box.vue +68 -68
  14. package/packages/components/other-components/sh-cron-modal/tabs/cron-week-box.vue +126 -126
  15. package/packages/components/other-components/sh-cron-modal/tabs/cron-year-box.vue +59 -59
  16. package/packages/components/other-components/sh-preview/components/sh-excel.vue +929 -929
  17. package/packages/components/other-components/sh-preview/components/sh-word.vue +78 -78
  18. package/packages/vxeTable/render/cell/vxe-render-code.vue +36 -36
  19. package/packages/vxeTable/render/cell/vxe-render-goption.vue +104 -104
  20. package/packages/vxeTable/render/cell/vxe-render-href.vue +21 -21
  21. package/packages/vxeTable/render/cell/vxe-render-input.vue +53 -53
  22. package/packages/vxeTable/render/cell/vxe-render-select.vue +52 -52
  23. package/packages/vxeTable/render/cell/vxe-render-table.vue +51 -51
  24. package/packages/vxeTable/render/cell/vxe-render-tree.vue +63 -63
  25. package/packages/vxeTable/render/filters/vxe-filter-input.vue +25 -25
  26. package/packages/vxeTable/render/footer/vxe-footer-input.vue +23 -23
  27. package/packages/vxeTable/render/footer/vxe-footer-money.vue +30 -30
  28. package/packages/vxeTable/render/header/vxe-header-money.vue +31 -31
@@ -1,179 +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
- }
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
+ }
@@ -1,101 +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 { 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
+ <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>