imatrix-ui 2.9.0-dw → 2.9.0-dw-tmp3

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 (172) hide show
  1. package/.babelrc +17 -0
  2. package/build/components.json +31 -0
  3. package/build/gen-style.js +32 -0
  4. package/build/webpack.base.js +140 -0
  5. package/build/webpack.component.js +40 -0
  6. package/build/webpack.prod.js +35 -0
  7. package/lib/breadcrumb.js +2 -0
  8. package/lib/department-tree.js +8 -0
  9. package/lib/department-user-tree.js +8 -0
  10. package/lib/dynamic-source-select.js +8 -0
  11. package/lib/fs-preview.js +15 -0
  12. package/lib/fs-upload-list.js +15 -0
  13. package/lib/fs-upload.js +9 -0
  14. package/lib/hamburger.js +2 -0
  15. package/lib/inline-department-tree.js +8 -0
  16. package/lib/inline-department-user-tree.js +8 -0
  17. package/lib/inline-workgroup-tree.js +8 -0
  18. package/lib/inline-workgroup-user-treee.js +8 -0
  19. package/lib/multipart-upload.js +15 -0
  20. package/lib/organization-input.js +8 -0
  21. package/lib/remove-department.js +2 -0
  22. package/lib/remove-user.js +2 -0
  23. package/lib/remove-workgroup.js +2 -0
  24. package/lib/rich-editor.js +8 -0
  25. package/lib/scan-code-input.js +2 -0
  26. package/lib/secret-info.js +2 -0
  27. package/lib/super-grid.js +28 -0
  28. package/lib/super-nine-grid.js +9 -0
  29. package/lib/super-ui.min.js +72 -0
  30. package/lib/svg-icon.js +2 -0
  31. package/lib/valid-code.js +2 -0
  32. package/lib/workflow-button.js +8 -0
  33. package/lib/workflow-history-list.js +8 -0
  34. package/lib/workgroup-tree.js +8 -0
  35. package/lib/workgroup-user-tree.js +8 -0
  36. package/lib/year-range-picker.js +2 -0
  37. package/package.json +49 -24
  38. package/lib/super-ui.css +0 -1
  39. package/lib/super-ui.umd.min.js +0 -67
  40. package/packages/breadcrumb/index.js +0 -6
  41. package/packages/breadcrumb/src/breadcrumb.vue +0 -71
  42. package/packages/department-tree/index.js +0 -6
  43. package/packages/department-tree/src/department-tree.vue +0 -108
  44. package/packages/department-tree-inline/index.js +0 -6
  45. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +0 -402
  46. package/packages/department-tree-inline/src/department-single-tree-inline.vue +0 -284
  47. package/packages/department-tree-inline/src/department-tree-inline.vue +0 -86
  48. package/packages/department-tree-inline/src/department-tree-service.js +0 -245
  49. package/packages/department-tree-inline/src/search-result.vue +0 -176
  50. package/packages/department-user-tree/index.js +0 -6
  51. package/packages/department-user-tree/src/department-user-multiple-tree.vue +0 -116
  52. package/packages/department-user-tree/src/department-user-single-tree.vue +0 -76
  53. package/packages/department-user-tree/src/department-user-tree.vue +0 -101
  54. package/packages/department-user-tree-inline/index.js +0 -6
  55. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +0 -626
  56. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +0 -269
  57. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +0 -79
  58. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +0 -230
  59. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -122
  60. package/packages/department-user-tree-inline/src/search-result.vue +0 -197
  61. package/packages/directives/prevent-reclick.js +0 -19
  62. package/packages/dynamic-source-select/index.js +0 -6
  63. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +0 -70
  64. package/packages/dynamic-source-select/src/dynamic-source-select.vue +0 -440
  65. package/packages/dynamic-source-select/src/events.js +0 -55
  66. package/packages/fs-preview/index.js +0 -6
  67. package/packages/fs-preview/src/fs-preview.vue +0 -226
  68. package/packages/fs-upload/index.js +0 -6
  69. package/packages/fs-upload/src/fs-upload-multi.vue +0 -420
  70. package/packages/fs-upload/src/fs-upload-single.vue +0 -312
  71. package/packages/fs-upload/src/fs-upload.vue +0 -189
  72. package/packages/fs-upload/src/see-big-picture.vue +0 -55
  73. package/packages/fs-upload-list/index.js +0 -6
  74. package/packages/fs-upload-list/src/fs-upload-list.vue +0 -287
  75. package/packages/hamburger/index.js +0 -6
  76. package/packages/hamburger/src/hamburger.vue +0 -38
  77. package/packages/index.js +0 -121
  78. package/packages/multipart-upload/index.js +0 -6
  79. package/packages/multipart-upload/src/index.vue +0 -73
  80. package/packages/multipart-upload/src/multipart-upload-form.vue +0 -297
  81. package/packages/multipart-upload/src/multipart-upload-list.vue +0 -378
  82. package/packages/organization-input/index.js +0 -6
  83. package/packages/organization-input/src/organization-input.vue +0 -542
  84. package/packages/plugins/export-data-new.js +0 -453
  85. package/packages/plugins/export-data.js +0 -361
  86. package/packages/plugins/index.js +0 -15
  87. package/packages/plugins/public-method.js +0 -43
  88. package/packages/remove-department/index.js +0 -6
  89. package/packages/remove-department/src/remove-department.vue +0 -172
  90. package/packages/remove-department/src/remove-dept-service.js +0 -20
  91. package/packages/remove-user/index.js +0 -6
  92. package/packages/remove-user/src/remove-user-service.js +0 -20
  93. package/packages/remove-user/src/remove-user.vue +0 -195
  94. package/packages/remove-workgroup/index.js +0 -6
  95. package/packages/remove-workgroup/src/remove-workgroup-service.js +0 -20
  96. package/packages/remove-workgroup/src/remove-workgroup.vue +0 -159
  97. package/packages/rich-editor/index.js +0 -7
  98. package/packages/rich-editor/index.vue +0 -278
  99. package/packages/rich-editor/langs/zh-Hans.js +0 -1
  100. package/packages/rich-editor/viewer.vue +0 -103
  101. package/packages/scan-code-input/index.js +0 -6
  102. package/packages/scan-code-input/src/events.js +0 -33
  103. package/packages/scan-code-input/src/scan-code-input-colse.vue +0 -131
  104. package/packages/scan-code-input/src/scan-code-input.vue +0 -116
  105. package/packages/secret-info/index.js +0 -7
  106. package/packages/secret-info/index.vue +0 -90
  107. package/packages/super-grid/index.js +0 -7
  108. package/packages/super-grid/src/apis.js +0 -763
  109. package/packages/super-grid/src/columns-config.vue +0 -335
  110. package/packages/super-grid/src/custom-formatter.js +0 -250
  111. package/packages/super-grid/src/dynamic-input.vue +0 -1279
  112. package/packages/super-grid/src/eventBus.js +0 -2
  113. package/packages/super-grid/src/events.js +0 -55
  114. package/packages/super-grid/src/formValidatorUtil.js +0 -226
  115. package/packages/super-grid/src/formatter.js +0 -181
  116. package/packages/super-grid/src/group-column.vue +0 -100
  117. package/packages/super-grid/src/header-context-menu.vue +0 -87
  118. package/packages/super-grid/src/index-column.vue +0 -51
  119. package/packages/super-grid/src/normal-column.vue +0 -769
  120. package/packages/super-grid/src/public-methods.js +0 -31
  121. package/packages/super-grid/src/row-operation.vue +0 -161
  122. package/packages/super-grid/src/search-button.vue +0 -66
  123. package/packages/super-grid/src/search-condition-input.vue +0 -61
  124. package/packages/super-grid/src/search-condition-list.vue +0 -59
  125. package/packages/super-grid/src/search-form-advancedQuery.vue +0 -653
  126. package/packages/super-grid/src/search-form-dialog.vue +0 -79
  127. package/packages/super-grid/src/search-form-item.vue +0 -386
  128. package/packages/super-grid/src/search-form-number.vue +0 -38
  129. package/packages/super-grid/src/search-form-open.vue +0 -162
  130. package/packages/super-grid/src/search-form-ordinarySearch.vue +0 -188
  131. package/packages/super-grid/src/search-form.vue +0 -634
  132. package/packages/super-grid/src/search-methods.js +0 -387
  133. package/packages/super-grid/src/selection-column.vue +0 -43
  134. package/packages/super-grid/src/store.js +0 -3
  135. package/packages/super-grid/src/super-grid-service.js +0 -561
  136. package/packages/super-grid/src/super-grid.vue +0 -2793
  137. package/packages/super-grid/src/utils.js +0 -763
  138. package/packages/super-grid/src/view-image-dialog.vue +0 -130
  139. package/packages/super-nine-grid/index.js +0 -7
  140. package/packages/super-nine-grid/src/apis.js +0 -103
  141. package/packages/super-nine-grid/src/custom-formatter.js +0 -66
  142. package/packages/super-nine-grid/src/formatter.js +0 -132
  143. package/packages/super-nine-grid/src/search-form-number.vue +0 -38
  144. package/packages/super-nine-grid/src/search-form.vue +0 -430
  145. package/packages/super-nine-grid/src/search-methods.js +0 -134
  146. package/packages/super-nine-grid/src/store.js +0 -3
  147. package/packages/super-nine-grid/src/super-grid-service.js +0 -91
  148. package/packages/super-nine-grid/src/super-nine-grid.vue +0 -872
  149. package/packages/super-nine-grid/src/utils.js +0 -261
  150. package/packages/svg-icon/index.js +0 -6
  151. package/packages/svg-icon/src/svg-icon.vue +0 -43
  152. package/packages/utils/utils.js +0 -152
  153. package/packages/utils/value-set.js +0 -86
  154. package/packages/valid-code/index.js +0 -7
  155. package/packages/valid-code/src/valid-code.vue +0 -95
  156. package/packages/workflow-button/index.js +0 -6
  157. package/packages/workflow-button/src/workflow-button.vue +0 -325
  158. package/packages/workflow-history-list/index.js +0 -6
  159. package/packages/workflow-history-list/src/api.js +0 -7
  160. package/packages/workflow-history-list/src/workflow-history-list.vue +0 -185
  161. package/packages/workgroup-tree/index.js +0 -6
  162. package/packages/workgroup-tree/src/workgroup-tree.vue +0 -76
  163. package/packages/workgroup-tree-inline/index.js +0 -6
  164. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +0 -317
  165. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +0 -43
  166. package/packages/workgroup-user-tree/index.js +0 -6
  167. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +0 -100
  168. package/packages/workgroup-user-tree-inline/index.js +0 -6
  169. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +0 -163
  170. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +0 -436
  171. package/packages/year-range-picker/index.js +0 -6
  172. package/packages/year-range-picker/src/year-range-picker.vue +0 -51
@@ -1,2 +0,0 @@
1
- import Vue from 'vue'
2
- export default new Vue()
@@ -1,55 +0,0 @@
1
- const events = {
2
- select: function(selection, row) {
3
- this.$emit('select', selection, row)
4
- },
5
- selectAll: function(selection) {
6
- this.$emit('select-all', selection)
7
- },
8
- selectionChange: function(selection) {
9
- this.$emit('selection-change', selection)
10
- },
11
- cellMouseEnter: function(row, column, cell, event) {
12
- this.$emit('cell-mouse-enter', row, column, cell, event)
13
- },
14
- cellMouseLeave: function(row, column, cell, event) {
15
- this.$emit('cell-mouse-leave', row, column, cell, event)
16
- },
17
- cellClick: function(row, column, cell, event) {
18
- this.$emit('cell-click', row, column, cell, event)
19
- },
20
- cellDblClick: function(row, column, cell, event) {
21
- this.$emit('cell-dblclick', row, column, cell, event)
22
- },
23
- rowClick: function(row, column, event) {
24
- this.$emit('row-click', row, column, event)
25
- },
26
- rowContextMenu: function(row, column, event) {
27
- this.$emit('row-contextmenu', row, column, event)
28
- },
29
- rowDblClick: function(row, column, event) {
30
- this.$emit('row-dblclick', row, column, event)
31
- },
32
- headerClick: function(column, event) {
33
- this.$emit('header-click', column, event)
34
- },
35
- headerContextMenu: function(column, event) {
36
- this.$emit('header-contextmenu', column, event)
37
- },
38
- // super-grid.vue中已经做了处理
39
- // sortChange: function({ column, prop, order }) {
40
- // this.$emit('sort-change', { column, prop, order })
41
- // },
42
- filterChange: function(filters) {
43
- this.$emit('filter-change', filters)
44
- },
45
- currentChange: function(currentRow, oldCurrentRow) {
46
- this.$emit('current-change', currentRow, oldCurrentRow)
47
- },
48
- headerDragEnd: function(newWidth, oldWidth, column, event) {
49
- this.$emit('header-dragend', newWidth, oldWidth, column, event)
50
- },
51
- expandChange: function(row, expandedRows) {
52
- this.$emit('expand-change', row, expandedRows)
53
- }
54
- }
55
- export default events
@@ -1,226 +0,0 @@
1
- import Validator from 'async-validator'
2
- import store from './store'
3
- import Vue from 'vue'
4
- import {
5
- isDisableEdit
6
- } from './utils'
7
- import {
8
- getI18n
9
- } from '../../../src/utils/util'
10
-
11
- function setObjectPropRule(editField, rules, leafRule) {
12
- const rule = {}
13
- const prop = editField.prop
14
- if (!rules) {
15
- rules = {}
16
- }
17
- let num = 0
18
- const props = prop.split('.')
19
- props.forEach(subProp => {
20
- let objectRule
21
- if (num === props.length - 1) {
22
- // 说明是最后一个
23
- objectRule = getEndObjectRule(rule, props, subProp)
24
- objectRule.fields[subProp] = leafRule
25
- } else {
26
- let lastObjectRule
27
- if (num === 0) {
28
- objectRule = rules
29
- } else {
30
- lastObjectRule = getLastObjectRule(rule, props, props[num - 1])
31
- objectRule = lastObjectRule.fields
32
- }
33
- if (!objectRule[subProp]) {
34
- objectRule[subProp] = {
35
- type: 'object',
36
- required: true,
37
- fields: {}
38
- }
39
- }
40
- if (num === 0) {
41
- rule[subProp] = objectRule[subProp]
42
- } else {
43
- lastObjectRule.fields[subProp] = objectRule[subProp]
44
- }
45
- }
46
- num++
47
- })
48
- return rule
49
- }
50
-
51
- function getLastObjectRule(rule, props, currentProp) {
52
- let lastObjectdRule
53
- for (let i = 0; i < props.length; i++) {
54
- const subProp = props[i]
55
- if (i === 0) {
56
- lastObjectdRule = rule[subProp]
57
- } else {
58
- lastObjectdRule = lastObjectdRule.fields[props[i]]
59
- }
60
- if (subProp === currentProp) {
61
- break
62
- }
63
- }
64
- return lastObjectdRule
65
- }
66
-
67
- function getEndObjectRule(rule, props, currentProp) {
68
- let lastObjectdRule
69
- for (let i = 0; i < props.length; i++) {
70
- if (i === 0) {
71
- lastObjectdRule = rule[props[i]]
72
- } else {
73
- lastObjectdRule = lastObjectdRule.fields[props[i]]
74
- }
75
- if (i !== props.length - 1) {
76
- const leafSubProp = props[i + 1]
77
- if (leafSubProp === currentProp) {
78
- break
79
- }
80
- }
81
- }
82
- return lastObjectdRule
83
- }
84
-
85
- /**
86
- * @param {editFieldInfos} Array 编辑字段信息集合
87
- */
88
- function getValidator(listCode) {
89
- if (!listCode) {
90
- listCode = store.get('_list_code')
91
- }
92
- const gridParams = store.get(listCode)
93
- const editFieldInfos = gridParams.columns
94
- const rules = {}
95
- if (editFieldInfos) {
96
- editFieldInfos.forEach(editField => {
97
- const prop = editField.prop
98
- if (prop && editField.validations && !isDisableEdit(prop, listCode)) {
99
- const validations = JSON.parse(editField.validations)
100
- validations.forEach(item => {
101
- if (item.pattern) {
102
- // 后台传递的是正则字符串,不能直接使用
103
- item.pattern = new RegExp(item.pattern)
104
- }
105
- })
106
- if (prop.indexOf('.') > 0) {
107
- setObjectPropRule(editField, rules, validations)
108
- } else {
109
- if (validations && validations.length > 0) {
110
- rules[prop] = [...validations]
111
- }
112
- }
113
- }
114
- })
115
- }
116
- // console.log('rules', rules)
117
- return rules
118
- }
119
- /**
120
- * 验证实体
121
- * @param {*} entity 实体记录
122
- * @param {*} listCode 列表编码
123
- * @param {*} $index 当前行下标
124
- * @param {*} rules 验证规则
125
- * @param {*} isSubTableShowPage 表单子表是否显示分页区域
126
- * @param {*} pageNum 当前记录在子表中的第几页
127
- * @returns void
128
- */
129
-
130
- function validator(entity, listCode, $index, rules, isSubTableShowPage, pageNum, pageRowIndex) {
131
- return validatorEntity(entity, listCode, $index, rules, true, isSubTableShowPage, pageNum, pageRowIndex)
132
- }
133
-
134
- function validatorEntity(entity, listCode, $index, rules, isShouldRepeateValdate, isSubTableShowPage, pageNum, pageRowIndex) {
135
- let result = false
136
- let validateRules
137
- if (rules) {
138
- validateRules = rules
139
- } else {
140
- validateRules = getValidator(listCode)
141
- }
142
- const validator = new Validator(validateRules)
143
- if (!listCode) {
144
- listCode = store.get('_list_code')
145
- }
146
-
147
- const gridParams = store.get(listCode)
148
- validator.validate(entity, {
149
- first: true
150
- },
151
- (errors, fields) => {
152
- let fieldName
153
- if (errors) {
154
- const message = errors[0]['message']
155
- fieldName = errors[0]['field']
156
- if ($index !== null && $index !== undefined && gridParams.gridData.length > $index) {
157
- Vue.set(gridParams.gridData[$index], 'validateErrorField', errors[0]['field'])
158
- if (isSubTableShowPage !== undefined && isSubTableShowPage && pageNum !== undefined && pageRowIndex !== undefined) {
159
- // 表示表单子表验证时
160
- result = getI18n().t('superGrid.pageRecordLine', {
161
- pageNum: pageNum,
162
- row: pageRowIndex
163
- }) + ',' + message
164
- } else {
165
- // 表示列表记录验证时
166
- result = getI18n().t('superGrid.recordLine', {
167
- row: ($index + 1)
168
- }) + ',' + message
169
- }
170
- } else if (gridParams.$rowIndex !== null && gridParams.$rowIndex !== undefined && gridParams.gridData.length > gridParams.$rowIndex) {
171
- Vue.set(gridParams.gridData[gridParams.$rowIndex], 'validateErrorField', errors[0]['field'])
172
- result = getI18n().t('superGrid.recordLine', {
173
- row: (gridParams.$rowIndex + 1)
174
- }) + ',' + message
175
- }
176
- } else {
177
- // 验证成功后,将最后验证失败的字段置空
178
- if ($index !== null && $index !== undefined && gridParams.gridData.length > $index) {
179
- if (isSubTableShowPage !== undefined && isSubTableShowPage) {
180
- Vue.set(gridParams.subTableData[$index], 'validateErrorField', '')
181
- } else {
182
- Vue.set(gridParams.gridData[$index], 'validateErrorField', '')
183
- }
184
- } else if (gridParams.$rowIndex !== null && gridParams.$rowIndex !== undefined && gridParams.gridData.length > gridParams.$rowIndex) {
185
- Vue.set(gridParams.gridData[gridParams.$rowIndex], 'validateErrorField', '')
186
- } else if ($index !== null && $index !== undefined && isSubTableShowPage !== undefined && isSubTableShowPage && gridParams.gridData.length <= $index) {
187
- // 表示可能是子表分页时,清空子表的
188
- Vue.set(gridParams.subTableData[$index], 'validateErrorField', '')
189
- }
190
-
191
- result = true
192
- }
193
- if (fieldName && isShouldRepeateValdate === true) {
194
- // 将实体中字段名改为大写,然后再验证一次该字段是否已填值。因为mysql中jdbc获得实体记录字段名是小写的,但是验证规则中字段名是大写的,所以会导致字段验证失败
195
- const reg1 = /[A-Z]+/ // 大写字母
196
- if ((result !== undefined && result + '' !== 'true' && result + '' !== 'false') && (gridParams.isSql !== undefined && gridParams.isSql === true && reg1.test(fieldName) && entity[fieldName.toLowerCase()] !== undefined)) {
197
- // 表示验证失败,需要重新验证一次
198
- const copyEntity = JSON.parse(JSON.stringify(entity))
199
- copyEntity[fieldName.toUpperCase()] = entity[fieldName.toLowerCase()]
200
- delete copyEntity[fieldName.toLowerCase()]
201
- result = validatorEntity(copyEntity, listCode, $index, rules, false)
202
- }
203
- if (result !== undefined && result + '' !== 'true' && result + '' !== 'false') {
204
- // 表示验证失败
205
- if (gridParams.showValidateError) {
206
- gridParams.showValidateError = false
207
- Vue.prototype.$message({
208
- showClose: true,
209
- message: result,
210
- type: 'warning',
211
- onClose: (messageEle) => {
212
- gridParams.showValidateError = true
213
- }
214
- })
215
- }
216
- }
217
- }
218
- })
219
-
220
- return result
221
- }
222
-
223
- export default {
224
- validator,
225
- getValidator
226
- }
@@ -1,181 +0,0 @@
1
- import { isDynamicDataSourceSource } from './utils'
2
- const formatter = {
3
- number: function(inputValue, options) {
4
- // 小数位数
5
- const precision = options.precision
6
- // 数字符号
7
- const sign = options.sign
8
- // 是否显示千分位
9
- const isDelimiter = options.delimiter
10
- // 是否显示科学计数法
11
- const scientific = options.scientific
12
- // 几位开始计算
13
- let scientificNum = options.scientificNum
14
- if (inputValue !== undefined && inputValue != null) {
15
- if (precision > 0) {
16
- // 表示有小数
17
- inputValue = parseFloat(inputValue)
18
- inputValue = inputValue.toFixed(precision)
19
- }
20
- if (isDelimiter) {
21
- const inputValueStr = inputValue + ''
22
- const value = inputValueStr.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
23
- if (sign) {
24
- return value + sign
25
- } else {
26
- return value
27
- }
28
- } else if (scientific != null) {
29
- let isScientific = false
30
- if (scientificNum) {
31
- scientificNum = parseInt(scientificNum)
32
- } else {
33
- scientificNum = 11
34
- }
35
- if (inputValue.length >= scientificNum) {
36
- isScientific = true
37
- }
38
- if (isScientific) {
39
- inputValue = '' + inputValue
40
- inputValue = parseFloat(inputValue)
41
- inputValue = inputValue.toExponential() // 转换为标准的科学计数法形式(字符串)
42
- // const tmpArray = eformat.match(/\d(?:\.(\d*))?e([+-]\d+)/) // 分离出小数值和指数值
43
- // inputValue = inputValue.toFixed(Math.max(0, (tmpArray[1] || '').length - tmpArray[2]))
44
- }
45
- } else {
46
- if (sign) {
47
- return inputValue + sign
48
- } else {
49
- return inputValue
50
- }
51
- }
52
- }
53
-
54
- return inputValue
55
- },
56
- currency: function(value, options) {
57
- // 单位:$ 或 ¥
58
- const sign = options.sign
59
- return sign + this.number(value, options)
60
- },
61
- date: function(value, options) {
62
- // format格式,例如:yyyy-m-d,yyyy-m-d hh:mm:ss等等
63
- const format = options.format
64
- if (value != null) {
65
- const date = new Date(value)
66
- var y = date.getFullYear()
67
- var m = date.getMonth() + 1
68
- var d = date.getDate()
69
- var h = date.getHours()
70
- var min = date.getMinutes()
71
- var s = date.getSeconds()
72
- if (m < 10) {
73
- m = '0' + m
74
- }
75
- if (d < 10) {
76
- d = '0' + d
77
- }
78
- if (h < 10) {
79
- h = '0' + h
80
- }
81
- if (min < 10) {
82
- min = '0' + min
83
- }
84
- if (s < 10) {
85
- s = '0' + s
86
- }
87
- const newValue = format.replace('yyyy', y)
88
- .replace('mm', min)
89
- .replace('M', m)
90
- .replace('m', m)
91
- .replace('d', d)
92
- .replace('hh', h)
93
- .replace('ss', s)
94
- // 判断格式化的值是否包含NaN,如果包含NaN取数据库的值
95
- if (newValue.indexOf('NaN') === -1) {
96
- return newValue
97
- }
98
- return value
99
- }
100
- return value
101
- },
102
- time: function(value, options) {
103
- return this.date(value, options)
104
- },
105
- percent: function(value, options) {
106
- if (value || value >= 0) {
107
- return this.number(value, options) + '%'
108
- }
109
- return value
110
- }
111
- }
112
-
113
- export function doFormat(column, value) {
114
- value = doFormatWithValueSet(column, value)
115
- if (value === undefined || value === null) {
116
- return
117
- }
118
- // 获得默认的格式设置
119
- if (column.formatter === undefined) {
120
- if (column.dataType === 'DATE') {
121
- // 默认的“DATE”类型的格式设置
122
- column.formatter = {
123
- type: 'date',
124
- options: {
125
- format: 'yyyy-m-d'
126
- }
127
- }
128
- } else if (column.dataType === 'TIME') {
129
- // 默认的“TIME”类型的格式设置
130
- column.formatter = {
131
- type: 'time',
132
- options: {
133
- format: 'yyyy-m-d hh:mm:ss'
134
- }
135
- }
136
- }
137
- }
138
- const columnFormatter = column.formatter
139
- if (columnFormatter !== undefined && formatter[columnFormatter.type] !== undefined) {
140
- return formatter[columnFormatter.type](value, columnFormatter.options)
141
- } else {
142
- return value
143
- }
144
- }
145
-
146
- export function doFormatWithValueSet(column, value) {
147
- if (value === undefined || value === null) {
148
- return value
149
- }
150
- const valueSet = column.valueSet
151
- // 先处理值设置再处理格式化设置:即会对值设置的结果进行格式化设置
152
- if (valueSet !== undefined) {
153
- if (column.componentType === 'multiselect' && !isDynamicDataSourceSource(column)) {
154
- if (typeof (value) === 'number') {
155
- // 当value是0时, value instanceof Number 为false
156
- value += ''
157
- }
158
- const beforeLabel = (value + '').split(',')
159
- const label = []
160
- beforeLabel.forEach(element => {
161
- const item = valueSet.filter(item => {
162
- return item.value === element + ''
163
- })
164
- if (item.length > 0) {
165
- label.push(item[0].label)
166
- }
167
- })
168
- value = label.join(',')
169
- } else {
170
- const item = valueSet.filter(item => {
171
- return item.value === value + ''
172
- })
173
- if (item.length > 0) {
174
- // 数据库的原始值要显示成label值,后续对这个label进行格式化(不是处理原始值)
175
- value = item[0].label
176
- }
177
- }
178
- }
179
- return value
180
- }
181
-
@@ -1,100 +0,0 @@
1
-
2
- <template>
3
- <el-table-column
4
- width="150"
5
- :align="column.groupHeader?'center':''"
6
- >
7
- <template v-slot:header>
8
- <span class="cell--span" :title="label" v-html="label" />
9
- </template>
10
- <template v-if="customFormat">
11
- <component
12
- :is="child.prop?'NormalColumn':'GroupColumn'"
13
- v-for="(child, index) in visibleChildren"
14
- :key="child.label + index"
15
- :column="child"
16
- :is-sql="isSql"
17
- :custom-format="child.prop ?customFormat[child.prop] : customFormat"
18
- :list-code="listCode"
19
- @findIndex="findIndex(scope.$index)"
20
- @refresData="refresData"
21
- @refresPortData="refresPortData"
22
- @refresPortsData="refresPortsData"
23
- @refresMainTableFields="refresMainTableFields"
24
- />
25
- </template>
26
- <template v-else>
27
- <component
28
- :is="child.prop?'NormalColumn':'GroupColumn'"
29
- v-for="(child, index) in visibleChildren"
30
- :key="child.label + index"
31
- :is-sql="isSql"
32
- :column="child"
33
- :list-code="listCode"
34
- />
35
- </template>
36
- </el-table-column>
37
- </template>
38
- <script>
39
- import NormalColumn from './normal-column'
40
- import GroupColumn from './group-column'
41
- import { doFormatWithValueSet } from './formatter'
42
- export default {
43
- name: 'GroupColumn',
44
- components: {
45
- NormalColumn,
46
- GroupColumn
47
- },
48
- props: {
49
- column: {
50
- type: Object,
51
- default: null
52
- },
53
- // 操作列、占位符列内容显示的函数,格式为:{'属性名':方法},例如:{'name':viewUser,'operation':showOperation}
54
- customFormat: {
55
- type: Object,
56
- default: null
57
- },
58
- listCode: {
59
- type: String,
60
- default: null
61
- },
62
- isSql: {
63
- type: Boolean,
64
- default: false
65
- }
66
- },
67
- data() {
68
- return {
69
- label: null // 标题
70
- }
71
- },
72
- computed: {
73
- visibleChildren() {
74
- if (this.column.children) {
75
- return this.column.children.filter(column => {
76
- return column.show === undefined || column.show
77
- })
78
- } else {
79
- return []
80
- }
81
- }
82
- },
83
- created() {
84
- this.label = this.getHeader()
85
- },
86
- methods: {
87
- getHeader() {
88
- if (!this.column.titleValueSet) {
89
- return this.column.label.replace(/\\n/g, '</br>')
90
- } else {
91
- return this.formatHeader()
92
- }
93
- },
94
- formatHeader() {
95
- return doFormatWithValueSet(this.column.titleValueSetValue, this.column.label)
96
- }
97
- }
98
- }
99
- </script>
100
-
@@ -1,87 +0,0 @@
1
- <template>
2
- <ul class="context-menu">
3
- <li v-for="menu in buttomArr" :key="menu.name">
4
- <i :class="menu.icon" /><span @click="buttonClick(menu.event, menu)">{{ menu.label }}</span>
5
- </li>
6
- </ul>
7
- </template>
8
- <script>
9
- // import Vue from 'vue'
10
-
11
- export default {
12
- name: 'HeaderContextMenu',
13
- components: {
14
- },
15
- filters: {
16
- },
17
- props: {
18
- buttomArr: {
19
- type: Array,
20
- default: null
21
- },
22
- column: {
23
- type: Object,
24
- default: null
25
- }
26
- },
27
- data() {
28
- return {
29
-
30
- }
31
- },
32
- computed: {
33
-
34
- },
35
- watch: {
36
-
37
- },
38
- created() {
39
- console.log('12345', this.buttomArr)
40
- },
41
- methods: {
42
- // 操作按钮的点击事件
43
- buttonClick(event, data) {
44
- if (event) {
45
- if (typeof (event) === 'function') {
46
- event.call(this, data, this.column)
47
- } else {
48
- this.$emit(event, data, this.column)
49
- }
50
- this.$emit('clearHeaderContextmenu')
51
- }
52
- }
53
- }
54
- }
55
- </script>
56
- <style lang="scss" scoped>
57
- li {
58
- color: #333;
59
- }
60
- .context-menu {
61
- position: fixed;
62
- background: #fff;
63
- z-index: 999;
64
- padding:5px;
65
- margin:0;
66
- margin-top: 30px
67
- }
68
- .context-menu li {
69
- min-width: 75px;
70
- height: 28px;
71
- line-height: 28px;
72
- text-align: left;
73
- color: #1a1a1a;
74
- }
75
- .context-menu li:hover {
76
- background: #42b983;
77
- color: #fff;
78
- }
79
- .context-menu {
80
- border: 1px solid #eee;
81
- box-shadow: 0 0.5em 1em 0 rgba(0,0,0,.1);
82
- border-radius: 5px;
83
- }
84
- li {
85
- list-style-type:none;
86
- }
87
- </style>
@@ -1,51 +0,0 @@
1
-
2
- <template>
3
- <el-table-column
4
- align="center"
5
- :fixed="fixed"
6
- :width="column.width?column.width:'80'"
7
- >
8
- <template v-slot:header>
9
- <span class="cell--span">{{ $t('superGrid.index') }}</span>
10
- </template>
11
- <template slot-scope="scope">
12
- <span class="cell--span">
13
- {{ scope.$index + 1 }}
14
- </span>
15
- </template>
16
- </el-table-column>
17
- </template>
18
- <script>
19
- /**
20
- * 序号列
21
- */
22
- export default {
23
- name: 'IndexColumn',
24
- components: {
25
- },
26
- props: {
27
- column: {
28
- type: Object,
29
- default: null
30
- },
31
- isLineEdit: {
32
- type: Boolean,
33
- default: false
34
- }
35
-
36
- },
37
- computed: {
38
- fixed() {
39
- if (this.column.fixed && (this.column.fixed === 'false' || this.column.fixed === '')) {
40
- return false
41
- }
42
- // 序号只支持左固定
43
- if (this.column.fixed && (this.column.fixed === 'right')) {
44
- return 'left'
45
- }
46
- return this.column.fixed
47
- }
48
- }
49
- }
50
- </script>
51
-