super-pages 0.0.9-up → 0.0.11-up

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 (52) hide show
  1. package/index.html +13 -0
  2. package/package.json +2 -12
  3. package/packages/index.js +30 -0
  4. package/packages/super-page/index.js +9 -0
  5. package/packages/super-page/src/button-group.vue +294 -0
  6. package/packages/super-page/src/chart-page.vue +215 -0
  7. package/packages/super-page/src/chart-query-page.vue +163 -0
  8. package/packages/super-page/src/common-form-page.vue +594 -0
  9. package/packages/super-page/src/export-form-report-dialog.vue +145 -0
  10. package/packages/super-page/src/form-head.vue +74 -0
  11. package/packages/super-page/src/form-page.vue +107 -0
  12. package/packages/super-page/src/group-tag.vue +21 -0
  13. package/packages/super-page/src/list-page.vue +1453 -0
  14. package/packages/super-page/src/list-toolbar-dynamic-source.vue +89 -0
  15. package/packages/super-page/src/list-toolbar-page.vue +377 -0
  16. package/packages/super-page/src/my-button-base.vue +438 -0
  17. package/packages/super-page/src/my-button.vue +196 -0
  18. package/packages/super-page/src/page-custom-component.vue +56 -0
  19. package/packages/super-page/src/remove-signer-dialog.vue +103 -0
  20. package/packages/super-page/src/sub-tab-page.vue +79 -0
  21. package/packages/super-page/src/super-page-component.vue +86 -0
  22. package/packages/super-page/src/super-page.vue +162 -0
  23. package/packages/super-page/src/tab-page.vue +154 -0
  24. package/packages/super-page/src/task-informition-dialog.vue +82 -0
  25. package/packages/super-page/src/util/ListButtonEvent.js +896 -0
  26. package/packages/super-page/src/util/api.js +37 -0
  27. package/packages/super-page/src/util/callEvents.js +62 -0
  28. package/packages/super-page/src/util/chartButtonEvent.js +60 -0
  29. package/packages/super-page/src/util/common-util.js +102 -0
  30. package/packages/super-page/src/util/commonButtonEvent.js +70 -0
  31. package/packages/super-page/src/util/eventBus.js +8 -0
  32. package/packages/super-page/src/util/formButtonEvent.js +509 -0
  33. package/packages/super-page/src/util/store.js +3 -0
  34. package/packages/super-page/src/util/super-page.js +29 -0
  35. package/packages/super-page/src/util/util.js +1491 -0
  36. package/packages/super-page/src/util/workflowButtonEvent.js +1729 -0
  37. package/packages/super-page/src/widget-col-page.vue +339 -0
  38. package/packages/super-page/src/widget-page.vue +703 -0
  39. package/packages/super-page/src/widget-sub-tab-pane-page.vue +115 -0
  40. package/packages/super-page/src/widget-tab-pane-page.vue +135 -0
  41. package/packages/super-page/src/workflow-button-group.vue +561 -0
  42. package/packages/super-page/src/workflow-form-page.vue +1310 -0
  43. package/packages/super-page-dialog/index.js +9 -0
  44. package/packages/super-page-dialog/src/super-page-dialog.vue +200 -0
  45. package/packages/utils/gogocodeTransfer.js +59 -0
  46. package/public/vite.svg +1 -0
  47. package/src/i18n/i18n.js +16 -0
  48. package/src/i18n/langs/cn.js +65 -0
  49. package/src/i18n/langs/en.js +68 -0
  50. package/src/styles/index.scss +4 -0
  51. package/src/utils/common-util.js +9 -0
  52. package/vite.config.js +36 -0
@@ -0,0 +1,1453 @@
1
+ <template>
2
+ <div v-if="showPage">
3
+ <button-group
4
+ v-if="colSetting.options.buttonGroup"
5
+ :button-groups="colSetting.options.buttonGroup"
6
+ :permission-prefix="permissionPrefix"
7
+ :additional-param-map="additionalParamMap"
8
+ :list-toolbar-list="listToolbarList"
9
+ :button-area-custom-component-arr="
10
+ colSetting.options.buttonAreaCustomComponentArr
11
+ "
12
+ position="list"
13
+ :search-form-info="searchFormInfo"
14
+ :toolbar-right-show="colSetting.options.toolbarRightShow"
15
+ :page-code="pageCode"
16
+ :selections="selections"
17
+ :disabled="disabled"
18
+ @refresh="refreshList"
19
+ @searchGridData="searchGridData"
20
+ @click="clickListButton"
21
+ @getSystemRef="getSystemRef"
22
+ />
23
+ <!-- 工具栏组件 -->
24
+ <div v-else>
25
+ <list-toolbar-page
26
+ :list-toolbar-list="listToolbarList"
27
+ :page-code="pageCode"
28
+ @searchGridData="searchGridData"
29
+ />
30
+ <page-custom-component
31
+ :button-area-custom-component-arr="
32
+ colSetting.options.buttonAreaCustomComponentArr
33
+ "
34
+ :page-code="pageCode"
35
+ @getSystemRef="getSystemRef"
36
+ />
37
+ </div>
38
+ <input
39
+ ref="_selectFile_"
40
+ type="file"
41
+ name="_selectFile_"
42
+ style="display: none"
43
+ @change="doImport(button)"
44
+ />
45
+ <super-grid
46
+ ref="grid"
47
+ :url="urlToListData"
48
+ :options="options"
49
+ :code="listCode"
50
+ :search-form-info="searchFormInfo"
51
+ :list-toolbar-form-data="listToolbarFormData"
52
+ @select="select"
53
+ @select-all="select"
54
+ @setSearchType="closeSearch"
55
+ @refresh="clickRefresh"
56
+ />
57
+ <super-page-dialog
58
+ v-if="isShowPageDialog"
59
+ :preview="isPreview"
60
+ :dev-mode="pageDevMode"
61
+ :jump-page-setting="jumpPageSetting"
62
+ @update-value="updateValues"
63
+ @close="closeInPage"
64
+ />
65
+ </div>
66
+ </template>
67
+
68
+ <script>
69
+ import Util from './util/util'
70
+ import * as Vue from 'vue'
71
+ import ButtonGroup from './button-group'
72
+ import eventBus from './util/eventBus'
73
+ import buttonEvents from './util/ListButtonEvent'
74
+ import callEvents from './util/callEvents'
75
+ import apis from './util/api'
76
+ import store from './util/store'
77
+ import listToolbarPage from './list-toolbar-page'
78
+ import pageCustomComponent from './page-custom-component'
79
+ import { getStoreInfo, setStoreInfo } from './util/common-util'
80
+ import {
81
+ getSystemBackendUrl,
82
+ isPromise,
83
+ } from 'imatrix-ui/src/utils/common-util'
84
+ export default {
85
+ name: 'ListPage',
86
+ components: {
87
+ ButtonGroup,
88
+ listToolbarPage,
89
+ pageCustomComponent,
90
+ },
91
+ props: {
92
+ colSetting: {
93
+ type: Object,
94
+ default: null,
95
+ },
96
+ // 页面编码
97
+ pageCode: {
98
+ type: String,
99
+ default: null,
100
+ },
101
+ // 页签编码
102
+ tabCode: {
103
+ type: String,
104
+ default: null,
105
+ },
106
+ },
107
+ data() {
108
+ let baseURL = window.$vueApp.config.globalProperties.baseURL
109
+ const tableName = this.colSetting.baseSetting.modelDataTableCode
110
+ let isWorkflowEntity = getStoreInfo(this.pageCode, tableName + '_isProcess')
111
+ if (isWorkflowEntity === null && isWorkflowEntity === undefined) {
112
+ isWorkflowEntity = false
113
+ }
114
+ const system = getStoreInfo(this.pageCode, '_systemInfo')
115
+ const isSqlQuery = getStoreInfo(this.pageCode, '_pageIsDsc')
116
+ console.log(
117
+ 'list-page--_pageIsDsc--isSqlQuery=',
118
+ isSqlQuery,
119
+ 'this.pageCode=',
120
+ this.pageCode
121
+ )
122
+ const pageCode = getStoreInfo(this.pageCode, '_pageCode')
123
+ const urlToListData = this.getUrlToListData(system)
124
+ // 实体类名,首字母小写
125
+ const entityName = this.colSetting.baseSetting.modelDataTableEntityName
126
+ const beanName = this.colSetting.baseSetting.beanName
127
+ const importBeanName = this.colSetting.baseSetting.importBeanName
128
+ let permissionPrefix
129
+ if (system) {
130
+ baseURL = getSystemBackendUrl(system.backendUrl)
131
+ permissionPrefix =
132
+ system.code +
133
+ '.' +
134
+ pageCode +
135
+ '.' +
136
+ this.colSetting.baseSetting.componentCode
137
+ }
138
+ let initSearchForm = this.colSetting.options.listFilterCondition
139
+ if (typeof initSearchForm === 'undefined') {
140
+ initSearchForm = []
141
+ }
142
+ const pathQuery = getStoreInfo(this.pageCode, '_pathQuery')
143
+ const pageHeight = getStoreInfo(this.pageCode, '_pageHeight')
144
+ const options = {
145
+ isSql: isSqlQuery,
146
+ extraParam: {
147
+ entityName: entityName,
148
+ beanName: beanName,
149
+ functionCode: permissionPrefix + '.list',
150
+ tableName,
151
+ },
152
+ initSearchForm,
153
+ lineEditOptions: {
154
+ aftersaveIsCreateRow: false,
155
+ autoSave: false,
156
+ enter: this.enterSave,
157
+ esc: this.escRestorRow,
158
+ },
159
+ multiple: this.colSetting.options.isListViewMultiple, // 是否多选,默认以列表管理中配置的为准
160
+ showIndex: this.colSetting.options.isListViewShowSerialNumber, // 是否显示序号,默认以列表管理中配置的为准
161
+ indexContinuous: this.colSetting.options.serialNumberContinuous,
162
+ pageSizes: this.colSetting.options.listViewPageNum, // 可选行数
163
+ initSearch: this.colSetting.options.isListViewDefaultQuery, // 初始化时是否查询,默认是查询
164
+ resizeHeight: this.resizeListHeight,
165
+ pageCode: this.pageCode,
166
+ pageHeight: pageHeight, // 页面的高度
167
+ additionalParamMap: pathQuery, // 将路由参数传给列表组件
168
+ showOverflowTooltip: !!(
169
+ this.colSetting.options.isBreakLine === undefined ||
170
+ this.colSetting.options.isBreakLine === false
171
+ ), // 单元格内容是否换行显示
172
+ isEnableEnterEvent: this.colSetting.options.isEnableEnterEvent, // 是否启用回车事件
173
+ }
174
+ if (system) {
175
+ // 系统编码传给列表数据后台请求
176
+ options.extraParam.systemCode = system.code
177
+ // 当前系统,表示是当前的自定义系统信息
178
+ options.system = system
179
+ }
180
+ if (this.colSetting.options.sortFields) {
181
+ options.initSortInfo = []
182
+ this.colSetting.options.sortFields.forEach((item) => {
183
+ const sortInfo = {
184
+ order: item.sortOrder,
185
+ }
186
+ if (isSqlQuery) {
187
+ sortInfo.prop = item.propDbName
188
+ } else {
189
+ sortInfo.prop = item.sortColumn
190
+ }
191
+ options.initSortInfo.push(sortInfo)
192
+ })
193
+ } else {
194
+ if (
195
+ this.colSetting.options.listViewOrderProp &&
196
+ this.colSetting.options.listViewOrderMode
197
+ ) {
198
+ // 默认排序字段,和排序方式
199
+ options.initSortInfo = {
200
+ order: this.colSetting.options.listViewOrderMode,
201
+ }
202
+ if (isSqlQuery) {
203
+ options.initSortInfo.prop =
204
+ this.colSetting.options.listViewOrderPropDbName
205
+ } else {
206
+ options.initSortInfo.prop = this.colSetting.options.listViewOrderProp
207
+ }
208
+ }
209
+ }
210
+ if (this.colSetting.options.isWithDataPermission) {
211
+ options.isWithDataPermission =
212
+ this.colSetting.options.isWithDataPermission
213
+ }
214
+ const listViewTreeTableSetting =
215
+ this.colSetting.options.listViewTreeTableSetting
216
+ if (listViewTreeTableSetting) {
217
+ // 父级字段配置
218
+ // 格式为:name~~dbCloumnName,name表示实体字段名,dbCloumnName表示数据库字段名
219
+ const parentPropInfo = listViewTreeTableSetting.parentProp
220
+ let parentProp
221
+ let parentPropDbName
222
+ if (parentPropInfo && parentPropInfo.indexOf('~~') > 0) {
223
+ parentProp = parentPropInfo.substring(0, parentPropInfo.indexOf('~~'))
224
+ parentPropDbName = parentPropInfo.substring(
225
+ parentPropInfo.indexOf('~~') + 2
226
+ )
227
+ }
228
+ if (isSqlQuery) {
229
+ // 数据库字段名
230
+ options.parentProp = parentPropDbName
231
+ } else {
232
+ // 实体字段名
233
+ options.parentProp = parentProp
234
+ }
235
+ if (options.parentProp) {
236
+ // 表示配置了父级字段名,则表示是树状结构数据
237
+ // 树表格配置传给后台
238
+ options.extraParam.listViewTreeSetting = JSON.stringify(
239
+ listViewTreeTableSetting
240
+ )
241
+ const lazy = listViewTreeTableSetting.lazy
242
+ if (lazy === undefined || lazy === null) {
243
+ options.lazy = true
244
+ } else {
245
+ options.lazy = lazy
246
+ }
247
+ const defaultExpandAll = listViewTreeTableSetting.defaultExpandAll
248
+ if (defaultExpandAll === undefined || defaultExpandAll === null) {
249
+ options.defaultExpandAll = false
250
+ } else {
251
+ options.defaultExpandAll = defaultExpandAll
252
+ }
253
+
254
+ if (isSqlQuery) {
255
+ options.subRowUrl = baseURL + '/dsc/commons/list-subs'
256
+ }
257
+ }
258
+ }
259
+ const isPreview = getStoreInfo(this.pageCode, '_pagePreview')
260
+ if (isPreview !== undefined && isPreview === true) {
261
+ // 预览时,不请求数据,只查看列表结构
262
+ options.loadBeforeSend = function () {
263
+ return false
264
+ }
265
+ }
266
+ let pageDevMode = getStoreInfo(this.pageCode, '_pageDevMode')
267
+ if (pageDevMode === null || pageDevMode === undefined) {
268
+ pageDevMode = false
269
+ }
270
+ options.pageDevMode = pageDevMode
271
+ let formNoRuleCode = ''
272
+ if (this.colSetting.options && this.colSetting.options.formNoRuleCode) {
273
+ formNoRuleCode = this.colSetting.options.formNoRuleCode
274
+ }
275
+ let listToolbarList
276
+ if (this.colSetting.options && this.colSetting.options.listToolbarList) {
277
+ listToolbarList = this.colSetting.options.listToolbarList
278
+ }
279
+ const listCode = this.colSetting.baseSetting.modelCode
280
+ let importRuleCode = ''
281
+ if (this.colSetting.options && this.colSetting.options.importRuleCode) {
282
+ importRuleCode = this.colSetting.options.importRuleCode
283
+ } else {
284
+ // 如果没有配置导入编码的时候,可以默认给导入编码赋上列表编码
285
+ // importRuleCode = listCode
286
+ }
287
+ options.isWorkflowEntity = isWorkflowEntity
288
+ // 表单事件集合
289
+ let listEvents
290
+ const pageEvents = getStoreInfo(this.pageCode, '_pageEvents')
291
+ if (pageEvents) {
292
+ listEvents = pageEvents.listEvents
293
+ if (listEvents && listEvents[listCode + '__beforeListLoad']) {
294
+ options.loadBeforeSend = listEvents[listCode + '__beforeListLoad']
295
+ }
296
+ if (listEvents && listEvents[listCode + '__onListLoad']) {
297
+ options.gridDataLoaded = listEvents[listCode + '__onListLoad']
298
+ }
299
+ if (listEvents && listEvents[listCode + '__afterListLoad']) {
300
+ options.gridComplete = listEvents[listCode + '__afterListLoad']
301
+ }
302
+ // 重新计算列表高度事件
303
+ if (listEvents && listEvents[listCode + '__resizeTableHeight']) {
304
+ options.resizeHeight = listEvents[listCode + '__resizeTableHeight']
305
+ }
306
+ if (listEvents && listEvents[listCode + '__beforeEdit']) {
307
+ if (options.lineEditOptions === undefined) {
308
+ options.lineEditOptions = {}
309
+ }
310
+ options.lineEditOptions.beforeEdit =
311
+ listEvents[listCode + '__beforeEdit']
312
+ }
313
+ if (listEvents && listEvents[listCode + '__beforeRestoreValidate']) {
314
+ if (options.lineEditOptions === undefined) {
315
+ options.lineEditOptions = {}
316
+ }
317
+ options.lineEditOptions.beforeRestoreValidate =
318
+ listEvents[listCode + '__beforeRestoreValidate']
319
+ }
320
+ if (listEvents && listEvents[listCode + '__beforeRestore']) {
321
+ if (options.lineEditOptions === undefined) {
322
+ options.lineEditOptions = {}
323
+ }
324
+ options.lineEditOptions.beforeRestore =
325
+ listEvents[listCode + '__beforeRestore']
326
+ }
327
+ const customEvents = pageEvents.customEvents
328
+ if (customEvents) {
329
+ // 将页面中配置的自定义事件集合传给列表组件super-grid,供列表行编辑控件使用
330
+ options.eventCallBack = customEvents
331
+ if (
332
+ this.colSetting.options.styleCustomMethod &&
333
+ this.colSetting.options.styleCustomMethod !== ''
334
+ ) {
335
+ if (
336
+ customEvents &&
337
+ customEvents[this.colSetting.options.styleCustomMethod]
338
+ ) {
339
+ options.rowStyleRender =
340
+ customEvents[this.colSetting.options.styleCustomMethod]
341
+ }
342
+ }
343
+ }
344
+ }
345
+ // console.log('options--', options)
346
+ return {
347
+ listToolbarList,
348
+ urlToListData,
349
+ // 列表组件配置属性
350
+ options,
351
+ operationButtons: this.colSetting.options.operationButtons,
352
+ selections: null,
353
+ listCode,
354
+ permissionPrefix, // 按钮组中按钮的资源编码前缀,例如:系统编码.实体类名
355
+ system,
356
+ tableName: this.colSetting.baseSetting.modelDataTableCode,
357
+ entityName: entityName, // 实体类名(包括包路径)
358
+ beanName,
359
+ importBeanName,
360
+ myJsContent: null, // 按钮的js内容
361
+ isSqlQuery,
362
+ judgeHeavyList: this.colSetting.options.judgeHeavyList, // 判重组合字段配置
363
+ listViewImportDuplicate: this.colSetting.options.listViewImportDuplicate, // 导入重复规则
364
+ buttonRestfulApiPath: null, // 按钮的后台路径
365
+ deleteLogicSetting: this.colSetting.options.deleteLogicSetting, // 删除逻辑控制配置,子表有记录时是否允许删除,默认是true允许
366
+ baseURL,
367
+ autoSetValueData: null, // 按钮的“自动设值”配置
368
+ dataConversionRule: null, // 数据转换规则编码
369
+ formNoRuleCode, // 表单编号规则
370
+ importRuleCode, // 导入编码
371
+ isPreview, // 是否是预览
372
+ button: null, // 点击的当前按钮
373
+ logSettingText: null,
374
+ additionalParamMap: null, // 跳转页面的附加参数
375
+ dataTypeMap: null, // 数据类型map集合,key为字段名,value为字段类型,优化保存速度
376
+ showPage: false, // 是否显示页面内容
377
+ operationButtonObj: {}, // 操作列按钮对象,key为按钮编码,value为按钮对象
378
+ listEvents,
379
+ pageDevMode,
380
+ isShowPageDialog: false, // 是否显示弹框页面
381
+ jumpPageSetting: null, // 弹框页面的设置信息
382
+ editRowData: null, // 行编辑时当前编辑的行记录
383
+ searchIsPopup: false, // 是否是弹窗查询
384
+ customEvents: pageEvents ? pageEvents.customEvents : null,
385
+ listToolbarFormData: null, // 列表工具栏的值对象
386
+ isWorkflowEntity,
387
+ searchFormInfo: { data: {} },
388
+ disabled: false,
389
+ pageType: 'list', // 页面类型
390
+ }
391
+ },
392
+ watch: {
393
+ jumpPageSetting: {
394
+ deep: true,
395
+ handler(jumpPageSetting) {
396
+ if (jumpPageSetting && jumpPageSetting !== null) {
397
+ const that = this
398
+ eventBus.$on(
399
+ jumpPageSetting.pageCode + '-close-dialog',
400
+ (pageCode, successOperation, popEntity, popPageCode) => {
401
+ if (pageCode === jumpPageSetting.pageCode) {
402
+ that.closeInPageEvent(
403
+ popEntity,
404
+ popPageCode,
405
+ successOperation,
406
+ that
407
+ )
408
+ }
409
+ that.$set(that, 'selections', null)
410
+ // that.selections = null
411
+ // 关闭事件
412
+ eventBus.$off(pageCode + '-close-dialog')
413
+ }
414
+ )
415
+ }
416
+ },
417
+ },
418
+ },
419
+ created() {
420
+ window.addEventListener('message', this.recieveMessage)
421
+ this.getDataTypeMap().then(() => {
422
+ const tableName = this.colSetting.baseSetting.modelDataTableCode
423
+ const isWfEntity = getStoreInfo(this.pageCode, tableName + '_isProcess')
424
+ if (isWfEntity === null && isWfEntity === undefined) {
425
+ this.isWorkflowEntity = false
426
+ } else {
427
+ this.isWorkflowEntity = isWfEntity
428
+ }
429
+ // 设置列表操作列按钮
430
+ this.setOperationButtons()
431
+ })
432
+ const additionalParamMap = getStoreInfo(this.pageCode, 'additionalParamMap')
433
+ if (additionalParamMap) {
434
+ if (!this.options.additionalParamMap) {
435
+ this.options['additionalParamMap'] = {}
436
+ }
437
+ Object.assign(this.options.additionalParamMap, additionalParamMap)
438
+ }
439
+ if (this.options.additionalParamMap) {
440
+ this.additionalParamMap = this.options.additionalParamMap
441
+ }
442
+ const that = this
443
+ eventBus.$on(
444
+ that.pageCode + '-close-component-page-dialog',
445
+ (jumpInfo, popEntity, popPageCode) => {
446
+ console.log(
447
+ 'close-component-page-dialog-list------',
448
+ jumpInfo,
449
+ popEntity,
450
+ popPageCode
451
+ )
452
+ if (that.$refs.grid) {
453
+ that.$refs.grid.closePageDialog({
454
+ entity: popEntity,
455
+ pageCode: popPageCode,
456
+ })
457
+ }
458
+ }
459
+ )
460
+ // 刷新指定页签的表格数据
461
+ eventBus.$on(that.pageCode + '-refresh-tab', (tabCode) => {
462
+ if (
463
+ that.$refs.grid &&
464
+ tabCode !== undefined &&
465
+ tabCode === that.tabCode
466
+ ) {
467
+ that.$refs.grid.refresh()
468
+ }
469
+ })
470
+ // 关闭弹框事件回调使用
471
+ eventBus.$on(this.pageCode + '_close-dialog-get-entity', () => {
472
+ $emit(eventBus, that.pageCode + '_close-super-dialog')
473
+ })
474
+ },
475
+ beforeUnmount() {
476
+ eventBus.$off(this.pageCode + '-close-component-page-dialog')
477
+ eventBus.$off(this.pageCode + '-refresh-tab')
478
+ eventBus.$off(this.pageCode + '_close-dialog-get-entity')
479
+ },
480
+ methods: {
481
+ ...Util,
482
+ ...buttonEvents,
483
+ ...callEvents,
484
+ ...apis,
485
+ // 列表组件内容刷新后的回调事件
486
+ clickRefresh() {
487
+ this.selections = []
488
+ },
489
+ getSystemRef(refKey, operation) {
490
+ if (!refKey) {
491
+ // 列表的ref属性的值
492
+ refKey = 'grid'
493
+ }
494
+ if (!operation) {
495
+ operation = 'refresh'
496
+ }
497
+ if (this.$refs[refKey]) {
498
+ const domRef = this.$refs[refKey]
499
+ if (domRef) {
500
+ if (operation === 'refresh') {
501
+ domRef.refresh()
502
+ }
503
+ }
504
+ }
505
+ return 123
506
+ },
507
+ getDataTypeMap() {
508
+ return new Promise((resolve, reject) => {
509
+ if (this.isPreview) {
510
+ // 预览时不需要获得字段类型
511
+ this.showPage = true
512
+ resolve()
513
+ } else {
514
+ this.getDataTypeMapRequest(this.system, this.tableName)
515
+ .then((dataTypeMap) => {
516
+ this.dataTypeMap = dataTypeMap.dataTypeMap
517
+ setStoreInfo(
518
+ this.pageCode,
519
+ this.tableName + '_isProcess',
520
+ dataTypeMap.isProcess
521
+ )
522
+ console.log(store)
523
+ this.showPage = true
524
+ resolve()
525
+ })
526
+ .catch(() => {
527
+ reject(
528
+ new Error(
529
+ '获得数据表:' + this.tableName + '的字段类型集合失败'
530
+ )
531
+ )
532
+ })
533
+ }
534
+ })
535
+ },
536
+ // 点击导入按钮选择文件
537
+ clickImport() {
538
+ if (!this.isPreview) {
539
+ // 预览时,导入按钮不生效才行
540
+ this.$refs._selectFile_.click()
541
+ }
542
+ },
543
+ // 选择文件后执行导入
544
+ doImport() {
545
+ const button = this.button
546
+ if (button) {
547
+ const that = this
548
+ if (!this.$refs._selectFile_) {
549
+ return
550
+ }
551
+ if (
552
+ this.$refs._selectFile_.value === '' ||
553
+ this.$refs._selectFile_.value === null
554
+ )
555
+ return
556
+ const fileObj = this.$refs._selectFile_.files[0]
557
+ if (fileObj) {
558
+ this.$refs._selectFile_.value = null
559
+ // console.log('doImport=', button)
560
+ that.doImportFinally(
561
+ that.system,
562
+ button.restfulApiPath,
563
+ that.tableName,
564
+ that.entityName,
565
+ that.myJsContent,
566
+ button,
567
+ that.listViewImportDuplicate,
568
+ fileObj,
569
+ that.judgeHeavyList,
570
+ that.formNoRuleCode,
571
+ that.importRuleCode,
572
+ that.listCode,
573
+ that.beanName,
574
+ that.pageCode,
575
+ that.importBeanName
576
+ )
577
+ } else {
578
+ this.$message({
579
+ showClose: true,
580
+ type: 'warning',
581
+ message: this.$t('superPageMessage.noFileSelected'),
582
+ })
583
+ }
584
+ }
585
+ },
586
+ clickListButton(button) {
587
+ const that = this
588
+ // console.log('---clickListButton---', button, this.selections)
589
+ if (that.isPreview) {
590
+ // 预览时按钮无需操作
591
+ return
592
+ }
593
+ if (button) {
594
+ const beforeClickResult = this.callBeforeClickButton(
595
+ this.listEvents,
596
+ this.listCode + '__' + button.code,
597
+ {
598
+ params: this.additionalParamMap,
599
+ additionalParamMap: this.additionalParamMap,
600
+ entity: this.selections,
601
+ listToolbarFormData: this.listToolbarFormData,
602
+ button: button,
603
+ formNoRuleCode: this.formNoRuleCode,
604
+ importRuleCode: this.importRuleCode,
605
+ }
606
+ )
607
+ if (!beforeClickResult) {
608
+ // 返回值为false,不继续执行按钮操作
609
+ return
610
+ }
611
+ if (isPromise(beforeClickResult)) {
612
+ beforeClickResult.then((result) => {
613
+ if (result) {
614
+ that.clickListButtonSuccess(button, that)
615
+ }
616
+ })
617
+ } else {
618
+ that.clickListButtonSuccess(button, that)
619
+ }
620
+ }
621
+ },
622
+ clickListButtonSuccess(button, that) {
623
+ let entities = []
624
+ if (that.selections && that.selections !== null) {
625
+ entities = [].concat(that.selections)
626
+ }
627
+ if (button.code && button.code === 'search') {
628
+ // 表示点击的查询按钮
629
+ this.clickSearchButton(button)
630
+ return
631
+ } else if (button.code && button.code === 'import') {
632
+ this.button = button
633
+ this.clickImport()
634
+ return
635
+ } else if (button.code && button.code === 'lineEditCreate') {
636
+ this.createRow(button)
637
+ return
638
+ }
639
+ // 不是行编辑的事件响应
640
+ let dataIds = []
641
+ dataIds = that.getSelectionIds()
642
+ that
643
+ .canExecuteWithMore(
644
+ button.executableData,
645
+ entities,
646
+ that.isSqlQuery,
647
+ this.tableName,
648
+ this.additionalParamMap
649
+ )
650
+ .then((result) => {
651
+ if (result.canExecute === true) {
652
+ // 表示可执行该操作
653
+ if (button.code !== 'lineEditDelete' && result.entities) {
654
+ entities = result.entities
655
+ }
656
+ let jsContent = false
657
+ if (button && typeof button.jsContent !== 'undefined') {
658
+ jsContent = button.jsContent
659
+ }
660
+ that.myJsContent = jsContent
661
+ that.buttonRestfulApiPath = button.restfulApiPath
662
+ if (button.autoSetValueData) {
663
+ that.autoSetValueData = button.autoSetValueData
664
+ }
665
+ if (button.dataConversionRule) {
666
+ that.dataConversionRule = button.dataConversionRule
667
+ }
668
+ const UUID = that.getUUID()
669
+ that.clickButton(
670
+ button,
671
+ that.system,
672
+ that.listCode,
673
+ dataIds,
674
+ that.tableName,
675
+ that.entityName,
676
+ jsContent,
677
+ entities,
678
+ that.deleteLogicSetting,
679
+ that.formNoRuleCode,
680
+ that.importRuleCode,
681
+ that.beanName,
682
+ that.isWorkflowEntity,
683
+ UUID
684
+ )
685
+ this.getExport(UUID)
686
+ }
687
+ })
688
+ },
689
+ /**
690
+ * 获取一个UUID
691
+ * 格式:8-4-4-4-12
692
+ * @returns UUID
693
+ */
694
+ getUUID() {
695
+ return 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
696
+ const r = (Math.random() * 16) | 0
697
+ const v = c === 'x' ? r : (r & 0x3) | 0x8
698
+ return v.toString(16)
699
+ })
700
+ },
701
+ // 导出时,权限控制
702
+ getExport(UUID) {
703
+ const that = this
704
+ setTimeout(() => {
705
+ if (localStorage.getItem(UUID)) {
706
+ if (localStorage.getItem(UUID) === 'start') {
707
+ that.disabled = true
708
+ that['disabled'] = true
709
+ this.getExport(UUID)
710
+ } else {
711
+ that.disabled = false
712
+ localStorage.removeItem(UUID)
713
+ }
714
+ }
715
+ }, 500)
716
+ },
717
+ // 点击查询或取消查询按钮
718
+ clickSearchButton(button) {
719
+ const cancelSearchLabel = this.$t(
720
+ 'superPageMessage.cancelSearchButtonLabel'
721
+ )
722
+ const searchLabel = this.$t('superPageMessage.searchButtonLabel')
723
+
724
+ const queryMode = this.$refs.grid.getQueryMode()
725
+ if (queryMode === 'popup') {
726
+ // 如果是弹窗方式,每次都是打开方式,每次都是查询按钮
727
+ // 点击查询时
728
+ this.$refs.grid.showSearchForm()
729
+ if (!this.searchIsPopup) {
730
+ button.label = searchLabel
731
+ }
732
+ } else {
733
+ // 如果是嵌入模式,再进行判断
734
+ if (!button.label || button.label === searchLabel) {
735
+ // 点击查询时
736
+ this.$refs.grid.showSearchForm()
737
+ if (!this.searchIsPopup) {
738
+ button.label = cancelSearchLabel
739
+ }
740
+ } else {
741
+ // 表示取消查询时
742
+ this.$refs.grid.cancelSearch()
743
+ button.label = searchLabel
744
+ }
745
+ }
746
+ },
747
+ // 弹窗方式关闭查询
748
+ closeSearch(flag) {
749
+ this.searchIsPopup = flag
750
+ },
751
+ // 行编辑新建按钮
752
+ createRow(button) {
753
+ this.$refs.grid.createRow(this.listCode).then((row) => {
754
+ // 调用afterClick回调方法
755
+ this.callAfterClickButton(
756
+ this.listEvents,
757
+ this.listCode + '__' + button.code,
758
+ {
759
+ params: this.additionalParamMap,
760
+ additionalParamMap: this.additionalParamMap,
761
+ row,
762
+ listToolbarFormData: this.listToolbarFormData,
763
+ }
764
+ )
765
+ })
766
+ },
767
+ // 重写行编辑时保存的实现
768
+ saveLineEditRow(
769
+ row,
770
+ columns,
771
+ dataTypeMap,
772
+ dynamicColumnInfo,
773
+ additionalParamMap,
774
+ mainDefaultValueColumns
775
+ ) {
776
+ const button = this.operationButtonObj.lineEditSave
777
+ const that = this
778
+ return new Promise((resolve, reject) => {
779
+ that.myJsContent = ''
780
+ let jsContent = false
781
+ if (button && typeof button.jsContent !== 'undefined') {
782
+ jsContent = button.jsContent
783
+ }
784
+ that.myJsContent = jsContent
785
+ // formViewCode,formViewVersion 都设为空,是因为行编辑时保存时,后台会获得最高版本的表单的配置进行保存
786
+ this.getSaveFormRequest(
787
+ that.system,
788
+ that.buttonRestfulApiPath,
789
+ '',
790
+ '',
791
+ that.tableName,
792
+ row,
793
+ that.entityName,
794
+ that.myJsContent,
795
+ that.formNoRuleCode,
796
+ that.dataConversionRule,
797
+ that.autoSetValueData,
798
+ '/dsc/commons',
799
+ that.operationButtonObj && that.operationButtonObj.lineEditSave
800
+ ? that.operationButtonObj.lineEditSave.logSetting
801
+ : null,
802
+ dynamicColumnInfo,
803
+ mainDefaultValueColumns,
804
+ button.taskMap,
805
+ null,
806
+ additionalParamMap,
807
+ that.beanName,
808
+ that.isWorkflowEntity,
809
+ button.functionCode
810
+ )
811
+ .then((commonEntity) => {
812
+ if (commonEntity) {
813
+ resolve(commonEntity.entity)
814
+ } else {
815
+ resolve({})
816
+ }
817
+ })
818
+ .catch((error) => {
819
+ reject(error)
820
+ })
821
+ })
822
+ },
823
+ getUrlToListData(system) {
824
+ let urlToListData = this.colSetting.options.urlToListData
825
+ if (system && system.standard === false && !urlToListData) {
826
+ // 表示自定义系统,并且没有配置路径
827
+ urlToListData = this.baseURL + '/dsc/commons/list'
828
+ }
829
+ if (urlToListData) {
830
+ urlToListData = this.getRealRestApiPath(urlToListData, system)
831
+ }
832
+ return urlToListData
833
+ },
834
+ select(selection, row) {
835
+ this.selections = selection
836
+ },
837
+ // 获得列表组件需要的操作列按钮配置信息
838
+ setOperationButtons() {
839
+ this.operationButtonObj = {}
840
+ if (this.operationButtons) {
841
+ // 是否受权限控制
842
+ let noPermission = false
843
+ const isDevMode = getStoreInfo(this.pageCode, '_pageDevMode')
844
+ const isPreview = getStoreInfo(this.pageCode, '_pagePreview')
845
+ if (
846
+ (isDevMode && isDevMode === true) ||
847
+ (isPreview && isPreview === true)
848
+ ) {
849
+ // 开发模式 或 预览时,权限不受控制
850
+ noPermission = true
851
+ }
852
+ const operationButtons = []
853
+ const operationButtonGroupMap = {}
854
+ this.operationButtons.forEach((button) => {
855
+ const myButtonSet = {}
856
+ const myButtonProps = Object.assign({}, button)
857
+ // element plus不支持该属性了
858
+ // myButtonProps.type = 'text'
859
+ myButtonProps.elementType = 'el-button'
860
+ if(myButtonProps.size==='mini') {
861
+ myButtonProps.size = 'small'
862
+ }
863
+ myButtonProps.elementType = 'el-button'
864
+ if (!noPermission) {
865
+ // 表示受权限控制
866
+ myButtonProps.permission = this.permissionPrefix + '.' + button.code
867
+ }
868
+
869
+ myButtonSet.props = myButtonProps
870
+ myButtonSet.onClick = this.getOperationButtonClickEvent(button)
871
+ if (!button.groupName || button.groupName === '') {
872
+ operationButtons.push(myButtonSet)
873
+ } else {
874
+ const groupName = button.groupName
875
+ if (operationButtonGroupMap[groupName]) {
876
+ const group = operationButtonGroupMap[groupName]
877
+ group.push(myButtonSet)
878
+ } else {
879
+ const group = []
880
+ group.push(myButtonSet)
881
+ operationButtonGroupMap[groupName] = group
882
+ }
883
+ }
884
+ })
885
+ for (let key in operationButtonGroupMap) {
886
+ const groupObj = {}
887
+ groupObj.label = key
888
+ groupObj.isGroup = true
889
+ groupObj.buttons = operationButtonGroupMap[key]
890
+ operationButtons.push(groupObj)
891
+ }
892
+ if (!this.options.operations) {
893
+ this.options.operations = {}
894
+ }
895
+ this.options.operations.operation = operationButtons
896
+ }
897
+ },
898
+ // 获得操作列按钮点击事件
899
+ getOperationButtonClickEvent(button) {
900
+ let onClick = function () {}
901
+ this.operationButtonObj[button.code] = button
902
+ if (button.code === 'lineEditSave') {
903
+ // 行编辑保存
904
+ onClick = this.saveRow
905
+ } else if (button.code === 'restoreEdit') {
906
+ onClick = this.restoreRow
907
+ } else if (button.code === 'lineEditUpdate') {
908
+ // 行编辑修改按钮
909
+ onClick = this.editRow
910
+ } else if (button.code === 'lineEditDelete') {
911
+ // 行编辑删除按钮
912
+ onClick = this.deleteRow
913
+ } else if (button.code === 'viewDetail') {
914
+ onClick = this.viewDetailLineEdit
915
+ } else {
916
+ onClick = this.customButtonClick
917
+ // TODO 自定义行编辑按钮事件处理
918
+ }
919
+ return onClick
920
+ },
921
+ // 回车保存事件
922
+ enterSave(rowIndex, column, row, orgRow) {
923
+ this.saveRow(null, null, row, column, rowIndex)
924
+ },
925
+ // esc取消行编辑
926
+ escRestorRow(rowIndex, column, row, orgRow) {
927
+ this.restoreRow(null, null, row, column, rowIndex)
928
+ },
929
+ beforeSaveRow(
930
+ row,
931
+ columns,
932
+ dataTypeMap,
933
+ dynamicColumnInfo,
934
+ additionalParamMap,
935
+ mainDefaultValueColumns
936
+ ) {
937
+ const button = this.operationButtonObj.lineEditSave
938
+ return this.callBeforeClickButton(
939
+ this.listEvents,
940
+ this.listCode + '__' + button.code,
941
+ {
942
+ params: additionalParamMap,
943
+ additionalParamMap: additionalParamMap,
944
+ row,
945
+ columns,
946
+ dataTypeMap,
947
+ dynamicColumnInfo,
948
+ mainDefaultValueColumns,
949
+ }
950
+ )
951
+ },
952
+ // 行编辑保存
953
+ saveRow(originalValue, formatValue, row, column, rowIndex) {
954
+ const button = this.operationButtonObj.lineEditSave
955
+ this.options.lineEditOptions['beforeSave'] = this.beforeSaveRow
956
+ const entities = []
957
+ entities.push(row)
958
+ this.canExecuteWithMore(
959
+ button.executableData,
960
+ entities,
961
+ this.isSqlQuery,
962
+ this.tableName,
963
+ this.additionalParamMap
964
+ ).then((result) => {
965
+ if (result.canExecute === true) {
966
+ // 设置保存的自定义实现
967
+ if (button.autoSetValueData) {
968
+ this.autoSetValueData = button.autoSetValueData
969
+ }
970
+ this.options.lineEditOptions['saveRow'] = this.saveLineEditRow
971
+ this.$refs.grid.saveRow(rowIndex, this.listCode).then(() => {
972
+ // 调用afterClick回调方法
973
+ this.callAfterClickButton(
974
+ this.listEvents,
975
+ this.listCode + '__' + button.code,
976
+ {
977
+ params: this.additionalParamMap,
978
+ additionalParamMap: this.additionalParamMap,
979
+ originalValue,
980
+ formatValue,
981
+ row,
982
+ column,
983
+ rowIndex,
984
+ }
985
+ )
986
+ })
987
+ }
988
+ })
989
+ },
990
+ // 行编辑取消编辑
991
+ restoreRow(originalValue, formatValue, row, column, rowIndex) {
992
+ const beforeClickResult = this.callBeforeClickButton(
993
+ this.listEvents,
994
+ this.listCode + '__restoreEdit',
995
+ {
996
+ params: this.additionalParamMap,
997
+ additionalParamMap: this.additionalParamMap,
998
+ originalValue,
999
+ formatValue,
1000
+ row,
1001
+ column,
1002
+ rowIndex,
1003
+ }
1004
+ )
1005
+ if (!beforeClickResult) {
1006
+ // 返回值为false,不继续执行按钮操作
1007
+ return
1008
+ }
1009
+ if (isPromise(beforeClickResult)) {
1010
+ // 表示是promise函数
1011
+ beforeClickResult.then((result) => {
1012
+ if (result) {
1013
+ this.$refs.grid.restoreRow(rowIndex, this.listCode)
1014
+ }
1015
+ })
1016
+ } else {
1017
+ this.$refs.grid.restoreRow(rowIndex, this.listCode)
1018
+ }
1019
+ // 调用afterClick回调方法
1020
+ this.callAfterClickButton(
1021
+ this.listEvents,
1022
+ this.listCode + '__restoreEdit',
1023
+ {
1024
+ params: this.additionalParamMap,
1025
+ additionalParamMap: this.additionalParamMap,
1026
+ originalValue,
1027
+ formatValue,
1028
+ row,
1029
+ column,
1030
+ rowIndex,
1031
+ }
1032
+ )
1033
+ },
1034
+ // 行编辑的修改
1035
+ editRow(originalValue, formatValue, row, column, rowIndex) {
1036
+ const button = this.operationButtonObj.lineEditUpdate
1037
+ const beforeClickResult = this.callBeforeClickButton(
1038
+ this.listEvents,
1039
+ this.listCode + '__' + button.code,
1040
+ {
1041
+ params: this.additionalParamMap,
1042
+ additionalParamMap: this.additionalParamMap,
1043
+ originalValue,
1044
+ formatValue,
1045
+ row,
1046
+ column,
1047
+ rowIndex,
1048
+ }
1049
+ )
1050
+ if (!beforeClickResult) {
1051
+ // 返回值为false,不继续执行按钮操作
1052
+ return
1053
+ }
1054
+ if (isPromise(beforeClickResult)) {
1055
+ // 表示是promise函数
1056
+ beforeClickResult.then((result) => {
1057
+ if (result) {
1058
+ this.editRowReal(
1059
+ originalValue,
1060
+ formatValue,
1061
+ row,
1062
+ column,
1063
+ rowIndex,
1064
+ button
1065
+ )
1066
+ }
1067
+ })
1068
+ } else {
1069
+ this.editRowReal(
1070
+ originalValue,
1071
+ formatValue,
1072
+ row,
1073
+ column,
1074
+ rowIndex,
1075
+ button
1076
+ )
1077
+ }
1078
+ },
1079
+ editRowReal(originalValue, formatValue, row, column, rowIndex, button) {
1080
+ this.editRowData = row
1081
+ const entities = []
1082
+ entities.push(row)
1083
+ this.canExecuteWithMore(
1084
+ button.executableData,
1085
+ entities,
1086
+ this.isSqlQuery,
1087
+ this.tableName,
1088
+ this.additionalParamMap
1089
+ ).then((result) => {
1090
+ if (result.canExecute === true) {
1091
+ if (button.jumpPage) {
1092
+ let dataId
1093
+ if (row && row.id) {
1094
+ dataId = row.id
1095
+ } else if (row && row.ID) {
1096
+ dataId = row.ID
1097
+ }
1098
+ if (!dataId) {
1099
+ this.$message({
1100
+ showClose: true,
1101
+ type: 'warning',
1102
+ message: this.$t('superPageMessage.pleaseSaveRow'),
1103
+ })
1104
+ return
1105
+ }
1106
+ this.update(button.jumpPage, this.system, dataId, button)
1107
+ } else {
1108
+ this.$refs.grid.editRow(rowIndex, this.listCode)
1109
+ // 调用afterClick回调方法
1110
+ this.callAfterClickButton(
1111
+ this.listEvents,
1112
+ this.listCode + '__' + button.code,
1113
+ {
1114
+ params: this.additionalParamMap,
1115
+ additionalParamMap: this.additionalParamMap,
1116
+ originalValue,
1117
+ formatValue,
1118
+ row,
1119
+ column,
1120
+ rowIndex,
1121
+ }
1122
+ )
1123
+ }
1124
+ }
1125
+ })
1126
+ },
1127
+ // 行编辑的删除
1128
+ deleteRow(originalValue, formatValue, row, column, rowIndex) {
1129
+ const button = this.operationButtonObj.lineEditDelete
1130
+ const beforeClickResult = this.callBeforeClickButton(
1131
+ this.listEvents,
1132
+ this.listCode + '__' + button.code,
1133
+ {
1134
+ params: this.additionalParamMap,
1135
+ additionalParamMap: this.additionalParamMap,
1136
+ originalValue,
1137
+ formatValue,
1138
+ row,
1139
+ column,
1140
+ rowIndex,
1141
+ }
1142
+ )
1143
+ if (!beforeClickResult) {
1144
+ // 返回值为false,不继续执行按钮操作
1145
+ return
1146
+ }
1147
+
1148
+ if (isPromise(beforeClickResult)) {
1149
+ // 表示是promise函数
1150
+ beforeClickResult.then((result) => {
1151
+ if (result) {
1152
+ this.deleteRowReal(
1153
+ originalValue,
1154
+ formatValue,
1155
+ row,
1156
+ column,
1157
+ rowIndex,
1158
+ button
1159
+ )
1160
+ }
1161
+ })
1162
+ } else {
1163
+ this.deleteRowReal(
1164
+ originalValue,
1165
+ formatValue,
1166
+ row,
1167
+ column,
1168
+ rowIndex,
1169
+ button
1170
+ )
1171
+ }
1172
+ },
1173
+ deleteRowReal(originalValue, formatValue, row, column, rowIndex, button) {
1174
+ if (row.id || row.ID) {
1175
+ this.buttonRestfulApiPath = button.restfulApiPath
1176
+ let jsContent = false
1177
+ if (button && typeof button.jsContent !== 'undefined') {
1178
+ jsContent = button.jsContent
1179
+ }
1180
+ this.myJsContent = jsContent
1181
+ const entities = []
1182
+ entities.push(row)
1183
+ this.canExecuteWithMore(
1184
+ button.executableData,
1185
+ entities,
1186
+ this.isSqlQuery,
1187
+ this.tableName,
1188
+ this.additionalParamMap
1189
+ ).then((result) => {
1190
+ if (result.canExecute === true) {
1191
+ const ids = []
1192
+ if (row.id) {
1193
+ ids.push(row.id)
1194
+ } else {
1195
+ ids.push(row.ID)
1196
+ }
1197
+ this.delete(
1198
+ ids,
1199
+ this.system,
1200
+ this.buttonRestfulApiPath,
1201
+ this.tableName,
1202
+ this.entityName,
1203
+ this.myJsContent,
1204
+ button,
1205
+ this.deleteLogicSetting,
1206
+ null,
1207
+ this.beanName,
1208
+ this.isWorkflowEntity
1209
+ )
1210
+ }
1211
+ })
1212
+ } else {
1213
+ this.restoreRow(originalValue, formatValue, row, column, rowIndex)
1214
+ // 调用afterClick回调方法
1215
+ this.callAfterClickButton(
1216
+ this.listEvents,
1217
+ this.listCode + '__' + button.code,
1218
+ {
1219
+ params: this.additionalParamMap,
1220
+ additionalParamMap: this.additionalParamMap,
1221
+ originalValue,
1222
+ formatValue,
1223
+ row,
1224
+ column,
1225
+ rowIndex,
1226
+ }
1227
+ )
1228
+ }
1229
+ },
1230
+ // 行编辑查看详情
1231
+ viewDetailLineEdit(originalValue, formatValue, row, column, rowIndex) {
1232
+ const button = this.operationButtonObj.viewDetail
1233
+ const beforeClickResult = this.callBeforeClickButton(
1234
+ this.listEvents,
1235
+ this.listCode + '__' + button.code,
1236
+ {
1237
+ params: this.additionalParamMap,
1238
+ additionalParamMap: this.additionalParamMap,
1239
+ originalValue,
1240
+ formatValue,
1241
+ row,
1242
+ column,
1243
+ rowIndex,
1244
+ }
1245
+ )
1246
+ if (!beforeClickResult) {
1247
+ // 返回值为false,不继续执行按钮操作
1248
+ return
1249
+ }
1250
+ if (isPromise(beforeClickResult)) {
1251
+ // 表示是promise函数
1252
+ beforeClickResult.then((result) => {
1253
+ if (result) {
1254
+ this.viewDetail(
1255
+ button.jumpPage,
1256
+ this.system,
1257
+ row.id ? row.id : row.ID ? row.ID : null,
1258
+ button,
1259
+ row
1260
+ )
1261
+ }
1262
+ })
1263
+ } else {
1264
+ this.viewDetail(
1265
+ button.jumpPage,
1266
+ this.system,
1267
+ row.id ? row.id : row.ID ? row.ID : null,
1268
+ button,
1269
+ row
1270
+ )
1271
+ }
1272
+ },
1273
+ // 获得选中记录id集合
1274
+ getSelectionIds() {
1275
+ const dataIds = []
1276
+ if (this.selections && this.selections !== null) {
1277
+ this.selections.forEach((item) => {
1278
+ dataIds.push(item.id ? item.id : item.ID ? item.ID : null)
1279
+ })
1280
+ }
1281
+ return dataIds
1282
+ },
1283
+ // 接受工具栏参数,刷新列表
1284
+ searchGridData(data, controlTypes, dataTypeObj, currentControlType) {
1285
+ this.listToolbarFormData = data
1286
+ let toolbarFieldParam = []
1287
+ if (data) {
1288
+ for (var key in data) {
1289
+ const value = data[key]
1290
+ if (value !== null && value !== undefined && value !== '') {
1291
+ // 需要解析data为FieldParam,
1292
+ // 如果是多选,需要用or拼接,其他不为空不为“”的值,用and连接
1293
+ if (value instanceof Array) {
1294
+ // 需要解析为两个
1295
+ if (value.length > 0) {
1296
+ const multipleFieldParam = []
1297
+ for (var i = 0; i < value.length; i++) {
1298
+ const fieldParam = {}
1299
+ if (i === 0) {
1300
+ fieldParam.leftBracket = '(('
1301
+ } else {
1302
+ fieldParam.leftBracket = '('
1303
+ }
1304
+ fieldParam.propName = key
1305
+ fieldParam.propDbName = key
1306
+ fieldParam.dataType = dataTypeObj[key]
1307
+ ? dataTypeObj[key]
1308
+ : 'TEXT'
1309
+ fieldParam.operator = 'EQ'
1310
+ fieldParam.propValue = value[i]
1311
+ if (i === value.length - 1) {
1312
+ fieldParam.rightBracket = '))'
1313
+ fieldParam.joinSign = 'and'
1314
+ } else {
1315
+ fieldParam.rightBracket = ')'
1316
+ fieldParam.joinSign = 'or'
1317
+ }
1318
+ multipleFieldParam.push(fieldParam)
1319
+ }
1320
+ toolbarFieldParam = toolbarFieldParam.concat(multipleFieldParam)
1321
+ }
1322
+ } else {
1323
+ // 解析为单个-判断是普通值还是时间选择
1324
+ if (
1325
+ currentControlType &&
1326
+ controlTypes[key + '~~year'] &&
1327
+ controlTypes[key + '~~month']
1328
+ ) {
1329
+ // 表示使用一个字段同时配置了年份、月份,判断当前点击的是年份还是月份
1330
+ if (currentControlType === 'year') {
1331
+ // 表示当前点击的是年份,以年份的值为准
1332
+ const fieldParam = this.getFieldParamByYearOrMonth(
1333
+ key,
1334
+ value,
1335
+ dataTypeObj[key],
1336
+ 'YEAR'
1337
+ )
1338
+ toolbarFieldParam.push(fieldParam)
1339
+ } else if (currentControlType === 'month') {
1340
+ // 表示当前点击的是月份,以月份的值为准
1341
+ const fieldParam = this.getFieldParamByYearOrMonth(
1342
+ key,
1343
+ value,
1344
+ dataTypeObj[key],
1345
+ 'MONTH'
1346
+ )
1347
+ toolbarFieldParam.push(fieldParam)
1348
+ }
1349
+ } else if (controlTypes[key + '~~year'] === 'year') {
1350
+ // 表示是年份控件
1351
+ const fieldParam = this.getFieldParamByYearOrMonth(
1352
+ key,
1353
+ value,
1354
+ dataTypeObj[key],
1355
+ 'YEAR'
1356
+ )
1357
+ toolbarFieldParam.push(fieldParam)
1358
+ } else if (controlTypes[key + '~~month'] === 'month') {
1359
+ // 表示是月份控件
1360
+ // 年份月份如何匹配 2020(动态解析为未1-1和12-31) 2020-01(根据月份匹配第一天和最后一天)?
1361
+ const fieldParam = this.getFieldParamByYearOrMonth(
1362
+ key,
1363
+ value,
1364
+ dataTypeObj[key],
1365
+ 'MONTH'
1366
+ )
1367
+ toolbarFieldParam.push(fieldParam)
1368
+ } else {
1369
+ const fieldParam = {}
1370
+ fieldParam.leftBracket = '('
1371
+ fieldParam.propName = key
1372
+ fieldParam.propDbName = key
1373
+ fieldParam.dataType = dataTypeObj[key]
1374
+ ? dataTypeObj[key]
1375
+ : 'TEXT'
1376
+ fieldParam.operator = 'EQ'
1377
+ fieldParam.propValue = value
1378
+ fieldParam.rightBracket = ')'
1379
+ fieldParam.joinSign = 'and'
1380
+ toolbarFieldParam.push(fieldParam)
1381
+ }
1382
+ }
1383
+ }
1384
+ }
1385
+ }
1386
+ this.$refs.grid.toolbarRefresh(null, null, toolbarFieldParam)
1387
+ },
1388
+ getFieldParamByYearOrMonth(key, value, dataType, formatType) {
1389
+ const fieldParam = {}
1390
+ fieldParam.leftBracket = '('
1391
+ fieldParam.propName = key
1392
+ fieldParam.propDbName = key
1393
+ fieldParam.dataType = dataType || null
1394
+ fieldParam.dateFormatType = formatType
1395
+ fieldParam.operator = 'EQ'
1396
+ fieldParam.startValue = value
1397
+ fieldParam.endValue = value
1398
+ fieldParam.propValue = value
1399
+ fieldParam.rightBracket = ')'
1400
+ fieldParam.joinSign = 'and'
1401
+ return fieldParam
1402
+ },
1403
+ resizeListHeight(params) {
1404
+ const pageHeight = getStoreInfo(this.pageCode, '_pageHeight')
1405
+ if (
1406
+ pageHeight === undefined ||
1407
+ pageHeight === null ||
1408
+ pageHeight === ''
1409
+ ) {
1410
+ return params.height - 20
1411
+ }
1412
+ },
1413
+ // 设置字段禁止编辑
1414
+ fnProhibitToEdit(entity) {
1415
+ this.$refs['grid'].fnProhibitToEdit(entity)
1416
+ },
1417
+ recieveMessage(event) {
1418
+ if (event.data === 'close_open_win') {
1419
+ if (this.$refs.grid) {
1420
+ this.$refs.grid.refresh()
1421
+ }
1422
+ }
1423
+ },
1424
+ customButtonClick(
1425
+ originalValue,
1426
+ formatValue,
1427
+ row,
1428
+ column,
1429
+ rowIndex,
1430
+ button
1431
+ ) {
1432
+ this.callBeforeClickButton(
1433
+ this.listEvents,
1434
+ this.listCode + '__' + button.code,
1435
+ {
1436
+ params: this.additionalParamMap,
1437
+ listToolbarFormData: this.listToolbarFormData,
1438
+ originalValue,
1439
+ formatValue,
1440
+ row,
1441
+ column,
1442
+ rowIndex,
1443
+ }
1444
+ )
1445
+ },
1446
+ customButtonSaveRow(rowIndex) {
1447
+ this.options.lineEditOptions['saveRow'] = this.saveLineEditRow
1448
+ this.$refs.grid.saveRow(rowIndex, this.listCode)
1449
+ },
1450
+ },
1451
+ emits: [],
1452
+ }
1453
+ </script>