imatrix-ui 2.8.97-dw-tmp39 → 2.8.97-dw-tmp41

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 (141) hide show
  1. package/lib/super-ui.umd.min.js +3 -3
  2. package/package.json +1 -1
  3. package/packages/breadcrumb/index.js +6 -0
  4. package/packages/breadcrumb/src/breadcrumb.vue +71 -0
  5. package/packages/department-tree/index.js +6 -0
  6. package/packages/department-tree/src/department-tree.vue +108 -0
  7. package/packages/department-tree-inline/index.js +6 -0
  8. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +402 -0
  9. package/packages/department-tree-inline/src/department-single-tree-inline.vue +284 -0
  10. package/packages/department-tree-inline/src/department-tree-inline.vue +86 -0
  11. package/packages/department-tree-inline/src/department-tree-service.js +245 -0
  12. package/packages/department-tree-inline/src/search-result.vue +176 -0
  13. package/packages/department-user-tree/index.js +6 -0
  14. package/packages/department-user-tree/src/department-user-multiple-tree.vue +116 -0
  15. package/packages/department-user-tree/src/department-user-single-tree.vue +76 -0
  16. package/packages/department-user-tree/src/department-user-tree.vue +101 -0
  17. package/packages/department-user-tree-inline/index.js +6 -0
  18. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +626 -0
  19. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +269 -0
  20. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +79 -0
  21. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +230 -0
  22. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +122 -0
  23. package/packages/department-user-tree-inline/src/search-result.vue +197 -0
  24. package/packages/directives/prevent-reclick.js +19 -0
  25. package/packages/dynamic-source-select/index.js +6 -0
  26. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +70 -0
  27. package/packages/dynamic-source-select/src/dynamic-source-select.vue +440 -0
  28. package/packages/dynamic-source-select/src/events.js +55 -0
  29. package/packages/fs-preview/index.js +6 -0
  30. package/packages/fs-preview/src/fs-preview.vue +226 -0
  31. package/packages/fs-upload/index.js +6 -0
  32. package/packages/fs-upload/src/fs-upload-multi.vue +420 -0
  33. package/packages/fs-upload/src/fs-upload-single.vue +312 -0
  34. package/packages/fs-upload/src/fs-upload.vue +189 -0
  35. package/packages/fs-upload/src/see-big-picture.vue +55 -0
  36. package/packages/fs-upload-list/index.js +6 -0
  37. package/packages/fs-upload-list/src/fs-upload-list.vue +287 -0
  38. package/packages/hamburger/index.js +6 -0
  39. package/packages/hamburger/src/hamburger.vue +38 -0
  40. package/packages/index.js +121 -0
  41. package/packages/multipart-upload/index.js +6 -0
  42. package/packages/multipart-upload/src/index.vue +73 -0
  43. package/packages/multipart-upload/src/multipart-upload-form.vue +297 -0
  44. package/packages/multipart-upload/src/multipart-upload-list.vue +378 -0
  45. package/packages/organization-input/index.js +6 -0
  46. package/packages/organization-input/src/organization-input.vue +542 -0
  47. package/packages/plugins/export-data-new.js +453 -0
  48. package/packages/plugins/export-data.js +361 -0
  49. package/packages/plugins/index.js +15 -0
  50. package/packages/plugins/public-method.js +43 -0
  51. package/packages/remove-department/index.js +6 -0
  52. package/packages/remove-department/src/remove-department.vue +172 -0
  53. package/packages/remove-department/src/remove-dept-service.js +20 -0
  54. package/packages/remove-user/index.js +6 -0
  55. package/packages/remove-user/src/remove-user-service.js +20 -0
  56. package/packages/remove-user/src/remove-user.vue +195 -0
  57. package/packages/remove-workgroup/index.js +6 -0
  58. package/packages/remove-workgroup/src/remove-workgroup-service.js +20 -0
  59. package/packages/remove-workgroup/src/remove-workgroup.vue +159 -0
  60. package/packages/rich-editor/index.js +7 -0
  61. package/packages/rich-editor/index.vue +278 -0
  62. package/packages/rich-editor/langs/zh-Hans.js +1 -0
  63. package/packages/rich-editor/viewer.vue +103 -0
  64. package/packages/scan-code-input/index.js +6 -0
  65. package/packages/scan-code-input/src/events.js +33 -0
  66. package/packages/scan-code-input/src/scan-code-input-colse.vue +131 -0
  67. package/packages/scan-code-input/src/scan-code-input.vue +116 -0
  68. package/packages/secret-info/index.js +7 -0
  69. package/packages/secret-info/index.vue +90 -0
  70. package/packages/super-grid/index.js +7 -0
  71. package/packages/super-grid/src/apis.js +763 -0
  72. package/packages/super-grid/src/columns-config.vue +335 -0
  73. package/packages/super-grid/src/custom-formatter.js +250 -0
  74. package/packages/super-grid/src/dynamic-input.vue +1279 -0
  75. package/packages/super-grid/src/eventBus.js +2 -0
  76. package/packages/super-grid/src/events.js +55 -0
  77. package/packages/super-grid/src/formValidatorUtil.js +226 -0
  78. package/packages/super-grid/src/formatter.js +181 -0
  79. package/packages/super-grid/src/group-column.vue +100 -0
  80. package/packages/super-grid/src/header-context-menu.vue +87 -0
  81. package/packages/super-grid/src/index-column.vue +51 -0
  82. package/packages/super-grid/src/normal-column copy.vue +769 -0
  83. package/packages/super-grid/src/normal-column.vue +769 -0
  84. package/packages/super-grid/src/public-methods.js +31 -0
  85. package/packages/super-grid/src/row-operation.vue +161 -0
  86. package/packages/super-grid/src/search-button.vue +66 -0
  87. package/packages/super-grid/src/search-condition-input.vue +61 -0
  88. package/packages/super-grid/src/search-condition-list.vue +59 -0
  89. package/packages/super-grid/src/search-form-advancedQuery.vue +653 -0
  90. package/packages/super-grid/src/search-form-dialog.vue +79 -0
  91. package/packages/super-grid/src/search-form-item.vue +386 -0
  92. package/packages/super-grid/src/search-form-number.vue +38 -0
  93. package/packages/super-grid/src/search-form-open.vue +162 -0
  94. package/packages/super-grid/src/search-form-ordinarySearch.vue +188 -0
  95. package/packages/super-grid/src/search-form.vue +634 -0
  96. package/packages/super-grid/src/search-methods.js +387 -0
  97. package/packages/super-grid/src/selection-column.vue +43 -0
  98. package/packages/super-grid/src/store.js +3 -0
  99. package/packages/super-grid/src/super-grid-service-static.js +1313 -0
  100. package/packages/super-grid/src/super-grid-service.js +561 -0
  101. package/packages/super-grid/src/super-grid-static.vue +3229 -0
  102. package/packages/super-grid/src/super-grid.vue +2793 -0
  103. package/packages/super-grid/src/utils.js +763 -0
  104. package/packages/super-grid/src/view-image-dialog.vue +130 -0
  105. package/packages/super-nine-grid/index.js +7 -0
  106. package/packages/super-nine-grid/src/apis.js +103 -0
  107. package/packages/super-nine-grid/src/custom-formatter.js +66 -0
  108. package/packages/super-nine-grid/src/formatter.js +132 -0
  109. package/packages/super-nine-grid/src/search-form-number.vue +38 -0
  110. package/packages/super-nine-grid/src/search-form.vue +430 -0
  111. package/packages/super-nine-grid/src/search-methods.js +134 -0
  112. package/packages/super-nine-grid/src/store.js +3 -0
  113. package/packages/super-nine-grid/src/super-grid-service.js +91 -0
  114. package/packages/super-nine-grid/src/super-nine-grid.vue +872 -0
  115. package/packages/super-nine-grid/src/utils.js +261 -0
  116. package/packages/svg-icon/index.js +6 -0
  117. package/packages/svg-icon/src/svg-icon.vue +43 -0
  118. package/packages/utils/utils.js +152 -0
  119. package/packages/utils/value-set.js +86 -0
  120. package/packages/valid-code/index.js +7 -0
  121. package/packages/valid-code/src/valid-code.vue +95 -0
  122. package/packages/workflow-button/index.js +6 -0
  123. package/packages/workflow-button/src/workflow-button.vue +325 -0
  124. package/packages/workflow-history-list/index.js +6 -0
  125. package/packages/workflow-history-list/src/api.js +7 -0
  126. package/packages/workflow-history-list/src/workflow-history-list.vue +185 -0
  127. package/packages/workgroup-tree/index.js +6 -0
  128. package/packages/workgroup-tree/src/workgroup-tree.vue +76 -0
  129. package/packages/workgroup-tree-inline/index.js +6 -0
  130. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +317 -0
  131. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +43 -0
  132. package/packages/workgroup-user-tree/index.js +6 -0
  133. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +100 -0
  134. package/packages/workgroup-user-tree-inline/index.js +6 -0
  135. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +163 -0
  136. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +436 -0
  137. package/packages/year-range-picker/index.js +6 -0
  138. package/packages/year-range-picker/src/year-range-picker.vue +51 -0
  139. package/lib/super-ui.common.1.js +0 -368
  140. package/lib/super-ui.umd.1.js +0 -368
  141. package/lib/super-ui.umd.min.1.js +0 -2
@@ -0,0 +1,1313 @@
1
+ /* eslint-disable no-undef */
2
+ import Vue from 'vue'
3
+ import Sortable from 'sortablejs'
4
+ import store from './store'
5
+ // import {
6
+ // packageEnumAndBeanColumnValueSets
7
+ // } from '../../utils/value-set'
8
+ import {
9
+ isHasOptionFunction
10
+ } from './utils'
11
+ const superGridService = {
12
+ initialize() {
13
+ const a = new Date().getTime()
14
+ return new Promise((resolve, reject) => {
15
+ const gridParams = store.get(this.code)
16
+ if (this.options.isAdministerListView) {
17
+ // 要从配置中实时获取页面的配置
18
+ // 根据this.options.showColumns设置显示的字段
19
+ this.getShowColumns(this.options.SuperGrid)
20
+ Object.assign(this, this.options.SuperGrid)
21
+ gridParams.isSql = this.isSql
22
+ gridParams.columns = this.columns
23
+ gridParams.query = this.query
24
+ gridParams.pagination = this.pagination
25
+ this.createBackgroundColorMap()
26
+ this.hasLoadedColumns = true
27
+ this.fetchData(null, null, null, null)
28
+ resolve()
29
+ } else {
30
+ // const url = Vue.prototype.baseAPI + '/component/super-grids/' + this.code
31
+ const param = {}
32
+ const isSqlSetting = this.options.isSql
33
+ if (this.options && typeof (isSqlSetting) !== 'undefined') {
34
+ this.isSql = isSqlSetting
35
+ param.isSql = isSqlSetting + ''
36
+ }
37
+ if (this.options && typeof (this.options.isAdministerListView) !== 'undefined' && this.options.isAdministerListView) {
38
+ param.isAdminister = this.options.isAdministerListView + ''
39
+ }
40
+ let additionalParams
41
+ const additionalParamMap = sessionStorage.getItem('additionalParamMap')
42
+ if (additionalParamMap) {
43
+ console.log('进入判断', additionalParamMap)
44
+ if (additionalParamMap && typeof (additionalParamMap) === 'object') {
45
+ additionalParams = JSON.stringify(additionalParamMap)
46
+ } else if (additionalParamMap && additionalParamMap !== '') {
47
+ additionalParams = additionalParamMap
48
+ }
49
+ }
50
+ if (this.options.additionalParamMap && typeof (this.options.additionalParamMap) === 'object') {
51
+ const optionParam = JSON.stringify(this.options.additionalParamMap)
52
+ if (additionalParams) {
53
+ Object.assign(additionalParams, optionParam)
54
+ } else {
55
+ additionalParams = optionParam
56
+ }
57
+ } else if (this.options.additionalParamMap && this.options.additionalParamMap !== '') {
58
+ const optionParam = this.options.additionalParamMap
59
+ if (additionalParams) {
60
+ Object.assign(additionalParams, optionParam)
61
+ } else {
62
+ additionalParams = optionParam
63
+ }
64
+ }
65
+ if (additionalParams) {
66
+ param.additionalParamMap = additionalParams
67
+ }
68
+ if (this.options.extraParam && this.options.extraParam.entityMap) {
69
+ this.parentFormData = this.options.extraParam.entityMap
70
+ }
71
+ this.isLoading = true
72
+ // 初始化组件时先获取元信息再获取数据,以后翻页、排序、查询不再去获取元数据了
73
+ // this.$http.post(url, param).then(data => {
74
+ // const p1 = new Date().getTime()
75
+ // // 行编辑设置所有字段的默认值null时使用,优化行编辑性能
76
+ // let allColumns = []
77
+ // allColumns = allColumns.concat(JSON.parse(JSON.stringify(data.columns)))
78
+ // // 根据this.options.showColumns设置显示的字段
79
+ // this.getShowColumns(data)
80
+ // // 将列表信息存入store缓存中,用来导出时获取国际化名
81
+ // if (data.basicInfo) {
82
+ // store.set(this.code + 'basicInfo', data.basicInfo)
83
+ // }
84
+ // if (this.options.pageSizes && data.pagination) {
85
+ // // 组件的options属性配置中配置“可选行数”,已该配置为准
86
+ // let pageSizeArr = null
87
+ // const pageSizeStrs = this.options.pageSizes.split(',')
88
+ // if (pageSizeStrs && pageSizeStrs.length > 0) {
89
+ // pageSizeArr = []
90
+ // for (var i = 0; i < pageSizeStrs.length; i++) {
91
+ // pageSizeArr.push(pageSizeStrs[i] * 1)
92
+ // }
93
+ // data.pagination.pageSize = pageSizeArr[0]
94
+ // }
95
+ // data.pagination.layout = 'total, sizes, prev, pager, next, jumper'
96
+ // data.pagination.pageSizes = pageSizeArr
97
+ // }
98
+ // if (typeof (this.options.initSortInfo) !== 'undefined') {
99
+ // // 组件的options属性配置中配置“排序信息”,以该配置为准
100
+ // if (Array.isArray(this.options.initSortInfo)) {
101
+ // data.sortInfo = this.options.initSortInfo
102
+ // } else {
103
+ // data.sortInfo = []
104
+ // data.sortInfo.push(this.options.initSortInfo)
105
+ // }
106
+ // }
107
+
108
+ // // 需要多个组件共享的数据放到store中,避免组件定义一堆props来接收这些共享数据
109
+ // packageEnumAndBeanColumnValueSets(data.columns, this.code).then(() => {
110
+ // return this.getDynamicColumnByBean(additionalParams, data.dynamicColumnInfo, data.columns, gridParams)
111
+ // }).then((dynamicColumns) => {
112
+ const data = {
113
+ 'basicInfo': {
114
+ 'code': 'SUPPLIER_QUALIFIED_SUPPLIER',
115
+ 'name': '合格供应商维护',
116
+ 'customConfig': true,
117
+ 'summary': 'no',
118
+ 'tableName': 'SUPPLIER_QUALIFIED_SUPPLIER',
119
+ 'displayEffect': 'default',
120
+ 'border': false,
121
+ 'systemCode': 'sqm',
122
+ 'sql': true,
123
+ 'hasJoinTable': false,
124
+ 'initializationQuery': true
125
+ },
126
+ 'pagination': {
127
+ 'pageSize': 20,
128
+ 'pageSizes': [
129
+ 20,
130
+ 30,
131
+ 40,
132
+ 50,
133
+ 100
134
+ ],
135
+ 'layout': 'total, sizes, prev, pager, next, jumper',
136
+ 'showTotal': true
137
+ },
138
+ 'query': {
139
+ 'queryType': 'INSIDE_QUERY',
140
+ 'showType': 'embedded',
141
+ 'advancedQuery': false,
142
+ 'normalQuery': true,
143
+ 'fuzzyQuery': false,
144
+ 'queryLabelPosition': 'left'
145
+ },
146
+ 'lineEdit': {
147
+ 'editable': true
148
+ },
149
+ 'colSetting': {
150
+ 'isDragColumn': false
151
+ },
152
+ 'columns': [
153
+ {
154
+ 'prop': '$selection',
155
+ 'orgProp': '$selection',
156
+ 'label': '多选框',
157
+ 'dataType': 'TEXT',
158
+ 'width': 50,
159
+ 'show': true,
160
+ 'exportable': false,
161
+ 'filterable': false,
162
+ 'fixed': 'left',
163
+ 'span': false,
164
+ 'queryType': 'no',
165
+ 'editable': false,
166
+ 'componentType': 'input',
167
+ 'showType': 'default',
168
+ 'exportType': 'default',
169
+ 'displayOrderType': 'default',
170
+ 'displayOrder': 0,
171
+ 'widthType': 'default',
172
+ 'ifMultiData': false,
173
+ 'dynamic': false,
174
+ 'total': false,
175
+ 'custom': true,
176
+ 'remoteEnum': false,
177
+ 'groupHeader': false,
178
+ 'fuzzy': true
179
+ },
180
+ {
181
+ 'prop': '$index',
182
+ 'orgProp': '$index',
183
+ 'label': '序号',
184
+ 'dataType': 'TEXT',
185
+ 'width': 50,
186
+ 'show': true,
187
+ 'exportable': false,
188
+ 'filterable': false,
189
+ 'fixed': 'left',
190
+ 'span': false,
191
+ 'queryType': 'no',
192
+ 'editable': false,
193
+ 'componentType': 'input',
194
+ 'showType': 'default',
195
+ 'exportType': 'default',
196
+ 'displayOrderType': 'default',
197
+ 'displayOrder': 1,
198
+ 'widthType': 'default',
199
+ 'ifMultiData': false,
200
+ 'dynamic': false,
201
+ 'total': false,
202
+ 'custom': true,
203
+ 'remoteEnum': false,
204
+ 'groupHeader': false,
205
+ 'fuzzy': true
206
+ },
207
+ {
208
+ 'prop': 'CODE',
209
+ 'orgProp': 'CODE',
210
+ 'label': '供应商编码',
211
+ 'dataType': 'TEXT',
212
+ 'width': 150,
213
+ 'show': true,
214
+ 'exportable': true,
215
+ 'sortable': 'true',
216
+ 'filterable': false,
217
+ 'span': false,
218
+ 'queryType': 'normal',
219
+ 'querySetting': '{"width":null,"labelWidth":120,"label":null}',
220
+ 'editable': true,
221
+ 'componentType': 'input',
222
+ 'validations': '[{"required":true,"message":"供应商编码 必须填写"}]',
223
+ 'showType': 'default',
224
+ 'exportType': 'default',
225
+ 'displayOrderType': 'default',
226
+ 'displayOrder': 3,
227
+ 'widthType': 'default',
228
+ 'ifMultiData': false,
229
+ 'dynamic': false,
230
+ 'total': false,
231
+ 'custom': false,
232
+ 'remoteEnum': false,
233
+ 'groupHeader': false,
234
+ 'fuzzy': true
235
+ },
236
+ {
237
+ 'prop': 'COMPANY',
238
+ 'orgProp': 'COMPANY',
239
+ 'label': '公司',
240
+ 'dataType': 'TEXT',
241
+ 'width': 150,
242
+ 'show': true,
243
+ 'exportable': true,
244
+ 'sortable': 'true',
245
+ 'filterable': false,
246
+ 'span': false,
247
+ 'queryType': 'normal',
248
+ 'valueSet': [
249
+ {
250
+ 'value': 'AV',
251
+ 'label': 'AV'
252
+ },
253
+ {
254
+ 'value': 'TV',
255
+ 'label': 'TV'
256
+ },
257
+ {
258
+ 'value': 'AMB',
259
+ 'label': 'AMB'
260
+ }
261
+ ],
262
+ 'editable': true,
263
+ 'componentType': 'multiselect',
264
+ 'showType': 'default',
265
+ 'exportType': 'default',
266
+ 'displayOrderType': 'default',
267
+ 'displayOrder': 3,
268
+ 'widthType': 'default',
269
+ 'ifMultiData': false,
270
+ 'dynamic': false,
271
+ 'total': false,
272
+ 'custom': false,
273
+ 'remoteEnum': false,
274
+ 'groupHeader': false,
275
+ 'fuzzy': true
276
+ },
277
+ {
278
+ 'prop': 'NAME',
279
+ 'orgProp': 'NAME',
280
+ 'label': '供应商名称',
281
+ 'dataType': 'TEXT',
282
+ 'width': 200,
283
+ 'show': true,
284
+ 'exportable': true,
285
+ 'sortable': 'true',
286
+ 'filterable': false,
287
+ 'span': false,
288
+ 'queryType': 'normal',
289
+ 'querySetting': '{"width":null,"labelWidth":120,"label":null}',
290
+ 'editable': true,
291
+ 'componentType': 'input',
292
+ 'validations': '[{"required":true,"message":"供应商名称 必须填写"}]',
293
+ 'showType': 'default',
294
+ 'exportType': 'default',
295
+ 'displayOrderType': 'default',
296
+ 'displayOrder': 4,
297
+ 'widthType': 'default',
298
+ 'ifMultiData': false,
299
+ 'dynamic': false,
300
+ 'total': false,
301
+ 'custom': false,
302
+ 'remoteEnum': false,
303
+ 'groupHeader': false,
304
+ 'fuzzy': true
305
+ },
306
+ {
307
+ 'prop': 'ADDRESS',
308
+ 'orgProp': 'ADDRESS',
309
+ 'label': '供应商地址',
310
+ 'dataType': 'TEXT',
311
+ 'width': 150,
312
+ 'show': true,
313
+ 'exportable': true,
314
+ 'sortable': 'true',
315
+ 'filterable': false,
316
+ 'span': false,
317
+ 'queryType': 'no',
318
+ 'editable': true,
319
+ 'componentType': 'input',
320
+ 'showType': 'default',
321
+ 'exportType': 'default',
322
+ 'displayOrderType': 'default',
323
+ 'displayOrder': 5,
324
+ 'widthType': 'default',
325
+ 'ifMultiData': false,
326
+ 'dynamic': false,
327
+ 'total': false,
328
+ 'custom': false,
329
+ 'remoteEnum': false,
330
+ 'groupHeader': false,
331
+ 'fuzzy': true
332
+ },
333
+ {
334
+ 'prop': 'TERRITORY',
335
+ 'orgProp': 'TERRITORY',
336
+ 'label': '所属地',
337
+ 'dataType': 'TEXT',
338
+ 'width': 150,
339
+ 'show': true,
340
+ 'exportable': true,
341
+ 'sortable': 'true',
342
+ 'filterable': false,
343
+ 'span': false,
344
+ 'queryType': 'no',
345
+ 'editable': true,
346
+ 'componentType': 'input',
347
+ 'showType': 'default',
348
+ 'exportType': 'default',
349
+ 'displayOrderType': 'default',
350
+ 'displayOrder': 6,
351
+ 'widthType': 'default',
352
+ 'ifMultiData': false,
353
+ 'dynamic': false,
354
+ 'total': false,
355
+ 'custom': false,
356
+ 'remoteEnum': false,
357
+ 'groupHeader': false,
358
+ 'fuzzy': true
359
+ },
360
+ {
361
+ 'prop': 'MATERIAL_CATEGORY',
362
+ 'orgProp': 'MATERIAL_CATEGORY',
363
+ 'label': '物料类别',
364
+ 'dataType': 'TEXT',
365
+ 'width': 150,
366
+ 'show': true,
367
+ 'exportable': true,
368
+ 'sortable': 'true',
369
+ 'filterable': false,
370
+ 'span': false,
371
+ 'queryType': 'normal',
372
+ 'valueSet': [
373
+ {
374
+ 'value': '电子',
375
+ 'label': '电子'
376
+ },
377
+ {
378
+ 'value': '塑胶',
379
+ 'label': '塑胶'
380
+ },
381
+ {
382
+ 'value': '包材',
383
+ 'label': '包材'
384
+ },
385
+ {
386
+ 'value': '五金',
387
+ 'label': '五金'
388
+ },
389
+ {
390
+ 'value': '辅料',
391
+ 'label': '辅料'
392
+ }
393
+ ],
394
+ 'editable': true,
395
+ 'componentType': 'select',
396
+ 'validations': '[{"required":true,"message":"物料类别 必须填写"}]',
397
+ 'showType': 'default',
398
+ 'exportType': 'default',
399
+ 'displayOrderType': 'default',
400
+ 'displayOrder': 7,
401
+ 'widthType': 'default',
402
+ 'ifMultiData': false,
403
+ 'dynamic': false,
404
+ 'total': false,
405
+ 'custom': false,
406
+ 'remoteEnum': false,
407
+ 'groupHeader': false,
408
+ 'fuzzy': true
409
+ },
410
+ {
411
+ 'prop': 'BUSINESS_CONTACT',
412
+ 'orgProp': 'BUSINESS_CONTACT',
413
+ 'label': '业务联系人',
414
+ 'dataType': 'TEXT',
415
+ 'width': 150,
416
+ 'show': true,
417
+ 'exportable': true,
418
+ 'sortable': 'true',
419
+ 'filterable': false,
420
+ 'span': false,
421
+ 'queryType': 'no',
422
+ 'editable': true,
423
+ 'componentType': 'input',
424
+ 'showType': 'default',
425
+ 'exportType': 'default',
426
+ 'displayOrderType': 'default',
427
+ 'displayOrder': 8,
428
+ 'widthType': 'default',
429
+ 'ifMultiData': false,
430
+ 'dynamic': false,
431
+ 'total': false,
432
+ 'custom': false,
433
+ 'remoteEnum': false,
434
+ 'groupHeader': false,
435
+ 'fuzzy': true
436
+ },
437
+ {
438
+ 'prop': 'BUSINESS_CONTACT_NUMBER',
439
+ 'orgProp': 'BUSINESS_CONTACT_NUMBER',
440
+ 'label': '业务联系电话',
441
+ 'dataType': 'TEXT',
442
+ 'width': 150,
443
+ 'show': true,
444
+ 'exportable': true,
445
+ 'sortable': 'true',
446
+ 'filterable': false,
447
+ 'span': false,
448
+ 'queryType': 'no',
449
+ 'editable': true,
450
+ 'componentType': 'input',
451
+ 'showType': 'default',
452
+ 'exportType': 'default',
453
+ 'displayOrderType': 'default',
454
+ 'displayOrder': 9,
455
+ 'widthType': 'default',
456
+ 'ifMultiData': false,
457
+ 'dynamic': false,
458
+ 'total': false,
459
+ 'custom': false,
460
+ 'remoteEnum': false,
461
+ 'groupHeader': false,
462
+ 'fuzzy': true
463
+ },
464
+ {
465
+ 'prop': 'BUSINESS_EMAIL_ADDRESS',
466
+ 'orgProp': 'BUSINESS_EMAIL_ADDRESS',
467
+ 'label': '业务邮箱地址',
468
+ 'dataType': 'TEXT',
469
+ 'width': 150,
470
+ 'show': true,
471
+ 'exportable': true,
472
+ 'sortable': 'true',
473
+ 'filterable': false,
474
+ 'span': false,
475
+ 'queryType': 'no',
476
+ 'editable': true,
477
+ 'componentType': 'input',
478
+ 'validations': '[{"type":"email","message":"业务邮箱地址 格式不正确"}]',
479
+ 'showType': 'default',
480
+ 'exportType': 'default',
481
+ 'displayOrderType': 'default',
482
+ 'displayOrder': 10,
483
+ 'widthType': 'default',
484
+ 'ifMultiData': false,
485
+ 'dynamic': false,
486
+ 'total': false,
487
+ 'custom': false,
488
+ 'remoteEnum': false,
489
+ 'groupHeader': false,
490
+ 'fuzzy': true
491
+ },
492
+ {
493
+ 'prop': 'CONTACTS_NAME',
494
+ 'orgProp': 'CONTACTS_NAME',
495
+ 'label': '联系人名称',
496
+ 'dataType': 'TEXT',
497
+ 'width': 150,
498
+ 'show': true,
499
+ 'exportable': true,
500
+ 'sortable': 'true',
501
+ 'filterable': false,
502
+ 'span': false,
503
+ 'queryType': 'no',
504
+ 'editable': true,
505
+ 'componentType': 'input',
506
+ 'showType': 'default',
507
+ 'exportType': 'default',
508
+ 'displayOrderType': 'default',
509
+ 'displayOrder': 11,
510
+ 'widthType': 'default',
511
+ 'ifMultiData': false,
512
+ 'dynamic': false,
513
+ 'total': false,
514
+ 'custom': false,
515
+ 'remoteEnum': false,
516
+ 'groupHeader': false,
517
+ 'fuzzy': true
518
+ },
519
+ {
520
+ 'prop': 'CONTACTS_PHONE',
521
+ 'orgProp': 'CONTACTS_PHONE',
522
+ 'label': '联系人电话',
523
+ 'dataType': 'TEXT',
524
+ 'width': 150,
525
+ 'show': true,
526
+ 'exportable': true,
527
+ 'sortable': 'true',
528
+ 'filterable': false,
529
+ 'span': false,
530
+ 'queryType': 'no',
531
+ 'editable': true,
532
+ 'componentType': 'input',
533
+ 'showType': 'default',
534
+ 'exportType': 'default',
535
+ 'displayOrderType': 'default',
536
+ 'displayOrder': 12,
537
+ 'widthType': 'default',
538
+ 'ifMultiData': false,
539
+ 'dynamic': false,
540
+ 'total': false,
541
+ 'custom': false,
542
+ 'remoteEnum': false,
543
+ 'groupHeader': false,
544
+ 'fuzzy': true
545
+ },
546
+ {
547
+ 'prop': 'QUALITY_EMAIL_ADDRESS',
548
+ 'orgProp': 'QUALITY_EMAIL_ADDRESS',
549
+ 'label': '质量邮箱地址',
550
+ 'dataType': 'TEXT',
551
+ 'width': 150,
552
+ 'show': true,
553
+ 'exportable': true,
554
+ 'sortable': 'true',
555
+ 'filterable': false,
556
+ 'span': false,
557
+ 'queryType': 'no',
558
+ 'editable': true,
559
+ 'componentType': 'input',
560
+ 'validations': '[{"type":"email","message":"质量邮箱地址 格式不正确"}]',
561
+ 'showType': 'default',
562
+ 'exportType': 'default',
563
+ 'displayOrderType': 'default',
564
+ 'displayOrder': 13,
565
+ 'widthType': 'default',
566
+ 'ifMultiData': false,
567
+ 'dynamic': false,
568
+ 'total': false,
569
+ 'custom': false,
570
+ 'remoteEnum': false,
571
+ 'groupHeader': false,
572
+ 'fuzzy': true
573
+ },
574
+ {
575
+ 'prop': 'IS_CUSTOMER_INDEX',
576
+ 'orgProp': 'IS_CUSTOMER_INDEX',
577
+ 'label': '是否客指',
578
+ 'dataType': 'BOOLEAN',
579
+ 'width': 150,
580
+ 'show': true,
581
+ 'exportable': true,
582
+ 'sortable': 'true',
583
+ 'filterable': false,
584
+ 'span': false,
585
+ 'queryType': 'no',
586
+ 'editable': true,
587
+ 'componentType': 'slider',
588
+ 'showType': 'default',
589
+ 'exportType': 'default',
590
+ 'displayOrderType': 'default',
591
+ 'displayOrder': 14,
592
+ 'widthType': 'default',
593
+ 'ifMultiData': false,
594
+ 'dynamic': false,
595
+ 'total': false,
596
+ 'custom': false,
597
+ 'remoteEnum': false,
598
+ 'groupHeader': false,
599
+ 'fuzzy': true
600
+ },
601
+ {
602
+ 'prop': 'CREATED_TIME',
603
+ 'orgProp': 'CREATED_TIME',
604
+ 'label': '创建时间',
605
+ 'dataType': 'DATE',
606
+ 'width': 150,
607
+ 'show': false,
608
+ 'exportable': true,
609
+ 'sortable': 'true',
610
+ 'filterable': false,
611
+ 'span': false,
612
+ 'queryType': 'no',
613
+ 'editable': true,
614
+ 'componentType': 'input',
615
+ 'showType': 'default',
616
+ 'exportType': 'default',
617
+ 'displayOrderType': 'default',
618
+ 'displayOrder': 15,
619
+ 'widthType': 'default',
620
+ 'ifMultiData': false,
621
+ 'dynamic': false,
622
+ 'total': false,
623
+ 'custom': false,
624
+ 'remoteEnum': false,
625
+ 'groupHeader': false,
626
+ 'fuzzy': true
627
+ },
628
+ {
629
+ 'prop': 'CONTACTS_ID',
630
+ 'orgProp': 'CONTACTS_ID',
631
+ 'label': '联系人id',
632
+ 'dataType': 'LONG',
633
+ 'width': 150,
634
+ 'show': false,
635
+ 'exportable': false,
636
+ 'sortable': 'true',
637
+ 'filterable': false,
638
+ 'span': false,
639
+ 'queryType': 'no',
640
+ 'editable': false,
641
+ 'componentType': 'input',
642
+ 'showType': 'default',
643
+ 'exportType': 'default',
644
+ 'displayOrderType': 'default',
645
+ 'displayOrder': 16,
646
+ 'widthType': 'default',
647
+ 'ifMultiData': false,
648
+ 'dynamic': false,
649
+ 'total': false,
650
+ 'custom': false,
651
+ 'remoteEnum': false,
652
+ 'groupHeader': false,
653
+ 'fuzzy': true
654
+ },
655
+ {
656
+ 'prop': 'BUSINESS_CONTACT_ID',
657
+ 'orgProp': 'BUSINESS_CONTACT_ID',
658
+ 'label': '业务联系人Id',
659
+ 'dataType': 'LONG',
660
+ 'width': 150,
661
+ 'show': false,
662
+ 'exportable': false,
663
+ 'sortable': 'true',
664
+ 'filterable': false,
665
+ 'span': false,
666
+ 'queryType': 'no',
667
+ 'editable': false,
668
+ 'componentType': 'input',
669
+ 'showType': 'default',
670
+ 'exportType': 'default',
671
+ 'displayOrderType': 'default',
672
+ 'displayOrder': 17,
673
+ 'widthType': 'default',
674
+ 'ifMultiData': false,
675
+ 'dynamic': false,
676
+ 'total': false,
677
+ 'custom': false,
678
+ 'remoteEnum': false,
679
+ 'groupHeader': false,
680
+ 'fuzzy': true
681
+ },
682
+ {
683
+ 'prop': 'STATE',
684
+ 'orgProp': 'STATE',
685
+ 'label': '状态',
686
+ 'dataType': 'TEXT',
687
+ 'width': 150,
688
+ 'show': false,
689
+ 'exportable': false,
690
+ 'sortable': 'true',
691
+ 'filterable': false,
692
+ 'span': false,
693
+ 'queryType': 'no',
694
+ 'editable': false,
695
+ 'componentType': 'input',
696
+ 'showType': 'default',
697
+ 'exportType': 'default',
698
+ 'displayOrderType': 'default',
699
+ 'displayOrder': 17,
700
+ 'widthType': 'default',
701
+ 'ifMultiData': false,
702
+ 'dynamic': false,
703
+ 'total': false,
704
+ 'custom': false,
705
+ 'remoteEnum': false,
706
+ 'groupHeader': false,
707
+ 'fuzzy': true
708
+ },
709
+ {
710
+ 'prop': 'operation',
711
+ 'orgProp': 'operation',
712
+ 'label': '操作',
713
+ 'dataType': 'TEXT',
714
+ 'width': 320,
715
+ 'show': true,
716
+ 'exportable': false,
717
+ 'filterable': false,
718
+ 'fixed': 'right',
719
+ 'span': false,
720
+ 'queryType': 'no',
721
+ 'editable': false,
722
+ 'componentType': 'input',
723
+ 'showType': 'default',
724
+ 'exportType': 'default',
725
+ 'displayOrderType': 'default',
726
+ 'displayOrder': 18,
727
+ 'widthType': 'default',
728
+ 'ifMultiData': false,
729
+ 'dynamic': false,
730
+ 'total': false,
731
+ 'custom': true,
732
+ 'remoteEnum': false,
733
+ 'groupHeader': false,
734
+ 'fuzzy': true
735
+ }
736
+ ],
737
+ 'dynamicColumnInfo': [],
738
+ 'mergeFields': [],
739
+ 'mainDefaultValueColumns': [
740
+ {
741
+ 'id': 8979,
742
+ 'createdTime': 1626077341000,
743
+ 'creator': 'admin',
744
+ 'name': 'businessContactId',
745
+ 'alias': '业务联系人Id',
746
+ 'dbColumnName': 'BUSINESS_CONTACT_ID',
747
+ 'dataType': 'LONG',
748
+ 'defaultValue': '0',
749
+ 'displayOrder': 14,
750
+ 'dataTableId': 631,
751
+ 'deleted': false,
752
+ 'casual': false,
753
+ 'joinTable': false
754
+ },
755
+ {
756
+ 'id': 8978,
757
+ 'createdTime': 1626077341000,
758
+ 'creator': 'admin',
759
+ 'name': 'isCustomerIndex',
760
+ 'alias': '是否客指',
761
+ 'dbColumnName': 'IS_CUSTOMER_INDEX',
762
+ 'dataType': 'BOOLEAN',
763
+ 'defaultValue': 'false',
764
+ 'displayOrder': 13,
765
+ 'dataTableId': 631,
766
+ 'deleted': false,
767
+ 'casual': false,
768
+ 'joinTable': false
769
+ },
770
+ {
771
+ 'id': 8976,
772
+ 'createdTime': 1626077341000,
773
+ 'creator': 'admin',
774
+ 'name': 'hasChildren',
775
+ 'alias': '是否有子节点',
776
+ 'dbColumnName': 'HAS_CHILDREN',
777
+ 'dataType': 'BOOLEAN',
778
+ 'displayOrder': 12,
779
+ 'dataTableId': 631,
780
+ 'deleted': false,
781
+ 'casual': false,
782
+ 'joinTable': false
783
+ },
784
+ {
785
+ 'id': 8972,
786
+ 'createdTime': 1626077341000,
787
+ 'creator': 'admin',
788
+ 'name': 'dataVisible',
789
+ 'alias': '是否显示',
790
+ 'dbColumnName': 'DATA_VISIBLE',
791
+ 'dataType': 'BOOLEAN',
792
+ 'displayOrder': 10,
793
+ 'dataTableId': 631,
794
+ 'deleted': false,
795
+ 'casual': false,
796
+ 'joinTable': false
797
+ },
798
+ {
799
+ 'id': 8961,
800
+ 'createdTime': 1626077341000,
801
+ 'creator': 'admin',
802
+ 'name': 'contactsId',
803
+ 'alias': '联系人id',
804
+ 'dbColumnName': 'CONTACTS_ID',
805
+ 'dataType': 'LONG',
806
+ 'defaultValue': '0',
807
+ 'displayOrder': 4,
808
+ 'dataTableId': 631,
809
+ 'deleted': false,
810
+ 'casual': false,
811
+ 'joinTable': false
812
+ }
813
+ ],
814
+ 'contextParameter': {
815
+ 'currentTime': '2023-06-11 14:36:40',
816
+ 'currentTransactorRoleId': '2,3,4,5,6,7,8,9,10,11,14,16,17,18,19,59,60,61,62,68,70,71,85,86,87,88,89,92,93,96,97,98,99,118,143,144,145,146,147,148,149,150,151,152,153,155,156,157,158,159,160,163,164,177,178,179,180,181,183,184,185,186,187,188,189,190,191,192,193,194,195,198,199,200,201,204,205,206,207,208,209,210,211,212,213,214,215,216,217,219,220,221,222,223,224,225,226,227',
817
+ 'currentTransactorMainDepartmentId': '2',
818
+ 'currentTransactor': 'admin',
819
+ 'currentDate': '2023-06-11',
820
+ 'currentTransactorWorkGroup': '工作组2,工作组1',
821
+ 'currentTransactorWorkGroupId': '2,1',
822
+ 'currentTransactorNameAndEnName': '管理员(Admin1)',
823
+ 'currentTransactorId': '20',
824
+ 'currentTransactorRole': '普通用户,基础设置管理员,测试角色2,区域销售,销售总监,角色1,超级管理员,流程管理员,test001,管理员,系统元数据管理员,测试角色1,系统管理员,文件管理员,分支机构管理员,客服人员,消息管理员',
825
+ 'currentTransactorName': '管理员',
826
+ 'currentTransactorMainDepartment': '部门2'
827
+ }
828
+ }
829
+ const p1 = new Date().getTime()
830
+ // 行编辑设置所有字段的默认值null时使用,优化行编辑性能
831
+ let allColumns = []
832
+ allColumns = allColumns.concat(JSON.parse(JSON.stringify(data.columns)))
833
+ // 根据this.options.showColumns设置显示的字段
834
+ this.getShowColumns(data)
835
+ // 将列表信息存入store缓存中,用来导出时获取国际化名
836
+ if (data.basicInfo) {
837
+ store.set(this.code + 'basicInfo', data.basicInfo)
838
+ }
839
+ if (this.options.pageSizes && data.pagination) {
840
+ // 组件的options属性配置中配置“可选行数”,已该配置为准
841
+ let pageSizeArr = null
842
+ const pageSizeStrs = this.options.pageSizes.split(',')
843
+ if (pageSizeStrs && pageSizeStrs.length > 0) {
844
+ pageSizeArr = []
845
+ for (var i = 0; i < pageSizeStrs.length; i++) {
846
+ pageSizeArr.push(pageSizeStrs[i] * 1)
847
+ }
848
+ data.pagination.pageSize = pageSizeArr[0]
849
+ }
850
+ data.pagination.layout = 'total, sizes, prev, pager, next, jumper'
851
+ data.pagination.pageSizes = pageSizeArr
852
+ }
853
+ if (typeof (this.options.initSortInfo) !== 'undefined') {
854
+ // 组件的options属性配置中配置“排序信息”,以该配置为准
855
+ if (Array.isArray(this.options.initSortInfo)) {
856
+ data.sortInfo = this.options.initSortInfo
857
+ } else {
858
+ data.sortInfo = []
859
+ data.sortInfo.push(this.options.initSortInfo)
860
+ }
861
+ }
862
+ const dynamicColumns = []
863
+ const b = new Date().getTime()
864
+ let showColumns = []
865
+ if (typeof (this.options.showColumns) !== 'undefined') {
866
+ showColumns = this.options.showColumns.split(',')
867
+ }
868
+ let customDynamicColumns = dynamicColumns
869
+ if (!customDynamicColumns || customDynamicColumns.length === 0) {
870
+ if (this.options.dynamicColumns && this.options.dynamicColumns.length > 0) {
871
+ customDynamicColumns = this.options.dynamicColumns
872
+ }
873
+ }
874
+ if (customDynamicColumns && customDynamicColumns.length > 0) {
875
+ allColumns = allColumns.concat(JSON.parse(JSON.stringify(customDynamicColumns)))
876
+ if (showColumns && showColumns.length > 0) {
877
+ for (let i = 0; i < customDynamicColumns.length; i++) {
878
+ const prop = customDynamicColumns[i].prop
879
+ customDynamicColumns[i].dynamic = true
880
+ if (showColumns.indexOf(prop) >= 0) {
881
+ customDynamicColumns[i].show = true
882
+ } else {
883
+ customDynamicColumns[i].show = false
884
+ }
885
+ }
886
+ }
887
+ data.columns = data.columns.concat(customDynamicColumns)
888
+ // 按照排序字段的值升序排列字段
889
+ data.columns = data.columns.sort((col1, col2) => col1.displayOrder - col2.displayOrder)
890
+ }
891
+ Object.assign(this, data)
892
+ if (this.options && typeof (isSqlSetting) === 'undefined') {
893
+ // 如果options中没有配置,则以后台传过来的为准,在有动态列配置时,该值会赋值为true
894
+ this.isSql = this.basicInfo.sql
895
+ }
896
+ gridParams.isSql = this.isSql
897
+ // 行编辑时使用
898
+ gridParams.allColumns = allColumns
899
+ gridParams.columns = this.columns
900
+ // 存放map,prop-columnOption。方便直接通过prop 获取对应的配置
901
+ this.packageColumnOptionMap(gridParams)
902
+ // const columnOptionMap = {}
903
+ // if (gridParams.columns && gridParams.columns.length > 0) {
904
+ // gridParams.columns.forEach(item => {
905
+ // if (item && item.prop) {
906
+ // columnOptionMap[item.prop] = item
907
+ // }
908
+ // })
909
+ // }
910
+ // gridParams.columnOptionMap = columnOptionMap
911
+ this.judgeIsFormSubTable()
912
+ gridParams.colSetting = this.colSetting
913
+ gridParams.lineEdit = this.lineEdit
914
+ gridParams.basicInfo = this.basicInfo
915
+ gridParams.pagination = this.pagination
916
+ if (this.pagination) {
917
+ // 监控每行显示多少条变量使用
918
+ this.pageSize = this.pagination.pageSize
919
+ }
920
+ gridParams.query = this.query
921
+ gridParams.dynamicColumnInfo = this.dynamicColumnInfo
922
+ gridParams.mainDefaultValueColumns = this.mainDefaultValueColumns
923
+ gridParams.contextParameter = this.contextParameter
924
+ // 是否显示分页区域
925
+ this.isShowPage = this.isShowPageArea()
926
+ // 子表是否分页
927
+ this.isSubTableShowPage = this.isFormSubTable ? this.isShowPage : false
928
+ gridParams.isSubTableShowPage = this.isSubTableShowPage
929
+ this.hasLoadedColumns = true
930
+ let canFetchData = true
931
+ if (isHasOptionFunction('loadBeforeSend', this.code)) {
932
+ canFetchData = gridParams.options.loadBeforeSend.call(this, {
933
+ columns: this.columns,
934
+ gridParams
935
+ })
936
+ }
937
+ if (canFetchData === undefined || canFetchData === true) {
938
+ // 表示初始化时查询记录
939
+ this.fetchData()
940
+ // if (this.options.isPageInfo) {
941
+ // // 表示是页面展示模式
942
+ // } else if (typeof (this.options.initSearch) === 'undefined') {
943
+ // if (typeof (gridParams.basicInfo.initializationQuery) === 'undefined' || gridParams.basicInfo.initializationQuery) {
944
+ // this.fetchData()
945
+ // }
946
+ // } else if (this.options.initSearch !== false) {
947
+ // this.fetchData()
948
+ // }
949
+ }
950
+ this.createBackgroundColorMap()
951
+ const p2 = new Date().getTime()
952
+ console.log('拿到共享数据并存储p2-p1=', p2 - p1)
953
+ console.log('拿到共享数据并存储p2-b=', p2 - b)
954
+ resolve()
955
+ // }).catch(error => {
956
+ // reject(error)
957
+ // })
958
+ // }).catch(error => {
959
+ // reject(error)
960
+ // })
961
+ }
962
+ const a1 = new Date().getTime()
963
+ console.log('初始化所耗时间', a1 - a)
964
+ })
965
+ },
966
+ packageColumnOptionMap(gridParams) {
967
+ const columnOptionMap = {}
968
+ if (gridParams.columns && gridParams.columns.length > 0) {
969
+ this.packageColumnOptionMapItems(gridParams.columns, columnOptionMap)
970
+ }
971
+ gridParams.columnOptionMap = columnOptionMap
972
+ },
973
+ packageColumnOptionMapItems(columns, columnOptionMap) {
974
+ columns.forEach(item => {
975
+ if (item.children && item.children.length > 0) {
976
+ this.packageColumnOptionMapItems(item.children, columnOptionMap)
977
+ }
978
+ if (item && item.prop) {
979
+ columnOptionMap[item.prop] = item
980
+ }
981
+ })
982
+ },
983
+ getDynamicColumnByBean(additionalParams, dynamicColumnInfos, columns, gridParams) {
984
+ return new Promise((resolve, reject) => {
985
+ if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
986
+ this.parentFormData = gridParams.options.extraParam.entityMap
987
+ }
988
+ if (!this.options.isPageInfo && dynamicColumnInfos && dynamicColumnInfos.length > 0) {
989
+ const totalDynamicColumns = []
990
+ this.getDynamicColumnByBeanWithOneSet(additionalParams, dynamicColumnInfos[0], columns, 0, dynamicColumnInfos, totalDynamicColumns, gridParams).then(totalDynamicColumns => {
991
+ resolve(totalDynamicColumns)
992
+ }).catch(error => {
993
+ reject(error)
994
+ })
995
+ } else {
996
+ resolve([])
997
+ }
998
+ })
999
+ },
1000
+ getDynamicColumnByBeanWithOneSet(additionalParams, dynamicColumnInfo, columns, index, dynamicColumnInfos, totalDynamicColumns, gridParams) {
1001
+ return new Promise((resolve, reject) => {
1002
+ if (dynamicColumnInfo && dynamicColumnInfo.beanName) {
1003
+ const url = Vue.prototype.baseURL + '/common/dynamic-columns'
1004
+ const param = {
1005
+ additionalParams, // 附加参数对象
1006
+ listCode: this.code,
1007
+ columns,
1008
+ beanName: dynamicColumnInfo.beanName
1009
+ }
1010
+ if (this.parentFormData) {
1011
+ // 初始化表单时,加载动态列需要
1012
+ if (gridParams.dynamicTemp) {
1013
+ param.parent = gridParams.dynamicTemp.parent
1014
+ param.watchParentAttrValues = gridParams.dynamicTemp.watchParentAttrValues
1015
+ } else {
1016
+ param.parent = this.parentFormData
1017
+ }
1018
+ // 监听主表字段的值
1019
+ if (dynamicColumnInfo.watchParentAttr) {
1020
+ const watchParentAttrs = dynamicColumnInfo.watchParentAttr.split(',')
1021
+ watchParentAttrs.forEach(watchParentAttr => {
1022
+ if (watchParentAttr) {
1023
+ // 存储属性对应的值
1024
+ if (!param.watchParentAttrValues) {
1025
+ param.watchParentAttrValues = {}
1026
+ }
1027
+ param.watchParentAttrValues[watchParentAttr] = this.parentFormData[watchParentAttr]
1028
+ const unWatch = this.$watch('parentFormData.' + watchParentAttr, function(newValue, oldValue) {
1029
+ // 重新加载表格及表格数据
1030
+ if (!gridParams.dynamicTemp) {
1031
+ gridParams.dynamicTemp = {}
1032
+ }
1033
+ gridParams.dynamicTemp.parent = this.parentFormData
1034
+ if (!gridParams.dynamicTemp.watchParentAttrValues) {
1035
+ gridParams.dynamicTemp.watchParentAttrValues = {}
1036
+ }
1037
+ gridParams.dynamicTemp.watchParentAttrValues[watchParentAttr] = newValue
1038
+ if (this.$refs && this.$refs.superGrid) {
1039
+ // 手动注销watch,否则会调用多次watch
1040
+ unWatch()
1041
+ // 重新加载表格及表格数据
1042
+ this.$emit('reload-grid')
1043
+ }
1044
+ })
1045
+ }
1046
+ })
1047
+ }
1048
+ }
1049
+ this.$http.post(url, param).then(dynamicColumns => {
1050
+ // 给动态列分组。如果是后台接口返回的动态列,保存时要自己实现动态列的保存
1051
+ dynamicColumnInfo.dynamicColumns = dynamicColumns
1052
+ totalDynamicColumns = totalDynamicColumns.concat(dynamicColumns)
1053
+ if (index + 1 < dynamicColumnInfos.length) {
1054
+ this.getDynamicColumnByBeanWithOneSet(additionalParams, dynamicColumnInfos[index + 1], columns, index + 1, dynamicColumnInfos, totalDynamicColumns)
1055
+ } else {
1056
+ resolve(totalDynamicColumns)
1057
+ }
1058
+ }).catch(() => {
1059
+ resolve([])
1060
+ })
1061
+ } else {
1062
+ resolve([])
1063
+ }
1064
+ })
1065
+ },
1066
+ // 列拖拽
1067
+ columnDrop() {
1068
+ const vm = this
1069
+ // 作用于实际展示列表数据时拖拽列
1070
+ let isDragColumnFlag = false
1071
+ if (typeof (this.options.isDragColumnFlag) !== 'undefined' && this.options.isDragColumn != null &&
1072
+ this.options.isDragColumn === true) {
1073
+ isDragColumnFlag = true
1074
+ const wrapperTr = document.querySelector('.el-table__header-wrapper tr')
1075
+ if (wrapperTr != null) {
1076
+ this.sortable = Sortable.create(wrapperTr, {
1077
+ animation: 180,
1078
+ delay: 0,
1079
+ onEnd: evt => {
1080
+ let oldIndex = evt.oldIndex
1081
+ let newIndex = evt.newIndex
1082
+ // 判断冻结列,获取真实index
1083
+ const frozenArr = []
1084
+ // const columns = this.listColumnList.filter(listColumn => {
1085
+ // return listColumn.listColumnFixed === 'left' || listColumn.listColumnFixed === 'right'
1086
+ // })
1087
+ for (var r = 0; r < vm.columns.length; r++) {
1088
+ if (vm.columns[r].fixed === 'left' || vm.columns[r].fixed === 'right') {
1089
+ frozenArr.push(r)
1090
+ }
1091
+ }
1092
+ if (frozenArr && frozenArr.length > 0) {
1093
+ for (var m = 0; m < frozenArr.length; m++) {
1094
+ if (frozenArr[m] >= newIndex) {
1095
+ newIndex--
1096
+ }
1097
+ if (frozenArr[m] >= oldIndex) {
1098
+ oldIndex--
1099
+ }
1100
+ }
1101
+ }
1102
+ if (oldIndex !== null && oldIndex !== undefined && oldIndex !== -1 && newIndex !== null && newIndex !== undefined && newIndex !== -1) {
1103
+ if (oldIndex > newIndex) {
1104
+ // 从后往前
1105
+ if (vm.columns && vm.columns.length > 0) {
1106
+ const item = vm.columns[oldIndex]
1107
+ for (var i = oldIndex - 1; i >= newIndex; i--) {
1108
+ const col = vm.columns[i]
1109
+ col.displayOrderType = 'custom'
1110
+ vm.columns[i + 1] = col
1111
+ }
1112
+ vm.columns[newIndex] = item
1113
+ }
1114
+ } else {
1115
+ // 从前往后
1116
+ if (vm.columns && vm.columns.length > 0) {
1117
+ const item = vm.columns[oldIndex]
1118
+ for (var k = oldIndex + 1; k <= newIndex; k++) {
1119
+ const col = vm.columns[k]
1120
+ col.displayOrderType = 'custom'
1121
+ vm.columns[k - 1] = col
1122
+ }
1123
+ vm.columns[newIndex] = item
1124
+ }
1125
+ }
1126
+ }
1127
+ vm.indexAfterTheChangeUpdateDisplayOrder(vm.columns, oldIndex, newIndex, 'displayOrder')
1128
+ let splitArr = []
1129
+ if (oldIndex > newIndex) {
1130
+ // 从后往前
1131
+ splitArr = vm.columns.slice(newIndex, oldIndex + 1)
1132
+ } else {
1133
+ // 从前往后
1134
+ splitArr = vm.columns.slice(oldIndex, newIndex + 1)
1135
+ }
1136
+ const params = {
1137
+ listCode: vm.code,
1138
+ columns: splitArr
1139
+ }
1140
+ vm.$http.post(Vue.prototype.baseAPI + '/component/super-grids/drag-columns', params).then(data => {
1141
+ console.log('移动成功')
1142
+ })
1143
+ // const oldIndex = evt.oldIndex
1144
+ // const newIndex = evt.newIndex
1145
+ // const currentItem = vm.columns[evt.oldIndex]
1146
+ // const targetItem = vm.columns[evt.newIndex]
1147
+ // const currentDisplayOrder = vm.getDisplayOrder(currentItem, oldIndex + 1)
1148
+ // const targetDisplayOrder = vm.getDisplayOrder(targetItem, newIndex + 1)
1149
+ // const params = {
1150
+ // 'listCode': vm.code,
1151
+ // 'oldIndex': currentDisplayOrder,
1152
+ // 'newIndex': targetDisplayOrder,
1153
+ // 'currentProp': currentItem.prop, // 当前拖动的列的属性名
1154
+ // 'targetProp': targetItem.prop // 拖动的列的原属性名
1155
+ // }
1156
+ // vm.$http.post(Vue.prototype.baseAPI + '/component/super-grids/drag-columns', params).then(data => {
1157
+ // vm.columns.splice(oldIndex, 1)
1158
+ // vm.columns.splice(newIndex, 0, currentItem)
1159
+ // vm.$set(currentItem, 'displayOrder', targetDisplayOrder)
1160
+ // vm.$set(currentItem, 'displayOrderType', 'custom')
1161
+ // vm.$set(targetItem, 'displayOrder', currentDisplayOrder)
1162
+ // vm.$set(targetItem, 'displayOrderType', 'custom')
1163
+ // })
1164
+ }
1165
+ })
1166
+ }
1167
+ }
1168
+ // 作用于列表管理编辑模式
1169
+ // 作用于列表管理编辑模式
1170
+ if (typeof (this.options.isAdministerListView) !== 'undefined' && this.options.isAdministerListView != null &&
1171
+ this.options.isAdministerListView === true && !isDragColumnFlag) {
1172
+ const wrapperTr = document.querySelector('.el-table__header-wrapper tr')
1173
+ if (wrapperTr != null) {
1174
+ this.sortable = Sortable.create(wrapperTr, {
1175
+ animation: 180,
1176
+ delay: 0,
1177
+ onEnd: evt => {
1178
+ const oldIndex = evt.oldIndex
1179
+ const newIndex = evt.newIndex
1180
+ const oldItem = this.columns[evt.oldIndex]
1181
+ const that = this
1182
+ that.columns.splice(oldIndex, 1)
1183
+ that.columns.splice(newIndex, 0, oldItem)
1184
+ this.$emit('columnDrop', oldIndex, newIndex)
1185
+ }
1186
+ })
1187
+ }
1188
+ }
1189
+ },
1190
+ // 移动完成后的displayOrder设置
1191
+ indexAfterTheChangeUpdateDisplayOrder(dataList, oldIndex, newIndex, prop) {
1192
+ if (dataList && dataList.length > 0) {
1193
+ if (oldIndex != null && oldIndex !== undefined && oldIndex !== -1) {
1194
+ if (newIndex !== null && newIndex !== undefined && newIndex !== -1) {
1195
+ if (prop && prop !== '') {
1196
+ const selectCol = dataList[newIndex]
1197
+ if (newIndex > oldIndex) {
1198
+ // 表示向后移动
1199
+ // 位置已经移动,所以参数要赋值给原始位置的下一个
1200
+ const afProp = dataList[newIndex - 1][prop]
1201
+ const arr = dataList.slice(oldIndex, newIndex)
1202
+ if (arr && arr.length > 0) {
1203
+ for (let i = arr.length - 1; i > -1; i--) {
1204
+ const col = arr[i]
1205
+ if (i === 0) {
1206
+ // 紧靠原始位置的上一个
1207
+ col[prop] = selectCol[prop]
1208
+ } else {
1209
+ col[prop] = arr[i - 1][prop]
1210
+ }
1211
+ }
1212
+ }
1213
+ selectCol[prop] = afProp
1214
+ } else {
1215
+ const befProp = dataList[newIndex + 1][prop]
1216
+ // 表示向前移动
1217
+ // 位置已经移动,所以参数要赋值给原始位置的上一个
1218
+ const arr = dataList.slice(newIndex + 1, oldIndex + 1)
1219
+ if (arr && arr.length > 0) {
1220
+ for (let i = 0; i < arr.length; i++) {
1221
+ const col = arr[i]
1222
+ if (i === arr.length - 1) {
1223
+ // 紧靠原始位置的上一个
1224
+ col[prop] = selectCol[prop]
1225
+ } else {
1226
+ col[prop] = arr[i + 1][prop]
1227
+ }
1228
+ }
1229
+ }
1230
+ selectCol[prop] = befProp
1231
+ }
1232
+ }
1233
+ }
1234
+ }
1235
+ }
1236
+ },
1237
+ getDisplayOrder(column, dragIndex) {
1238
+ if (column && column.displayOrder !== undefined && column.displayOrder !== null) {
1239
+ return column.displayOrder
1240
+ } else {
1241
+ return dragIndex + 1
1242
+ }
1243
+ },
1244
+ getShowColumns(data) {
1245
+ let showColumns = []
1246
+ if (typeof (this.options.showColumns) !== 'undefined') {
1247
+ showColumns = this.options.showColumns.split(',')
1248
+ }
1249
+ if (showColumns.length > 0) {
1250
+ const columns = []
1251
+ for (let i = 0; i < data.columns.length; i++) {
1252
+ const column = data.columns[i]
1253
+ const prop = column.prop
1254
+ if (prop === '$index' || prop === '$selection') {
1255
+ columns.push(column)
1256
+ continue
1257
+ }
1258
+ if (column.hasOwnProperty('children')) {
1259
+ // 表示是组合表头,需要判断子表头是否显示
1260
+ const children = this.getChildrenColumns(column.children, showColumns)
1261
+ column.children = children
1262
+ if (children.length > 0) {
1263
+ columns.push(column)
1264
+ }
1265
+ } else {
1266
+ if (showColumns.indexOf(prop) >= 0) {
1267
+ columns.push(column)
1268
+ }
1269
+ }
1270
+ }
1271
+ data.columns = columns
1272
+ }
1273
+ },
1274
+ getChildrenColumns(children, showColumns) {
1275
+ const columns = []
1276
+ for (let i = 0; i < children.length; i++) {
1277
+ const column = children[i]
1278
+ const prop = column.prop
1279
+ if (column.hasOwnProperty('children')) {
1280
+ // 表示是组合表头,需要判断子表头是否显示
1281
+ const children = this.getChildrenColumns(column.children, showColumns)
1282
+ column.children = children
1283
+ if (children.length > 0) {
1284
+ columns.push(column)
1285
+ }
1286
+ } else {
1287
+ if (showColumns.indexOf(prop) >= 0) {
1288
+ columns.push(column)
1289
+ }
1290
+ }
1291
+ }
1292
+ return columns
1293
+ },
1294
+ // 保存拖动列宽
1295
+ saveColumnWidth(prop, width) {
1296
+ return new Promise((resolve, reject) => {
1297
+ if (width !== undefined) {
1298
+ const params = {
1299
+ 'prop': prop,
1300
+ 'width': width + ''
1301
+ }
1302
+ this.$http.post(Vue.prototype.baseAPI + '/component/super-grids/setting-column-widths/' + this.code, params).then(data => {
1303
+ resolve(width)
1304
+ }).catch(error => {
1305
+ reject(error)
1306
+ })
1307
+ } else {
1308
+ resolve()
1309
+ }
1310
+ })
1311
+ }
1312
+ }
1313
+ export default superGridService