sh-view 2.1.0 → 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 (128) 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 +209 -182
  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 +140 -129
  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 +73 -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 +40 -30
  61. package/packages/components/other-components/sh-menu-card/index.vue +70 -64
  62. package/packages/components/other-components/sh-menu-card/menu-box.vue +50 -44
  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 +28 -24
  69. package/packages/css/index.js +4 -4
  70. package/packages/directive/module/prevent-click.js +1 -1
  71. package/packages/directive/module/resize.js +11 -154
  72. package/packages/index.js +39 -39
  73. package/packages/mixin/index.js +86 -87
  74. package/packages/vxeTable/render/cell/vxe-render-checkbox.vue +14 -5
  75. package/packages/vxeTable/render/cell/vxe-render-checkgroup.vue +43 -36
  76. package/packages/vxeTable/render/cell/vxe-render-code.vue +14 -5
  77. package/packages/vxeTable/render/cell/vxe-render-goption.vue +34 -24
  78. package/packages/vxeTable/render/cell/vxe-render-href.vue +21 -11
  79. package/packages/vxeTable/render/cell/vxe-render-img.vue +16 -10
  80. package/packages/vxeTable/render/cell/vxe-render-input.vue +83 -79
  81. package/packages/vxeTable/render/cell/vxe-render-money.vue +14 -6
  82. package/packages/vxeTable/render/cell/vxe-render-progress.vue +28 -19
  83. package/packages/vxeTable/render/cell/vxe-render-radio.vue +14 -5
  84. package/packages/vxeTable/render/cell/vxe-render-radiogroup.vue +43 -36
  85. package/packages/vxeTable/render/cell/vxe-render-select.vue +44 -36
  86. package/packages/vxeTable/render/cell/vxe-render-switch.vue +14 -5
  87. package/packages/vxeTable/render/cell/vxe-render-table.vue +51 -78
  88. package/packages/vxeTable/render/cell/vxe-render-textarea.vue +14 -5
  89. package/packages/vxeTable/render/cell/vxe-render-time.vue +23 -13
  90. package/packages/vxeTable/render/cell/vxe-render-tree.vue +23 -27
  91. package/packages/vxeTable/render/cell/vxe-render-upload.vue +11 -7
  92. package/packages/vxeTable/render/filters/vxe-filter-input.vue +25 -43
  93. package/packages/vxeTable/render/footer/vxe-footer-input.vue +23 -13
  94. package/packages/vxeTable/render/footer/vxe-footer-money.vue +30 -20
  95. package/packages/vxeTable/render/globalRenders.jsx +1 -1
  96. package/packages/vxeTable/render/header/vxe-header-money.vue +31 -21
  97. package/packages/vxeTable/render/mixin/cell-hooks.js +162 -0
  98. package/packages/vxeTable/render/mixin/cell-props.js +23 -0
  99. package/packages/vxeTable/render/mixin/filter-hooks.js +28 -0
  100. package/packages/components/global-components/sh-form/components/form-item.vue +0 -25
  101. package/packages/components/global-components/sh-form/css/index.scss +0 -55
  102. package/packages/components/global-components/sh-form/index.vue +0 -114
  103. package/packages/components/global-components/sh-form/js/methods.js +0 -146
  104. package/packages/components/global-components/sh-form/mixin/defaultData.js +0 -32
  105. package/packages/components/global-components/sh-icon/css/default/index.scss +0 -27
  106. package/packages/components/global-components/sh-icon/css/font/index.scss +0 -16
  107. package/packages/components/global-components/sh-icon/icon-default.vue +0 -32
  108. package/packages/components/global-components/sh-icon/icon-font.vue +0 -32
  109. package/packages/components/global-components/sh-poptip/popper.js +0 -115
  110. package/packages/components/global-components/sh-query/index.vue +0 -317
  111. package/packages/components/global-components/sh-table/js/methods.js +0 -549
  112. package/packages/components/global-components/sh-table/mixin/defaultData.js +0 -94
  113. package/packages/components/global-components/sh-upload/js/mixin.js +0 -257
  114. package/packages/components/other-components/sh-cron-modal/mixin/cron-box.js +0 -169
  115. package/packages/vxeTable/render/mixin/cell-mixin.js +0 -195
  116. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.svg → ionicons.svg} +0 -0
  117. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.ttf → ionicons.ttf} +0 -0
  118. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.woff → ionicons.woff} +0 -0
  119. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.woff2 → ionicons.woff2} +0 -0
  120. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.js → iconfont.js} +0 -0
  121. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.json → iconfont.json} +0 -0
  122. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.ttf → iconfont.ttf} +0 -0
  123. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.woff → iconfont.woff} +0 -0
  124. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.woff2 → iconfont.woff2} +0 -0
  125. /package/packages/{assets/css → css}/animated.scss +0 -0
  126. /package/packages/{assets/css → css}/loader.scss +0 -0
  127. /package/packages/{assets/css → css}/main.scss +0 -0
  128. /package/packages/{assets/css → css}/theme.scss +0 -0
@@ -1,257 +0,0 @@
1
- // 上传组件通用方法
2
-
3
- import ajax from './ajax'
4
-
5
- export default {
6
- props: {
7
- modelValue: {
8
- type: Array,
9
- default() {
10
- return []
11
- }
12
- },
13
- action: {
14
- type: String,
15
- default: 'fileservice/v2/upload'
16
- },
17
- headers: {
18
- type: Object,
19
- default() {
20
- return {}
21
- }
22
- },
23
- disabled: {
24
- type: Boolean,
25
- default: false
26
- },
27
- maxSize: {
28
- type: Number,
29
- default: 1024 * 2 // 文件大小限制,单位 kb
30
- },
31
- accept: {
32
- type: String,
33
- default: '.doc,.docx,.xls,.xlsx,.txt,.pdf,.jpg,.jpeg,.png,.txt,.7z,.zip,.rar'
34
- },
35
- name: {
36
- type: String,
37
- default: 'file'
38
- },
39
- beforeUpload: {
40
- type: Function
41
- },
42
- webkitdirectory: {
43
- type: Boolean,
44
- default: false // 是否开启选择文件夹,部分浏览器适用
45
- },
46
- withCredentials: {
47
- type: Boolean,
48
- default: false // 支持发送 cookie 凭证信息
49
- },
50
- paste: {
51
- type: Boolean,
52
- default: false // 是否支持粘贴上传文件
53
- },
54
- format: {
55
- type: Array,
56
- default() {
57
- return []
58
- }
59
- },
60
- onFormatError: {
61
- type: Function
62
- },
63
- onExceededSize: {
64
- type: Function
65
- },
66
- onProgress: {
67
- type: Function,
68
- default() {}
69
- },
70
- onSuccess: {
71
- type: Function,
72
- default() {}
73
- },
74
- onError: {
75
- type: Function,
76
- default() {}
77
- },
78
- onRemove: {
79
- type: Function,
80
- default() {}
81
- },
82
- onPreview: {
83
- type: Function,
84
- default() {}
85
- },
86
- onDownload: {
87
- type: Function,
88
- default() {}
89
- }
90
- },
91
- data() {
92
- return {
93
- tempIndex: 1,
94
- dragOver: false,
95
- fileList: []
96
- }
97
- },
98
- methods: {
99
- progressConfig(file) {
100
- return {
101
- textInside: true,
102
- strokeWidth: 20,
103
- percent: parseInt(file.percentage, 10),
104
- status: file.status
105
- }
106
- },
107
- handleClick() {
108
- if (this.disabled) return
109
- this.$refs.input.click()
110
- },
111
- handleChange(e) {
112
- const files = e.target.files
113
- if (!files) return
114
- this.uploadFiles(files)
115
- this.$refs.input.value = null
116
- },
117
- handleStart(file) {
118
- file.uid = Date.now() + this.tempIndex++
119
- const _file = {
120
- status: 'active',
121
- name: file.name,
122
- size: file.size,
123
- percentage: 0,
124
- uid: file.uid,
125
- showProgress: true
126
- }
127
- this.fileList.push(_file)
128
- },
129
- handlePaste(e) {
130
- if (this.disabled) return
131
- if (this.paste) {
132
- this.uploadFiles(e.clipboardData.files)
133
- }
134
- },
135
- handleProgress(e, file) {
136
- const _file = this.getFile(file)
137
- this.onProgress(e, _file, this.fileList)
138
- _file.percentage = e.percent || 0
139
- },
140
- handleSuccess(res, file) {
141
- const _file = this.getFile(file)
142
- if (_file) {
143
- _file.status = 'success'
144
- _file.response = res
145
- this.emitValue()
146
- this.onSuccess(res, _file, this.fileList)
147
- setTimeout(() => {
148
- _file.showProgress = false
149
- }, 1000)
150
- }
151
- },
152
- handleError(err, response, file) {
153
- const _file = this.getFile(file)
154
- const fileList = this.fileList
155
- _file.status = 'wrong'
156
- fileList.splice(fileList.indexOf(_file), 1)
157
- this.onError(err, response, file)
158
- },
159
- handleRemove(file) {
160
- const fileList = this.fileList
161
- fileList.splice(fileList.indexOf(file), 1)
162
- this.emitValue()
163
- this.onRemove(file, fileList)
164
- },
165
- handlePreview(file) {
166
- const fileList = this.fileList
167
- fileList.splice(fileList.indexOf(file), 1)
168
- this.onRemove(file, fileList)
169
- },
170
- handleDownload(file) {
171
- const fileList = this.fileList
172
- fileList.splice(fileList.indexOf(file), 1)
173
- this.onDownload(file, fileList)
174
- },
175
- onDrop(e) {
176
- this.dragOver = false
177
- if (this.disabled) return
178
- this.uploadFiles(e.dataTransfer.files)
179
- },
180
- uploadFiles(files) {
181
- let postFiles = Array.prototype.slice.call(files)
182
- if (!this.multiple) postFiles = postFiles.slice(0, 1)
183
- if (postFiles.length === 0) return
184
- postFiles.forEach(file => {
185
- this.upload(file)
186
- })
187
- },
188
- upload(file) {
189
- if (!this.beforeUpload) {
190
- return this.post(file)
191
- }
192
- const before = this.beforeUpload(file)
193
- if (before && before.then) {
194
- before.then(processedFile => {
195
- if (Object.prototype.toString.call(processedFile) === '[object File]') {
196
- this.post(processedFile)
197
- } else {
198
- this.post(file)
199
- }
200
- })
201
- } else if (before !== false) {
202
- this.post(file)
203
- }
204
- },
205
- async post(file) {
206
- let { headers, name, params, action, withCredentials } = this
207
- if (this.validateFile) {
208
- let valResult = this.validateFile(file)
209
- if (!valResult) return
210
- }
211
- this.handleStart(file)
212
- ajax({
213
- headers: headers,
214
- withCredentials: withCredentials,
215
- file: file,
216
- data: params,
217
- filename: name,
218
- action: action,
219
- onProgress: e => {
220
- this.handleProgress(e, file)
221
- },
222
- onSuccess: res => {
223
- this.handleSuccess(res, file)
224
- },
225
- onError: (err, response) => {
226
- this.handleError(err, response, file)
227
- }
228
- })
229
- },
230
- getFile(file) {
231
- const fileList = this.fileList
232
- let target
233
- fileList.every(item => {
234
- target = file.uid === item.uid ? item : null
235
- return !target
236
- })
237
- return target
238
- },
239
- clearFiles() {
240
- this.fileList = []
241
- this.emitValue()
242
- },
243
- emitValue() {
244
- let list = this.getModelValue ? this.getModelValue() : this.fileList
245
- this.$emit('update:modelValue', list)
246
- }
247
- },
248
- watch: {
249
- modelValue: {
250
- handler(fileList) {
251
- this.fileList = fileList
252
- },
253
- immediate: true,
254
- deep: true
255
- }
256
- }
257
- }
@@ -1,169 +0,0 @@
1
- const TypeEnum = {
2
- unset: 'UNSET',
3
- every: 'EVERY',
4
- range: 'RANGE',
5
- loop: 'LOOP',
6
- work: 'WORK',
7
- last: 'LAST',
8
- specify: 'SPECIFY'
9
- }
10
-
11
- export default {
12
- props: {
13
- modelValue: {
14
- type: String,
15
- default: '*'
16
- },
17
- disabled: {
18
- type: Boolean
19
- }
20
- },
21
- emits: ['update:modelValue', 'change'],
22
- data() {
23
- return {
24
- TypeEnum: TypeEnum,
25
- type: TypeEnum.every,
26
- valueList: [],
27
- valueWork: ''
28
- }
29
- },
30
- computed: {
31
- beforeRadioAttrs() {
32
- return {
33
- class: ['choice'],
34
- disabled: this.disabled
35
- }
36
- },
37
- inputNumberAttrs() {
38
- return {
39
- class: ['cron-item-input'],
40
- type: 'integer',
41
- size: 'mini'
42
- }
43
- },
44
- typeRangeAttrs() {
45
- return {
46
- ...this.inputNumberAttrs,
47
- disabled: this.type !== TypeEnum.range || this.disabled
48
- }
49
- },
50
- typeLoopAttrs() {
51
- return {
52
- ...this.inputNumberAttrs,
53
- disabled: this.type !== TypeEnum.loop || this.disabled
54
- }
55
- },
56
- typeSpecifyAttrs() {
57
- return {
58
- class: ['list-check-item'],
59
- disabled: this.type !== TypeEnum.specify || this.disabled
60
- }
61
- },
62
- specifyRange() {
63
- const { minValue, maxValue } = this
64
- let range = []
65
- if (maxValue != null) {
66
- for (let i = minValue; i <= maxValue; i++) {
67
- range.push(i)
68
- }
69
- }
70
- return range
71
- },
72
- // 根据不同的类型计算出的value
73
- computeValue() {
74
- let { defaultValue, type, valueRange, valueLoop, valueWork, valueList, minValue } = this
75
- let valueArray = []
76
- switch (type) {
77
- case TypeEnum.unset:
78
- valueArray.push('?')
79
- break
80
- case TypeEnum.every:
81
- valueArray.push('*')
82
- break
83
- case TypeEnum.range:
84
- valueArray.push(`${valueRange.start}-${valueRange.end}`)
85
- break
86
- case TypeEnum.loop:
87
- valueArray.push(`${valueLoop.start}/${valueLoop.interval}`)
88
- break
89
- case TypeEnum.work:
90
- valueArray.push(`${valueWork}W`)
91
- break
92
- case TypeEnum.last:
93
- valueArray.push('L')
94
- break
95
- case TypeEnum.specify:
96
- if (valueList.length === 0) {
97
- valueList.push(minValue)
98
- }
99
- valueArray.push(valueList.join(','))
100
- break
101
- default:
102
- valueArray.push(defaultValue)
103
- break
104
- }
105
- return valueArray.length > 0 ? valueArray.join('') : defaultValue
106
- }
107
- },
108
- methods: {
109
- parseValue(value) {
110
- let { computeValue, defaultValue } = this
111
- if (value === computeValue) {
112
- return
113
- }
114
- try {
115
- if (!value || value === defaultValue) {
116
- this.type = TypeEnum.every
117
- } else if (value.indexOf('?') >= 0) {
118
- this.type = TypeEnum.unset
119
- } else if (value.indexOf('-') >= 0) {
120
- this.type = TypeEnum.range
121
- const values = value.split('-')
122
- if (values.length >= 2) {
123
- this.valueRange.start = parseInt(values[0])
124
- this.valueRange.end = parseInt(values[1])
125
- }
126
- } else if (value.indexOf('/') >= 0) {
127
- this.type = TypeEnum.loop
128
- const values = value.split('/')
129
- if (values.length >= 2) {
130
- this.valueLoop.start = value[0] === '*' ? 0 : parseInt(values[0])
131
- this.valueLoop.interval = parseInt(values[1])
132
- }
133
- } else if (value.indexOf('W') >= 0) {
134
- this.type = TypeEnum.work
135
- const values = value.split('W')
136
- if (!values[0] && !isNaN(values[0])) {
137
- this.valueWork = parseInt(values[0])
138
- }
139
- } else if (value.indexOf('L') >= 0) {
140
- this.type = TypeEnum.last
141
- } else if (value.indexOf(',') >= 0 || !isNaN(value)) {
142
- this.type = TypeEnum.specify
143
- this.valueList = value.split(',').map(item => parseInt(item))
144
- } else {
145
- this.type = TypeEnum.every
146
- }
147
- } catch (e) {
148
- this.type = TypeEnum.every
149
- }
150
- },
151
- updateValue(value) {
152
- this.$emit('change', value)
153
- this.$emit('update:modelValue', value)
154
- }
155
- },
156
- watch: {
157
- modelValue: {
158
- handler(val) {
159
- if (val !== this.computeValue) {
160
- this.parseValue(val)
161
- }
162
- },
163
- immediate: true
164
- },
165
- computeValue(v) {
166
- this.updateValue(v)
167
- }
168
- }
169
- }
@@ -1,195 +0,0 @@
1
- export default {
2
- props: {
3
- redit: { type: Boolean },
4
- rkey: { type: String },
5
- rname: { type: String },
6
- rdata: {
7
- type: Object,
8
- default() {
9
- return {}
10
- }
11
- },
12
- rprops: {
13
- type: Object,
14
- default() {
15
- return {}
16
- }
17
- },
18
- rparams: {
19
- type: Object,
20
- default() {
21
- return {}
22
- }
23
- }
24
- },
25
- data() {
26
- return {
27
- renderValue: null
28
- }
29
- },
30
- computed: {
31
- rsize() {
32
- return this.rprops.size || this.rparams.$table?.props?.size || this.rparams.$form?.props?.size
33
- },
34
- rform() {
35
- return this.rparams.$form
36
- },
37
- reditmode() {
38
- return this.rparams.$table?.props?.editConfig?.mode
39
- },
40
- isEditAll() {
41
- return !this.rform && this.reditmode === 'all'
42
- },
43
- moneyUnitText() {
44
- let moneyUnitConstants = [
45
- { value: 1, label: '元' },
46
- { value: 1000, label: '千元' },
47
- { value: 10000, label: '万元' }
48
- ]
49
- let moneyConstant = moneyUnitConstants.find(item => item.value === this.rprops.moneyUnit)
50
- return moneyConstant && moneyConstant.label
51
- },
52
- billGroups() {
53
- let { billStart = '分', billEnd = '亿' } = this.rprops
54
- let cnGroups = [
55
- { shortText: '兆', fullText: '兆', value: '' },
56
- { shortText: '千', fullText: '千亿', value: '' },
57
- { shortText: '百', fullText: '百亿', value: '' },
58
- { shortText: '十', fullText: '十亿', value: '' },
59
- { shortText: '亿', fullText: '亿', value: '' },
60
- { shortText: '千', fullText: '千万', value: '' },
61
- { shortText: '百', fullText: '百万', value: '' },
62
- { shortText: '十', fullText: '十万', value: '' },
63
- { shortText: '万', fullText: '万', value: '' },
64
- { shortText: '千', fullText: '千', value: '' },
65
- { shortText: '百', fullText: '百', value: '' },
66
- { shortText: '十', fullText: '十', value: '' },
67
- { shortText: '元', fullText: '元', value: '' },
68
- { shortText: '角', fullText: '角', value: '' },
69
- { shortText: '分', fullText: '分', value: '' },
70
- { shortText: '毫', fullText: '毫', value: '' },
71
- { shortText: '厘', fullText: '厘', value: '' }
72
- ]
73
- let startIndex = cnGroups.findIndex(cn => cn.fullText === billEnd)
74
- let endIndex = cnGroups.findIndex(cn => cn.fullText === billStart)
75
- return cnGroups.slice(startIndex, endIndex)
76
- },
77
- getBillClass() {
78
- return bil => {
79
- return {
80
- basic: bil.fullText === '元',
81
- commafy: ['千', '百万', '十亿', '兆'].includes(bil.fullText)
82
- }
83
- }
84
- },
85
- renderText() {
86
- let keyValue = this.$vUtils.get(this.rdata, this.rkey)
87
- let { rtext } = this.formatValueFun(keyValue)
88
- return rtext
89
- }
90
- },
91
- methods: {
92
- // 输入框变化
93
- async vxeInputChange({ value, $event }) {
94
- if (!this.rform) {
95
- this.setTableValue(value)
96
- }
97
- },
98
- // 输入框变化回调
99
- async vxeChangeCallBack({ value, $event }) {
100
- if (this.rform) {
101
- this.setFormValue(value)
102
- } else {
103
- this.setTableValue(value)
104
- }
105
- },
106
- // radio 变化回调
107
- async vxeRadioCallBack({ label, $event }) {
108
- if (this.rform) {
109
- this.setFormValue(label)
110
- } else {
111
- this.setTableValue(label)
112
- }
113
- },
114
- // check变化回调
115
- async vxeCheckCallBack({ checklist, checked, label, $event }) {
116
- if (this.rform) {
117
- this.setFormValue(checklist)
118
- } else {
119
- this.setTableValue(checklist)
120
- }
121
- },
122
- // 输入框失去焦点回调
123
- async vxeBlurCallback({ value, $event }) {
124
- if (this.rform) {
125
- this.setFormValue(value)
126
- } else {
127
- this.setTableValue(value)
128
- }
129
- },
130
- // form回调赋值
131
- setFormValue(value) {
132
- if (['$vMoney'].includes(this.rname) && value !== '') value = this.$vUtils.multiply(value, this.rprops.moneyUnit || 1)
133
- let { rvalue } = this.formatValueFun(value, true)
134
- let { data, $form } = this.rparams
135
- this.$vUtils.set(data, this.rkey, rvalue)
136
- $form.context.emit('edit-closed', this.rparams, this)
137
- },
138
- // table回调赋值
139
- setTableValue(value) {
140
- if (['$vMoney'].includes(this.rname) && value !== '') value = this.$vUtils.multiply(value, this.rprops.moneyUnit || 1)
141
- const { row, column } = this.rparams
142
- const { model } = column
143
- model.change = true
144
- model.value = value
145
- },
146
- // 格式化值formatValue
147
- formatValueFun(value, editable) {
148
- let rObj = this.$vUtils.formatRender(value, this.rkey, this.rdata, this.rname, this.rprops, this, editable)
149
- this.renderValue = ['$vMoney'].includes(this.rname) ? rObj.rtext : rObj.rvalue
150
- return rObj
151
- },
152
- // 格式化底部值
153
- getFooterData(qianfen = true) {
154
- let { $table, items, itemIndex, column } = this.rparams
155
- let tableData = $table.reactData.tableData
156
- let { rname, rprops, rfooter, property } = column
157
- let { digits, moneyUnit, commafy, type, calculate } = rprops
158
- let footerValue = items[itemIndex]
159
- if (rfooter) {
160
- let caculateObj = rfooter[items[rfooter.index || 0]]
161
- if (caculateObj && (rname === '$vMoney' || (['number', 'float', 'integer'].includes(type) && calculate))) {
162
- let tableColumnData = this.$vUtils.mapTree(tableData, row => row[property])
163
- let { computeType, result, typeObj } = caculateObj
164
- switch (computeType) {
165
- case 'subTotal':
166
- footerValue = this.$vUtils.sum(tableColumnData)
167
- break
168
- case 'allTotal':
169
- footerValue = typeObj[property] || result
170
- break
171
- case 'mean':
172
- footerValue = this.$vUtils.mean(tableColumnData)
173
- break
174
- default:
175
- footerValue = result
176
- break
177
- }
178
- if (rname === '$vMoney') footerValue = this.$vUtils.truncate(this.$vUtils.divide(footerValue, moneyUnit), digits)
179
- if (qianfen && commafy) footerValue = this.$vUtils.commafy(footerValue, { digits })
180
- }
181
- }
182
- return footerValue
183
- },
184
- // 获取单据值
185
- getBillValue(index, total = false) {
186
- let value = total ? this.getFooterData(false) : this.renderValue
187
- if (!value) return ''
188
- let fullValue = this.$vUtils.formatMoneyPad(value)
189
- let fullList = fullValue.replace('.', '').split('')
190
- return fullList[index]
191
- }
192
- },
193
- created() {},
194
- activated() {}
195
- }
File without changes
File without changes
File without changes
File without changes