agilebuilder-ui 1.1.12 → 1.1.13-tmp2
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.
- package/lib/super-ui.css +1 -1
- package/lib/super-ui.js +24703 -23322
- package/lib/super-ui.umd.cjs +78 -72
- package/package.json +6 -2
- package/packages/fs-upload-list/src/fs-upload-list.vue +11 -10
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-app.vue +14 -6
- package/packages/super-grid/src/apis.js +259 -403
- package/packages/super-grid/src/components/card-view.jsx +103 -0
- package/packages/super-grid/src/components/mobile-table-card.jsx +394 -0
- package/packages/super-grid/src/normal-column-content.vue +6 -2
- package/packages/super-grid/src/super-grid.vue +151 -72
- package/src/mixins/resizeMixin.js +49 -0
- package/src/store/modules/app.js +26 -0
- package/src/styles/display-layout.scss +132 -0
- package/src/styles/index.scss +1 -0
- package/src/utils/guid.js +13 -0
- package/vite.config.js +10 -6
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
getEntityFieldValue,
|
|
16
16
|
getI18n,
|
|
17
17
|
setEntityFieldValue,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
getPropValue,
|
|
19
|
+
getPropValueNew
|
|
20
20
|
} from '../../../src/utils/util'
|
|
21
21
|
import eventBus from './eventBus'
|
|
22
22
|
import { isPromise } from '../../../src/utils/common-util'
|
|
@@ -156,33 +156,32 @@ const apis = {
|
|
|
156
156
|
// 每页显示多少条
|
|
157
157
|
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
158
158
|
const isMobile = this.isMobile
|
|
159
|
-
if(gridParams.pageContext){
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
rowIndex:gridParams.$rowIndex,
|
|
159
|
+
if (gridParams.pageContext) {
|
|
160
|
+
canCreate = gridParams.options.lineEditOptions.beforeInsertRow.call(this, {
|
|
161
|
+
gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
162
|
+
rowIndex: gridParams.$rowIndex,
|
|
163
163
|
isMobile,
|
|
164
|
-
baseURL:this.baseURL,
|
|
165
|
-
totalData:isSubTableShowPage ? gridParams.gridData : null,
|
|
164
|
+
baseURL: this.baseURL,
|
|
165
|
+
totalData: isSubTableShowPage ? gridParams.gridData : null,
|
|
166
166
|
pageSize,
|
|
167
|
-
additionalParamMap:gridParams.additionalParamMap,
|
|
167
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
168
168
|
row,
|
|
169
169
|
pageContext: gridParams.pageContext,
|
|
170
|
-
configureObj: gridParams.configureObj
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
170
|
+
configureObj: gridParams.configureObj
|
|
171
|
+
})
|
|
172
|
+
} else {
|
|
173
|
+
canCreate = gridParams.options.lineEditOptions.beforeInsertRow.call(
|
|
174
|
+
this,
|
|
175
|
+
isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
176
|
+
gridParams.$rowIndex,
|
|
177
|
+
isMobile,
|
|
178
|
+
this.baseURL,
|
|
179
|
+
isSubTableShowPage ? gridParams.gridData : null,
|
|
180
|
+
pageSize,
|
|
181
|
+
gridParams.additionalParamMap,
|
|
182
|
+
row
|
|
183
|
+
)
|
|
184
|
+
}
|
|
186
185
|
}
|
|
187
186
|
// console.log('创建行记录执行前判断', canCreate)
|
|
188
187
|
// console.log('创建行记录gridParams.options.isFormSubTable=', gridParams.options.isFormSubTable)
|
|
@@ -191,16 +190,11 @@ const apis = {
|
|
|
191
190
|
// 如果是表单子表模式,则不需要判断上一行是否是编辑状态
|
|
192
191
|
// 取消上一行的编辑状态
|
|
193
192
|
let myGridData = gridParams.gridData
|
|
194
|
-
if (
|
|
195
|
-
gridParams.isSubTableShowPage !== undefined &&
|
|
196
|
-
gridParams.isSubTableShowPage === true
|
|
197
|
-
) {
|
|
193
|
+
if (gridParams.isSubTableShowPage !== undefined && gridParams.isSubTableShowPage === true) {
|
|
198
194
|
// 子表集合
|
|
199
195
|
myGridData = gridParams.subTableData
|
|
200
196
|
}
|
|
201
|
-
const editRows = myGridData.filter(
|
|
202
|
-
(item) => item.$editing !== undefined && item.$editing === true
|
|
203
|
-
)
|
|
197
|
+
const editRows = myGridData.filter((item) => item.$editing !== undefined && item.$editing === true)
|
|
204
198
|
if (editRows && editRows.length > 0) {
|
|
205
199
|
editRows.forEach((editRow) => {
|
|
206
200
|
setEntityFieldValue(editRow, '$editing', false)
|
|
@@ -213,16 +207,15 @@ const apis = {
|
|
|
213
207
|
} else {
|
|
214
208
|
if (
|
|
215
209
|
!isLastEditRowSave(listCode) ||
|
|
216
|
-
(typeof gridParams.isCreateRow !== 'undefined' &&
|
|
217
|
-
gridParams.isCreateRow === true)
|
|
210
|
+
(typeof gridParams.isCreateRow !== 'undefined' && gridParams.isCreateRow === true)
|
|
218
211
|
) {
|
|
219
212
|
// 最后编辑的一行没有保存 或(说明刚刚新建的行还没有保存 或 撤销编辑),则提示
|
|
220
213
|
window.$vueApp.config.globalProperties.$message({
|
|
221
214
|
showClose: true,
|
|
222
215
|
message: getI18n().t('superGrid.pleaseSaveLine', {
|
|
223
|
-
row: gridParams.$rowIndex + 1
|
|
216
|
+
row: gridParams.$rowIndex + 1
|
|
224
217
|
}),
|
|
225
|
-
type: 'warning'
|
|
218
|
+
type: 'warning'
|
|
226
219
|
})
|
|
227
220
|
reject(new Error('please save line'))
|
|
228
221
|
return
|
|
@@ -247,7 +240,7 @@ const apis = {
|
|
|
247
240
|
gridParams.contextParameter,
|
|
248
241
|
row,
|
|
249
242
|
listCode,
|
|
250
|
-
options?options.getDefaultValueFunc: null
|
|
243
|
+
options ? options.getDefaultValueFunc : null
|
|
251
244
|
)
|
|
252
245
|
|
|
253
246
|
// console.log('创建行记录要添加的新行1', row)
|
|
@@ -258,17 +251,10 @@ const apis = {
|
|
|
258
251
|
// console.log('创建行所属的list1', gridData)
|
|
259
252
|
if (gridParams.options && gridParams.options.isFormSubTable) {
|
|
260
253
|
// 表单的子表行编辑时显示是添加到最后面
|
|
261
|
-
if (
|
|
262
|
-
gridParams.isSubTableShowPage !== undefined &&
|
|
263
|
-
gridParams.isSubTableShowPage === true
|
|
264
|
-
) {
|
|
254
|
+
if (gridParams.isSubTableShowPage !== undefined && gridParams.isSubTableShowPage === true) {
|
|
265
255
|
// 子表集合添加该新建的行。会触发watch subTableData的监控
|
|
266
256
|
gridParams.isChangePage = true
|
|
267
|
-
gridParams.subTableData.splice(
|
|
268
|
-
gridParams.subTableData.length,
|
|
269
|
-
0,
|
|
270
|
-
row
|
|
271
|
-
)
|
|
257
|
+
gridParams.subTableData.splice(gridParams.subTableData.length, 0, row)
|
|
272
258
|
} else {
|
|
273
259
|
// 子表不分页
|
|
274
260
|
gridData.splice(gridData.length, 0, row)
|
|
@@ -304,42 +290,33 @@ const apis = {
|
|
|
304
290
|
if (isEditOptionFunction('afterInsertRow', listCode)) {
|
|
305
291
|
const isSubTableShowPage = gridParams.isSubTableShowPage
|
|
306
292
|
// 每页显示多少条
|
|
307
|
-
const pageSize =
|
|
308
|
-
gridParams.pagination && gridParams.pagination.pageSize
|
|
293
|
+
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
309
294
|
const isMobile = this.isMobile
|
|
310
|
-
|
|
311
|
-
if(gridParams.pageContext){
|
|
312
|
-
gridParams.options.lineEditOptions.afterInsertRow.call(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
totalData:isSubTableShowPage ? gridParams.gridData : null,
|
|
321
|
-
pageSize,
|
|
322
|
-
additionalParamMap:gridParams.additionalParamMap,
|
|
295
|
+
|
|
296
|
+
if (gridParams.pageContext) {
|
|
297
|
+
gridParams.options.lineEditOptions.afterInsertRow.call(this, {
|
|
298
|
+
gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
299
|
+
rowIndex: gridParams.$rowIndex,
|
|
300
|
+
isMobile,
|
|
301
|
+
baseURL: this.baseURL,
|
|
302
|
+
totalData: isSubTableShowPage ? gridParams.gridData : null,
|
|
303
|
+
pageSize,
|
|
304
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
323
305
|
pageContext: gridParams.pageContext,
|
|
324
306
|
configureObj: gridParams.configureObj
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
} else {
|
|
307
|
+
})
|
|
308
|
+
} else {
|
|
328
309
|
gridParams.options.lineEditOptions.afterInsertRow.call(
|
|
329
|
-
|
|
330
|
-
isSubTableShowPage
|
|
331
|
-
? gridParams.subTableData
|
|
332
|
-
: gridParams.gridData,
|
|
310
|
+
this,
|
|
311
|
+
isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
333
312
|
gridParams.$rowIndex,
|
|
334
313
|
isMobile,
|
|
335
314
|
this.baseURL,
|
|
336
315
|
isSubTableShowPage ? gridParams.gridData : null,
|
|
337
316
|
pageSize,
|
|
338
317
|
gridParams.additionalParamMap
|
|
339
|
-
|
|
340
|
-
|
|
318
|
+
)
|
|
341
319
|
}
|
|
342
|
-
|
|
343
320
|
}
|
|
344
321
|
|
|
345
322
|
gridParams.isCreateRow = true
|
|
@@ -353,14 +330,7 @@ const apis = {
|
|
|
353
330
|
})
|
|
354
331
|
},
|
|
355
332
|
// 获取一个新的对象,已经解析完默认值
|
|
356
|
-
getNewRow(
|
|
357
|
-
defaultValueColumns,
|
|
358
|
-
additionalParamMap,
|
|
359
|
-
contextParameter,
|
|
360
|
-
row,
|
|
361
|
-
listCode,
|
|
362
|
-
getDefaultValueFunc
|
|
363
|
-
) {
|
|
333
|
+
getNewRow(defaultValueColumns, additionalParamMap, contextParameter, row, listCode, getDefaultValueFunc) {
|
|
364
334
|
if (!row) {
|
|
365
335
|
row = {}
|
|
366
336
|
}
|
|
@@ -380,20 +350,13 @@ const apis = {
|
|
|
380
350
|
if (
|
|
381
351
|
col.defaultValue &&
|
|
382
352
|
col.defaultValue !== '' &&
|
|
383
|
-
(propValue === undefined ||
|
|
384
|
-
propValue === '' ||
|
|
385
|
-
propValue === null)
|
|
353
|
+
(propValue === undefined || propValue === '' || propValue === null)
|
|
386
354
|
) {
|
|
387
355
|
let value
|
|
388
|
-
if(gridParams.pageContext){
|
|
356
|
+
if (gridParams.pageContext) {
|
|
389
357
|
value = getPropValueNew(col.defaultValue, gridParams.pageContext)
|
|
390
358
|
} else {
|
|
391
|
-
value = getPropValue(
|
|
392
|
-
col.defaultValue,
|
|
393
|
-
row,
|
|
394
|
-
additionalParamMap,
|
|
395
|
-
contextParameter
|
|
396
|
-
)
|
|
359
|
+
value = getPropValue(col.defaultValue, row, additionalParamMap, contextParameter)
|
|
397
360
|
}
|
|
398
361
|
setEntityFieldValue(row, col.prop, value)
|
|
399
362
|
}
|
|
@@ -420,11 +383,11 @@ const apis = {
|
|
|
420
383
|
const defaultValueSet = column.defaultValue
|
|
421
384
|
let defaultValue = null
|
|
422
385
|
//console.log('setColumnsDefaultValue111------getDefaultValueFunc--', getDefaultValueFunc, 'column=',column,'defaultValueSet=', defaultValueSet)
|
|
423
|
-
if(getDefaultValueFunc) {
|
|
386
|
+
if (getDefaultValueFunc) {
|
|
424
387
|
//console.log('setColumnsDefaultValue22---getDefaultValueFunc222---')
|
|
425
388
|
defaultValue = getDefaultValueFunc(gridParams.pageContext, defaultValueSet, null, null)
|
|
426
389
|
//console.log('setColumnsDefaultValue33---defaultValue---', defaultValue)
|
|
427
|
-
if(defaultValue === undefined) {
|
|
390
|
+
if (defaultValue === undefined) {
|
|
428
391
|
defaultValue = null
|
|
429
392
|
}
|
|
430
393
|
}
|
|
@@ -466,8 +429,7 @@ const apis = {
|
|
|
466
429
|
// 不是当前编辑行时
|
|
467
430
|
if (
|
|
468
431
|
typeof gridParams.options.lineEditOptions.autoSave === 'undefined' ||
|
|
469
|
-
(isHasEditOption('autoSave', listCode) &&
|
|
470
|
-
gridParams.options.lineEditOptions.autoSave === true)
|
|
432
|
+
(isHasEditOption('autoSave', listCode) && gridParams.options.lineEditOptions.autoSave === true)
|
|
471
433
|
) {
|
|
472
434
|
// 自动保存行数据
|
|
473
435
|
if (!isSaveCallback) {
|
|
@@ -484,9 +446,9 @@ const apis = {
|
|
|
484
446
|
window.$vueApp.config.globalProperties.$message({
|
|
485
447
|
showClose: true,
|
|
486
448
|
message: getI18n().t('superGrid.pleaseSaveLine', {
|
|
487
|
-
row: gridParams.$rowIndex + 1
|
|
449
|
+
row: gridParams.$rowIndex + 1
|
|
488
450
|
}),
|
|
489
|
-
type: 'warning'
|
|
451
|
+
type: 'warning'
|
|
490
452
|
})
|
|
491
453
|
return
|
|
492
454
|
}
|
|
@@ -499,9 +461,7 @@ const apis = {
|
|
|
499
461
|
// 每页显示多少条
|
|
500
462
|
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
501
463
|
canEdit = gridParams.options.lineEditOptions.beforeEdit.call(this, {
|
|
502
|
-
gridData: isSubTableShowPage
|
|
503
|
-
? gridParams.subTableData
|
|
504
|
-
: gridParams.gridData,
|
|
464
|
+
gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
505
465
|
listCode: listCode,
|
|
506
466
|
entity: gridParams.gridData[rowIndex],
|
|
507
467
|
row: gridParams.gridData[rowIndex],
|
|
@@ -577,9 +537,9 @@ const apis = {
|
|
|
577
537
|
window.$vueApp.config.globalProperties.$message({
|
|
578
538
|
showClose: true,
|
|
579
539
|
message: getI18n().t('superGrid.noNeedToSaveRow', {
|
|
580
|
-
row: rowIndex + 1
|
|
540
|
+
row: rowIndex + 1
|
|
581
541
|
}),
|
|
582
|
-
type: 'warning'
|
|
542
|
+
type: 'warning'
|
|
583
543
|
})
|
|
584
544
|
return
|
|
585
545
|
}
|
|
@@ -589,9 +549,9 @@ const apis = {
|
|
|
589
549
|
window.$vueApp.config.globalProperties.$message({
|
|
590
550
|
showClose: true,
|
|
591
551
|
message: getI18n().t('superGrid.pleaseSaveLine', {
|
|
592
|
-
row: gridParams.$rowIndex + 1
|
|
552
|
+
row: gridParams.$rowIndex + 1
|
|
593
553
|
}),
|
|
594
|
-
type: 'warning'
|
|
554
|
+
type: 'warning'
|
|
595
555
|
})
|
|
596
556
|
return
|
|
597
557
|
}
|
|
@@ -606,7 +566,7 @@ const apis = {
|
|
|
606
566
|
window.$vueApp.config.globalProperties.$message({
|
|
607
567
|
showClose: true,
|
|
608
568
|
message: getI18n().t('superGrid.pleaseSetURLToSaveRowInformation'),
|
|
609
|
-
type: 'warning'
|
|
569
|
+
type: 'warning'
|
|
610
570
|
})
|
|
611
571
|
return
|
|
612
572
|
}
|
|
@@ -623,35 +583,27 @@ const apis = {
|
|
|
623
583
|
}
|
|
624
584
|
let validateResult = true
|
|
625
585
|
if (needValidate === true) {
|
|
626
|
-
validateResult = formValidatorService.validator(
|
|
627
|
-
row,
|
|
628
|
-
listCode,
|
|
629
|
-
rowIndex
|
|
630
|
-
)
|
|
586
|
+
validateResult = formValidatorService.validator(row, listCode, rowIndex)
|
|
631
587
|
}
|
|
632
588
|
if (validateResult === true) {
|
|
633
589
|
let canSave = true
|
|
634
590
|
if (isEditOptionFunction('beforeSave', listCode)) {
|
|
635
|
-
if(gridParams.pageContext){
|
|
636
|
-
canSave = gridParams.options.lineEditOptions['beforeSave'].call(
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
}
|
|
645
|
-
)
|
|
591
|
+
if (gridParams.pageContext) {
|
|
592
|
+
canSave = gridParams.options.lineEditOptions['beforeSave'].call(this, {
|
|
593
|
+
row,
|
|
594
|
+
columns: gridParams.columns,
|
|
595
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
596
|
+
pageContext: gridParams.pageContext,
|
|
597
|
+
configureObj: gridParams.configureObj
|
|
598
|
+
})
|
|
646
599
|
} else {
|
|
647
600
|
canSave = gridParams.options.lineEditOptions['beforeSave'].call(
|
|
648
601
|
this,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
602
|
+
row,
|
|
603
|
+
gridParams.columns,
|
|
604
|
+
gridParams.additionalParamMap
|
|
652
605
|
)
|
|
653
606
|
}
|
|
654
|
-
|
|
655
607
|
}
|
|
656
608
|
if (canSave === undefined || canSave === true) {
|
|
657
609
|
// 触发点击保存时的事件线,在 normal-column 监听处对字段控件是选项组的字段的值进行处理
|
|
@@ -660,79 +612,59 @@ const apis = {
|
|
|
660
612
|
let saveRowRequest
|
|
661
613
|
if (isEditOptionFunction('saveRow', listCode)) {
|
|
662
614
|
// 表示保存方法,用户自己重写了
|
|
663
|
-
if(gridParams.pageContext){
|
|
664
|
-
saveRowRequest = gridParams.options.lineEditOptions[
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
pageContext: gridParams.pageContext,
|
|
675
|
-
configureObj: gridParams.configureObj
|
|
676
|
-
}
|
|
677
|
-
)
|
|
615
|
+
if (gridParams.pageContext) {
|
|
616
|
+
saveRowRequest = gridParams.options.lineEditOptions['saveRow'].call(this, {
|
|
617
|
+
row,
|
|
618
|
+
columns: gridParams.columns,
|
|
619
|
+
dataTypeMap: gridParams.$dataTypeMap,
|
|
620
|
+
dynamicColumnInfo: gridParams.dynamicColumnInfo,
|
|
621
|
+
additionalParamMap,
|
|
622
|
+
mainDefaultValueColumns: gridParams.mainDefaultValueColumns,
|
|
623
|
+
pageContext: gridParams.pageContext,
|
|
624
|
+
configureObj: gridParams.configureObj
|
|
625
|
+
})
|
|
678
626
|
} else {
|
|
679
627
|
// 兼容历史数据
|
|
680
|
-
saveRowRequest = gridParams.options.lineEditOptions[
|
|
681
|
-
'saveRow'
|
|
682
|
-
].call(
|
|
628
|
+
saveRowRequest = gridParams.options.lineEditOptions['saveRow'].call(
|
|
683
629
|
this,
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
630
|
+
row,
|
|
631
|
+
gridParams.columns,
|
|
632
|
+
gridParams.$dataTypeMap,
|
|
633
|
+
gridParams.dynamicColumnInfo,
|
|
634
|
+
additionalParamMap,
|
|
635
|
+
gridParams.mainDefaultValueColumns
|
|
690
636
|
)
|
|
691
637
|
}
|
|
692
|
-
|
|
693
638
|
}
|
|
694
|
-
if (
|
|
695
|
-
!saveRowRequest &&
|
|
696
|
-
gridParams.lineEdit &&
|
|
697
|
-
gridParams.lineEdit.urlToSaveRow
|
|
698
|
-
) {
|
|
639
|
+
if (!saveRowRequest && gridParams.lineEdit && gridParams.lineEdit.urlToSaveRow) {
|
|
699
640
|
// 使用默认的保存实现
|
|
700
641
|
let urlToSaveRow = gridParams.lineEdit.urlToSaveRow
|
|
701
642
|
if (isHasEditOption('urlToSaveRow', listCode)) {
|
|
702
643
|
// 表示手动配置了保存行记录的url
|
|
703
|
-
urlToSaveRow =
|
|
704
|
-
gridParams.options.lineEditOptions['urlToSaveRow']
|
|
644
|
+
urlToSaveRow = gridParams.options.lineEditOptions['urlToSaveRow']
|
|
705
645
|
}
|
|
706
|
-
saveRowRequest =
|
|
707
|
-
window.$vueApp.config.globalProperties
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
)
|
|
646
|
+
saveRowRequest = window.$vueApp.config.globalProperties.$http.post(
|
|
647
|
+
window.$vueApp.config.globalProperties.baseURL + urlToSaveRow,
|
|
648
|
+
row
|
|
649
|
+
)
|
|
711
650
|
}
|
|
712
|
-
if (
|
|
713
|
-
gridParams.isHasDynamic !== undefined &&
|
|
714
|
-
gridParams.isHasDynamic === true &&
|
|
715
|
-
!saveRowRequest
|
|
716
|
-
) {
|
|
651
|
+
if (gridParams.isHasDynamic !== undefined && gridParams.isHasDynamic === true && !saveRowRequest) {
|
|
717
652
|
// 表示有动态列,保存时使用平台封装好的请求
|
|
718
653
|
const urlToSaveRow = '/common/dynamic-values'
|
|
719
654
|
const dynamicValueDTO = {
|
|
720
655
|
mainTableName:
|
|
721
|
-
gridParams.basicInfo && gridParams.basicInfo.tableName
|
|
722
|
-
? gridParams.basicInfo.tableName
|
|
723
|
-
: '',
|
|
656
|
+
gridParams.basicInfo && gridParams.basicInfo.tableName ? gridParams.basicInfo.tableName : '',
|
|
724
657
|
row: row,
|
|
725
658
|
dynamicColumnInfo: gridParams.dynamicColumnInfo,
|
|
726
659
|
additionalParamMap: additionalParamMap,
|
|
727
660
|
dataTypeMap: gridParams.$dataTypeMap,
|
|
728
661
|
dynamicServiceName: gridParams.dynamicServiceName,
|
|
729
|
-
mainDefaultValueColumns: gridParams.mainDefaultValueColumns
|
|
662
|
+
mainDefaultValueColumns: gridParams.mainDefaultValueColumns
|
|
730
663
|
}
|
|
731
|
-
saveRowRequest =
|
|
732
|
-
window.$vueApp.config.globalProperties
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
)
|
|
664
|
+
saveRowRequest = window.$vueApp.config.globalProperties.$http.post(
|
|
665
|
+
window.$vueApp.config.globalProperties.baseURL + urlToSaveRow,
|
|
666
|
+
dynamicValueDTO
|
|
667
|
+
)
|
|
736
668
|
}
|
|
737
669
|
if (saveRowRequest) {
|
|
738
670
|
saveRowRequest
|
|
@@ -748,13 +680,7 @@ const apis = {
|
|
|
748
680
|
.catch((error) => {
|
|
749
681
|
gridParams.canSaveRow = true
|
|
750
682
|
if (isEditOptionFunction('saveError', listCode)) {
|
|
751
|
-
gridParams.options.lineEditOptions['saveError'].call(
|
|
752
|
-
this,
|
|
753
|
-
row,
|
|
754
|
-
gridParams.columns,
|
|
755
|
-
rowIndex,
|
|
756
|
-
error
|
|
757
|
-
)
|
|
683
|
+
gridParams.options.lineEditOptions['saveError'].call(this, row, gridParams.columns, rowIndex, error)
|
|
758
684
|
}
|
|
759
685
|
reject(error)
|
|
760
686
|
})
|
|
@@ -764,11 +690,7 @@ const apis = {
|
|
|
764
690
|
}
|
|
765
691
|
} else {
|
|
766
692
|
gridParams.canSaveRow = true
|
|
767
|
-
reject(
|
|
768
|
-
getI18n().t(
|
|
769
|
-
'superGrid.theReturnValueOfTheBeforesaveCallbackMethodIsFalse'
|
|
770
|
-
)
|
|
771
|
-
)
|
|
693
|
+
reject(getI18n().t('superGrid.theReturnValueOfTheBeforesaveCallbackMethodIsFalse'))
|
|
772
694
|
}
|
|
773
695
|
} else {
|
|
774
696
|
gridParams.canSaveRow = true
|
|
@@ -788,16 +710,14 @@ const apis = {
|
|
|
788
710
|
window.$vueApp.config.globalProperties.$message({
|
|
789
711
|
showClose: true,
|
|
790
712
|
message: getI18n().t('superGrid.lineSavedSuccessfully', {
|
|
791
|
-
row: rowIndex + 1
|
|
713
|
+
row: rowIndex + 1
|
|
792
714
|
}),
|
|
793
|
-
type: 'success'
|
|
715
|
+
type: 'success'
|
|
794
716
|
})
|
|
795
717
|
if (
|
|
796
|
-
typeof gridParams.options.lineEditOptions.aftersaveIsCancelEditState ===
|
|
797
|
-
'undefined' ||
|
|
718
|
+
typeof gridParams.options.lineEditOptions.aftersaveIsCancelEditState === 'undefined' ||
|
|
798
719
|
(isHasEditOption('aftersaveIsCancelEditState', listCode) &&
|
|
799
|
-
gridParams.options.lineEditOptions.aftersaveIsCancelEditState ===
|
|
800
|
-
true)
|
|
720
|
+
gridParams.options.lineEditOptions.aftersaveIsCancelEditState === true)
|
|
801
721
|
) {
|
|
802
722
|
// 取消编辑状态
|
|
803
723
|
setEntityFieldValue(row, '$editing', false)
|
|
@@ -806,18 +726,16 @@ const apis = {
|
|
|
806
726
|
}
|
|
807
727
|
|
|
808
728
|
if (isEditOptionFunction('saveSuccess', listCode)) {
|
|
809
|
-
if(gridParams.pageContext) {
|
|
810
|
-
gridParams.options.lineEditOptions['saveSuccess'].call(
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
)
|
|
820
|
-
|
|
729
|
+
if (gridParams.pageContext) {
|
|
730
|
+
gridParams.options.lineEditOptions['saveSuccess'].call(this, {
|
|
731
|
+
data,
|
|
732
|
+
columns: gridParams.columns,
|
|
733
|
+
rowIndex,
|
|
734
|
+
row,
|
|
735
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
736
|
+
pageContext: gridParams.pageContext,
|
|
737
|
+
configureObj: gridParams.configureObj
|
|
738
|
+
})
|
|
821
739
|
} else {
|
|
822
740
|
gridParams.options.lineEditOptions['saveSuccess'].call(
|
|
823
741
|
this,
|
|
@@ -844,15 +762,14 @@ const apis = {
|
|
|
844
762
|
this.refresh(false, true)
|
|
845
763
|
.then(() => {
|
|
846
764
|
if (
|
|
847
|
-
typeof gridParams.options.lineEditOptions.aftersaveIsCreateRow ===
|
|
848
|
-
'undefined' ||
|
|
765
|
+
typeof gridParams.options.lineEditOptions.aftersaveIsCreateRow === 'undefined' ||
|
|
849
766
|
gridParams.options.lineEditOptions.aftersaveIsCreateRow
|
|
850
767
|
) {
|
|
851
768
|
this.createRow(listCode)
|
|
852
769
|
}
|
|
853
770
|
resolve({
|
|
854
771
|
rowIndex,
|
|
855
|
-
listCode
|
|
772
|
+
listCode
|
|
856
773
|
})
|
|
857
774
|
})
|
|
858
775
|
.catch((error) => reject(error))
|
|
@@ -875,18 +792,14 @@ const apis = {
|
|
|
875
792
|
const gridParams = store.get(listCode)
|
|
876
793
|
// console.log('restoreCurrentRow-gridParams.$rowIndex,rowIndex', gridParams.$rowIndex, rowIndex)
|
|
877
794
|
if (gridParams.lineEdit && gridParams.lineEdit.editable) {
|
|
878
|
-
if (
|
|
879
|
-
gridParams.$rowIndex !== null &&
|
|
880
|
-
gridParams.$rowIndex !== rowIndex &&
|
|
881
|
-
!isLastEditRowSave(listCode)
|
|
882
|
-
) {
|
|
795
|
+
if (gridParams.$rowIndex !== null && gridParams.$rowIndex !== rowIndex && !isLastEditRowSave(listCode)) {
|
|
883
796
|
// 最后编辑的一行没有保存,则提示
|
|
884
797
|
window.$vueApp.config.globalProperties.$message({
|
|
885
798
|
showClose: true,
|
|
886
799
|
message: getI18n().t('superGrid.pleaseSaveLine', {
|
|
887
|
-
row: gridParams.$rowIndex + 1
|
|
800
|
+
row: gridParams.$rowIndex + 1
|
|
888
801
|
}),
|
|
889
|
-
type: 'warning'
|
|
802
|
+
type: 'warning'
|
|
890
803
|
})
|
|
891
804
|
return
|
|
892
805
|
}
|
|
@@ -902,22 +815,19 @@ const apis = {
|
|
|
902
815
|
// 每页显示多少条
|
|
903
816
|
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
904
817
|
const isMobile = this.isMobile
|
|
905
|
-
isValidate =
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
pageContext: gridParams.pageContext,
|
|
919
|
-
configureObj: gridParams.configureObj
|
|
920
|
-
})
|
|
818
|
+
isValidate = gridParams.options.lineEditOptions.beforeRestoreValidate.call(this, {
|
|
819
|
+
rowIndex,
|
|
820
|
+
gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
821
|
+
entity: gridParams.gridData[rowIndex],
|
|
822
|
+
isMobile,
|
|
823
|
+
baseURL: this.baseURL,
|
|
824
|
+
isEditing: !isUnEditing,
|
|
825
|
+
pageGridData: isSubTableShowPage ? gridParams.gridData : null,
|
|
826
|
+
pageSize,
|
|
827
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
828
|
+
pageContext: gridParams.pageContext,
|
|
829
|
+
configureObj: gridParams.configureObj
|
|
830
|
+
})
|
|
921
831
|
}
|
|
922
832
|
if (isValidate === undefined || isValidate === true) {
|
|
923
833
|
// 例如:自定义验证成功,再继续平台的验证
|
|
@@ -927,9 +837,9 @@ const apis = {
|
|
|
927
837
|
window.$vueApp.config.globalProperties.$message({
|
|
928
838
|
showClose: true,
|
|
929
839
|
message: getI18n().t('superGrid.lineNoNeedToUndoEdit', {
|
|
930
|
-
row: rowIndex + 1
|
|
840
|
+
row: rowIndex + 1
|
|
931
841
|
}),
|
|
932
|
-
type: 'warning'
|
|
842
|
+
type: 'warning'
|
|
933
843
|
})
|
|
934
844
|
return
|
|
935
845
|
}
|
|
@@ -943,90 +853,71 @@ const apis = {
|
|
|
943
853
|
// 每页显示多少条
|
|
944
854
|
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
945
855
|
const isMobile = this.isMobile
|
|
946
|
-
canRestore = gridParams.options.lineEditOptions.beforeRestore.call(
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
additionalParamMap: gridParams.additionalParamMap,
|
|
960
|
-
pageContext: gridParams.pageContext,
|
|
961
|
-
configureObj: gridParams.configureObj
|
|
962
|
-
}
|
|
963
|
-
)
|
|
856
|
+
canRestore = gridParams.options.lineEditOptions.beforeRestore.call(this, {
|
|
857
|
+
rowIndex,
|
|
858
|
+
gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
859
|
+
entity: gridParams.gridData[rowIndex],
|
|
860
|
+
isMobile,
|
|
861
|
+
baseURL: window.$vueApp.config.globalProperties.baseURL,
|
|
862
|
+
isEditing: !isUnEditing,
|
|
863
|
+
pageGridData: isSubTableShowPage ? gridParams.gridData : null,
|
|
864
|
+
pageSize,
|
|
865
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
866
|
+
pageContext: gridParams.pageContext,
|
|
867
|
+
configureObj: gridParams.configureObj
|
|
868
|
+
})
|
|
964
869
|
}
|
|
965
870
|
if (canRestore === undefined || canRestore === true) {
|
|
966
871
|
// 如果没有编辑过任何行
|
|
967
|
-
if (
|
|
968
|
-
!gridParams.orgGridData[rowIndex].id &&
|
|
969
|
-
!gridParams.orgGridData[rowIndex].ID
|
|
970
|
-
) {
|
|
872
|
+
if (!gridParams.orgGridData[rowIndex].id && !gridParams.orgGridData[rowIndex].ID) {
|
|
971
873
|
// 表示没有保存行数据,需要删除该行记录
|
|
972
874
|
this.deleteRow(rowIndex, listCode, true)
|
|
973
875
|
} else {
|
|
974
876
|
// 这样写会导致“如果字段值原来是空的,输入了内容后,取消编辑没法把输入的值清空”问题
|
|
975
877
|
// Object.assign(gridParams.gridData[rowIndex], gridParams.orgGridData[rowIndex])
|
|
976
878
|
// 所以改成如下写法
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
)
|
|
980
|
-
if (
|
|
981
|
-
gridParams.isSubTableShowPage !== undefined &&
|
|
982
|
-
gridParams.isSubTableShowPage === true
|
|
983
|
-
) {
|
|
879
|
+
const orgRow = JSON.parse(JSON.stringify(gridParams.orgGridData[rowIndex]))
|
|
880
|
+
if (gridParams.isSubTableShowPage !== undefined && gridParams.isSubTableShowPage === true) {
|
|
984
881
|
// 子表集合移除该行。会触发watch subTableData的监控
|
|
985
882
|
const lastPageRowIndex = (this.currentPage - 1) * this.pageSize
|
|
986
883
|
const subTableRowIndex = lastPageRowIndex + rowIndex
|
|
987
|
-
gridParams.subTableData[subTableRowIndex] =
|
|
988
|
-
gridParams.gridData[rowIndex]
|
|
884
|
+
gridParams.subTableData[subTableRowIndex] = gridParams.gridData[rowIndex]
|
|
989
885
|
}
|
|
990
886
|
window.$vueApp.config.globalProperties.$message({
|
|
991
887
|
showClose: true,
|
|
992
888
|
message: getI18n().t('superGrid.lineCancelledSuccessfully', {
|
|
993
|
-
row: rowIndex + 1
|
|
889
|
+
row: rowIndex + 1
|
|
994
890
|
}),
|
|
995
|
-
type: 'success'
|
|
891
|
+
type: 'success'
|
|
996
892
|
})
|
|
997
893
|
|
|
998
894
|
if (
|
|
999
|
-
typeof gridParams.options.lineEditOptions
|
|
1000
|
-
.afterRestoreIsCancelEditState === 'undefined' ||
|
|
895
|
+
typeof gridParams.options.lineEditOptions.afterRestoreIsCancelEditState === 'undefined' ||
|
|
1001
896
|
(isHasEditOption('afterRestoreIsCancelEditState', listCode) &&
|
|
1002
|
-
gridParams.options.lineEditOptions
|
|
1003
|
-
.afterRestoreIsCancelEditState === true)
|
|
897
|
+
gridParams.options.lineEditOptions.afterRestoreIsCancelEditState === true)
|
|
1004
898
|
) {
|
|
1005
899
|
// 取消编辑状态
|
|
1006
|
-
setEntityFieldValue(
|
|
1007
|
-
|
|
1008
|
-
'$editing',
|
|
1009
|
-
false
|
|
1010
|
-
)
|
|
900
|
+
// setEntityFieldValue(gridParams.gridData[rowIndex], '$editing', false)
|
|
901
|
+
orgRow.$editing = false
|
|
1011
902
|
// Vue.set(gridParams.gridData[rowIndex], '$editing', false)
|
|
1012
903
|
gridParams.isEditRow = false
|
|
1013
904
|
}
|
|
905
|
+
this.restoreCurrentRowTimer = setTimeout(() => {
|
|
906
|
+
gridParams.gridData[rowIndex] = orgRow
|
|
907
|
+
}, 100)
|
|
1014
908
|
}
|
|
1015
909
|
gridParams.$rowIndex = null
|
|
1016
910
|
gridParams.isCreateRow = false
|
|
1017
911
|
// 撤销编辑后回调
|
|
1018
912
|
if (isEditOptionFunction('afterRestore', listCode)) {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
configureObj: gridParams.configureObj
|
|
1028
|
-
}
|
|
1029
|
-
)
|
|
913
|
+
if (gridParams.pageContext) {
|
|
914
|
+
gridParams.options.lineEditOptions.afterRestore.call(this, {
|
|
915
|
+
rowIndex,
|
|
916
|
+
row: gridParams.orgGridData[rowIndex],
|
|
917
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
918
|
+
pageContext: gridParams.pageContext,
|
|
919
|
+
configureObj: gridParams.configureObj
|
|
920
|
+
})
|
|
1030
921
|
} else {
|
|
1031
922
|
gridParams.options.lineEditOptions.afterRestore.call(
|
|
1032
923
|
this,
|
|
@@ -1035,7 +926,6 @@ const apis = {
|
|
|
1035
926
|
gridParams.additionalParamMap
|
|
1036
927
|
)
|
|
1037
928
|
}
|
|
1038
|
-
|
|
1039
929
|
}
|
|
1040
930
|
}
|
|
1041
931
|
}
|
|
@@ -1052,27 +942,22 @@ const apis = {
|
|
|
1052
942
|
const isSubTableShowPage = gridParams.isSubTableShowPage
|
|
1053
943
|
// 每页显示多少条
|
|
1054
944
|
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
1055
|
-
const gridData = isSubTableShowPage
|
|
1056
|
-
? gridParams.subTableData
|
|
1057
|
-
: gridParams.gridData
|
|
945
|
+
const gridData = isSubTableShowPage ? gridParams.subTableData : gridParams.gridData
|
|
1058
946
|
const isMobile = this.isMobile
|
|
1059
|
-
if(gridParams.pageContext){
|
|
1060
|
-
canDelete = gridParams.options.lineEditOptions.beforeDelete.call(
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
)
|
|
1075
|
-
}else {
|
|
947
|
+
if (gridParams.pageContext) {
|
|
948
|
+
canDelete = gridParams.options.lineEditOptions.beforeDelete.call(this, {
|
|
949
|
+
rowIndex,
|
|
950
|
+
row: gridParams.gridData[rowIndex],
|
|
951
|
+
gridData,
|
|
952
|
+
isMobile,
|
|
953
|
+
baseURL: this.baseURL,
|
|
954
|
+
totalData: isSubTableShowPage ? gridParams.gridData : null,
|
|
955
|
+
pageSize,
|
|
956
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
957
|
+
pageContext: gridParams.pageContext,
|
|
958
|
+
configureObj: gridParams.configureObj
|
|
959
|
+
})
|
|
960
|
+
} else {
|
|
1076
961
|
canDelete = gridParams.options.lineEditOptions.beforeDelete.call(
|
|
1077
962
|
this,
|
|
1078
963
|
rowIndex,
|
|
@@ -1085,13 +970,9 @@ const apis = {
|
|
|
1085
970
|
gridParams.additionalParamMap
|
|
1086
971
|
)
|
|
1087
972
|
}
|
|
1088
|
-
|
|
1089
973
|
}
|
|
1090
974
|
if (canDelete === undefined || canDelete === true) {
|
|
1091
|
-
if (
|
|
1092
|
-
gridParams.isSubTableShowPage !== undefined &&
|
|
1093
|
-
gridParams.isSubTableShowPage === true
|
|
1094
|
-
) {
|
|
975
|
+
if (gridParams.isSubTableShowPage !== undefined && gridParams.isSubTableShowPage === true) {
|
|
1095
976
|
// 子表集合添加该新建的行。会触发watch subTableData的监控
|
|
1096
977
|
gridParams.isChangePage = true
|
|
1097
978
|
const lastPageRowIndex = (this.currentPage - 1) * this.pageSize
|
|
@@ -1110,7 +991,7 @@ const apis = {
|
|
|
1110
991
|
window.$vueApp.config.globalProperties.$message({
|
|
1111
992
|
showClose: true,
|
|
1112
993
|
message: getI18n().t('superGrid.deleteSuccessful'),
|
|
1113
|
-
type: 'success'
|
|
994
|
+
type: 'success'
|
|
1114
995
|
})
|
|
1115
996
|
if (gridParams.gridData.length === 0) {
|
|
1116
997
|
if (
|
|
@@ -1132,34 +1013,27 @@ const apis = {
|
|
|
1132
1013
|
if (isEditOptionFunction('afterDelete', listCode)) {
|
|
1133
1014
|
const isSubTableShowPage = gridParams.isSubTableShowPage
|
|
1134
1015
|
// 每页显示多少条
|
|
1135
|
-
const pageSize =
|
|
1136
|
-
gridParams.pagination && gridParams.pagination.pageSize
|
|
1016
|
+
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
1137
1017
|
const isMobile = this.isMobile
|
|
1138
|
-
if(gridParams.pageContext){
|
|
1139
|
-
gridParams.options.lineEditOptions.afterDelete.call(
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
configureObj: gridParams.configureObj
|
|
1153
|
-
}
|
|
1154
|
-
)
|
|
1155
|
-
}else {
|
|
1018
|
+
if (gridParams.pageContext) {
|
|
1019
|
+
gridParams.options.lineEditOptions.afterDelete.call(this, {
|
|
1020
|
+
rowIndex,
|
|
1021
|
+
row: gridParams.orgGridData[rowIndex],
|
|
1022
|
+
gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
1023
|
+
isMobile,
|
|
1024
|
+
baseURL: this.baseURL,
|
|
1025
|
+
totalData: isSubTableShowPage ? gridParams.gridData : null,
|
|
1026
|
+
pageSize,
|
|
1027
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
1028
|
+
pageContext: gridParams.pageContext,
|
|
1029
|
+
configureObj: gridParams.configureObj
|
|
1030
|
+
})
|
|
1031
|
+
} else {
|
|
1156
1032
|
gridParams.options.lineEditOptions.afterDelete.call(
|
|
1157
1033
|
this,
|
|
1158
1034
|
rowIndex,
|
|
1159
1035
|
gridParams.orgGridData[rowIndex],
|
|
1160
|
-
isSubTableShowPage
|
|
1161
|
-
? gridParams.subTableData
|
|
1162
|
-
: gridParams.gridData,
|
|
1036
|
+
isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
1163
1037
|
isMobile,
|
|
1164
1038
|
this.baseURL,
|
|
1165
1039
|
isSubTableShowPage ? gridParams.gridData : null,
|
|
@@ -1167,7 +1041,6 @@ const apis = {
|
|
|
1167
1041
|
gridParams.additionalParamMap
|
|
1168
1042
|
)
|
|
1169
1043
|
}
|
|
1170
|
-
|
|
1171
1044
|
}
|
|
1172
1045
|
}
|
|
1173
1046
|
}
|
|
@@ -1215,7 +1088,7 @@ const apis = {
|
|
|
1215
1088
|
}
|
|
1216
1089
|
const gridParams = store.get(listCode)
|
|
1217
1090
|
const columns = gridParams.columns
|
|
1218
|
-
columns.forEach(col => {
|
|
1091
|
+
columns.forEach((col) => {
|
|
1219
1092
|
const prop = col.prop
|
|
1220
1093
|
const isDynamicDataSource = isDynamicDataSourceSource(col)
|
|
1221
1094
|
if (!isDynamicDataSource && col.valueSet && col.valueSet.length > 0) {
|
|
@@ -1224,26 +1097,26 @@ const apis = {
|
|
|
1224
1097
|
})
|
|
1225
1098
|
return result
|
|
1226
1099
|
},
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
}
|
|
1100
|
+
// 获得该列表中,下拉选是选项组的字段信息,返回的key是属性名,value是选项集合
|
|
1101
|
+
getTableSelectOptions(listCode) {
|
|
1102
|
+
const result = {}
|
|
1103
|
+
if (!listCode) {
|
|
1104
|
+
listCode = store.get('_list_code')
|
|
1105
|
+
}
|
|
1106
|
+
const gridParams = store.get(listCode)
|
|
1107
|
+
const columns = gridParams.columns
|
|
1108
|
+
columns.forEach((col) => {
|
|
1109
|
+
const prop = col.prop
|
|
1110
|
+
const isDynamicDataSource = isDynamicDataSourceSource(col)
|
|
1111
|
+
if (!isDynamicDataSource && col.valueSet && col.valueSet.length > 0) {
|
|
1112
|
+
result[prop] = {
|
|
1113
|
+
options: col.valueSet,
|
|
1114
|
+
column: col
|
|
1243
1115
|
}
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1116
|
+
}
|
|
1117
|
+
})
|
|
1118
|
+
return result
|
|
1119
|
+
},
|
|
1247
1120
|
// 取消列表的编辑状态
|
|
1248
1121
|
restoreGridEdit(listCode) {
|
|
1249
1122
|
if (!listCode) {
|
|
@@ -1275,10 +1148,7 @@ const apis = {
|
|
|
1275
1148
|
// api方法,super-pages中有调用该方法
|
|
1276
1149
|
closePageDialog(popParams) {
|
|
1277
1150
|
// popParams格式为:{ entity, pageCode }
|
|
1278
|
-
console.log(
|
|
1279
|
-
'列表组件--closePageDialog---this.jumpPageSetting=',
|
|
1280
|
-
this.jumpPageSetting
|
|
1281
|
-
)
|
|
1151
|
+
console.log('列表组件--closePageDialog---this.jumpPageSetting=', this.jumpPageSetting)
|
|
1282
1152
|
if (this.jumpPageSetting) {
|
|
1283
1153
|
// 调用关闭弹框事件
|
|
1284
1154
|
const gridParams = store.get(this.code)
|
|
@@ -1298,26 +1168,22 @@ const apis = {
|
|
|
1298
1168
|
const params = {
|
|
1299
1169
|
params: gridParams.additionalParamMap,
|
|
1300
1170
|
additionalParamMap: gridParams.additionalParamMap,
|
|
1301
|
-
entity: row
|
|
1171
|
+
entity: row
|
|
1302
1172
|
}
|
|
1303
1173
|
if (popParams) {
|
|
1304
1174
|
params.eventParams = {
|
|
1305
1175
|
popEntity: popParams.entity,
|
|
1306
1176
|
popPageCode: popParams.pageCode,
|
|
1307
|
-
pageCode: this.pageCode
|
|
1177
|
+
pageCode: this.pageCode
|
|
1308
1178
|
}
|
|
1309
1179
|
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1180
|
+
closeEvent.call(this, params)
|
|
1181
|
+
if (popParams.jumpInfo && popParams.jumpInfo.successOperation === 'closeWindowAndRefresh') {
|
|
1312
1182
|
this.refresh()
|
|
1313
1183
|
}
|
|
1314
1184
|
}
|
|
1315
|
-
const isRefreshWhenClosePopup =
|
|
1316
|
-
|
|
1317
|
-
if (
|
|
1318
|
-
isRefreshWhenClosePopup !== undefined &&
|
|
1319
|
-
isRefreshWhenClosePopup === true
|
|
1320
|
-
) {
|
|
1185
|
+
const isRefreshWhenClosePopup = this.jumpPageSetting.isRefreshWhenClosePopup
|
|
1186
|
+
if (isRefreshWhenClosePopup !== undefined && isRefreshWhenClosePopup === true) {
|
|
1321
1187
|
// 关闭弹框时,刷新父页面列表
|
|
1322
1188
|
const gridParams = store.get(this.code)
|
|
1323
1189
|
this.search(gridParams.searchForm)
|
|
@@ -1330,19 +1196,14 @@ const apis = {
|
|
|
1330
1196
|
// TODO 值更新
|
|
1331
1197
|
const gridParams = store.get(this.code)
|
|
1332
1198
|
const editRowIndex = targetRowIndex
|
|
1333
|
-
if (
|
|
1334
|
-
editRowIndex !== undefined &&
|
|
1335
|
-
editRowIndex !== null &&
|
|
1336
|
-
editRowIndex < this.gridData.length
|
|
1337
|
-
) {
|
|
1199
|
+
if (editRowIndex !== undefined && editRowIndex !== null && editRowIndex < this.gridData.length) {
|
|
1338
1200
|
// 返回true表示不需要替换字段,false表示需要替换字段
|
|
1339
1201
|
const isNotNeedReplaceFieldName =
|
|
1340
1202
|
this.isSql === false ||
|
|
1341
1203
|
(gridParams.options &&
|
|
1342
1204
|
((gridParams.options.isAdministerListView !== undefined &&
|
|
1343
1205
|
gridParams.options.isAdministerListView === true) ||
|
|
1344
|
-
(gridParams.options.isFormSubTable !== undefined &&
|
|
1345
|
-
gridParams.options.isFormSubTable === true)))
|
|
1206
|
+
(gridParams.options.isFormSubTable !== undefined && gridParams.options.isFormSubTable === true)))
|
|
1346
1207
|
const tableName = this.tableName
|
|
1347
1208
|
updateWithPageValue(
|
|
1348
1209
|
sourceModel,
|
|
@@ -1353,9 +1214,7 @@ const apis = {
|
|
|
1353
1214
|
!isNotNeedReplaceFieldName
|
|
1354
1215
|
)
|
|
1355
1216
|
const updateValueEventName =
|
|
1356
|
-
this.jumpPageSetting && this.jumpPageSetting.updateValueEvent
|
|
1357
|
-
? this.jumpPageSetting.updateValueEvent
|
|
1358
|
-
: null
|
|
1217
|
+
this.jumpPageSetting && this.jumpPageSetting.updateValueEvent ? this.jumpPageSetting.updateValueEvent : null
|
|
1359
1218
|
let updateValueEvent
|
|
1360
1219
|
if (
|
|
1361
1220
|
gridParams.options.eventCallBack &&
|
|
@@ -1364,8 +1223,7 @@ const apis = {
|
|
|
1364
1223
|
gridParams.options.eventCallBack[updateValueEventName]
|
|
1365
1224
|
) {
|
|
1366
1225
|
// 表单页面中子表自定义事件集合
|
|
1367
|
-
updateValueEvent =
|
|
1368
|
-
gridParams.options.eventCallBack[updateValueEventName]
|
|
1226
|
+
updateValueEvent = gridParams.options.eventCallBack[updateValueEventName]
|
|
1369
1227
|
}
|
|
1370
1228
|
if (updateValueEvent) {
|
|
1371
1229
|
updateValueEvent.call(this, {
|
|
@@ -1375,16 +1233,14 @@ const apis = {
|
|
|
1375
1233
|
entity: this.gridData[editRowIndex],
|
|
1376
1234
|
targetTableName: tableName,
|
|
1377
1235
|
isNeedReplaceFieldName: !isNotNeedReplaceFieldName,
|
|
1378
|
-
additionalParamMap: gridParams.additionalParamMap
|
|
1236
|
+
additionalParamMap: gridParams.additionalParamMap
|
|
1379
1237
|
})
|
|
1380
1238
|
}
|
|
1381
1239
|
}
|
|
1382
1240
|
},
|
|
1383
1241
|
refreshChildData(listCode, gridData, isShowPageArea) {
|
|
1384
1242
|
const gridParams = store.get(listCode)
|
|
1385
|
-
if (isShowPageArea === undefined ||
|
|
1386
|
-
isShowPageArea === null ||
|
|
1387
|
-
isShowPageArea === false) {
|
|
1243
|
+
if (isShowPageArea === undefined || isShowPageArea === null || isShowPageArea === false) {
|
|
1388
1244
|
// 子表不分页
|
|
1389
1245
|
// console.log('refreshChildData111====', listCode + 'listCode', gridData)
|
|
1390
1246
|
gridParams.gridData = gridData
|
|
@@ -1402,7 +1258,7 @@ const apis = {
|
|
|
1402
1258
|
const gridParams = store.get(listCode)
|
|
1403
1259
|
const defaultValueColumns = gridParams.defaultValueColumns
|
|
1404
1260
|
if (defaultValueColumns && defaultValueColumns.length > 0) {
|
|
1405
|
-
defaultValueColumns.forEach(column => {
|
|
1261
|
+
defaultValueColumns.forEach((column) => {
|
|
1406
1262
|
defaultValueColumnsMap[column.prop] = column.defaultValue
|
|
1407
1263
|
})
|
|
1408
1264
|
}
|
|
@@ -1414,7 +1270,7 @@ const apis = {
|
|
|
1414
1270
|
gridParams.options['subTableData'] = null
|
|
1415
1271
|
this.fetchListData()
|
|
1416
1272
|
},
|
|
1417
|
-
|
|
1273
|
+
/**
|
|
1418
1274
|
* v10 行编辑时动态控制字段的编辑权限
|
|
1419
1275
|
* @param pageContext 页面解析的上下文对象
|
|
1420
1276
|
* @param customRules 格式如下:
|
|
@@ -1453,30 +1309,30 @@ const apis = {
|
|
|
1453
1309
|
}
|
|
1454
1310
|
]
|
|
1455
1311
|
*/
|
|
1456
|
-
dynamicControlTableEdit(pageContext, customRules, listCode){
|
|
1312
|
+
dynamicControlTableEdit(pageContext, customRules, listCode) {
|
|
1457
1313
|
const gridParams = store.get(listCode)
|
|
1458
1314
|
// console.log('dynamicControlTableEdit----customRules-----', customRules, gridParams.options.customRules)
|
|
1459
|
-
if(!customRules){
|
|
1315
|
+
if (!customRules) {
|
|
1460
1316
|
return
|
|
1461
1317
|
}
|
|
1462
1318
|
let gridCustomRules = {}
|
|
1463
|
-
if(gridParams.options.customRules){
|
|
1319
|
+
if (gridParams.options.customRules) {
|
|
1464
1320
|
gridCustomRules = JSON.parse(JSON.stringify(gridParams.options.customRules))
|
|
1465
1321
|
}
|
|
1466
|
-
customRules.forEach(item=>{
|
|
1322
|
+
customRules.forEach((item) => {
|
|
1467
1323
|
const copyItem = JSON.parse(JSON.stringify(item))
|
|
1468
1324
|
const prop = item.name
|
|
1469
1325
|
// 当前列新的自定义规则集合
|
|
1470
1326
|
let columnRules
|
|
1471
|
-
if(!gridCustomRules[prop]){
|
|
1327
|
+
if (!gridCustomRules[prop]) {
|
|
1472
1328
|
gridCustomRules[prop] = {}
|
|
1473
1329
|
}
|
|
1474
1330
|
// console.log('dynamicControlTableEdit----gridCustomRules111-----', gridCustomRules)
|
|
1475
1331
|
// 获得当前列已有的自定义规则集合
|
|
1476
1332
|
columnRules = gridCustomRules[prop].rules
|
|
1477
|
-
|
|
1478
|
-
if(copyItem.rules){
|
|
1479
|
-
if(!columnRules){
|
|
1333
|
+
|
|
1334
|
+
if (copyItem.rules) {
|
|
1335
|
+
if (!columnRules) {
|
|
1480
1336
|
columnRules = []
|
|
1481
1337
|
}
|
|
1482
1338
|
// 将当前列自定义规则集合拼接到已有的自定义规则集合中
|
|
@@ -1485,7 +1341,7 @@ const apis = {
|
|
|
1485
1341
|
// 当前列总的自定义规则更新
|
|
1486
1342
|
copyItem.rules = columnRules
|
|
1487
1343
|
// this.options.customRules[prop] = copyItem
|
|
1488
|
-
if(!gridParams.options.customRules){
|
|
1344
|
+
if (!gridParams.options.customRules) {
|
|
1489
1345
|
gridParams.options.customRules = {}
|
|
1490
1346
|
}
|
|
1491
1347
|
// console.log('dynamicControlTableEdit----gridParams.options.customRules222-----', gridParams.options.customRules)
|
|
@@ -1494,22 +1350,22 @@ const apis = {
|
|
|
1494
1350
|
// console.log('dynamicControlTableEdit----gridParams.options.customRules333-----', gridParams.options.customRules)
|
|
1495
1351
|
},
|
|
1496
1352
|
doLayout(hiddenColumns, listCode) {
|
|
1497
|
-
if(!listCode){
|
|
1353
|
+
if (!listCode) {
|
|
1498
1354
|
listCode = this.code
|
|
1499
1355
|
}
|
|
1500
1356
|
const gridParams = store.get(listCode)
|
|
1501
1357
|
const orgHiddenColumns = gridParams.hiddenColumns
|
|
1502
1358
|
// console.log('doLayout----orgHiddenColumns=', orgHiddenColumns)
|
|
1503
|
-
if(hiddenColumns && hiddenColumns.length > 0){
|
|
1359
|
+
if (hiddenColumns && hiddenColumns.length > 0) {
|
|
1504
1360
|
let hiddenColumnsResult = orgHiddenColumns
|
|
1505
|
-
if(!hiddenColumnsResult){
|
|
1361
|
+
if (!hiddenColumnsResult) {
|
|
1506
1362
|
hiddenColumnsResult = []
|
|
1507
1363
|
}
|
|
1508
|
-
if(hiddenColumnsResult.length === 0){
|
|
1364
|
+
if (hiddenColumnsResult.length === 0) {
|
|
1509
1365
|
hiddenColumnsResult = hiddenColumns
|
|
1510
1366
|
} else {
|
|
1511
|
-
hiddenColumns.forEach(prop=>{
|
|
1512
|
-
if(hiddenColumnsResult.indexOf(prop) < 0) {
|
|
1367
|
+
hiddenColumns.forEach((prop) => {
|
|
1368
|
+
if (hiddenColumnsResult.indexOf(prop) < 0) {
|
|
1513
1369
|
// 去重处理
|
|
1514
1370
|
hiddenColumnsResult.push(prop)
|
|
1515
1371
|
}
|