imatrix-ui 2.8.39-dw → 2.8.39-pvtmp

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