imatrix-ui 2.9.15-dw-tmp2 → 2.9.16-boe2

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 (193) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.umd.min.js +5 -35
  3. package/package.json +2 -2
  4. package/src/api/sso-service.js +19 -1
  5. package/src/assets/nonemessage.png +0 -0
  6. package/src/i18n/i18n.js +1 -1
  7. package/src/i18n/langs/cn.js +18 -6
  8. package/src/i18n/langs/en.js +20 -7
  9. package/src/permission.js +2 -2
  10. package/src/plugins.js +3 -3
  11. package/src/router/index.js +10 -0
  12. package/src/store/modules/tab-content.js +6 -0
  13. package/src/store/modules/user.js +32 -2
  14. package/src/styles/display-layout.scss +1 -1
  15. package/src/styles/index.scss +74 -4
  16. package/src/styles/theme/black/font-style.scss +70 -0
  17. package/src/styles/theme/black/index.scss +6 -30
  18. package/src/styles/theme/blue/font-style.scss +37 -0
  19. package/src/styles/theme/blue/index.scss +2 -18
  20. package/src/styles/theme/blue2/font-style.scss +70 -0
  21. package/src/styles/theme/blue2/index.scss +3 -13
  22. package/src/styles/theme/dark-blue/card.scss +4 -6
  23. package/src/styles/theme/dark-blue/form.scss +7 -4
  24. package/src/styles/theme/dark-blue/index.scss +30 -5
  25. package/src/styles/theme/dark-blue/message.scss +8 -0
  26. package/src/styles/theme/dark-blue/radio.scss +13 -0
  27. package/src/styles/theme/dark-blue/sidebar.scss +7 -37
  28. package/src/styles/theme/dark-blue/tab.scss +4 -1
  29. package/src/styles/theme/dark-blue/table.scss +1 -1
  30. package/src/styles/theme/dark-blue/tree.scss +35 -10
  31. package/src/styles/theme/gray/card-style.scss +13 -1
  32. package/src/styles/theme/gray/font-style.scss +38 -0
  33. package/src/styles/theme/gray/index.scss +13 -25
  34. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  35. package/src/styles/theme/gray/sidebar.scss +7 -14
  36. package/src/utils/auth-api.js +47 -1
  37. package/src/utils/common-util.js +22 -81
  38. package/src/utils/jump-page-utils.js +3 -6
  39. package/src/utils/range-selector.js +185 -0
  40. package/src/utils/request.js +6 -3
  41. package/src/utils/util.js +13 -11
  42. package/src/utils/workflow-util.js +3 -0
  43. package/src/views/dsc-component/Sidebar/Item.vue +7 -5
  44. package/src/views/dsc-component/Sidebar/SidebarItem.vue +2 -3
  45. package/src/views/dsc-component/Sidebar/index.vue +12 -20
  46. package/src/views/dsc-component/tabs/tab-content.vue +8 -9
  47. package/src/views/layout/EmptyLayout.vue +4 -1
  48. package/src/views/layout/NewLayout.vue +6 -65
  49. package/src/views/layout/components/AppMain.vue +2 -1
  50. package/src/views/layout/components/Menubar/Item.vue +23 -7
  51. package/src/views/layout/components/Menubar/Link.vue +11 -2
  52. package/src/views/layout/components/Menubar/SidebarItem.vue +50 -7
  53. package/src/views/layout/components/Menubar/index.vue +51 -16
  54. package/src/views/layout/components/tabs/tab-content.vue +162 -0
  55. package/src/views/layout/tab-content-iframe-index.vue +31 -0
  56. package/src/views/layout/tab-content-index.vue +85 -0
  57. package/src/views/login/index.vue +1 -1
  58. package/packages/breadcrumb/index.js +0 -6
  59. package/packages/breadcrumb/src/breadcrumb.vue +0 -71
  60. package/packages/department-tree/index.js +0 -6
  61. package/packages/department-tree/src/department-tree.vue +0 -108
  62. package/packages/department-tree-inline/index.js +0 -6
  63. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +0 -408
  64. package/packages/department-tree-inline/src/department-single-tree-inline.vue +0 -290
  65. package/packages/department-tree-inline/src/department-tree-inline.vue +0 -86
  66. package/packages/department-tree-inline/src/department-tree-service.js +0 -273
  67. package/packages/department-tree-inline/src/search-result.vue +0 -176
  68. package/packages/department-user-tree/index.js +0 -6
  69. package/packages/department-user-tree/src/department-user-multiple-tree.vue +0 -116
  70. package/packages/department-user-tree/src/department-user-single-tree.vue +0 -76
  71. package/packages/department-user-tree/src/department-user-tree.vue +0 -101
  72. package/packages/department-user-tree-inline/index.js +0 -6
  73. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +0 -636
  74. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +0 -271
  75. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +0 -79
  76. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +0 -248
  77. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -142
  78. package/packages/department-user-tree-inline/src/search-result.vue +0 -197
  79. package/packages/directives/prevent-reclick.js +0 -19
  80. package/packages/dynamic-source-select/index.js +0 -6
  81. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +0 -70
  82. package/packages/dynamic-source-select/src/dynamic-source-select.vue +0 -440
  83. package/packages/dynamic-source-select/src/events.js +0 -55
  84. package/packages/fs-preview/index.js +0 -6
  85. package/packages/fs-preview/src/fs-preview.vue +0 -226
  86. package/packages/fs-upload/index.js +0 -6
  87. package/packages/fs-upload/src/fs-upload-multi.vue +0 -420
  88. package/packages/fs-upload/src/fs-upload-single.vue +0 -312
  89. package/packages/fs-upload/src/fs-upload.vue +0 -189
  90. package/packages/fs-upload/src/see-big-picture.vue +0 -55
  91. package/packages/fs-upload-list/index.js +0 -6
  92. package/packages/fs-upload-list/src/fs-upload-list.vue +0 -287
  93. package/packages/hamburger/index.js +0 -6
  94. package/packages/hamburger/src/hamburger.vue +0 -38
  95. package/packages/index.js +0 -121
  96. package/packages/multipart-upload/index.js +0 -6
  97. package/packages/multipart-upload/src/index.vue +0 -73
  98. package/packages/multipart-upload/src/multipart-upload-form.vue +0 -297
  99. package/packages/multipart-upload/src/multipart-upload-list.vue +0 -378
  100. package/packages/organization-input/index.js +0 -6
  101. package/packages/organization-input/src/organization-input.vue +0 -542
  102. package/packages/plugins/export-data-new.js +0 -466
  103. package/packages/plugins/export-data.js +0 -361
  104. package/packages/plugins/index.js +0 -15
  105. package/packages/plugins/public-method.js +0 -43
  106. package/packages/remove-department/index.js +0 -6
  107. package/packages/remove-department/src/remove-department.vue +0 -172
  108. package/packages/remove-department/src/remove-dept-service.js +0 -20
  109. package/packages/remove-user/index.js +0 -6
  110. package/packages/remove-user/src/remove-user-service.js +0 -20
  111. package/packages/remove-user/src/remove-user.vue +0 -195
  112. package/packages/remove-workgroup/index.js +0 -6
  113. package/packages/remove-workgroup/src/remove-workgroup-service.js +0 -20
  114. package/packages/remove-workgroup/src/remove-workgroup.vue +0 -159
  115. package/packages/rich-editor/index.js +0 -7
  116. package/packages/rich-editor/index.vue +0 -278
  117. package/packages/rich-editor/langs/zh-Hans.js +0 -1
  118. package/packages/rich-editor/viewer.vue +0 -103
  119. package/packages/scan-code-input/index.js +0 -6
  120. package/packages/scan-code-input/src/events.js +0 -33
  121. package/packages/scan-code-input/src/scan-code-input-colse.vue +0 -131
  122. package/packages/scan-code-input/src/scan-code-input.vue +0 -116
  123. package/packages/secret-info/index.js +0 -7
  124. package/packages/secret-info/index.vue +0 -90
  125. package/packages/super-grid/index.js +0 -7
  126. package/packages/super-grid/src/apis.js +0 -820
  127. package/packages/super-grid/src/columns-config.vue +0 -335
  128. package/packages/super-grid/src/custom-formatter.js +0 -278
  129. package/packages/super-grid/src/dynamic-input.vue +0 -1279
  130. package/packages/super-grid/src/eventBus.js +0 -2
  131. package/packages/super-grid/src/events.js +0 -55
  132. package/packages/super-grid/src/formValidatorUtil.js +0 -226
  133. package/packages/super-grid/src/formatter.js +0 -181
  134. package/packages/super-grid/src/group-column.vue +0 -100
  135. package/packages/super-grid/src/header-context-menu.vue +0 -87
  136. package/packages/super-grid/src/index-column.vue +0 -51
  137. package/packages/super-grid/src/normal-column.vue +0 -771
  138. package/packages/super-grid/src/public-methods.js +0 -31
  139. package/packages/super-grid/src/row-operation.vue +0 -161
  140. package/packages/super-grid/src/search-button.vue +0 -66
  141. package/packages/super-grid/src/search-condition-input.vue +0 -61
  142. package/packages/super-grid/src/search-condition-list.vue +0 -59
  143. package/packages/super-grid/src/search-form-advancedQuery.vue +0 -653
  144. package/packages/super-grid/src/search-form-dialog.vue +0 -79
  145. package/packages/super-grid/src/search-form-item.vue +0 -404
  146. package/packages/super-grid/src/search-form-number.vue +0 -38
  147. package/packages/super-grid/src/search-form-open.vue +0 -170
  148. package/packages/super-grid/src/search-form-ordinarySearch.vue +0 -196
  149. package/packages/super-grid/src/search-form.vue +0 -642
  150. package/packages/super-grid/src/search-methods.js +0 -448
  151. package/packages/super-grid/src/selection-column.vue +0 -43
  152. package/packages/super-grid/src/store.js +0 -3
  153. package/packages/super-grid/src/super-grid-service.js +0 -593
  154. package/packages/super-grid/src/super-grid.vue +0 -2882
  155. package/packages/super-grid/src/utils.js +0 -762
  156. package/packages/super-grid/src/view-image-dialog.vue +0 -130
  157. package/packages/super-nine-grid/index.js +0 -7
  158. package/packages/super-nine-grid/src/apis.js +0 -103
  159. package/packages/super-nine-grid/src/custom-formatter.js +0 -66
  160. package/packages/super-nine-grid/src/formatter.js +0 -132
  161. package/packages/super-nine-grid/src/search-form-number.vue +0 -38
  162. package/packages/super-nine-grid/src/search-form.vue +0 -430
  163. package/packages/super-nine-grid/src/search-methods.js +0 -134
  164. package/packages/super-nine-grid/src/store.js +0 -3
  165. package/packages/super-nine-grid/src/super-grid-service.js +0 -91
  166. package/packages/super-nine-grid/src/super-nine-grid.vue +0 -872
  167. package/packages/super-nine-grid/src/utils.js +0 -261
  168. package/packages/svg-icon/index.js +0 -6
  169. package/packages/svg-icon/src/svg-icon.vue +0 -43
  170. package/packages/utils/memory-cache-utils.js +0 -90
  171. package/packages/utils/utils.js +0 -152
  172. package/packages/utils/value-set.js +0 -86
  173. package/packages/valid-code/index.js +0 -7
  174. package/packages/valid-code/src/valid-code.vue +0 -95
  175. package/packages/workflow-button/index.js +0 -6
  176. package/packages/workflow-button/src/workflow-button.vue +0 -325
  177. package/packages/workflow-history-list/index.js +0 -6
  178. package/packages/workflow-history-list/src/api.js +0 -7
  179. package/packages/workflow-history-list/src/workflow-history-list.vue +0 -185
  180. package/packages/workgroup-tree/index.js +0 -6
  181. package/packages/workgroup-tree/src/workgroup-tree.vue +0 -76
  182. package/packages/workgroup-tree-inline/index.js +0 -6
  183. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +0 -317
  184. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +0 -43
  185. package/packages/workgroup-user-tree/index.js +0 -6
  186. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +0 -100
  187. package/packages/workgroup-user-tree-inline/index.js +0 -6
  188. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +0 -163
  189. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +0 -436
  190. package/packages/year-range-picker/index.js +0 -6
  191. package/packages/year-range-picker/src/year-range-picker.vue +0 -51
  192. package/src/index.js +0 -93
  193. package/src/styles/theme/gray/form-style.scss +0 -41
@@ -1,762 +0,0 @@
1
- import Vue from 'vue'
2
- import {
3
- getToken
4
- } from '../../../src/utils/auth'
5
- import {
6
- isPlateSys,
7
- isShowMenuRoute
8
- } from '../../../src/utils/common-util'
9
- import {
10
- getEntityFieldValue
11
- } from '../../../src/utils/util'
12
- import store from './store'
13
- export function getColumnValues(data, prop) {
14
- const values = []
15
- for (const obj of data) {
16
- values.push(obj[prop])
17
- }
18
- return values
19
- }
20
- /**
21
- * 返回的数组表示当前列每行的合并情况:[3,0,0,1,1]表示1到3行合并,四五行不合并
22
- * @param {Array} data 列表数据
23
- * @param {String} prop 列名
24
- */
25
- export function getSpanValuesForColumn(data, prop, mergerCellBasis) {
26
- const spanArr = []
27
- let pos = 0
28
- for (let i = 0; i < data.length; i++) {
29
- if (i === 0) {
30
- spanArr.push(1)
31
- pos = 0
32
- } else {
33
- if (mergerCellBasis && mergerCellBasis !== '') {
34
- // 判断当前元素与上一个元素是否相同
35
- let compareValue1 = ''
36
- let compareValue2 = ''
37
- const arr = mergerCellBasis.split(',')
38
- for (let k = 0; k < arr.length; k++) {
39
- compareValue1 += data[i][arr[k]]
40
- compareValue2 += data[i - 1][arr[k]]
41
- }
42
- if (compareValue1 === compareValue2) {
43
- spanArr[pos] += 1
44
- spanArr.push(0)
45
- } else {
46
- spanArr.push(1)
47
- pos = i
48
- }
49
- } else {
50
- // 判断当前元素与上一个元素是否相同
51
- if (data[i][prop] === data[i - 1][prop]) {
52
- spanArr[pos] += 1
53
- spanArr.push(0)
54
- } else {
55
- spanArr.push(1)
56
- pos = i
57
- }
58
- }
59
- }
60
- }
61
- return spanArr
62
- }
63
-
64
- export function getFirstEditableColumn(listCode) {
65
- if (!listCode) {
66
- listCode = store.get('_list_code')
67
- }
68
- for (const column of store.get(listCode).columns) {
69
- if (column.editable) {
70
- return column.prop
71
- }
72
- }
73
- return null
74
- }
75
-
76
- const ArrowKeyAction = {
77
- getIndex(prop) {
78
- let i = 0
79
- for (const column of store.columns) {
80
- if (column.prop === prop) {
81
- return i
82
- } else {
83
- i++
84
- }
85
- }
86
- },
87
- getLeftColumn(prop) {
88
- const index = ArrowKeyAction.getIndex(prop)
89
- let i = 0
90
- for (i = index - 1; i >= 0; i--) {
91
- if (store.columns[i].editable) {
92
- return store.columns[i].prop
93
- } else {
94
- return null
95
- }
96
- }
97
- }
98
-
99
- }
100
- export {
101
- ArrowKeyAction
102
- }
103
-
104
- // 行编辑时设置当前选中行
105
- export function setCurrentRow(rowIndex, listCode) {
106
- if (!listCode) {
107
- listCode = store.get('_list_code')
108
- }
109
- const gridParams = store.get(listCode)
110
- if (rowIndex < gridParams.gridData.length) {
111
- // 新建时会传过来比记录条数大的行号
112
- if (gridParams.isMulitiSelect) {
113
- gridParams.superGrid.clearSelection()
114
- gridParams.superGrid.toggleRowSelection(gridParams.gridData[rowIndex], true)
115
- } else {
116
- gridParams.superGrid.setCurrentRow(gridParams.gridData[rowIndex])
117
- }
118
- }
119
- }
120
-
121
- // 判断两个对象内容是否相等
122
- export function isObjectValueEqual(a, b) {
123
- if (!a && !b) {
124
- return true
125
- }
126
- if (a && b) {
127
- var aProps = getProps(a)
128
- var bProps = getProps(b)
129
- let forProps = aProps
130
- if (aProps.length > bProps.length) {
131
- forProps = aProps
132
- } else {
133
- forProps = bProps
134
- }
135
-
136
- for (var i = 0; i < forProps.length; i++) {
137
- var propName = forProps[i]
138
- if (propName === '$editing') {
139
- continue
140
- }
141
- var propA = a[propName]
142
- var propB = b[propName]
143
- if (propA !== propB) {
144
- return false
145
- }
146
- }
147
- return true
148
- }
149
- return false
150
- }
151
-
152
- function getProps(obj) {
153
- const props = []
154
- for (var name in obj) {
155
- props.push(name)
156
- }
157
- return props
158
- }
159
-
160
- // 最后编辑的行是否保存
161
- export function isLastEditRowSave(listCode) {
162
- if (!listCode) {
163
- listCode = store.get('_list_code')
164
- }
165
- const gridParams = store.get(listCode)
166
- if (gridParams.isEditRow !== undefined && gridParams.isEditRow === true) {
167
- // 表示有正在编辑的行,不能编辑其他行
168
- return false
169
- }
170
- if (typeof (gridParams.$rowIndex) === 'undefined' || gridParams.$rowIndex === null) {
171
- // 表示没有在该列表编辑任何行,可以编辑行
172
- return true
173
- }
174
- if (typeof (gridParams.$lastSaveRowIndex) === 'undefined' || gridParams.$lastSaveRowIndex === null) {
175
- // 表示没有在该列表保存任何行,可以编辑行
176
- return true
177
- }
178
- if (gridParams.$rowIndex === gridParams.$lastSaveRowIndex) {
179
- // 当前编辑行 等于 最后保存的行号,则表示最后编辑的行已保存
180
- return true
181
- }
182
- return false
183
- }
184
-
185
- // 是否可以刷新列表
186
- export function isCanRefreshGrid(listCode) {
187
- if (!listCode) {
188
- listCode = store.get('_list_code')
189
- }
190
- const gridParams = store.get(listCode)
191
- if (gridParams.isEditRow !== undefined && gridParams.isEditRow === true) {
192
- // 表示有正正编辑的行,不能刷新列表
193
- return false
194
- }
195
- const isEditRowSave = isLastEditRowSave()
196
- if (!isEditRowSave) {
197
- // 如果最后编辑行没有保存或撤销编辑,则表示当前列表中有编辑行,不能刷新列表数据
198
- return false
199
- }
200
-
201
- if (typeof (gridParams.isCreateRow) !== 'undefined' && gridParams.isCreateRow === true) {
202
- // 说明刚刚新建的行还没有保存 或 撤销编辑,表示当前列表中有编辑行,不能刷新列表数据
203
- return false
204
- }
205
- return true
206
- }
207
-
208
- function getEntityId(row) {
209
- if (row && row.id) {
210
- return row.id
211
- } else if (row && row.ID) {
212
- return row.ID
213
- }
214
- }
215
-
216
- // 行编辑时,是否有权限编辑某字段
217
- export function isDisableEdit(prop, listCode, row) {
218
- if (!listCode) {
219
- listCode = store.get('_list_code')
220
- }
221
- // 默认是可编辑的
222
- let isDiabled = false
223
- const gridParams = store.get(listCode)
224
- const disableEditProps = isHasEditOption('disableEditProps', listCode) ? gridParams.options.lineEditOptions.disableEditProps : null
225
- if (disableEditProps) {
226
- const disableEditPropsArr = disableEditProps.split(',')
227
- if (disableEditPropsArr && disableEditPropsArr.indexOf(prop) >= 0) {
228
- isDiabled = true
229
- }
230
- }
231
- const rowId = getEntityId(row)
232
- if (isDiabled === false && gridParams.options) {
233
- const fieldPermissions = gridParams.options.validateRules
234
- if (fieldPermissions) {
235
- const fieldRule = fieldPermissions.filter(item => item.name && (item.name === prop || item.name === 'all_fields'))
236
- let canEdit = true
237
- if (fieldRule && fieldRule.length > 0) {
238
- for (let i = 0; i < fieldRule.length; i++) {
239
- if (fieldRule[i].rowIndexes === undefined || fieldRule[i].rowIndexes === null) {
240
- canEdit = fieldRule[i].canEdit
241
- } else if (fieldRule[i].rowIndexes.indexOf(rowId) >= 0) {
242
- canEdit = fieldRule[i].canEdit
243
- } else {
244
- canEdit = true
245
- }
246
- }
247
- if (canEdit === false) {
248
- isDiabled = true
249
- }
250
- // const fieldPermission = fieldRule[0]
251
- // const canEdit = fieldPermission.canEdit
252
- // if (typeof canEdit !== 'undefined' && canEdit === false) {
253
- // // 表示禁止编辑
254
- // if (fieldPermission.rowIndexes === undefined || (rowId !== undefined && fieldPermission.rowIndexes && fieldPermission.rowIndexes.indexOf(rowId) >= 0)) {
255
- // // 表示是子表记录,需要验证当前行是否需要禁止编辑
256
- // isDiabled = true
257
- // }
258
- // }
259
- }
260
- }
261
- if (isDiabled === false) {
262
- // 根据子表的修改权限来判断是否可编辑,如果不能修改,则该行记录禁止编辑
263
- const actionPermission = gridParams.options.actionPermission
264
- const isOneRowCanUpdate = isRowCanUpdate(actionPermission, rowId)
265
- if (isOneRowCanUpdate === false) {
266
- // 如果当前行是禁止修改的,则当前行所有字段都禁止编辑
267
- isDiabled = true
268
- }
269
- }
270
- }
271
- return isDiabled
272
- }
273
-
274
- // 行编辑时,是否必填某字段
275
- export function isRequiredEdit(prop, listCode) {
276
- if (!listCode) {
277
- listCode = store.get('_list_code')
278
- }
279
- // 默认是不必填的
280
- let isRequired = false
281
- // 表示是可以编辑的,不是禁止编辑的字段,才判断是否必填
282
- const gridParams = store.get(listCode)
283
- if (gridParams && gridParams.options) {
284
- const fieldPermissions = gridParams.options.validateRules
285
- if (fieldPermissions) {
286
- const fieldRule = fieldPermissions.filter(item => (item.name && (item.name === prop || item.name === 'all_fields') && item.canEdit !== undefined && item.canEdit === true))
287
- if (fieldRule && fieldRule.length > 0) {
288
- isRequired = true
289
- }
290
- }
291
- }
292
- return isRequired
293
- }
294
-
295
- // 当前行是否可修改
296
- function isRowCanUpdate(tableActionPermission, rowId) {
297
- let canUpdate = true
298
- const oneTableActionPermission = tableActionPermission
299
- if (oneTableActionPermission && oneTableActionPermission.canUpdate !== undefined && oneTableActionPermission.canUpdate === false &&
300
- (rowId !== undefined && oneTableActionPermission.updateRowIndexes && oneTableActionPermission.updateRowIndexes.indexOf(rowId) >= 0)) {
301
- // 表示是子表字段,且新建的记录(未保存的)可以修改 或 指定行不能修改
302
- canUpdate = false
303
- }
304
- return canUpdate
305
- }
306
-
307
- /**
308
- * 是否是行编辑时的属性
309
- * @param {*} event
310
- */
311
- export function isHasEditOption(event, listCode) {
312
- if (!listCode) {
313
- listCode = store.get('_list_code')
314
- }
315
- const gridParams = store.get(listCode)
316
- if (gridParams.options.lineEditOptions && gridParams.options.lineEditOptions[event]) {
317
- return true
318
- }
319
- return false
320
- }
321
-
322
- export function isEditOptionFunction(event, listCode) {
323
- if (!listCode) {
324
- listCode = store.get('_list_code')
325
- }
326
- const gridParams = store.get(listCode)
327
- if (gridParams.options.lineEditOptions && typeof (gridParams.options.lineEditOptions[event]) === 'function') {
328
- return true
329
- }
330
- return false
331
- }
332
-
333
- /**
334
- * 是否是行编辑时的属性
335
- * @param {*} event
336
- */
337
- export function isHasOptionFunction(event, listCode) {
338
- if (!listCode) {
339
- listCode = store.get('_list_code')
340
- }
341
- const gridParams = store.get(listCode)
342
- if (gridParams.options && typeof (gridParams.options[event]) === 'function') {
343
- return true
344
- }
345
- return false
346
- }
347
-
348
- export function isOptionFunction(props, listCode) {
349
- if (!listCode) {
350
- listCode = store.get('_list_code')
351
- }
352
- const gridParams = store.get(listCode)
353
- if (props && props.indexOf('.') > 0) {
354
- let optionProp = gridParams.options
355
- const propsArr = props.split('.')
356
- for (let i = 0; i < propsArr.length; i++) {
357
- const event = propsArr[i]
358
- if (optionProp) {
359
- if (typeof (optionProp[event]) === 'function') {
360
- return true
361
- } else {
362
- optionProp = optionProp[event]
363
- }
364
- } else {
365
- return false
366
- }
367
- }
368
- } else {
369
- if (gridParams.options && typeof (gridParams.options[event]) === 'function') {
370
- return true
371
- }
372
- }
373
- }
374
-
375
- /**
376
- * 获得控制表格需要的参数
377
- */
378
- export function getGridParams() {
379
- const gridParams = {
380
- columns: [],
381
- gridData: [],
382
- orgGridData: [], // 行编辑保存时使用
383
- canSaveRow: true, // 行编辑时是否可以保存行记录的状态为
384
- showValidateError: true, // 是否可以显示验证信息,防止同时弹出两个验证信息的
385
- defaultLineEditOptions: {
386
- 'aftersaveIsCreateRow': true, // 保存成功后,是否自动新增一行
387
- 'autoSave': true, // 失去焦点时,是否自动保存
388
- 'isSaveByEnter': true, // 点击enter时,是否自动保存
389
- 'isRestoreByEsc': true, // 点击ESC时,是否撤销编辑,
390
- 'aftersaveIsCancelEditState': true, // 保存后,是否取消编辑状态
391
- 'afterRestoreIsCancelEditState': true, // 撤销编辑后,是否取消编辑状态
392
- 'input': function () { } // 数据改变时触发
393
- // 'beforeSave': function() { return true }, // 保存行数据前的回调
394
- // 'saveSuccess': function() {}, // 保存行数据成功的回调
395
- // 'saveError': function() {}, // 保存行数据发生异常的回调
396
- // 'beforeRestore': function() { return true }, // 撤销编辑前
397
- // 'afterRestore': function() {}, // 撤销编辑后
398
- // 'input': function() {}, // 数据改变时触发
399
- // 'enter': function() {}, // enter回调
400
- // 'esc': function() {}, // ESC回调
401
- // 'focus': function() {}, // 获得焦点
402
- // 'change': function() {}, // 值发生变化
403
- // 'clear': function() {}, // 清空组件数据
404
- // 'blur': function() {}, // 失去焦点
405
- // 'remove-tag': function() {}, // select 多选模式下移除tag时触发
406
- // 'visible-tag': function() {}, // 下拉框出现/隐藏时触发
407
- // 'select-value': function() {}, // 组织树关闭时回调
408
- // 'disableEditProps': '', // 字段配置的是可编辑的,但是当前用户没有权限禁止编辑的字段属性名,多个属性名之间以逗号隔开,例如:name,address
409
- // 'beforeInsertRow': function(gridData, rowIndex) { return true }, // 插入行前的回调
410
- // 'afterInsertRow': function(gridData, rowIndex) {}, // 插入行后的回调
411
- // 'beforeEdit': function(gridData, rowIndex) { return true } // 编辑当前行前
412
- },
413
- options: {
414
- // 行编辑需要的一些回调事件
415
- lineEditOptions: {
416
- // urlToSaveRow:'', // 保存行记录的url,如果设置了以该设置的为准
417
- // isEnableValidate: true, // 保存行记录时,是否启用必填验证
418
- // saveRow: function(){return new Promise((resolve, reject) => {...resolve(data)})} // 需要返回的是保存后的行记录的值
419
- }
420
- // 自定义行编辑
421
- // customFormatter: {
422
- // },
423
- // 动态列
424
- // dynamicColumns: [],
425
- // 附加参数
426
- // extraParam: {},
427
- // 表头渲染设置
428
- // 格式为:{'props':'fieldName,fieldName,fieldName','color':'表头的背景色。样式表支持的颜色'}
429
- // renderHeader: {},
430
- // 渲染行数据,格式为:{rowIndex:'color',rowIndex:'color'},rowIndex的从0开始计数
431
- // renderRow: {},
432
- // 渲染行的回调方法,返回值是个对象,如:{'background': 'red'},详情见element-ui的官方文档
433
- // rowStyleRender({row, rowIndex}){},
434
- // 表格及数据均加载完成后
435
- // gridComplete: function(gridData, columns) {}, // gridData, columns
436
- // 刚请求到字段配置,没有请求数据时,可以通过该方法修改表头或添加自定义表头
437
- // loadBeforeSend: function(columns, settings) { return true }, // columns, settings(列表所有设置,包括字段设置、分页设置、查询设置、行编辑设置)
438
- // 数据加载失败的回调方法
439
- // loadError: function(code, error) {}, // code, error
440
- // 数据请求成功后,表格记录显示前的回调方法,该方法主要是处理业务数据,比如:处理xss攻击
441
- // gridDataLoaded: function(data) { return data },
442
- // 查询组件需要的一些参数
443
- // search: {
444
- // // 属性自定义组件,当不是行编辑时,查询框需要自定义控件时
445
- // customSearchElements: function(column) { return null },
446
- // labelWidth: '150px',
447
- // fieldNum: 4, // 查询的每行排放的字段个数,默认是4个字段
448
- // },
449
- // isDargColumn: false, // 是否可以拖动列顺序,true表示可以拖动,false表示不能拖动,默认是false不可以拖动
450
- // showColumns: '', // 要显示的属性名集合,多个属性之间以逗号隔开
451
- // subRowUrl: '', // 树形数据时,获得子数据集合的请求url路径,例如:http://localhost:90902/cm/ecn-sub-list
452
- // loadChildrenComplete: function(parentRow, childrenData, columns) {}, // parentRow, childrenData, columns
453
- // isSql:false, // 是否是sql查询数据内容。在使用sql语句查询表内容时,否则会导致列表字段的值不显示,都显示为空
454
- // initSearchForm: [], // 初始查询条件,格式同“查询”按钮封装的json格式
455
- // multiple: true/false,// 是否多选,默认以列表管理中配置的为准
456
- // showIndex: true/false,// 是否显示序号,默认以列表管理中配置的为准
457
- // initSortInfo: {prop:'',order: 'ASC/DESC'},// 默认排序字段,和排序方式
458
- // pageSizes: '20,30,50,100',// 可选行数
459
- // initSearch: true/false, // 初始化时是否查询,默认是查询
460
- // parentProp: 'parentId', // 树状结构数据时,父字段名,默认是parentId
461
- // operations:{ // 对象名为属性名,值为该列所具有的组件信息
462
- // 'operation':[ // 例如操作列,按钮组
463
- // {props:{elementType:'button',label:'删除',size:'mini',type:'danger',icon:'el-icon-delete',style:{marginLeft:'10px'}},isShow:function(originalValue, formatValue, row, column, rowIndex){},onClick:function(originalValue, formatValue, row, this.column, rowIndex){}}
464
- // ],
465
- // 'name':[ // 例如:名称列,超链接
466
- // {props:{elementType:'link',type:'primary'},onClick:function(originalValue, formatValue, row, column, rowIndex){},isShow:function(originalValue, formatValue, row, column, rowIndex){}}
467
- // ]
468
- // },
469
- // 'eventCallBack':{// 行编辑控件事件对应的回调方法,funName1、funName2是自定义的方法名,自己定义即可
470
- // funName1:function({event,value,row,column,prop,originalValue, appendValue,newValue}){},
471
- // funName2:function({event,value,row,column,prop,originalValue, appendValue,newValue}){}
472
- // },
473
- // isHiddenSearchForm: false, //查询时,是否隐藏查询区域,不配置默认是显示的
474
- // align:left/center/right, //记录对齐方式,默认是left
475
- // headerAlign: left/center/right, // 表头对齐方式,若不设置该项,则使用表格的对齐方式
476
- // showOverflowTooltip: true, // 内容过长是否省略号显示,不换行,默认是true,显示省略号
477
- // isDefaultShowEdit: false, // 行编辑时,当表格没有记录时,是否默认创建一行空记录,默认时false,不创建
478
- // system: {}, // 当前系统对象,链接跳转页面时使用
479
- // additionalParamMap: '{}', // 附加参数json字符串
480
- // validateRules: {prop1:{name:'prop1',canEdit:true/false,dataType:'xxx',label:'xxx',rowIndexes:[10,11,13]},prop2:{name:'prop2',canEdit:true/false,dataType:'xxx',label:'xxx',rowIndexes:[10,11,13]}},//流程编辑器的验证规则或用户自己定义的规则
481
- // actionPermission: { 'canAdd': true, 'canUpdate': true, 'canDelete': true }, // 列表行编辑时控制按钮的权限
482
- // formData: {}, // 主表单的实体信息
483
- // hiddenColumns:['operation','xx]
484
- }
485
-
486
- }
487
- return Vue.observable(gridParams)
488
- }
489
-
490
- export function addDynamicProp(target, prop, propValue) {
491
- const nestedProp = prop.split('.')
492
- if (nestedProp.length === 1) {
493
- if (propValue !== undefined) {
494
- target[prop] = propValue
495
- } else {
496
- target[prop] = null
497
- }
498
- return
499
- }
500
- // 如果是嵌套属性,就要逐层添加空对象,起点是searchForm,属性每多一层嵌套,parent就前进一层,到倒数第二层为止
501
- let parent = target
502
- for (let i = 0; i < nestedProp.length - 1; i++) {
503
- if (parent[nestedProp[i]] === undefined) {
504
- parent[nestedProp[i]] = {}
505
- }
506
- parent = parent[nestedProp[i]]
507
- }
508
- if (propValue !== undefined) {
509
- parent[nestedProp[nestedProp.length - 1]] = propValue
510
- } else {
511
- parent[nestedProp[nestedProp.length - 1]] = null
512
- }
513
- }
514
-
515
- export function addDynamicPropDateSection(target, prop, propValue) {
516
- const nestedProp = prop.split('.')
517
- if (nestedProp.length === 1) {
518
- if (propValue !== undefined) {
519
- target[prop] = propValue
520
- } else {
521
- target[prop] = [new Date(), new Date()]
522
- }
523
- return
524
- }
525
- // 如果是嵌套属性,就要逐层添加空对象,起点是searchForm,属性每多一层嵌套,parent就前进一层,到倒数第二层为止
526
- let parent = target
527
- for (let i = 0; i < nestedProp.length - 1; i++) {
528
- if (parent[nestedProp[i]] === undefined) {
529
- parent[nestedProp[i]] = {}
530
- }
531
- parent = parent[nestedProp[i]]
532
- }
533
- if (propValue !== undefined) {
534
- parent[nestedProp[nestedProp.length - 1]] = propValue
535
- } else {
536
- parent[nestedProp[nestedProp.length - 1]] = [new Date(), new Date()]
537
- }
538
- }
539
-
540
- export function getTableHeight(superGrid, listCode, pageHeight) {
541
- let topDivHeight = 120
542
- const boxCard = document.querySelector('.box-card')
543
- if (boxCard && boxCard !== null) {
544
- // 表示是配置系统的列表页面
545
- // 16 .gray .app-container .box-card,
546
- // 20为内容区域的padding 20
547
- // 34 + 5为翻页 height 和margin-top
548
- topDivHeight = 16 * 2 + 20 + 34 + 5
549
- }
550
-
551
- if (isShowMenuRoute() === true) {
552
- // 如果显示菜单层级,列表高度需要减少50
553
- topDivHeight = topDivHeight + 50
554
- }
555
-
556
- const listGrid = document.querySelector('.el-tabs__content .' + listCode)
557
- if (listGrid) {
558
- // 表示当前列表在tab页签内容,需要减去tab的高度
559
- topDivHeight = topDivHeight + 80
560
- }
561
- if (pageHeight === undefined || pageHeight === null || pageHeight === '') {
562
- pageHeight = window.innerHeight
563
- } else {
564
- // 表示弹框页面的高度
565
- topDivHeight = 0
566
- }
567
- const totalHeight = pageHeight - superGrid.$el.offsetTop - topDivHeight
568
- // const cur = document.querySelectorAll("div[class='grid-area']")
569
- // if (cur.length === 1) {
570
- // 表示只有一个表格
571
- return totalHeight
572
- // } else if (cur.length > 1) {
573
- // // 表示有多个表格
574
- // // TODO 主子表的表格高度自适应待实现
575
- // const gridParams = store.get(listCode)
576
- // let addHeight = 0
577
- // if (gridParams.options.addHeight) {
578
- // addHeight = gridParams.options.addHeight
579
- // }
580
- // const hasLoadMainTable = store.hasLoadMainTable
581
- // if (typeof (hasLoadMainTable) !== 'undefined' && hasLoadMainTable === true) {
582
- // // 表示主表已加载完成
583
- // const gridHeight = store.gridTableHeight + addHeight
584
- // store.hasLoadMainTable = false
585
- // return gridHeight
586
- // } else {
587
- // let gridHeight = totalHeight / cur.length - 5 + addHeight
588
- // if (gridHeight <= 0) {
589
- // gridHeight = 200
590
- // }
591
- // store.hasLoadMainTable = true
592
- // store.gridTableHeight = gridHeight
593
- // return gridHeight
594
- // }
595
- // }
596
- }
597
-
598
- export function getExtraParam(searchParam, gridParams) {
599
- const param = {
600
- searchParam: searchParam
601
- }
602
- param.withDataPermission = gridParams.options.isWithDataPermission
603
- param.isWorkflowEntity = gridParams.options.isWorkflowEntity
604
- if (gridParams.options.extraParam) {
605
- for (const paramName in gridParams.options.extraParam) {
606
- param[paramName] = gridParams.options.extraParam[paramName]
607
- }
608
- }
609
- return param
610
- }
611
-
612
- export function analysisFileSetObj(fileSetObj, isSql) {
613
- let showName = ''
614
- let serverPath = ''
615
- if (fileSetObj) {
616
- if (fileSetObj.showNameData) {
617
- if (isSql) {
618
- if (fileSetObj.showNameData.dbName) {
619
- showName = fileSetObj.showNameData.dbName
620
- }
621
- } else {
622
- if (fileSetObj.showNameData.name) {
623
- showName = fileSetObj.showNameData.name
624
- }
625
- }
626
- }
627
- if (fileSetObj.serverNameData) {
628
- if (isSql) {
629
- if (fileSetObj.serverNameData.dbName) {
630
- serverPath = fileSetObj.serverNameData.dbName
631
- }
632
- } else {
633
- if (fileSetObj.serverNameData.name) {
634
- serverPath = fileSetObj.serverNameData.name
635
- }
636
- }
637
- }
638
- }
639
- return {
640
- 'showName': showName,
641
- 'serverPath': serverPath
642
- }
643
- }
644
-
645
- export function otherFilesToStandard(fileSetObj, keyValueParam, files, filesStringData) {
646
- const standardFiles = []
647
- if (files) {
648
- if (files && files.length > 0) {
649
- for (var i = 0; i < files.length; i++) {
650
- const file = files[i]
651
- const standardFile = packageFile(file[keyValueParam.showName], file[keyValueParam.serverPath])
652
- standardFiles.push(standardFile)
653
- }
654
- }
655
- } else if (filesStringData) {
656
- const showNameStr = filesStringData.showName
657
- const serverNameStr = filesStringData.serverPath
658
- if (showNameStr && serverNameStr) {
659
- const showNameArr = showNameStr.split(',')
660
- const serverNameArr = serverNameStr.split(',')
661
- for (var k = 0; k < showNameArr.length; k++) {
662
- const standardFile = packageFile(showNameArr[k], serverNameArr[k])
663
- standardFiles.push(standardFile)
664
- }
665
- }
666
- }
667
- return standardFiles
668
- }
669
-
670
- export function packageFile(showName, serverPath) {
671
- if (showName) {
672
- showName = showName.replace('#', '~~').replace('?', '~$').replace('&', '$')
673
- }
674
- const standardFile = {}
675
- standardFile.showName = showName
676
- standardFile.serverPath = serverPath
677
-
678
- if (standardFile.showName && /\.(jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF|bmp|BMP|psd|PSD|tif|TIF)$/.test(showName)) {
679
- standardFile.isImg = true
680
- }
681
- const token = getToken()
682
- let url = Vue.prototype.baseURL + '/common/super-form/downloads?jwt=' + token
683
- if (isPlateSys(Vue.prototype.systemCode)) {
684
- url = Vue.prototype.baseAPI + '/component/super-form/downloads?jwt=' + token
685
- }
686
- const src = url + '&showName=' + encodeURI(standardFile.showName) + '&serverPath=' + standardFile.serverPath
687
- standardFile.src = src
688
- return standardFile
689
- }
690
-
691
- export function getFileList(row, column, isSql) {
692
- let fileList = []
693
- if (column.fileSet && column.fileSet !== '' && (column.componentType === 'annex' || column.componentType === 'multipartUpload')) {
694
- const fileSetObj = JSON.parse(column.fileSet)
695
- const keyValueParam = analysisFileSetObj(fileSetObj, isSql)
696
- if (fileSetObj && fileSetObj.multiple) {
697
- if (fileSetObj.childAnnexDataTableCode) {
698
- // const lowerStr = fileSetObj.childAnnexDataTableCode.toLowerCase()
699
- const fileArr = row[column.prop]
700
- // 子表
701
- fileList = otherFilesToStandard(fileSetObj, keyValueParam, fileArr, null)
702
- } else {
703
- const filesStringData = {
704
- 'showName': getEntityFieldValue(row, keyValueParam.showName),
705
- 'serverPath': getEntityFieldValue(row, keyValueParam.serverPath)
706
- }
707
- fileList = otherFilesToStandard(fileSetObj, keyValueParam, null, filesStringData)
708
- }
709
- } else {
710
- const showName = getEntityFieldValue(row, keyValueParam.showName)
711
- const serverPath = getEntityFieldValue(row, keyValueParam.serverPath)
712
- fileList.push(packageFile(showName, serverPath))
713
- }
714
- }
715
- return fileList
716
- }
717
-
718
- export function getDynamicDataSourceOptions(column, isSql) {
719
- const options = {
720
- isSql: isSql
721
- }
722
- // 如果是多选文件类型,需要解析(需要设置临时字段,判断文件还是图片,图片需要预览)
723
- if (column.valueSetOptions) {
724
- const valueSetOptionsObj = JSON.parse(column.valueSetOptions)
725
- if (valueSetOptionsObj && valueSetOptionsObj.valueSetOptions) {
726
- options.valueSetOptions = valueSetOptionsObj.valueSetOptions
727
- }
728
- if (valueSetOptionsObj.dynamicDataSourceCode && valueSetOptionsObj.dynamicDataSourceCode !== '') {
729
- options.dynamicDataSourceCode = valueSetOptionsObj.dynamicDataSourceCode
730
- }
731
- }
732
- return options
733
- }
734
-
735
- // 值设置是否是动态数据源类型的数据源
736
- export function isDynamicDataSourceSource(column) {
737
- if (column.valueSet && column.valueSet.length > 0 && column.valueSet[0].value === 'dynamicDataSource') {
738
- return true
739
- } else {
740
- return false
741
- }
742
- }
743
- // 获得最后一页的页数
744
- export function getLastPageNum(total, rowsPerPage) {
745
- if (total === undefined || total === null || total === 0) {
746
- return 1
747
- } else if (rowsPerPage === undefined || rowsPerPage === null || rowsPerPage === 0) {
748
- return 1
749
- } else {
750
- return Math.ceil(total / rowsPerPage)
751
- }
752
- }
753
- // 纵向滚动条滚动最底部功能
754
- export function scrollYToBottom(listCode) {
755
- const scrollDivElement = document.querySelector('.' + listCode + ' .el-table--scrollable-y .el-table__body-wrapper')
756
- console.log('scrollDivElement==', scrollDivElement)
757
- if (scrollDivElement && scrollDivElement !== null) {
758
- // 表示有滚动条,需要将滚动条滚动最底部
759
- console.log('scrollDivElement==scrollDivElement.scrollHeight=', scrollDivElement.scrollHeight)
760
- scrollDivElement.scrollTop = scrollDivElement.scrollHeight
761
- }
762
- }