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