agilebuilder-ui 1.0.90-tmp18 → 1.0.90-tmp182
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 +48544 -46849
- package/lib/super-ui.umd.cjs +94 -97
- package/package.json +1 -1
- package/packages/fs-upload-list/src/fs-upload-list.vue +2 -2
- package/packages/super-grid/src/apis.js +244 -469
- package/packages/super-grid/src/dynamic-input.vue +21 -50
- package/packages/super-grid/src/formValidatorUtil.js +15 -76
- package/packages/super-grid/src/normal-column-content.vue +88 -46
- package/packages/super-grid/src/normal-column.vue +24 -20
- package/packages/super-grid/src/super-grid.vue +4 -12
- package/packages/super-grid/src/utils.js +5 -18
- package/src/i18n/langs/cn.js +1 -2
- package/src/i18n/langs/en.js +1 -2
|
@@ -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
|
-
(row) => row.$editing !== undefined && row.$editing === true
|
|
203
|
-
)
|
|
197
|
+
const editRows = myGridData.filter((row) => row.$editing !== undefined && row.$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
|
}
|
|
@@ -419,13 +382,15 @@ const apis = {
|
|
|
419
382
|
// 不是操作列,才需要设值
|
|
420
383
|
const defaultValueSet = column.defaultValue
|
|
421
384
|
let defaultValue = null
|
|
422
|
-
|
|
423
|
-
if(getDefaultValueFunc) {
|
|
424
|
-
console.log('setColumnsDefaultValue22---getDefaultValueFunc222---')
|
|
385
|
+
if (getDefaultValueFunc) {
|
|
425
386
|
defaultValue = getDefaultValueFunc(gridParams.pageContext, defaultValueSet, null, null)
|
|
426
|
-
|
|
427
|
-
if(defaultValue === undefined) {
|
|
387
|
+
if (defaultValue === undefined) {
|
|
428
388
|
defaultValue = null
|
|
389
|
+
} else {
|
|
390
|
+
if (column.dataType === 'BOOLEAN') {
|
|
391
|
+
// 如果是布尔类型,需要转换一下,默认值是字符串,需要转换成布尔类型
|
|
392
|
+
defaultValue = defaultValue === 'true' || defaultValue === true
|
|
393
|
+
}
|
|
429
394
|
}
|
|
430
395
|
}
|
|
431
396
|
setEntityFieldValue(row, prop, defaultValue)
|
|
@@ -466,8 +431,7 @@ const apis = {
|
|
|
466
431
|
// 不是当前编辑行时
|
|
467
432
|
if (
|
|
468
433
|
typeof gridParams.options.lineEditOptions.autoSave === 'undefined' ||
|
|
469
|
-
(isHasEditOption('autoSave', listCode) &&
|
|
470
|
-
gridParams.options.lineEditOptions.autoSave === true)
|
|
434
|
+
(isHasEditOption('autoSave', listCode) && gridParams.options.lineEditOptions.autoSave === true)
|
|
471
435
|
) {
|
|
472
436
|
// 自动保存行数据
|
|
473
437
|
if (!isSaveCallback) {
|
|
@@ -484,9 +448,9 @@ const apis = {
|
|
|
484
448
|
window.$vueApp.config.globalProperties.$message({
|
|
485
449
|
showClose: true,
|
|
486
450
|
message: getI18n().t('superGrid.pleaseSaveLine', {
|
|
487
|
-
row: gridParams.$rowIndex + 1
|
|
451
|
+
row: gridParams.$rowIndex + 1
|
|
488
452
|
}),
|
|
489
|
-
type: 'warning'
|
|
453
|
+
type: 'warning'
|
|
490
454
|
})
|
|
491
455
|
return
|
|
492
456
|
}
|
|
@@ -499,9 +463,7 @@ const apis = {
|
|
|
499
463
|
// 每页显示多少条
|
|
500
464
|
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
501
465
|
canEdit = gridParams.options.lineEditOptions.beforeEdit.call(this, {
|
|
502
|
-
gridData: isSubTableShowPage
|
|
503
|
-
? gridParams.subTableData
|
|
504
|
-
: gridParams.gridData,
|
|
466
|
+
gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
505
467
|
listCode: listCode,
|
|
506
468
|
entity: gridParams.gridData[rowIndex],
|
|
507
469
|
row: gridParams.gridData[rowIndex],
|
|
@@ -577,9 +539,9 @@ const apis = {
|
|
|
577
539
|
window.$vueApp.config.globalProperties.$message({
|
|
578
540
|
showClose: true,
|
|
579
541
|
message: getI18n().t('superGrid.noNeedToSaveRow', {
|
|
580
|
-
row: rowIndex + 1
|
|
542
|
+
row: rowIndex + 1
|
|
581
543
|
}),
|
|
582
|
-
type: 'warning'
|
|
544
|
+
type: 'warning'
|
|
583
545
|
})
|
|
584
546
|
return
|
|
585
547
|
}
|
|
@@ -589,9 +551,9 @@ const apis = {
|
|
|
589
551
|
window.$vueApp.config.globalProperties.$message({
|
|
590
552
|
showClose: true,
|
|
591
553
|
message: getI18n().t('superGrid.pleaseSaveLine', {
|
|
592
|
-
row: gridParams.$rowIndex + 1
|
|
554
|
+
row: gridParams.$rowIndex + 1
|
|
593
555
|
}),
|
|
594
|
-
type: 'warning'
|
|
556
|
+
type: 'warning'
|
|
595
557
|
})
|
|
596
558
|
return
|
|
597
559
|
}
|
|
@@ -606,7 +568,7 @@ const apis = {
|
|
|
606
568
|
window.$vueApp.config.globalProperties.$message({
|
|
607
569
|
showClose: true,
|
|
608
570
|
message: getI18n().t('superGrid.pleaseSetURLToSaveRowInformation'),
|
|
609
|
-
type: 'warning'
|
|
571
|
+
type: 'warning'
|
|
610
572
|
})
|
|
611
573
|
return
|
|
612
574
|
}
|
|
@@ -623,35 +585,27 @@ const apis = {
|
|
|
623
585
|
}
|
|
624
586
|
let validateResult = true
|
|
625
587
|
if (needValidate === true) {
|
|
626
|
-
validateResult = formValidatorService.validator(
|
|
627
|
-
row,
|
|
628
|
-
listCode,
|
|
629
|
-
rowIndex
|
|
630
|
-
)
|
|
588
|
+
validateResult = formValidatorService.validator(row, listCode, rowIndex)
|
|
631
589
|
}
|
|
632
590
|
if (validateResult === true) {
|
|
633
591
|
let canSave = true
|
|
634
592
|
if (isEditOptionFunction('beforeSave', listCode)) {
|
|
635
|
-
if(gridParams.pageContext){
|
|
636
|
-
canSave = gridParams.options.lineEditOptions['beforeSave'].call(
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
}
|
|
645
|
-
)
|
|
593
|
+
if (gridParams.pageContext) {
|
|
594
|
+
canSave = gridParams.options.lineEditOptions['beforeSave'].call(this, {
|
|
595
|
+
row,
|
|
596
|
+
columns: gridParams.columns,
|
|
597
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
598
|
+
pageContext: gridParams.pageContext,
|
|
599
|
+
configureObj: gridParams.configureObj
|
|
600
|
+
})
|
|
646
601
|
} else {
|
|
647
602
|
canSave = gridParams.options.lineEditOptions['beforeSave'].call(
|
|
648
603
|
this,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
604
|
+
row,
|
|
605
|
+
gridParams.columns,
|
|
606
|
+
gridParams.additionalParamMap
|
|
652
607
|
)
|
|
653
608
|
}
|
|
654
|
-
|
|
655
609
|
}
|
|
656
610
|
if (canSave === undefined || canSave === true) {
|
|
657
611
|
// 触发点击保存时的事件线,在 normal-column 监听处对字段控件是选项组的字段的值进行处理
|
|
@@ -660,79 +614,59 @@ const apis = {
|
|
|
660
614
|
let saveRowRequest
|
|
661
615
|
if (isEditOptionFunction('saveRow', listCode)) {
|
|
662
616
|
// 表示保存方法,用户自己重写了
|
|
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
|
-
)
|
|
617
|
+
if (gridParams.pageContext) {
|
|
618
|
+
saveRowRequest = gridParams.options.lineEditOptions['saveRow'].call(this, {
|
|
619
|
+
row,
|
|
620
|
+
columns: gridParams.columns,
|
|
621
|
+
dataTypeMap: gridParams.$dataTypeMap,
|
|
622
|
+
dynamicColumnInfo: gridParams.dynamicColumnInfo,
|
|
623
|
+
additionalParamMap,
|
|
624
|
+
mainDefaultValueColumns: gridParams.mainDefaultValueColumns,
|
|
625
|
+
pageContext: gridParams.pageContext,
|
|
626
|
+
configureObj: gridParams.configureObj
|
|
627
|
+
})
|
|
678
628
|
} else {
|
|
679
629
|
// 兼容历史数据
|
|
680
|
-
saveRowRequest = gridParams.options.lineEditOptions[
|
|
681
|
-
'saveRow'
|
|
682
|
-
].call(
|
|
630
|
+
saveRowRequest = gridParams.options.lineEditOptions['saveRow'].call(
|
|
683
631
|
this,
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
632
|
+
row,
|
|
633
|
+
gridParams.columns,
|
|
634
|
+
gridParams.$dataTypeMap,
|
|
635
|
+
gridParams.dynamicColumnInfo,
|
|
636
|
+
additionalParamMap,
|
|
637
|
+
gridParams.mainDefaultValueColumns
|
|
690
638
|
)
|
|
691
639
|
}
|
|
692
|
-
|
|
693
640
|
}
|
|
694
|
-
if (
|
|
695
|
-
!saveRowRequest &&
|
|
696
|
-
gridParams.lineEdit &&
|
|
697
|
-
gridParams.lineEdit.urlToSaveRow
|
|
698
|
-
) {
|
|
641
|
+
if (!saveRowRequest && gridParams.lineEdit && gridParams.lineEdit.urlToSaveRow) {
|
|
699
642
|
// 使用默认的保存实现
|
|
700
643
|
let urlToSaveRow = gridParams.lineEdit.urlToSaveRow
|
|
701
644
|
if (isHasEditOption('urlToSaveRow', listCode)) {
|
|
702
645
|
// 表示手动配置了保存行记录的url
|
|
703
|
-
urlToSaveRow =
|
|
704
|
-
gridParams.options.lineEditOptions['urlToSaveRow']
|
|
646
|
+
urlToSaveRow = gridParams.options.lineEditOptions['urlToSaveRow']
|
|
705
647
|
}
|
|
706
|
-
saveRowRequest =
|
|
707
|
-
window.$vueApp.config.globalProperties
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
)
|
|
648
|
+
saveRowRequest = window.$vueApp.config.globalProperties.$http.post(
|
|
649
|
+
window.$vueApp.config.globalProperties.baseURL + urlToSaveRow,
|
|
650
|
+
row
|
|
651
|
+
)
|
|
711
652
|
}
|
|
712
|
-
if (
|
|
713
|
-
gridParams.isHasDynamic !== undefined &&
|
|
714
|
-
gridParams.isHasDynamic === true &&
|
|
715
|
-
!saveRowRequest
|
|
716
|
-
) {
|
|
653
|
+
if (gridParams.isHasDynamic !== undefined && gridParams.isHasDynamic === true && !saveRowRequest) {
|
|
717
654
|
// 表示有动态列,保存时使用平台封装好的请求
|
|
718
655
|
const urlToSaveRow = '/common/dynamic-values'
|
|
719
656
|
const dynamicValueDTO = {
|
|
720
657
|
mainTableName:
|
|
721
|
-
gridParams.basicInfo && gridParams.basicInfo.tableName
|
|
722
|
-
? gridParams.basicInfo.tableName
|
|
723
|
-
: '',
|
|
658
|
+
gridParams.basicInfo && gridParams.basicInfo.tableName ? gridParams.basicInfo.tableName : '',
|
|
724
659
|
row: row,
|
|
725
660
|
dynamicColumnInfo: gridParams.dynamicColumnInfo,
|
|
726
661
|
additionalParamMap: additionalParamMap,
|
|
727
662
|
dataTypeMap: gridParams.$dataTypeMap,
|
|
728
663
|
dynamicServiceName: gridParams.dynamicServiceName,
|
|
729
|
-
mainDefaultValueColumns: gridParams.mainDefaultValueColumns
|
|
664
|
+
mainDefaultValueColumns: gridParams.mainDefaultValueColumns
|
|
730
665
|
}
|
|
731
|
-
saveRowRequest =
|
|
732
|
-
window.$vueApp.config.globalProperties
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
)
|
|
666
|
+
saveRowRequest = window.$vueApp.config.globalProperties.$http.post(
|
|
667
|
+
window.$vueApp.config.globalProperties.baseURL + urlToSaveRow,
|
|
668
|
+
dynamicValueDTO
|
|
669
|
+
)
|
|
736
670
|
}
|
|
737
671
|
if (saveRowRequest) {
|
|
738
672
|
saveRowRequest
|
|
@@ -748,13 +682,7 @@ const apis = {
|
|
|
748
682
|
.catch((error) => {
|
|
749
683
|
gridParams.canSaveRow = true
|
|
750
684
|
if (isEditOptionFunction('saveError', listCode)) {
|
|
751
|
-
gridParams.options.lineEditOptions['saveError'].call(
|
|
752
|
-
this,
|
|
753
|
-
row,
|
|
754
|
-
gridParams.columns,
|
|
755
|
-
rowIndex,
|
|
756
|
-
error
|
|
757
|
-
)
|
|
685
|
+
gridParams.options.lineEditOptions['saveError'].call(this, row, gridParams.columns, rowIndex, error)
|
|
758
686
|
}
|
|
759
687
|
reject(error)
|
|
760
688
|
})
|
|
@@ -764,11 +692,7 @@ const apis = {
|
|
|
764
692
|
}
|
|
765
693
|
} else {
|
|
766
694
|
gridParams.canSaveRow = true
|
|
767
|
-
reject(
|
|
768
|
-
getI18n().t(
|
|
769
|
-
'superGrid.theReturnValueOfTheBeforesaveCallbackMethodIsFalse'
|
|
770
|
-
)
|
|
771
|
-
)
|
|
695
|
+
reject(getI18n().t('superGrid.theReturnValueOfTheBeforesaveCallbackMethodIsFalse'))
|
|
772
696
|
}
|
|
773
697
|
} else {
|
|
774
698
|
gridParams.canSaveRow = true
|
|
@@ -788,16 +712,14 @@ const apis = {
|
|
|
788
712
|
window.$vueApp.config.globalProperties.$message({
|
|
789
713
|
showClose: true,
|
|
790
714
|
message: getI18n().t('superGrid.lineSavedSuccessfully', {
|
|
791
|
-
row: rowIndex + 1
|
|
715
|
+
row: rowIndex + 1
|
|
792
716
|
}),
|
|
793
|
-
type: 'success'
|
|
717
|
+
type: 'success'
|
|
794
718
|
})
|
|
795
719
|
if (
|
|
796
|
-
typeof gridParams.options.lineEditOptions.aftersaveIsCancelEditState ===
|
|
797
|
-
'undefined' ||
|
|
720
|
+
typeof gridParams.options.lineEditOptions.aftersaveIsCancelEditState === 'undefined' ||
|
|
798
721
|
(isHasEditOption('aftersaveIsCancelEditState', listCode) &&
|
|
799
|
-
gridParams.options.lineEditOptions.aftersaveIsCancelEditState ===
|
|
800
|
-
true)
|
|
722
|
+
gridParams.options.lineEditOptions.aftersaveIsCancelEditState === true)
|
|
801
723
|
) {
|
|
802
724
|
// 取消编辑状态
|
|
803
725
|
setEntityFieldValue(row, '$editing', false)
|
|
@@ -806,18 +728,16 @@ const apis = {
|
|
|
806
728
|
}
|
|
807
729
|
|
|
808
730
|
if (isEditOptionFunction('saveSuccess', listCode)) {
|
|
809
|
-
if(gridParams.pageContext) {
|
|
810
|
-
gridParams.options.lineEditOptions['saveSuccess'].call(
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
)
|
|
820
|
-
|
|
731
|
+
if (gridParams.pageContext) {
|
|
732
|
+
gridParams.options.lineEditOptions['saveSuccess'].call(this, {
|
|
733
|
+
data,
|
|
734
|
+
columns: gridParams.columns,
|
|
735
|
+
rowIndex,
|
|
736
|
+
row,
|
|
737
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
738
|
+
pageContext: gridParams.pageContext,
|
|
739
|
+
configureObj: gridParams.configureObj
|
|
740
|
+
})
|
|
821
741
|
} else {
|
|
822
742
|
gridParams.options.lineEditOptions['saveSuccess'].call(
|
|
823
743
|
this,
|
|
@@ -844,15 +764,14 @@ const apis = {
|
|
|
844
764
|
this.refresh(false, true)
|
|
845
765
|
.then(() => {
|
|
846
766
|
if (
|
|
847
|
-
typeof gridParams.options.lineEditOptions.aftersaveIsCreateRow ===
|
|
848
|
-
'undefined' ||
|
|
767
|
+
typeof gridParams.options.lineEditOptions.aftersaveIsCreateRow === 'undefined' ||
|
|
849
768
|
gridParams.options.lineEditOptions.aftersaveIsCreateRow
|
|
850
769
|
) {
|
|
851
770
|
this.createRow(listCode)
|
|
852
771
|
}
|
|
853
772
|
resolve({
|
|
854
773
|
rowIndex,
|
|
855
|
-
listCode
|
|
774
|
+
listCode
|
|
856
775
|
})
|
|
857
776
|
})
|
|
858
777
|
.catch((error) => reject(error))
|
|
@@ -875,18 +794,14 @@ const apis = {
|
|
|
875
794
|
const gridParams = store.get(listCode)
|
|
876
795
|
// console.log('restoreCurrentRow-gridParams.$rowIndex,rowIndex', gridParams.$rowIndex, rowIndex)
|
|
877
796
|
if (gridParams.lineEdit && gridParams.lineEdit.editable) {
|
|
878
|
-
if (
|
|
879
|
-
gridParams.$rowIndex !== null &&
|
|
880
|
-
gridParams.$rowIndex !== rowIndex &&
|
|
881
|
-
!isLastEditRowSave(listCode)
|
|
882
|
-
) {
|
|
797
|
+
if (gridParams.$rowIndex !== null && gridParams.$rowIndex !== rowIndex && !isLastEditRowSave(listCode)) {
|
|
883
798
|
// 最后编辑的一行没有保存,则提示
|
|
884
799
|
window.$vueApp.config.globalProperties.$message({
|
|
885
800
|
showClose: true,
|
|
886
801
|
message: getI18n().t('superGrid.pleaseSaveLine', {
|
|
887
|
-
row: gridParams.$rowIndex + 1
|
|
802
|
+
row: gridParams.$rowIndex + 1
|
|
888
803
|
}),
|
|
889
|
-
type: 'warning'
|
|
804
|
+
type: 'warning'
|
|
890
805
|
})
|
|
891
806
|
return
|
|
892
807
|
}
|
|
@@ -902,22 +817,19 @@ const apis = {
|
|
|
902
817
|
// 每页显示多少条
|
|
903
818
|
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
904
819
|
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
|
-
})
|
|
820
|
+
isValidate = gridParams.options.lineEditOptions.beforeRestoreValidate.call(this, {
|
|
821
|
+
rowIndex,
|
|
822
|
+
gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
823
|
+
entity: gridParams.gridData[rowIndex],
|
|
824
|
+
isMobile,
|
|
825
|
+
baseURL: this.baseURL,
|
|
826
|
+
isEditing: !isUnEditing,
|
|
827
|
+
pageGridData: isSubTableShowPage ? gridParams.gridData : null,
|
|
828
|
+
pageSize,
|
|
829
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
830
|
+
pageContext: gridParams.pageContext,
|
|
831
|
+
configureObj: gridParams.configureObj
|
|
832
|
+
})
|
|
921
833
|
}
|
|
922
834
|
if (isValidate === undefined || isValidate === true) {
|
|
923
835
|
// 例如:自定义验证成功,再继续平台的验证
|
|
@@ -927,9 +839,9 @@ const apis = {
|
|
|
927
839
|
window.$vueApp.config.globalProperties.$message({
|
|
928
840
|
showClose: true,
|
|
929
841
|
message: getI18n().t('superGrid.lineNoNeedToUndoEdit', {
|
|
930
|
-
row: rowIndex + 1
|
|
842
|
+
row: rowIndex + 1
|
|
931
843
|
}),
|
|
932
|
-
type: 'warning'
|
|
844
|
+
type: 'warning'
|
|
933
845
|
})
|
|
934
846
|
return
|
|
935
847
|
}
|
|
@@ -943,71 +855,51 @@ const apis = {
|
|
|
943
855
|
// 每页显示多少条
|
|
944
856
|
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
945
857
|
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
|
-
)
|
|
858
|
+
canRestore = gridParams.options.lineEditOptions.beforeRestore.call(this, {
|
|
859
|
+
rowIndex,
|
|
860
|
+
gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
861
|
+
entity: gridParams.gridData[rowIndex],
|
|
862
|
+
isMobile,
|
|
863
|
+
baseURL: window.$vueApp.config.globalProperties.baseURL,
|
|
864
|
+
isEditing: !isUnEditing,
|
|
865
|
+
pageGridData: isSubTableShowPage ? gridParams.gridData : null,
|
|
866
|
+
pageSize,
|
|
867
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
868
|
+
pageContext: gridParams.pageContext,
|
|
869
|
+
configureObj: gridParams.configureObj
|
|
870
|
+
})
|
|
964
871
|
}
|
|
965
872
|
if (canRestore === undefined || canRestore === true) {
|
|
966
873
|
// 如果没有编辑过任何行
|
|
967
|
-
if (
|
|
968
|
-
!gridParams.orgGridData[rowIndex].id &&
|
|
969
|
-
!gridParams.orgGridData[rowIndex].ID
|
|
970
|
-
) {
|
|
874
|
+
if (!gridParams.orgGridData[rowIndex].id && !gridParams.orgGridData[rowIndex].ID) {
|
|
971
875
|
// 表示没有保存行数据,需要删除该行记录
|
|
972
876
|
this.deleteRow(rowIndex, listCode, true)
|
|
973
877
|
} else {
|
|
974
878
|
// 这样写会导致“如果字段值原来是空的,输入了内容后,取消编辑没法把输入的值清空”问题
|
|
975
879
|
// Object.assign(gridParams.gridData[rowIndex], gridParams.orgGridData[rowIndex])
|
|
976
880
|
// 所以改成如下写法
|
|
977
|
-
gridParams.gridData[rowIndex] = JSON.parse(
|
|
978
|
-
|
|
979
|
-
)
|
|
980
|
-
if (
|
|
981
|
-
gridParams.isSubTableShowPage !== undefined &&
|
|
982
|
-
gridParams.isSubTableShowPage === true
|
|
983
|
-
) {
|
|
881
|
+
gridParams.gridData[rowIndex] = JSON.parse(JSON.stringify(gridParams.orgGridData[rowIndex]))
|
|
882
|
+
if (gridParams.isSubTableShowPage !== undefined && gridParams.isSubTableShowPage === true) {
|
|
984
883
|
// 子表集合移除该行。会触发watch subTableData的监控
|
|
985
884
|
const lastPageRowIndex = (this.currentPage - 1) * this.pageSize
|
|
986
885
|
const subTableRowIndex = lastPageRowIndex + rowIndex
|
|
987
|
-
gridParams.subTableData[subTableRowIndex] =
|
|
988
|
-
gridParams.gridData[rowIndex]
|
|
886
|
+
gridParams.subTableData[subTableRowIndex] = gridParams.gridData[rowIndex]
|
|
989
887
|
}
|
|
990
888
|
window.$vueApp.config.globalProperties.$message({
|
|
991
889
|
showClose: true,
|
|
992
890
|
message: getI18n().t('superGrid.lineCancelledSuccessfully', {
|
|
993
|
-
row: rowIndex + 1
|
|
891
|
+
row: rowIndex + 1
|
|
994
892
|
}),
|
|
995
|
-
type: 'success'
|
|
893
|
+
type: 'success'
|
|
996
894
|
})
|
|
997
895
|
|
|
998
896
|
if (
|
|
999
|
-
typeof gridParams.options.lineEditOptions
|
|
1000
|
-
.afterRestoreIsCancelEditState === 'undefined' ||
|
|
897
|
+
typeof gridParams.options.lineEditOptions.afterRestoreIsCancelEditState === 'undefined' ||
|
|
1001
898
|
(isHasEditOption('afterRestoreIsCancelEditState', listCode) &&
|
|
1002
|
-
gridParams.options.lineEditOptions
|
|
1003
|
-
.afterRestoreIsCancelEditState === true)
|
|
899
|
+
gridParams.options.lineEditOptions.afterRestoreIsCancelEditState === true)
|
|
1004
900
|
) {
|
|
1005
901
|
// 取消编辑状态
|
|
1006
|
-
setEntityFieldValue(
|
|
1007
|
-
gridParams.gridData[rowIndex],
|
|
1008
|
-
'$editing',
|
|
1009
|
-
false
|
|
1010
|
-
)
|
|
902
|
+
setEntityFieldValue(gridParams.gridData[rowIndex], '$editing', false)
|
|
1011
903
|
// Vue.set(gridParams.gridData[rowIndex], '$editing', false)
|
|
1012
904
|
gridParams.isEditRow = false
|
|
1013
905
|
}
|
|
@@ -1016,17 +908,14 @@ const apis = {
|
|
|
1016
908
|
gridParams.isCreateRow = false
|
|
1017
909
|
// 撤销编辑后回调
|
|
1018
910
|
if (isEditOptionFunction('afterRestore', listCode)) {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
configureObj: gridParams.configureObj
|
|
1028
|
-
}
|
|
1029
|
-
)
|
|
911
|
+
if (gridParams.pageContext) {
|
|
912
|
+
gridParams.options.lineEditOptions.afterRestore.call(this, {
|
|
913
|
+
rowIndex,
|
|
914
|
+
row: gridParams.orgGridData[rowIndex],
|
|
915
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
916
|
+
pageContext: gridParams.pageContext,
|
|
917
|
+
configureObj: gridParams.configureObj
|
|
918
|
+
})
|
|
1030
919
|
} else {
|
|
1031
920
|
gridParams.options.lineEditOptions.afterRestore.call(
|
|
1032
921
|
this,
|
|
@@ -1035,7 +924,6 @@ const apis = {
|
|
|
1035
924
|
gridParams.additionalParamMap
|
|
1036
925
|
)
|
|
1037
926
|
}
|
|
1038
|
-
|
|
1039
927
|
}
|
|
1040
928
|
}
|
|
1041
929
|
}
|
|
@@ -1052,27 +940,22 @@ const apis = {
|
|
|
1052
940
|
const isSubTableShowPage = gridParams.isSubTableShowPage
|
|
1053
941
|
// 每页显示多少条
|
|
1054
942
|
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
1055
|
-
const gridData = isSubTableShowPage
|
|
1056
|
-
? gridParams.subTableData
|
|
1057
|
-
: gridParams.gridData
|
|
943
|
+
const gridData = isSubTableShowPage ? gridParams.subTableData : gridParams.gridData
|
|
1058
944
|
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 {
|
|
945
|
+
if (gridParams.pageContext) {
|
|
946
|
+
canDelete = gridParams.options.lineEditOptions.beforeDelete.call(this, {
|
|
947
|
+
rowIndex,
|
|
948
|
+
row: gridParams.gridData[rowIndex],
|
|
949
|
+
gridData,
|
|
950
|
+
isMobile,
|
|
951
|
+
baseURL: this.baseURL,
|
|
952
|
+
totalData: isSubTableShowPage ? gridParams.gridData : null,
|
|
953
|
+
pageSize,
|
|
954
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
955
|
+
pageContext: gridParams.pageContext,
|
|
956
|
+
configureObj: gridParams.configureObj
|
|
957
|
+
})
|
|
958
|
+
} else {
|
|
1076
959
|
canDelete = gridParams.options.lineEditOptions.beforeDelete.call(
|
|
1077
960
|
this,
|
|
1078
961
|
rowIndex,
|
|
@@ -1085,13 +968,9 @@ const apis = {
|
|
|
1085
968
|
gridParams.additionalParamMap
|
|
1086
969
|
)
|
|
1087
970
|
}
|
|
1088
|
-
|
|
1089
971
|
}
|
|
1090
972
|
if (canDelete === undefined || canDelete === true) {
|
|
1091
|
-
if (
|
|
1092
|
-
gridParams.isSubTableShowPage !== undefined &&
|
|
1093
|
-
gridParams.isSubTableShowPage === true
|
|
1094
|
-
) {
|
|
973
|
+
if (gridParams.isSubTableShowPage !== undefined && gridParams.isSubTableShowPage === true) {
|
|
1095
974
|
// 子表集合添加该新建的行。会触发watch subTableData的监控
|
|
1096
975
|
gridParams.isChangePage = true
|
|
1097
976
|
const lastPageRowIndex = (this.currentPage - 1) * this.pageSize
|
|
@@ -1110,7 +989,7 @@ const apis = {
|
|
|
1110
989
|
window.$vueApp.config.globalProperties.$message({
|
|
1111
990
|
showClose: true,
|
|
1112
991
|
message: getI18n().t('superGrid.deleteSuccessful'),
|
|
1113
|
-
type: 'success'
|
|
992
|
+
type: 'success'
|
|
1114
993
|
})
|
|
1115
994
|
if (gridParams.gridData.length === 0) {
|
|
1116
995
|
if (
|
|
@@ -1132,34 +1011,27 @@ const apis = {
|
|
|
1132
1011
|
if (isEditOptionFunction('afterDelete', listCode)) {
|
|
1133
1012
|
const isSubTableShowPage = gridParams.isSubTableShowPage
|
|
1134
1013
|
// 每页显示多少条
|
|
1135
|
-
const pageSize =
|
|
1136
|
-
gridParams.pagination && gridParams.pagination.pageSize
|
|
1014
|
+
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
1137
1015
|
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 {
|
|
1016
|
+
if (gridParams.pageContext) {
|
|
1017
|
+
gridParams.options.lineEditOptions.afterDelete.call(this, {
|
|
1018
|
+
rowIndex,
|
|
1019
|
+
row: gridParams.orgGridData[rowIndex],
|
|
1020
|
+
gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
1021
|
+
isMobile,
|
|
1022
|
+
baseURL: this.baseURL,
|
|
1023
|
+
totalData: isSubTableShowPage ? gridParams.gridData : null,
|
|
1024
|
+
pageSize,
|
|
1025
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
1026
|
+
pageContext: gridParams.pageContext,
|
|
1027
|
+
configureObj: gridParams.configureObj
|
|
1028
|
+
})
|
|
1029
|
+
} else {
|
|
1156
1030
|
gridParams.options.lineEditOptions.afterDelete.call(
|
|
1157
1031
|
this,
|
|
1158
1032
|
rowIndex,
|
|
1159
1033
|
gridParams.orgGridData[rowIndex],
|
|
1160
|
-
isSubTableShowPage
|
|
1161
|
-
? gridParams.subTableData
|
|
1162
|
-
: gridParams.gridData,
|
|
1034
|
+
isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
|
|
1163
1035
|
isMobile,
|
|
1164
1036
|
this.baseURL,
|
|
1165
1037
|
isSubTableShowPage ? gridParams.gridData : null,
|
|
@@ -1167,7 +1039,6 @@ const apis = {
|
|
|
1167
1039
|
gridParams.additionalParamMap
|
|
1168
1040
|
)
|
|
1169
1041
|
}
|
|
1170
|
-
|
|
1171
1042
|
}
|
|
1172
1043
|
}
|
|
1173
1044
|
}
|
|
@@ -1215,7 +1086,7 @@ const apis = {
|
|
|
1215
1086
|
}
|
|
1216
1087
|
const gridParams = store.get(listCode)
|
|
1217
1088
|
const columns = gridParams.columns
|
|
1218
|
-
columns.forEach(col => {
|
|
1089
|
+
columns.forEach((col) => {
|
|
1219
1090
|
const prop = col.prop
|
|
1220
1091
|
const isDynamicDataSource = isDynamicDataSourceSource(col)
|
|
1221
1092
|
if (!isDynamicDataSource && col.valueSet && col.valueSet.length > 0) {
|
|
@@ -1224,26 +1095,26 @@ const apis = {
|
|
|
1224
1095
|
})
|
|
1225
1096
|
return result
|
|
1226
1097
|
},
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
}
|
|
1098
|
+
// 获得该列表中,下拉选是选项组的字段信息,返回的key是属性名,value是选项集合
|
|
1099
|
+
getTableSelectOptions(listCode) {
|
|
1100
|
+
const result = {}
|
|
1101
|
+
if (!listCode) {
|
|
1102
|
+
listCode = store.get('_list_code')
|
|
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
|
|
1243
1113
|
}
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1114
|
+
}
|
|
1115
|
+
})
|
|
1116
|
+
return result
|
|
1117
|
+
},
|
|
1247
1118
|
// 取消列表的编辑状态
|
|
1248
1119
|
restoreGridEdit(listCode) {
|
|
1249
1120
|
if (!listCode) {
|
|
@@ -1275,10 +1146,7 @@ const apis = {
|
|
|
1275
1146
|
// api方法,super-pages中有调用该方法
|
|
1276
1147
|
closePageDialog(popParams) {
|
|
1277
1148
|
// popParams格式为:{ entity, pageCode }
|
|
1278
|
-
console.log(
|
|
1279
|
-
'列表组件--closePageDialog---this.jumpPageSetting=',
|
|
1280
|
-
this.jumpPageSetting
|
|
1281
|
-
)
|
|
1149
|
+
console.log('列表组件--closePageDialog---this.jumpPageSetting=', this.jumpPageSetting)
|
|
1282
1150
|
if (this.jumpPageSetting) {
|
|
1283
1151
|
// 调用关闭弹框事件
|
|
1284
1152
|
const gridParams = store.get(this.code)
|
|
@@ -1298,26 +1166,22 @@ const apis = {
|
|
|
1298
1166
|
const params = {
|
|
1299
1167
|
params: gridParams.additionalParamMap,
|
|
1300
1168
|
additionalParamMap: gridParams.additionalParamMap,
|
|
1301
|
-
entity: row
|
|
1169
|
+
entity: row
|
|
1302
1170
|
}
|
|
1303
1171
|
if (popParams) {
|
|
1304
1172
|
params.eventParams = {
|
|
1305
1173
|
popEntity: popParams.entity,
|
|
1306
1174
|
popPageCode: popParams.pageCode,
|
|
1307
|
-
pageCode: this.pageCode
|
|
1175
|
+
pageCode: this.pageCode
|
|
1308
1176
|
}
|
|
1309
1177
|
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1178
|
+
closeEvent.call(this, params)
|
|
1179
|
+
if (popParams.jumpInfo && popParams.jumpInfo.successOperation === 'closeWindowAndRefresh') {
|
|
1312
1180
|
this.refresh()
|
|
1313
1181
|
}
|
|
1314
1182
|
}
|
|
1315
|
-
const isRefreshWhenClosePopup =
|
|
1316
|
-
|
|
1317
|
-
if (
|
|
1318
|
-
isRefreshWhenClosePopup !== undefined &&
|
|
1319
|
-
isRefreshWhenClosePopup === true
|
|
1320
|
-
) {
|
|
1183
|
+
const isRefreshWhenClosePopup = this.jumpPageSetting.isRefreshWhenClosePopup
|
|
1184
|
+
if (isRefreshWhenClosePopup !== undefined && isRefreshWhenClosePopup === true) {
|
|
1321
1185
|
// 关闭弹框时,刷新父页面列表
|
|
1322
1186
|
const gridParams = store.get(this.code)
|
|
1323
1187
|
this.search(gridParams.searchForm)
|
|
@@ -1330,19 +1194,14 @@ const apis = {
|
|
|
1330
1194
|
// TODO 值更新
|
|
1331
1195
|
const gridParams = store.get(this.code)
|
|
1332
1196
|
const editRowIndex = targetRowIndex
|
|
1333
|
-
if (
|
|
1334
|
-
editRowIndex !== undefined &&
|
|
1335
|
-
editRowIndex !== null &&
|
|
1336
|
-
editRowIndex < this.gridData.length
|
|
1337
|
-
) {
|
|
1197
|
+
if (editRowIndex !== undefined && editRowIndex !== null && editRowIndex < this.gridData.length) {
|
|
1338
1198
|
// 返回true表示不需要替换字段,false表示需要替换字段
|
|
1339
1199
|
const isNotNeedReplaceFieldName =
|
|
1340
1200
|
this.isSql === false ||
|
|
1341
1201
|
(gridParams.options &&
|
|
1342
1202
|
((gridParams.options.isAdministerListView !== undefined &&
|
|
1343
1203
|
gridParams.options.isAdministerListView === true) ||
|
|
1344
|
-
(gridParams.options.isFormSubTable !== undefined &&
|
|
1345
|
-
gridParams.options.isFormSubTable === true)))
|
|
1204
|
+
(gridParams.options.isFormSubTable !== undefined && gridParams.options.isFormSubTable === true)))
|
|
1346
1205
|
const tableName = this.tableName
|
|
1347
1206
|
updateWithPageValue(
|
|
1348
1207
|
sourceModel,
|
|
@@ -1353,9 +1212,7 @@ const apis = {
|
|
|
1353
1212
|
!isNotNeedReplaceFieldName
|
|
1354
1213
|
)
|
|
1355
1214
|
const updateValueEventName =
|
|
1356
|
-
this.jumpPageSetting && this.jumpPageSetting.updateValueEvent
|
|
1357
|
-
? this.jumpPageSetting.updateValueEvent
|
|
1358
|
-
: null
|
|
1215
|
+
this.jumpPageSetting && this.jumpPageSetting.updateValueEvent ? this.jumpPageSetting.updateValueEvent : null
|
|
1359
1216
|
let updateValueEvent
|
|
1360
1217
|
if (
|
|
1361
1218
|
gridParams.options.eventCallBack &&
|
|
@@ -1364,8 +1221,7 @@ const apis = {
|
|
|
1364
1221
|
gridParams.options.eventCallBack[updateValueEventName]
|
|
1365
1222
|
) {
|
|
1366
1223
|
// 表单页面中子表自定义事件集合
|
|
1367
|
-
updateValueEvent =
|
|
1368
|
-
gridParams.options.eventCallBack[updateValueEventName]
|
|
1224
|
+
updateValueEvent = gridParams.options.eventCallBack[updateValueEventName]
|
|
1369
1225
|
}
|
|
1370
1226
|
if (updateValueEvent) {
|
|
1371
1227
|
updateValueEvent.call(this, {
|
|
@@ -1375,16 +1231,14 @@ const apis = {
|
|
|
1375
1231
|
entity: this.gridData[editRowIndex],
|
|
1376
1232
|
targetTableName: tableName,
|
|
1377
1233
|
isNeedReplaceFieldName: !isNotNeedReplaceFieldName,
|
|
1378
|
-
additionalParamMap: gridParams.additionalParamMap
|
|
1234
|
+
additionalParamMap: gridParams.additionalParamMap
|
|
1379
1235
|
})
|
|
1380
1236
|
}
|
|
1381
1237
|
}
|
|
1382
1238
|
},
|
|
1383
1239
|
refreshChildData(listCode, gridData, isShowPageArea) {
|
|
1384
1240
|
const gridParams = store.get(listCode)
|
|
1385
|
-
if (isShowPageArea === undefined ||
|
|
1386
|
-
isShowPageArea === null ||
|
|
1387
|
-
isShowPageArea === false) {
|
|
1241
|
+
if (isShowPageArea === undefined || isShowPageArea === null || isShowPageArea === false) {
|
|
1388
1242
|
// 子表不分页
|
|
1389
1243
|
// console.log('refreshChildData111====', listCode + 'listCode', gridData)
|
|
1390
1244
|
gridParams.gridData = gridData
|
|
@@ -1402,7 +1256,7 @@ const apis = {
|
|
|
1402
1256
|
const gridParams = store.get(listCode)
|
|
1403
1257
|
const defaultValueColumns = gridParams.defaultValueColumns
|
|
1404
1258
|
if (defaultValueColumns && defaultValueColumns.length > 0) {
|
|
1405
|
-
defaultValueColumns.forEach(column => {
|
|
1259
|
+
defaultValueColumns.forEach((column) => {
|
|
1406
1260
|
defaultValueColumnsMap[column.prop] = column.defaultValue
|
|
1407
1261
|
})
|
|
1408
1262
|
}
|
|
@@ -1413,85 +1267,6 @@ const apis = {
|
|
|
1413
1267
|
const gridParams = store.get(listCode)
|
|
1414
1268
|
gridParams.options['subTableData'] = null
|
|
1415
1269
|
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, listCode){
|
|
1457
|
-
const gridParams = store.get(listCode)
|
|
1458
|
-
// console.log('dynamicControlTableEdit----customRules-----', customRules, gridParams.options.customRules)
|
|
1459
|
-
if(!customRules){
|
|
1460
|
-
return
|
|
1461
|
-
}
|
|
1462
|
-
let gridCustomRules = {}
|
|
1463
|
-
if(gridParams.options.customRules){
|
|
1464
|
-
gridCustomRules = JSON.parse(JSON.stringify(gridParams.options.customRules))
|
|
1465
|
-
}
|
|
1466
|
-
customRules.forEach(item=>{
|
|
1467
|
-
const copyItem = JSON.parse(JSON.stringify(item))
|
|
1468
|
-
const prop = item.name
|
|
1469
|
-
// 当前列新的自定义规则集合
|
|
1470
|
-
let columnRules
|
|
1471
|
-
if(!gridCustomRules[prop]){
|
|
1472
|
-
gridCustomRules[prop] = {}
|
|
1473
|
-
}
|
|
1474
|
-
// console.log('dynamicControlTableEdit----gridCustomRules111-----', gridCustomRules)
|
|
1475
|
-
// 获得当前列已有的自定义规则集合
|
|
1476
|
-
columnRules = gridCustomRules[prop].rules
|
|
1477
|
-
|
|
1478
|
-
if(copyItem.rules){
|
|
1479
|
-
if(!columnRules){
|
|
1480
|
-
columnRules = []
|
|
1481
|
-
}
|
|
1482
|
-
// 将当前列自定义规则集合拼接到已有的自定义规则集合中
|
|
1483
|
-
columnRules = columnRules.concat(copyItem.rules)
|
|
1484
|
-
}
|
|
1485
|
-
// 当前列总的自定义规则更新
|
|
1486
|
-
copyItem.rules = columnRules
|
|
1487
|
-
// this.options.customRules[prop] = copyItem
|
|
1488
|
-
if(!gridParams.options.customRules){
|
|
1489
|
-
gridParams.options.customRules = {}
|
|
1490
|
-
}
|
|
1491
|
-
// console.log('dynamicControlTableEdit----gridParams.options.customRules222-----', gridParams.options.customRules)
|
|
1492
|
-
gridParams.options.customRules[prop] = copyItem
|
|
1493
|
-
})
|
|
1494
|
-
// console.log('dynamicControlTableEdit----gridParams.options.customRules333-----', gridParams.options.customRules)
|
|
1495
1270
|
}
|
|
1496
1271
|
}
|
|
1497
1272
|
export default apis
|