imatrix-ui 2.9.18-dw → 2.9.19-boe01

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 (199) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.umd.min.js +5 -35
  3. package/package.json +4 -3
  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 +25 -6
  8. package/src/i18n/langs/en.js +27 -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/input.scss +4 -1
  26. package/src/styles/theme/dark-blue/message.scss +8 -0
  27. package/src/styles/theme/dark-blue/radio.scss +13 -0
  28. package/src/styles/theme/dark-blue/scrollbar-style.scss +8 -3
  29. package/src/styles/theme/dark-blue/sidebar.scss +7 -37
  30. package/src/styles/theme/dark-blue/tab.scss +4 -1
  31. package/src/styles/theme/dark-blue/table.scss +2 -2
  32. package/src/styles/theme/dark-blue/tree.scss +35 -10
  33. package/src/styles/theme/gray/card-style.scss +13 -1
  34. package/src/styles/theme/gray/font-style.scss +38 -0
  35. package/src/styles/theme/gray/index.scss +13 -25
  36. package/src/styles/theme/gray/scrollbar-style.scss +37 -0
  37. package/src/styles/theme/gray/sidebar.scss +7 -14
  38. package/src/utils/auth-api.js +47 -1
  39. package/src/utils/calculator/calculator-util.js +14 -0
  40. package/src/utils/common-util.js +22 -81
  41. package/src/utils/jump-page-utils.js +12 -9
  42. package/src/utils/preview-util.js +32 -0
  43. package/src/utils/range-selector.js +185 -0
  44. package/src/utils/request.js +20 -12
  45. package/src/utils/util.js +13 -11
  46. package/src/utils/workflow-util.js +3 -0
  47. package/src/views/dsc-component/Sidebar/Item.vue +7 -5
  48. package/src/views/dsc-component/Sidebar/SidebarItem.vue +2 -3
  49. package/src/views/dsc-component/Sidebar/index.vue +14 -22
  50. package/src/views/dsc-component/tabs/tab-content.vue +8 -9
  51. package/src/views/layout/EmptyLayout.vue +4 -1
  52. package/src/views/layout/NewLayout.vue +6 -65
  53. package/src/views/layout/components/AppMain.vue +2 -1
  54. package/src/views/layout/components/Breadcrumb/index.vue +1 -1
  55. package/src/views/layout/components/Menubar/Item.vue +23 -7
  56. package/src/views/layout/components/Menubar/Link.vue +11 -2
  57. package/src/views/layout/components/Menubar/SidebarItem.vue +50 -7
  58. package/src/views/layout/components/Menubar/index.vue +51 -16
  59. package/src/views/layout/components/Sidebar/index.vue +2 -2
  60. package/src/views/layout/components/tabs/tab-content.vue +162 -0
  61. package/src/views/layout/tab-content-iframe-index.vue +31 -0
  62. package/src/views/layout/tab-content-index.vue +84 -0
  63. package/src/views/login/index.vue +1 -1
  64. package/packages/breadcrumb/index.js +0 -6
  65. package/packages/breadcrumb/src/breadcrumb.vue +0 -71
  66. package/packages/department-tree/index.js +0 -6
  67. package/packages/department-tree/src/department-tree.vue +0 -108
  68. package/packages/department-tree-inline/index.js +0 -6
  69. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +0 -411
  70. package/packages/department-tree-inline/src/department-single-tree-inline.vue +0 -293
  71. package/packages/department-tree-inline/src/department-tree-inline.vue +0 -86
  72. package/packages/department-tree-inline/src/department-tree-service.js +0 -275
  73. package/packages/department-tree-inline/src/search-result.vue +0 -176
  74. package/packages/department-user-tree/index.js +0 -6
  75. package/packages/department-user-tree/src/department-user-multiple-tree.vue +0 -116
  76. package/packages/department-user-tree/src/department-user-single-tree.vue +0 -76
  77. package/packages/department-user-tree/src/department-user-tree.vue +0 -101
  78. package/packages/department-user-tree-inline/index.js +0 -6
  79. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +0 -639
  80. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +0 -274
  81. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +0 -79
  82. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +0 -248
  83. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -142
  84. package/packages/department-user-tree-inline/src/search-result.vue +0 -197
  85. package/packages/directives/prevent-reclick.js +0 -19
  86. package/packages/dynamic-source-select/index.js +0 -6
  87. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +0 -70
  88. package/packages/dynamic-source-select/src/dynamic-source-select.vue +0 -440
  89. package/packages/dynamic-source-select/src/events.js +0 -55
  90. package/packages/fs-preview/index.js +0 -6
  91. package/packages/fs-preview/src/fs-preview.vue +0 -226
  92. package/packages/fs-upload/index.js +0 -6
  93. package/packages/fs-upload/src/fs-upload-multi.vue +0 -420
  94. package/packages/fs-upload/src/fs-upload-single.vue +0 -312
  95. package/packages/fs-upload/src/fs-upload.vue +0 -189
  96. package/packages/fs-upload/src/see-big-picture.vue +0 -55
  97. package/packages/fs-upload-list/index.js +0 -6
  98. package/packages/fs-upload-list/src/fs-upload-list.vue +0 -287
  99. package/packages/hamburger/index.js +0 -6
  100. package/packages/hamburger/src/hamburger.vue +0 -38
  101. package/packages/index.js +0 -121
  102. package/packages/multipart-upload/index.js +0 -6
  103. package/packages/multipart-upload/src/index.vue +0 -73
  104. package/packages/multipart-upload/src/multipart-upload-form.vue +0 -297
  105. package/packages/multipart-upload/src/multipart-upload-list.vue +0 -378
  106. package/packages/organization-input/index.js +0 -6
  107. package/packages/organization-input/src/organization-input.vue +0 -542
  108. package/packages/plugins/export-data-new.js +0 -466
  109. package/packages/plugins/export-data.js +0 -361
  110. package/packages/plugins/index.js +0 -15
  111. package/packages/plugins/public-method.js +0 -43
  112. package/packages/remove-department/index.js +0 -6
  113. package/packages/remove-department/src/remove-department.vue +0 -172
  114. package/packages/remove-department/src/remove-dept-service.js +0 -20
  115. package/packages/remove-user/index.js +0 -6
  116. package/packages/remove-user/src/remove-user-service.js +0 -20
  117. package/packages/remove-user/src/remove-user.vue +0 -195
  118. package/packages/remove-workgroup/index.js +0 -6
  119. package/packages/remove-workgroup/src/remove-workgroup-service.js +0 -20
  120. package/packages/remove-workgroup/src/remove-workgroup.vue +0 -159
  121. package/packages/rich-editor/index.js +0 -7
  122. package/packages/rich-editor/index.vue +0 -278
  123. package/packages/rich-editor/langs/zh-Hans.js +0 -1
  124. package/packages/rich-editor/viewer.vue +0 -103
  125. package/packages/scan-code-input/index.js +0 -6
  126. package/packages/scan-code-input/src/events.js +0 -33
  127. package/packages/scan-code-input/src/scan-code-input-colse.vue +0 -131
  128. package/packages/scan-code-input/src/scan-code-input.vue +0 -116
  129. package/packages/secret-info/index.js +0 -7
  130. package/packages/secret-info/index.vue +0 -90
  131. package/packages/super-grid/index.js +0 -7
  132. package/packages/super-grid/src/apis.js +0 -820
  133. package/packages/super-grid/src/columns-config.vue +0 -335
  134. package/packages/super-grid/src/custom-formatter.js +0 -278
  135. package/packages/super-grid/src/dynamic-input.vue +0 -1279
  136. package/packages/super-grid/src/eventBus.js +0 -2
  137. package/packages/super-grid/src/events.js +0 -55
  138. package/packages/super-grid/src/formValidatorUtil.js +0 -226
  139. package/packages/super-grid/src/formatter.js +0 -181
  140. package/packages/super-grid/src/group-column.vue +0 -100
  141. package/packages/super-grid/src/header-context-menu.vue +0 -87
  142. package/packages/super-grid/src/index-column.vue +0 -51
  143. package/packages/super-grid/src/normal-column.vue +0 -775
  144. package/packages/super-grid/src/public-methods.js +0 -31
  145. package/packages/super-grid/src/row-operation.vue +0 -161
  146. package/packages/super-grid/src/search-button.vue +0 -66
  147. package/packages/super-grid/src/search-condition-input.vue +0 -61
  148. package/packages/super-grid/src/search-condition-list.vue +0 -59
  149. package/packages/super-grid/src/search-form-advancedQuery.vue +0 -654
  150. package/packages/super-grid/src/search-form-dialog.vue +0 -79
  151. package/packages/super-grid/src/search-form-item.vue +0 -405
  152. package/packages/super-grid/src/search-form-number.vue +0 -38
  153. package/packages/super-grid/src/search-form-open.vue +0 -170
  154. package/packages/super-grid/src/search-form-ordinarySearch.vue +0 -196
  155. package/packages/super-grid/src/search-form.vue +0 -642
  156. package/packages/super-grid/src/search-methods.js +0 -448
  157. package/packages/super-grid/src/selection-column.vue +0 -43
  158. package/packages/super-grid/src/store.js +0 -3
  159. package/packages/super-grid/src/super-grid-service.js +0 -593
  160. package/packages/super-grid/src/super-grid.vue +0 -2873
  161. package/packages/super-grid/src/utils.js +0 -772
  162. package/packages/super-grid/src/view-image-dialog.vue +0 -130
  163. package/packages/super-nine-grid/index.js +0 -7
  164. package/packages/super-nine-grid/src/apis.js +0 -103
  165. package/packages/super-nine-grid/src/custom-formatter.js +0 -66
  166. package/packages/super-nine-grid/src/formatter.js +0 -132
  167. package/packages/super-nine-grid/src/search-form-number.vue +0 -38
  168. package/packages/super-nine-grid/src/search-form.vue +0 -430
  169. package/packages/super-nine-grid/src/search-methods.js +0 -134
  170. package/packages/super-nine-grid/src/store.js +0 -3
  171. package/packages/super-nine-grid/src/super-grid-service.js +0 -91
  172. package/packages/super-nine-grid/src/super-nine-grid.vue +0 -872
  173. package/packages/super-nine-grid/src/utils.js +0 -261
  174. package/packages/svg-icon/index.js +0 -6
  175. package/packages/svg-icon/src/svg-icon.vue +0 -43
  176. package/packages/utils/memory-cache-utils.js +0 -90
  177. package/packages/utils/utils.js +0 -152
  178. package/packages/utils/value-set.js +0 -86
  179. package/packages/valid-code/index.js +0 -7
  180. package/packages/valid-code/src/valid-code.vue +0 -95
  181. package/packages/workflow-button/index.js +0 -6
  182. package/packages/workflow-button/src/workflow-button.vue +0 -325
  183. package/packages/workflow-history-list/index.js +0 -6
  184. package/packages/workflow-history-list/src/api.js +0 -7
  185. package/packages/workflow-history-list/src/workflow-history-list.vue +0 -185
  186. package/packages/workgroup-tree/index.js +0 -6
  187. package/packages/workgroup-tree/src/workgroup-tree.vue +0 -76
  188. package/packages/workgroup-tree-inline/index.js +0 -6
  189. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +0 -317
  190. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +0 -43
  191. package/packages/workgroup-user-tree/index.js +0 -6
  192. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +0 -100
  193. package/packages/workgroup-user-tree-inline/index.js +0 -6
  194. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +0 -163
  195. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +0 -436
  196. package/packages/year-range-picker/index.js +0 -6
  197. package/packages/year-range-picker/src/year-range-picker.vue +0 -51
  198. package/src/index.js +0 -93
  199. package/src/styles/theme/gray/form-style.scss +0 -41
@@ -1,820 +0,0 @@
1
- import store from './store'
2
- import {
3
- setCurrentRow,
4
- isEditOptionFunction,
5
- isLastEditRowSave,
6
- isHasEditOption,
7
- scrollYToBottom
8
- } from './utils'
9
- import formValidatorService from './formValidatorUtil'
10
- import Vue from 'vue'
11
- import {
12
- getEntityFieldValue,
13
- getI18n,
14
- setEntityFieldValue,
15
- getPropValue
16
- } from '../../../src/utils/util'
17
- import eventBus from './eventBus'
18
- import { isPromise } from '../../../src/utils/common-util'
19
- const apis = {
20
- // 刷新列表数据
21
- refresh(parentRowIds, isLineEdit, toolbarFieldParam, isDeleteSubTableData) {
22
- return new Promise((resolve, reject) => {
23
- if (isDeleteSubTableData) {
24
- // 清空options.subTableData
25
- const gridParams = store.get(this.code)
26
- this.$set(gridParams.options, 'subTableData', null)
27
- }
28
- if (toolbarFieldParam && toolbarFieldParam.length > 0) {
29
- this.toolbarFieldParam = toolbarFieldParam
30
- }
31
- if (this.$refs) {
32
- if (typeof (parentRowIds) !== 'undefined' && parentRowIds !== null && parentRowIds instanceof Array && parentRowIds.length > 0) {
33
- // 树形数据时,刷新父记录对应的子记录集合时
34
- if (this.$refs.sf) {
35
- let param = this.$refs.sf.packageSearchParam()
36
- if (param && param.length > 0) {
37
- if (toolbarFieldParam && toolbarFieldParam.length > 0) {
38
- if (param.length === 1) {
39
- param[0].leftBracket = '('
40
- param[0].rightBracket = ')'
41
- }
42
- if (param[param.length - 1].joinSign === 'or') {
43
- param[param.length - 1].joinSign = 'and'
44
- }
45
- // 拼接
46
- Array.prototype.push.apply(param, toolbarFieldParam)
47
- }
48
- } else {
49
- if (toolbarFieldParam) {
50
- param = []
51
- param = toolbarFieldParam
52
- }
53
- }
54
- this.search(param, false, parentRowIds).then(() => resolve()).catch(error => reject(error))
55
- } else {
56
- this.search(toolbarFieldParam, false, parentRowIds).then(() => resolve()).catch(error => reject(error))
57
- }
58
- } else {
59
- // 刷新列表数据
60
- if (this.$refs.sf) {
61
- let param = this.$refs.sf.packageSearchParam()
62
- if (param && param.length > 0) {
63
- if (toolbarFieldParam && toolbarFieldParam.length > 0) {
64
- if (param.length === 1) {
65
- param[0].leftBracket = '('
66
- param[0].rightBracket = ')'
67
- }
68
- if (param[param.length - 1].joinSign === 'or') {
69
- param[param.length - 1].joinSign = 'and'
70
- }
71
- // 拼接
72
- // param.concat(toolbarFieldParam)
73
- Array.prototype.push.apply(param, toolbarFieldParam)
74
- }
75
- } else {
76
- if (toolbarFieldParam) {
77
- param = []
78
- param = toolbarFieldParam
79
- }
80
- }
81
- this.search(param, false).then(() => resolve()).catch(error => reject(error))
82
- } else {
83
- this.search(toolbarFieldParam, false).then(() => resolve()).catch(error => reject(error))
84
- }
85
- }
86
- } else {
87
- resolve()
88
- }
89
- })
90
- },
91
- // 显示查询
92
- showSearchForm() {
93
- this.showSearch = true
94
- this.$emit('showSearch')
95
- },
96
- // 取消查询
97
- cancelSearch() {
98
- this.showSearch = false
99
- this.$emit('cancelSearch')
100
- },
101
- // 获得查询条件
102
- getSearchForm() {
103
- const gridParams = store.get(this.code)
104
- if (gridParams.searchForm) {
105
- return gridParams.searchForm
106
- } else {
107
- return []
108
- }
109
- },
110
- // 新建行
111
- createRow(listCode, row) {
112
- return new Promise((resolve, reject) => {
113
- if (!listCode) {
114
- listCode = store.get('_list_code')
115
- }
116
- const gridParams = store.get(listCode)
117
- const gridData = gridParams.gridData
118
- gridParams.superGrid.clearSort()
119
- // console.log('创建行记录的条件1', gridParams.lineEdit)
120
- // console.log('创建行记录的条件2', gridParams.lineEdit.editable)
121
- // console.log('创建行记录的条件3', gridParams.loaded)
122
- if (gridParams.lineEdit && gridParams.lineEdit.editable &&
123
- (typeof (gridParams.loaded) !== 'undefined' && gridParams.loaded === true)) {
124
- // gridParams.loaded表示列表数据是否已加载成功,加载成功才允许新建记录
125
- // 插入行前的回调
126
- let canCreate = true
127
- if (isEditOptionFunction('beforeInsertRow', listCode)) {
128
- const isSubTableShowPage = gridParams.isSubTableShowPage
129
- // 每页显示多少条
130
- const pageSize = gridParams.pagination && gridParams.pagination.pageSize
131
- const isMobile = false
132
- canCreate = gridParams.options.lineEditOptions.beforeInsertRow.call(this, isSubTableShowPage ? gridParams.subTableData : gridParams.gridData, gridParams.$rowIndex, isMobile, this.baseURL, isSubTableShowPage ? gridParams.gridData : null, pageSize)
133
- }
134
- // console.log('创建行记录执行前判断', canCreate)
135
- // console.log('创建行记录gridParams.options.isFormSubTable=', gridParams.options.isFormSubTable)
136
- if (canCreate === undefined || canCreate === true) {
137
- if (gridParams.options && gridParams.options.isFormSubTable) {
138
- // 如果是表单子表模式,则不需要判断上一行是否是编辑状态
139
- // 取消上一行的编辑状态
140
- let myGridData = gridParams.gridData
141
- if (gridParams.isSubTableShowPage !== undefined && gridParams.isSubTableShowPage === true) {
142
- // 子表集合
143
- myGridData = gridParams.subTableData
144
- }
145
- const editRows = myGridData.filter((row) => (row.$editing !== undefined && row.$editing === true))
146
- if (editRows && editRows.length > 0) {
147
- editRows.forEach(editRow => {
148
- setEntityFieldValue(editRow, '$editing', false)
149
- // 取消上一行选中状态时,触发un-edit事件,处理下拉多选选项组问题
150
- eventBus.$emit('un-edit', { row: editRow })
151
- // Vue.set(editRow, '$editing', false)
152
- })
153
- }
154
- gridParams.isEditRow = false
155
- } else {
156
- if ((!isLastEditRowSave(listCode)) || (typeof (gridParams.isCreateRow) !== 'undefined' && gridParams.isCreateRow === true)) {
157
- // 最后编辑的一行没有保存 或(说明刚刚新建的行还没有保存 或 撤销编辑),则提示
158
- Vue.prototype.$message({
159
- showClose: true,
160
- message: getI18n().t('superGrid.pleaseSaveLine', {
161
- row: (gridParams.$rowIndex + 1)
162
- }),
163
- type: 'warning'
164
- })
165
- reject(new Error('please save line'))
166
- return
167
- }
168
- // 取消上一行的编辑状态
169
- if (typeof (gridParams.$rowIndex) !== 'undefined' && gridParams.$rowIndex !== null &&
170
- gridParams.$rowIndex < gridParams.gridData.length) {
171
- // 表示是有效行
172
- const lastEditRow = gridParams.gridData[gridParams.$rowIndex]
173
- setEntityFieldValue(lastEditRow, '$editing', false)
174
- // Vue.set(lastEditRow, '$editing', false)
175
- gridParams.isEditRow = false
176
- }
177
- }
178
- // 新建行
179
- row = this.getNewRow(gridParams.defaultValueColumns, gridParams.additionalParamMap, gridParams.contextParameter, row)
180
-
181
- // console.log('创建行记录要添加的新行1', row)
182
- setEntityFieldValue(row, '$editing', true)
183
- // Vue.set(row, '$editing', true)
184
- gridParams.isEditRow = true
185
- // console.log('创建行记录要添加的新行2', row)
186
- // console.log('创建行所属的list1', gridData)
187
- if (gridParams.options && gridParams.options.isFormSubTable) {
188
- // 表单的子表行编辑时显示是添加到最后面
189
- if (gridParams.isSubTableShowPage !== undefined && gridParams.isSubTableShowPage === true) {
190
- // 子表集合添加该新建的行。会触发watch subTableData的监控
191
- gridParams.isChangePage = true
192
- gridParams.subTableData.splice(gridParams.subTableData.length, 0, row)
193
- } else {
194
- // 子表不分页
195
- gridData.splice(gridData.length, 0, row)
196
- if (gridParams.lineEdit.editingCell) {
197
- gridParams.lineEdit.editingCell.row = gridData.length
198
- }
199
- }
200
-
201
- gridParams.$rowIndex = gridData.length
202
- // 滚动条滚到最后
203
- this.$nextTick(() => {
204
- scrollYToBottom(listCode)
205
- })
206
- } else {
207
- // 表格行编辑新建时是添加到最前面
208
- gridData.splice(0, 0, row)
209
- if (gridParams.lineEdit.editingCell) {
210
- gridParams.lineEdit.editingCell.row = 0
211
- }
212
-
213
- gridParams.$rowIndex = 0
214
- }
215
-
216
- // console.log('创建行所属的list2', gridData)
217
- // console.log('创建行所属的打印gridParams.gridData', gridParams.gridData)
218
- const orgRow = Object.assign({}, row)
219
- gridParams.orgGridData.splice(0, 0, orgRow)
220
- if (!gridParams.lineEdit.editingCell) {
221
- gridParams.lineEdit.editingCell = {}
222
- gridParams.lineEdit.validateErrorField = ''
223
- }
224
- // 插入行后的回调
225
- if (isEditOptionFunction('afterInsertRow', listCode)) {
226
- const isSubTableShowPage = gridParams.isSubTableShowPage
227
- // 每页显示多少条
228
- const pageSize = gridParams.pagination && gridParams.pagination.pageSize
229
- const isMobile = false
230
- gridParams.options.lineEditOptions.afterInsertRow.call(this, isSubTableShowPage ? gridParams.subTableData : gridParams.gridData, gridParams.$rowIndex, isMobile, this.baseURL, isSubTableShowPage ? gridParams.gridData : null, pageSize)
231
- }
232
-
233
- gridParams.isCreateRow = true
234
- resolve(row)
235
- } else {
236
- reject(new Error('can not create'))
237
- }
238
- } else {
239
- reject(new Error('list not editable or data not loaded completely'))
240
- }
241
- })
242
- },
243
- // 获取一个新的对象,已经解析完默认值
244
- getNewRow(defaultValueColumns, additionalParamMap, contextParameter, row, listCode) {
245
- if (!row) {
246
- row = {}
247
- }
248
- if (!listCode) {
249
- listCode = store.get('_list_code')
250
- }
251
- const gridParams = store.get(listCode)
252
- if (gridParams && gridParams.allColumns) {
253
- this.setColumnsDefaultValue(gridParams.allColumns, row)
254
- }
255
- if (defaultValueColumns && defaultValueColumns.length > 0) {
256
- for (var i = 0; i < defaultValueColumns.length; i++) {
257
- const col = defaultValueColumns[i]
258
- if (col && col.prop) {
259
- const propValue = getEntityFieldValue(row, col.prop)
260
- if (col.prop !== '$selection' && col.prop !== '$index') {
261
- if (col.defaultValue && col.defaultValue !== '' && (propValue === undefined || propValue === '' || propValue === null)) {
262
- const value = getPropValue(col.defaultValue, row, additionalParamMap, contextParameter)
263
- setEntityFieldValue(row, col.prop, value)
264
- }
265
- }
266
- }
267
- }
268
- }
269
- return row
270
- },
271
- // 设置默认值null
272
- setColumnsDefaultValue(allColumns, row) {
273
- for (let i = 0; i < allColumns.length; i++) {
274
- const column = allColumns[i]
275
- const prop = column.prop
276
- if (prop === '$index' || prop === '$selection' || prop === 'operation') {
277
- continue
278
- }
279
- if (column.hasOwnProperty('children')) {
280
- // 表示是组合表头,需要判断子表头是否显示
281
- this.setChildrenColumnsDefaultValue(column.children, row)
282
- } else {
283
- if (row[prop] === undefined) {
284
- // 不是操作列,才需要设值
285
- setEntityFieldValue(row, prop, null)
286
- }
287
- }
288
- }
289
- setEntityFieldValue(row, '$editing', false)
290
- },
291
- setChildrenColumnsDefaultValue(children, row) {
292
- for (let i = 0; i < children.length; i++) {
293
- const column = children[i]
294
- const prop = column.prop
295
- if (column.hasOwnProperty('children')) {
296
- // 表示是组合表头,需要判断子表头是否显示
297
- this.setChildrenColumnsDefaultValue(column.children, row)
298
- } else {
299
- if (row[prop] === undefined) {
300
- if (prop !== 'operation') {
301
- // 不是操作列,才需要设值
302
- setEntityFieldValue(row, prop, null)
303
- }
304
- }
305
- }
306
- }
307
- },
308
- // 编辑行
309
- editRow(rowIndex, listCode, isSaveCallback) {
310
- if (!listCode) {
311
- listCode = store.get('_list_code')
312
- }
313
- const gridParams = store.get(listCode)
314
- if (gridParams && gridParams.lineEdit && gridParams.lineEdit.editable) {
315
- if (typeof (gridParams.$rowIndex) !== 'undefined' && gridParams.$rowIndex !== null && gridParams.$rowIndex !== rowIndex) {
316
- // 不是当前编辑行时
317
- if (typeof (gridParams.options.lineEditOptions.autoSave) === 'undefined' ||
318
- (isHasEditOption('autoSave', listCode) && gridParams.options.lineEditOptions.autoSave === true)) {
319
- // 自动保存行数据
320
- if (!isSaveCallback) {
321
- // 点击了“编辑”按钮时需要走,不是自动保存行数据后回调方法中调用的editRow时
322
- this.saveRow(gridParams.$rowIndex, listCode)
323
- .then((res) => {
324
- this.editRow(rowIndex, listCode, true)
325
- })
326
- return
327
- }
328
- } else {
329
- // 如果不自动保存,则提示数据没有保存,让用户自己保存
330
- if (!isLastEditRowSave(listCode)) {
331
- // 最后编辑的一行没有保存,则提示
332
- Vue.prototype.$message({
333
- showClose: true,
334
- message: getI18n().t('superGrid.pleaseSaveLine', {
335
- row: (gridParams.$rowIndex + 1)
336
- }),
337
- type: 'warning'
338
- })
339
- return
340
- }
341
- }
342
- }
343
-
344
- let canEdit = true
345
- if (isEditOptionFunction('beforeEdit', listCode)) {
346
- const isSubTableShowPage = gridParams.isSubTableShowPage
347
- // 每页显示多少条
348
- const pageSize = gridParams.pagination && gridParams.pagination.pageSize
349
- canEdit = gridParams.options.lineEditOptions.beforeEdit.call(this, {
350
- gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
351
- listCode: listCode,
352
- entity: gridParams.gridData[rowIndex],
353
- rowIndex: rowIndex,
354
- columns: gridParams.columns,
355
- isMobile: false,
356
- pageGridData: isSubTableShowPage ? gridParams.gridData : null,
357
- pageSize
358
- })
359
- }
360
- if (isPromise(canEdit)) {
361
- canEdit.then((result) => {
362
- if (result === undefined || result === true) {
363
- this.doEditRow(gridParams, rowIndex)
364
- }
365
- })
366
- } else {
367
- if (canEdit === undefined || canEdit === true) {
368
- this.doEditRow(gridParams, rowIndex)
369
- }
370
- }
371
- }
372
- },
373
- doEditRow(gridParams, rowIndex) {
374
- // 取消上一行的编辑状态
375
- if (typeof (gridParams.$rowIndex) !== 'undefined' && gridParams.$rowIndex !== null &&
376
- gridParams.$rowIndex < gridParams.gridData.length) {
377
- const lastEditRow = gridParams.gridData[gridParams.$rowIndex]
378
- setEntityFieldValue(lastEditRow, '$editing', false)
379
- // Vue.set(lastEditRow, '$editing', false)
380
- gridParams.isEditRow = false
381
- }
382
- // 使指定行变为编辑状态
383
- const row = gridParams.gridData[rowIndex]
384
- setEntityFieldValue(row, '$editing', true)
385
- // Vue.set(row, '$editing', true)
386
- gridParams.$lastSaveRowIndex = null
387
- gridParams.$rowIndex = rowIndex
388
- gridParams.isEditRow = true
389
- // 使指定行变为编辑状态,触发获得焦点
390
- if (gridParams.lineEdit.editingCell) {
391
- gridParams.lineEdit.editingCell.row = rowIndex
392
- }
393
- },
394
- saveRow(rowIndex, listCode) {
395
- return new Promise((resolve, reject) => {
396
- const vm = this
397
- // 添加setTimeout是因为保存时事件和input等组件的@blur冲突,导致保存需要保存两次
398
- setTimeout(function() {
399
- vm.saveCurrentRow(rowIndex, listCode).then(data => {
400
- resolve(data)
401
- })
402
- }, 100)
403
- })
404
- },
405
- saveCurrentRow(rowIndex, listCode) {
406
- return new Promise((resolve, reject) => {
407
- if (!listCode) {
408
- listCode = store.get('_list_code')
409
- }
410
- const gridParams = store.get(listCode)
411
- if (gridParams.lineEdit && gridParams.lineEdit.editable) {
412
- if (typeof (gridParams.gridData[rowIndex].$editing) === 'undefined' || gridParams.gridData[rowIndex].$editing === false) {
413
- Vue.prototype.$message({
414
- showClose: true,
415
- message: getI18n().t('superGrid.noNeedToSaveRow', {
416
- row: (rowIndex + 1)
417
- }),
418
- type: 'warning'
419
- })
420
- return
421
- }
422
- // console.log('gridParams', gridParams)
423
- if (gridParams.$rowIndex !== rowIndex && !isLastEditRowSave(listCode)) {
424
- // 最后编辑的一行没有保存,则提示
425
- Vue.prototype.$message({
426
- showClose: true,
427
- message: getI18n().t('superGrid.pleaseSaveLine', {
428
- row: (gridParams.$rowIndex + 1)
429
- }),
430
- type: 'warning'
431
- })
432
- return
433
- }
434
- gridParams.$lastSaveRowIndex = null
435
- if ((gridParams.isHasDynamic !== undefined && gridParams.isHasDynamic === false) && !gridParams.lineEdit.urlToSaveRow && !isHasEditOption('urlToSaveRow', listCode) && !isEditOptionFunction('saveRow', listCode)) {
436
- Vue.prototype.$message({
437
- showClose: true,
438
- message: getI18n().t('superGrid.pleaseSetURLToSaveRowInformation'),
439
- type: 'warning'
440
- })
441
- return
442
- }
443
- if (!gridParams.canSaveRow) {
444
- // 防止重复保存
445
- return
446
- }
447
- gridParams.canSaveRow = false
448
- const row = gridParams.gridData[rowIndex]
449
- let needValidate = true
450
- if (isHasEditOption('isEnableValidate', listCode)) {
451
- // 表示配置了是否启用必填验证
452
- needValidate = gridParams.options.lineEditOptions['isEnableValidate']
453
- }
454
- let validateResult = true
455
- if (needValidate === true) {
456
- validateResult = formValidatorService.validator(row, listCode, rowIndex)
457
- }
458
- if (validateResult === true) {
459
- let canSave = true
460
- if (isEditOptionFunction('beforeSave', listCode)) {
461
- canSave = gridParams.options.lineEditOptions['beforeSave'].call(this, row, gridParams.columns)
462
- }
463
- if (canSave === undefined || canSave === true) {
464
- // 触发点击保存时的事件线,在 normal-column 监听处对字段控件是选项组的字段的值进行处理
465
- eventBus.$emit('un-edit', { row })
466
- let additionalParamMap = null
467
- if (gridParams.additionalParamMap && typeof (gridParams.additionalParamMap) === 'object') {
468
- additionalParamMap = gridParams.additionalParamMap
469
- } else if (gridParams.additionalParamMap && gridParams.additionalParamMap !== '') {
470
- additionalParamMap = JSON.parse(gridParams.additionalParamMap)
471
- }
472
- let saveRowRequest
473
- if (isEditOptionFunction('saveRow', listCode)) {
474
- // 表示保存方法,用户自己重写了
475
- saveRowRequest = gridParams.options.lineEditOptions['saveRow'].call(this, row, gridParams.columns, gridParams.$dataTypeMap, gridParams.dynamicColumnInfo, additionalParamMap, gridParams.mainDefaultValueColumns)
476
- }
477
- if (!saveRowRequest && gridParams.lineEdit && gridParams.lineEdit.urlToSaveRow) {
478
- // 使用默认的保存实现
479
- let urlToSaveRow = gridParams.lineEdit.urlToSaveRow
480
- if (isHasEditOption('urlToSaveRow', listCode)) {
481
- // 表示手动配置了保存行记录的url
482
- urlToSaveRow = gridParams.options.lineEditOptions['urlToSaveRow']
483
- }
484
- saveRowRequest = Vue.prototype.$http.post(Vue.prototype.baseURL + urlToSaveRow, row)
485
- }
486
- if (gridParams.isHasDynamic !== undefined && gridParams.isHasDynamic === true && !saveRowRequest) {
487
- // 表示有动态列,保存时使用平台封装好的请求
488
- const urlToSaveRow = '/common/dynamic-values'
489
- const dynamicValueDTO = {
490
- mainTableName: gridParams.basicInfo && gridParams.basicInfo.tableName ? gridParams.basicInfo.tableName : '',
491
- row: row,
492
- dynamicColumnInfo: gridParams.dynamicColumnInfo,
493
- additionalParamMap: additionalParamMap,
494
- dataTypeMap: gridParams.$dataTypeMap,
495
- dynamicServiceName: gridParams.dynamicServiceName,
496
- mainDefaultValueColumns: gridParams.mainDefaultValueColumns
497
- }
498
- saveRowRequest = Vue.prototype.$http.post(Vue.prototype.baseURL + urlToSaveRow, dynamicValueDTO)
499
- }
500
- if (saveRowRequest) {
501
- saveRowRequest.then(data => {
502
- this.afterSave(gridParams, rowIndex, listCode, data, row).then(data => {
503
- resolve(data)
504
- }).catch(error => {
505
- reject(error)
506
- })
507
- }).catch(error => {
508
- gridParams.canSaveRow = true
509
- if (isEditOptionFunction('saveError', listCode)) {
510
- gridParams.options.lineEditOptions['saveError'].call(this, row, gridParams.columns, rowIndex, error)
511
- }
512
- reject(error)
513
- })
514
- } else {
515
- gridParams.canSaveRow = true
516
- reject(getI18n().t('saveRowRequest is undefined'))
517
- }
518
- } else {
519
- gridParams.canSaveRow = true
520
- reject(getI18n().t('superGrid.theReturnValueOfTheBeforesaveCallbackMethodIsFalse'))
521
- }
522
- } else {
523
- gridParams.canSaveRow = true
524
- reject(getI18n().t('imatrixUIMessage.validationFailed'))
525
- }
526
- }
527
- })
528
- },
529
- afterSave(gridParams, rowIndex, listCode, data, row) {
530
- return new Promise((resolve, reject) => {
531
- gridParams.isCreateRow = false
532
- gridParams.canSaveRow = true
533
- gridParams.$rowIndex = null
534
- // 当前是否有正在编辑的行
535
- gridParams.isEditRow = false
536
- gridParams.$lastSaveRowIndex = rowIndex
537
- Vue.prototype.$message({
538
- showClose: true,
539
- message: getI18n().t('superGrid.lineSavedSuccessfully', {
540
- row: (rowIndex + 1)
541
- }),
542
- type: 'success'
543
- })
544
- if (typeof (gridParams.options.lineEditOptions.aftersaveIsCancelEditState) === 'undefined' ||
545
- (isHasEditOption('aftersaveIsCancelEditState', listCode) &&
546
- gridParams.options.lineEditOptions.aftersaveIsCancelEditState === true)) {
547
- // 取消编辑状态
548
- setEntityFieldValue(row, '$editing', false)
549
- // Vue.set(row, '$editing', false)
550
- gridParams.isEditRow = false
551
- }
552
-
553
- if (isEditOptionFunction('saveSuccess', listCode)) {
554
- gridParams.options.lineEditOptions['saveSuccess'].call(this, data, gridParams.columns, rowIndex, row)
555
- }
556
- Object.assign(gridParams.orgGridData[rowIndex], data)
557
- // 必须加这句,否则连续保存时报事务异常
558
- Object.assign(gridParams.gridData[rowIndex], data)
559
- // 必须调用这句话,刷新一下列表,否则当前页总条数和记录总条数都会显示错误
560
- this.refresh(false, true)
561
- .then(() => {
562
- if (typeof (gridParams.options.lineEditOptions.aftersaveIsCreateRow) === 'undefined' || gridParams.options.lineEditOptions.aftersaveIsCreateRow) {
563
- this.createRow(listCode)
564
- }
565
- resolve({
566
- rowIndex,
567
- listCode
568
- })
569
- })
570
- .catch((error) => reject(error))
571
- })
572
- },
573
- restoreRow(rowIndex, listCode) {
574
- // 撤销当前行的编辑的信息
575
- return new Promise((resolve, reject) => {
576
- this.restoreCurrentRow(rowIndex, listCode)
577
- resolve()
578
- })
579
- },
580
- /**
581
- * 撤销当前指定编辑行的信息
582
- */
583
- restoreCurrentRow(rowIndex, listCode) {
584
- if (!listCode) {
585
- listCode = store.get('_list_code')
586
- }
587
- const gridParams = store.get(listCode)
588
- // console.log('restoreCurrentRow-gridParams.$rowIndex,rowIndex', gridParams.$rowIndex, rowIndex)
589
- if (gridParams.lineEdit && gridParams.lineEdit.editable) {
590
- if (gridParams.$rowIndex !== null && gridParams.$rowIndex !== rowIndex && !isLastEditRowSave(listCode)) {
591
- // 最后编辑的一行没有保存,则提示
592
- Vue.prototype.$message({
593
- showClose: true,
594
- message: getI18n().t('superGrid.pleaseSaveLine', {
595
- row: (gridParams.$rowIndex + 1)
596
- }),
597
- type: 'warning'
598
- })
599
- return
600
- }
601
- // true表示没有编辑任何字段,false表示当前行有编辑的字段
602
- const isUnEditing = gridParams.$lastSaveRowIndex !== null && gridParams.$lastSaveRowIndex === rowIndex && typeof (gridParams.gridData[rowIndex].id) !== 'undefined'
603
- let isValidate = true
604
- // 撤销编辑前的回调
605
- if (isEditOptionFunction('beforeRestoreValidate', listCode)) {
606
- const isSubTableShowPage = gridParams.isSubTableShowPage
607
- // 每页显示多少条
608
- const pageSize = gridParams.pagination && gridParams.pagination.pageSize
609
- const isMobile = false
610
- isValidate = gridParams.options.lineEditOptions.beforeRestoreValidate.call(this, { rowIndex, gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData, entity: gridParams.gridData[rowIndex], isMobile, baseURL: this.baseURL, isEditing: !isUnEditing, pageGridData: isSubTableShowPage ? gridParams.gridData : null, pageSize })
611
- }
612
- if (isValidate === undefined || isValidate === true) {
613
- // 例如:自定义验证成功,再继续平台的验证
614
- if (isUnEditing === true) {
615
- // 当前行已保存,已是最新数据,无需再撤销编辑
616
- // console.log('gridParams.gridData[rowIndex].id=', gridParams.gridData[rowIndex].id)
617
- Vue.prototype.$message({
618
- showClose: true,
619
- message: getI18n().t('superGrid.lineNoNeedToUndoEdit', {
620
- row: (rowIndex + 1)
621
- }),
622
- type: 'warning'
623
- })
624
- return
625
- }
626
- } else {
627
- return
628
- }
629
- let canRestore = true
630
- // 撤销编辑前的回调
631
- if (isEditOptionFunction('beforeRestore', listCode)) {
632
- const isSubTableShowPage = gridParams.isSubTableShowPage
633
- // 每页显示多少条
634
- const pageSize = gridParams.pagination && gridParams.pagination.pageSize
635
- const isMobile = false
636
- canRestore = gridParams.options.lineEditOptions.beforeRestore.call(this, { rowIndex, gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData, entity: gridParams.gridData[rowIndex], isMobile, baseURL: Vue.prototype.baseURL, isEditing: !isUnEditing, pageGridData: isSubTableShowPage ? gridParams.gridData : null, pageSize })
637
- }
638
- if (canRestore === undefined || canRestore === true) {
639
- // 如果没有编辑过任何行
640
- if (!gridParams.orgGridData[rowIndex].id && !gridParams.orgGridData[rowIndex].ID) {
641
- // 表示没有保存行数据,需要删除该行记录
642
- this.deleteRow(rowIndex, listCode, true)
643
- } else {
644
- // 这样写会导致“如果字段值原来是空的,输入了内容后,取消编辑没法把输入的值清空”问题
645
- // Object.assign(gridParams.gridData[rowIndex], gridParams.orgGridData[rowIndex])
646
- // 所以改成如下写法
647
- Vue.set(gridParams.gridData, rowIndex, JSON.parse(JSON.stringify(gridParams.orgGridData[rowIndex])))
648
- if (gridParams.isSubTableShowPage !== undefined && gridParams.isSubTableShowPage === true) {
649
- // 子表集合移除该行。会触发watch subTableData的监控
650
- const lastPageRowIndex = (this.currentPage - 1) * this.pageSize
651
- const subTableRowIndex = lastPageRowIndex + rowIndex
652
- Vue.set(gridParams.subTableData, subTableRowIndex, gridParams.gridData[rowIndex])
653
- }
654
- Vue.prototype.$message({
655
- showClose: true,
656
- message: getI18n().t('superGrid.lineCancelledSuccessfully', {
657
- row: (rowIndex + 1)
658
- }),
659
- type: 'success'
660
- })
661
-
662
- if (typeof (gridParams.options.lineEditOptions.afterRestoreIsCancelEditState) === 'undefined' ||
663
- (isHasEditOption('afterRestoreIsCancelEditState', listCode) &&
664
- gridParams.options.lineEditOptions.afterRestoreIsCancelEditState === true)) {
665
- // 取消编辑状态
666
- setEntityFieldValue(gridParams.gridData[rowIndex], '$editing', false)
667
- // Vue.set(gridParams.gridData[rowIndex], '$editing', false)
668
- gridParams.isEditRow = false
669
- }
670
- }
671
- gridParams.$rowIndex = null
672
- gridParams.isCreateRow = false
673
- // 撤销编辑后回调
674
- if (isEditOptionFunction('afterRestore', listCode)) {
675
- gridParams.options.lineEditOptions.afterRestore.call(this, rowIndex, gridParams.orgGridData[rowIndex])
676
- }
677
- }
678
- }
679
- },
680
- deleteRow(rowIndex, listCode, isRestore) {
681
- return new Promise((resolve, reject) => {
682
- if (!listCode) {
683
- listCode = store.get('_list_code')
684
- }
685
- const gridParams = store.get(listCode)
686
- let canDelete = true
687
- // 删除行记录前的回调
688
- if (isEditOptionFunction('beforeDelete', listCode)) {
689
- const isSubTableShowPage = gridParams.isSubTableShowPage
690
- // 每页显示多少条
691
- const pageSize = gridParams.pagination && gridParams.pagination.pageSize
692
- const gridData = isSubTableShowPage ? gridParams.subTableData : gridParams.gridData
693
- const isMobile = false
694
- canDelete = gridParams.options.lineEditOptions.beforeDelete.call(this, rowIndex, gridParams.gridData[rowIndex], gridData, isMobile, this.baseURL, isSubTableShowPage ? gridParams.gridData : null, pageSize)
695
- }
696
- if (canDelete === undefined || canDelete === true) {
697
- if (gridParams.isSubTableShowPage !== undefined && gridParams.isSubTableShowPage === true) {
698
- // 子表集合添加该新建的行。会触发watch subTableData的监控
699
- gridParams.isChangePage = true
700
- const lastPageRowIndex = (this.currentPage - 1) * this.pageSize
701
- const subTableRowIndex = lastPageRowIndex + rowIndex
702
-
703
- gridParams.subTableData.splice(subTableRowIndex, 1)
704
- } else {
705
- gridParams.gridData.splice(rowIndex, 1)
706
- gridParams.orgGridData.splice(rowIndex, 1)
707
- }
708
- // TODO 注释下面的代码,是因为表单子表删除记录时会造成未保存新增的记录的字段被清空的问题,不知道当时为什么要加这个代码
709
- // Object.assign(gridParams.gridData, gridParams.orgGridData)
710
- gridParams.$lastSaveRowIndex = null
711
- gridParams.$rowIndex = null
712
- gridParams.isEditRow = false
713
- Vue.prototype.$message({
714
- showClose: true,
715
- message: getI18n().t('superGrid.deleteSuccessful'),
716
- type: 'success'
717
- })
718
- if (gridParams.gridData.length === 0) {
719
- if (gridParams.options && gridParams.options.isDefaultShowEdit !== null &&
720
- gridParams.options.isDefaultShowEdit !== undefined && gridParams.options.isDefaultShowEdit === true) {
721
- // 表示没有记录时,需要创建新行
722
- this.createRow(listCode)
723
- }
724
- }
725
- if (gridParams.isMulitiSelect) {
726
- gridParams.superGrid.clearSelection()
727
- }
728
- gridParams.isCreateRow = false
729
- if (isRestore !== undefined && isRestore === true) {
730
- // 表示是删除操作,执行删除记录后回调
731
- if (isEditOptionFunction('afterDelete', listCode)) {
732
- const isSubTableShowPage = gridParams.isSubTableShowPage
733
- // 每页显示多少条
734
- const pageSize = gridParams.pagination && gridParams.pagination.pageSize
735
- const isMobile = false
736
- gridParams.options.lineEditOptions.afterDelete.call(this, rowIndex, gridParams.orgGridData[rowIndex], isSubTableShowPage ? gridParams.subTableData : gridParams.gridData, isMobile, this.baseURL, isSubTableShowPage ? gridParams.gridData : null, pageSize)
737
- }
738
- }
739
- }
740
-
741
- resolve()
742
- })
743
- },
744
- // 行编辑时,点击自定义组件时,使当前行获得焦点
745
- focus(rowIndex, listCode) {
746
- setCurrentRow(rowIndex, listCode)
747
- },
748
- // 获得列表所有数据
749
- getGridData(listCode) {
750
- if (!listCode) {
751
- listCode = store.get('_list_code')
752
- }
753
- const gridParams = store.get(listCode)
754
- const isSubTableShowPage = gridParams.isSubTableShowPage
755
- if (isSubTableShowPage) {
756
- return gridParams.subTableData
757
- } else {
758
- return gridParams.gridData
759
- }
760
- },
761
- // 获得字段配置
762
- getColumns(listCode) {
763
- if (!listCode) {
764
- listCode = store.get('_list_code')
765
- }
766
- const gridParams = store.get(listCode)
767
- return gridParams.columns
768
- },
769
- getPagination(listCode) {
770
- if (!listCode) {
771
- listCode = store.get('_list_code')
772
- }
773
- const gridParams = store.get(listCode)
774
- return gridParams.pagination
775
- },
776
- // 获得该列表中,下拉选是选项组的字段信息,返回的key是属性名,value是选项集合
777
- getOptionsValueSet(listCode) {
778
- const result = {}
779
- if (!listCode) {
780
- listCode = store.get('_list_code')
781
- }
782
- const gridParams = store.get(listCode)
783
- const columns = gridParams.columns
784
- columns.forEach(col => {
785
- if (col.valueSet && col.valueSet.length > 0) {
786
- result[col.prop] = col.valueSet
787
- }
788
- })
789
- return result
790
- },
791
- // 取消列表的编辑状态
792
- restoreGridEdit(listCode) {
793
- if (!listCode) {
794
- listCode = store.get('_list_code')
795
- }
796
- const gridParams = store.get(listCode)
797
- if (gridParams.options && gridParams.options.isFormSubTable) {
798
- const isSubTableShowPage = gridParams.isSubTableShowPage
799
- let gridData = []
800
- if (isSubTableShowPage) {
801
- gridData = gridParams.subTableData
802
- } else {
803
- gridData = gridParams.gridData
804
- }
805
- if (gridData && gridData.length > 0) {
806
- for (let i = 0; i < gridData.length; i++) {
807
- const row = gridData[i]
808
- // 取消最后一个编辑行的状态
809
- if (row.$editing !== undefined && row.$editing === true) {
810
- setEntityFieldValue(row, '$editing', false)
811
- // 取消上一行选中状态时,触发un-edit事件,处理下拉多选选项组问题
812
- eventBus.$emit('un-edit', { row: row })
813
- break
814
- }
815
- }
816
- }
817
- }
818
- }
819
- }
820
- export default apis