cloud-web-corejs 1.0.217 → 1.0.219
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/package.json +1 -1
- package/src/components/excelExport/button.vue +55 -46
- package/src/components/excelExport/mixins.js +964 -2
- package/src/components/table/config.js +74 -1
- package/src/components/table/index.js +203 -89
- package/src/components/table/tableFormMixin.js +285 -1
- package/src/components/table/util/index.js +1 -1
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +4 -4
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +3 -3
- package/src/components/xform/form-render/container-item/data-table-mixin.js +224 -100
- package/src/views/user/fieldTranslation/editDialog.vue +1 -1
- package/src/views/user/fieldTranslation/list.vue +2 -2
|
@@ -243,7 +243,7 @@ modules = {
|
|
|
243
243
|
let formScriptEnabledTypes = ["select", "checkbox", "radio"];
|
|
244
244
|
if (formScriptEnabledTypes.includes(widgetType)) {
|
|
245
245
|
widget.options.optionItems = rows || [];
|
|
246
|
-
} else if (widgetType
|
|
246
|
+
} else if (widgetType === "status") {
|
|
247
247
|
widget.options.statusParam = rows || [];
|
|
248
248
|
}
|
|
249
249
|
widget._syncInited = true;
|
|
@@ -384,7 +384,7 @@ modules = {
|
|
|
384
384
|
},
|
|
385
385
|
getRowWidgetOption(rowParam, fieldWidget) {
|
|
386
386
|
let widget = this.getRowWidget(rowParam, fieldWidget);
|
|
387
|
-
let field = widget.category
|
|
387
|
+
let field = widget.category === "container" ? "widget" : "field";
|
|
388
388
|
let option = {
|
|
389
389
|
[field]: widget,
|
|
390
390
|
};
|
|
@@ -412,6 +412,7 @@ modules = {
|
|
|
412
412
|
},
|
|
413
413
|
initFieldSchema(val) {
|
|
414
414
|
let rows = val || [];
|
|
415
|
+
// 处理树结构数据排序
|
|
415
416
|
this.formModel[this.fieldKeyName] = rows;
|
|
416
417
|
this.fieldModel = rows;
|
|
417
418
|
this.initRowIdData(true);
|
|
@@ -420,6 +421,7 @@ modules = {
|
|
|
420
421
|
initValue(val) {
|
|
421
422
|
// this.clearRowWidgets()
|
|
422
423
|
let rows = val || [];
|
|
424
|
+
// this.handleNullValue(rows);
|
|
423
425
|
rows.forEach((row, index) => {
|
|
424
426
|
row._X_ROW_KEY = "row_" + generateId();
|
|
425
427
|
});
|
|
@@ -428,6 +430,65 @@ modules = {
|
|
|
428
430
|
this.initRowIdData(true);
|
|
429
431
|
this.initFieldSchemaData(true);
|
|
430
432
|
},
|
|
433
|
+
handleTreeData(rows) {
|
|
434
|
+
let isTreeTable = this.widget.options.isTreeTable;
|
|
435
|
+
if (isTreeTable) {
|
|
436
|
+
let $grid = this.getGridTable();
|
|
437
|
+
if(!$grid)return
|
|
438
|
+
let parentField = $grid.treeConfig.parentField;
|
|
439
|
+
if(parentField) {
|
|
440
|
+
// 构建树结构并排序
|
|
441
|
+
let sortedRows = [];
|
|
442
|
+
let nodeMap = new Map();
|
|
443
|
+
|
|
444
|
+
// 第一步:构建节点映射
|
|
445
|
+
rows.forEach(row => {
|
|
446
|
+
if (row.id !== undefined && row.id !== null) {
|
|
447
|
+
nodeMap.set(row.id, row);
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
// 第二步:按层次排序,先根节点,然后子节点
|
|
452
|
+
rows.forEach(row => {
|
|
453
|
+
let parentValue = row[parentField];
|
|
454
|
+
// 根节点(parentField为null、undefined、空字符串或0)
|
|
455
|
+
if (parentValue === null || parentValue === undefined || parentValue === '' || parentValue === 0) {
|
|
456
|
+
sortedRows.push(row);
|
|
457
|
+
// 递归添加子节点
|
|
458
|
+
this.addChildNodes(row.id, nodeMap, parentField, sortedRows);
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
// 如果没有找到根节点,返回原始数组
|
|
463
|
+
if (sortedRows.length === 0) {
|
|
464
|
+
return rows;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
return sortedRows;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return rows;
|
|
471
|
+
},
|
|
472
|
+
addChildNodes(parentId, nodeMap, parentField, sortedRows) {
|
|
473
|
+
// 遍历所有节点,找出当前父节点的子节点
|
|
474
|
+
for (let [id, node] of nodeMap.entries()) {
|
|
475
|
+
// 处理parentField值的类型转换,确保比较正确
|
|
476
|
+
let nodeParentValue = node[parentField];
|
|
477
|
+
let targetParentId = parentId;
|
|
478
|
+
|
|
479
|
+
// 转换为相同类型进行比较
|
|
480
|
+
if (typeof nodeParentValue !== typeof targetParentId) {
|
|
481
|
+
nodeParentValue = String(nodeParentValue);
|
|
482
|
+
targetParentId = String(targetParentId);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
if (nodeParentValue === targetParentId) {
|
|
486
|
+
sortedRows.push(node);
|
|
487
|
+
// 递归添加子节点的子节点
|
|
488
|
+
this.addChildNodes(id, nodeMap, parentField, sortedRows);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
},
|
|
431
492
|
setValue(val) {
|
|
432
493
|
// console.log("rows:",val);
|
|
433
494
|
this.clearRowWidgets();
|
|
@@ -496,7 +557,7 @@ modules = {
|
|
|
496
557
|
return this.widget.options.tableData.lastIndexOf(e);
|
|
497
558
|
},
|
|
498
559
|
setTableColumns: function (e) {
|
|
499
|
-
|
|
560
|
+
let t = this;
|
|
500
561
|
(this.widget.options.tableColumns = e),
|
|
501
562
|
this.$nextTick(function () {
|
|
502
563
|
t.$refs.dataTable.doLayout();
|
|
@@ -563,7 +624,7 @@ modules = {
|
|
|
563
624
|
},
|
|
564
625
|
importExcel() {},
|
|
565
626
|
getGrid(that, tableRef) {
|
|
566
|
-
|
|
627
|
+
let $grid;
|
|
567
628
|
if (Array.isArray(that.$refs[tableRef])) {
|
|
568
629
|
$grid = that.$refs[tableRef][0];
|
|
569
630
|
} else {
|
|
@@ -573,7 +634,7 @@ modules = {
|
|
|
573
634
|
},
|
|
574
635
|
getTableCondition: function () {
|
|
575
636
|
if (this.widget.options.tableCondition) {
|
|
576
|
-
|
|
637
|
+
let e = new Function(this.widget.options.tableCondition);
|
|
577
638
|
return e.call(this);
|
|
578
639
|
}
|
|
579
640
|
},
|
|
@@ -607,6 +668,7 @@ modules = {
|
|
|
607
668
|
}
|
|
608
669
|
|
|
609
670
|
let tableWidgetName = this.widget.options.name;
|
|
671
|
+
let isEditTable = this.widget.options.isEditTable || false;
|
|
610
672
|
const createColumn = (t, isChild) => {
|
|
611
673
|
let filterable = t.filterable ?? true;
|
|
612
674
|
let filterType = filterable ? null : false;
|
|
@@ -634,6 +696,11 @@ modules = {
|
|
|
634
696
|
};
|
|
635
697
|
if (t.required) {
|
|
636
698
|
col.title = col.title;
|
|
699
|
+
/* if(!isEditTable){
|
|
700
|
+
col.titlePrefix = {
|
|
701
|
+
icon: "vxe-cell--required-icon"
|
|
702
|
+
}
|
|
703
|
+
} */
|
|
637
704
|
col.titlePrefix = {
|
|
638
705
|
icon: "vxe-cell--required-icon"
|
|
639
706
|
}
|
|
@@ -717,7 +784,7 @@ modules = {
|
|
|
717
784
|
};
|
|
718
785
|
Object.assign(col.params, params);
|
|
719
786
|
if (!col.children || !col.children.length) {
|
|
720
|
-
if (t.formatS
|
|
787
|
+
if (t.formatS === "render") {
|
|
721
788
|
let r = t.render ? new Function("params", "h", t.render) : null;
|
|
722
789
|
col.slots.default = (params, h) => {
|
|
723
790
|
return r ? r.call(this, params, h) : "";
|
|
@@ -725,9 +792,9 @@ modules = {
|
|
|
725
792
|
} else if (widget) {
|
|
726
793
|
// col.slots.default = columnSelectedWidget.id;
|
|
727
794
|
col.slots.default = "widget";
|
|
728
|
-
} else if (t.formatS
|
|
795
|
+
} else if (t.formatS === "editTreeButtonGroup") {
|
|
729
796
|
col.slots.default = "editTreeButtonGroup";
|
|
730
|
-
} else if (t.formatS
|
|
797
|
+
} else if (t.formatS === "widgetRender") {
|
|
731
798
|
col.slots.default = "widgetList";
|
|
732
799
|
}
|
|
733
800
|
|
|
@@ -755,12 +822,12 @@ modules = {
|
|
|
755
822
|
let flag = tableConfig?.config?.toolbarConfig?.custom !== false;
|
|
756
823
|
if (
|
|
757
824
|
baseRefUtil.tableConfig &&
|
|
758
|
-
baseRefUtil.tableConfig.className
|
|
825
|
+
baseRefUtil.tableConfig.className === "list-table" &&
|
|
759
826
|
flag
|
|
760
827
|
) {
|
|
761
828
|
if (tableColumns.length) {
|
|
762
829
|
let tableColumn = tableColumns[tableColumns.length - 1];
|
|
763
|
-
if (tableColumn.fixed
|
|
830
|
+
if (tableColumn.fixed !== "right") {
|
|
764
831
|
newColumns.push({
|
|
765
832
|
width: 47,
|
|
766
833
|
title: "",
|
|
@@ -775,6 +842,7 @@ modules = {
|
|
|
775
842
|
},
|
|
776
843
|
async initTableList() {
|
|
777
844
|
let that = this;
|
|
845
|
+
let tableOption = null;
|
|
778
846
|
let path = null;
|
|
779
847
|
let paramFun = null;
|
|
780
848
|
// let mainDataSetDTO = null;
|
|
@@ -782,7 +850,7 @@ modules = {
|
|
|
782
850
|
let tableRef = this.getTableRef();
|
|
783
851
|
let formDataModel = this.getFormRef().formDataModel;
|
|
784
852
|
let isQueryTable = this.widget.options.isQueryTable || false;
|
|
785
|
-
let isDataPage = this.widget.options.accessReturnType
|
|
853
|
+
let isDataPage = this.widget.options.accessReturnType === "2";
|
|
786
854
|
let reportTemplate = this.getFormRef().reportTemplate;
|
|
787
855
|
let formCode = reportTemplate.formCode;
|
|
788
856
|
let dataId = this.formDataId;
|
|
@@ -953,7 +1021,7 @@ modules = {
|
|
|
953
1021
|
parentField: "f_parent",
|
|
954
1022
|
transform: true,
|
|
955
1023
|
expandAll: true,
|
|
956
|
-
loadMethod({ $table, row }) {
|
|
1024
|
+
loadMethod:({ $table, row })=> {
|
|
957
1025
|
// 模拟后台接口
|
|
958
1026
|
let $grid = that.getGridTable();
|
|
959
1027
|
let parentField = $grid.treeConfig.parentField;
|
|
@@ -981,10 +1049,20 @@ modules = {
|
|
|
981
1049
|
},
|
|
982
1050
|
},
|
|
983
1051
|
callback: (res) => {
|
|
984
|
-
if (res.type
|
|
1052
|
+
if (res.type === "success") {
|
|
1053
|
+
let items = this.handleTreeData((res.objx?.records || res.objx || []));
|
|
1054
|
+
if(res.objx?.records !== undefined){
|
|
1055
|
+
res.objx.records = items;
|
|
1056
|
+
}else{
|
|
1057
|
+
res.objx = items;
|
|
1058
|
+
}
|
|
985
1059
|
let rows = res.objx
|
|
986
|
-
|
|
987
|
-
|
|
1060
|
+
? res.objx.records || res.objx || []
|
|
1061
|
+
: [];
|
|
1062
|
+
// let rows = res.objx
|
|
1063
|
+
// ? res.objx.records || res.objx || []
|
|
1064
|
+
// : [];
|
|
1065
|
+
// that.handleNullValue(rows);
|
|
988
1066
|
that.initExportFieldSchemaData(rows);
|
|
989
1067
|
/* rows.forEach((row, index) => {
|
|
990
1068
|
if (!row._X_ROW_KEY) {
|
|
@@ -998,14 +1076,21 @@ modules = {
|
|
|
998
1076
|
}
|
|
999
1077
|
|
|
1000
1078
|
resolve(rows);
|
|
1001
|
-
let treeCallback = tableConfig?.treeCallback;
|
|
1079
|
+
/* let treeCallback = tableConfig?.treeCallback;
|
|
1002
1080
|
if (treeCallback) {
|
|
1003
1081
|
that.$nextTick(() => {
|
|
1004
1082
|
setTimeout(function () {
|
|
1005
1083
|
treeCallback(rows);
|
|
1006
1084
|
}, 0);
|
|
1007
1085
|
});
|
|
1008
|
-
}
|
|
1086
|
+
} */
|
|
1087
|
+
that.$nextTick(() => {
|
|
1088
|
+
setTimeout(function () {
|
|
1089
|
+
dataTableConfig.callback && dataTableConfig.callback(rows);
|
|
1090
|
+
tableOption.callback && tableOption.callback(rows);
|
|
1091
|
+
tableConfig.treeCallback && tableConfig.treeCallback(rows);
|
|
1092
|
+
}, 0);
|
|
1093
|
+
});
|
|
1009
1094
|
} else {
|
|
1010
1095
|
reject(res);
|
|
1011
1096
|
}
|
|
@@ -1017,6 +1102,18 @@ modules = {
|
|
|
1017
1102
|
}
|
|
1018
1103
|
let editOpts = {};
|
|
1019
1104
|
if (this.widget.options.isEditTable) {
|
|
1105
|
+
// let editRules = {};
|
|
1106
|
+
this.loodHandleColumns(this.widget.options.tableColumns, (item) => {
|
|
1107
|
+
if (!item.children?.length) {
|
|
1108
|
+
let editWidget = item.editWidget;
|
|
1109
|
+
if(editWidget && editWidget.options.required){
|
|
1110
|
+
let formField = this.getFieldKeyName(editWidget);
|
|
1111
|
+
/* editRules[formField] = [
|
|
1112
|
+
{ required: true, message: `[${editWidget.options.label}]不能为空` }
|
|
1113
|
+
]; */
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1020
1117
|
editOpts = {
|
|
1021
1118
|
keepSource: true,
|
|
1022
1119
|
editConfig: {
|
|
@@ -1025,6 +1122,7 @@ modules = {
|
|
|
1025
1122
|
showStatus: true,
|
|
1026
1123
|
autoClear: false,
|
|
1027
1124
|
},
|
|
1125
|
+
// editRules
|
|
1028
1126
|
};
|
|
1029
1127
|
}
|
|
1030
1128
|
let showFooter = this.widget.options.showGridFooter || false;
|
|
@@ -1104,7 +1202,7 @@ modules = {
|
|
|
1104
1202
|
(item) => {
|
|
1105
1203
|
let columnSlots = null;
|
|
1106
1204
|
let columnParams = {};
|
|
1107
|
-
if (item.formatS
|
|
1205
|
+
if (item.formatS === "render") {
|
|
1108
1206
|
let r = item.render
|
|
1109
1207
|
? new Function("params", "h", item.render)
|
|
1110
1208
|
: null;
|
|
@@ -1150,7 +1248,7 @@ modules = {
|
|
|
1150
1248
|
rowConfig.height = this.widget.options.tableRowHeight
|
|
1151
1249
|
}
|
|
1152
1250
|
|
|
1153
|
-
|
|
1251
|
+
tableOption = {
|
|
1154
1252
|
// vue: this,
|
|
1155
1253
|
tableRef: tableRef,
|
|
1156
1254
|
tableName: this.getGridTableName(),
|
|
@@ -1226,7 +1324,7 @@ modules = {
|
|
|
1226
1324
|
query: ({ page, sorts, filters, form, param, customParam }) => {
|
|
1227
1325
|
let scriptCode = this.getScriptCode();
|
|
1228
1326
|
let $grid = this.getGridTable();
|
|
1229
|
-
let originOption = $grid.originOption;
|
|
1327
|
+
let originOption = $grid.params.originOption;
|
|
1230
1328
|
let formData = {};
|
|
1231
1329
|
|
|
1232
1330
|
if (customParam?.exportParam?.type !== "exportItem") {
|
|
@@ -1271,8 +1369,8 @@ modules = {
|
|
|
1271
1369
|
Object.assign(queryParams, that.dataTableConfig.queryParam);
|
|
1272
1370
|
}
|
|
1273
1371
|
|
|
1274
|
-
|
|
1275
|
-
let accessReturnType = this.widget.options.accessReturnType || 2;
|
|
1372
|
+
let reqPath = typeof path === "function" ? path() : path;
|
|
1373
|
+
let accessReturnType = this.widget.options.accessReturnType || "2";
|
|
1276
1374
|
|
|
1277
1375
|
return new Promise((resolve, reject) => {
|
|
1278
1376
|
let reqData = {
|
|
@@ -1284,9 +1382,17 @@ modules = {
|
|
|
1284
1382
|
// let f = new Function("dataId", "formCode", "param", "done", accessScript);
|
|
1285
1383
|
let done = (res) => {
|
|
1286
1384
|
// this.clearRowWidgets();
|
|
1287
|
-
|
|
1385
|
+
|
|
1386
|
+
let items = this.handleTreeData((res.objx?.records || res.objx || []));
|
|
1387
|
+
if(res.objx?.records !== undefined){
|
|
1388
|
+
res.objx.records = items;
|
|
1389
|
+
}else{
|
|
1390
|
+
res.objx = items;
|
|
1391
|
+
}
|
|
1392
|
+
let rows = res.objx
|
|
1288
1393
|
? res.objx.records || res.objx || []
|
|
1289
1394
|
: [];
|
|
1395
|
+
// that.handleNullValue(rows);
|
|
1290
1396
|
if (customParam?.export) {
|
|
1291
1397
|
//导出
|
|
1292
1398
|
this.initExportFieldSchemaData(rows);
|
|
@@ -1295,7 +1401,7 @@ modules = {
|
|
|
1295
1401
|
}
|
|
1296
1402
|
|
|
1297
1403
|
resolve(res);
|
|
1298
|
-
if (res.type
|
|
1404
|
+
if (res.type === "success") {
|
|
1299
1405
|
if (that.widget.options.isTreeTable) {
|
|
1300
1406
|
if (rows.length > 0) {
|
|
1301
1407
|
let fullAllDataRowMap
|
|
@@ -1351,6 +1457,7 @@ modules = {
|
|
|
1351
1457
|
}
|
|
1352
1458
|
that.$nextTick(() => {
|
|
1353
1459
|
setTimeout(function () {
|
|
1460
|
+
dataTableConfig.callback && dataTableConfig.callback(rows);
|
|
1354
1461
|
tableOption.callback && tableOption.callback(rows);
|
|
1355
1462
|
that.handleCustomEvent(
|
|
1356
1463
|
that.widget.options.formScriptCallback,
|
|
@@ -1419,13 +1526,13 @@ modules = {
|
|
|
1419
1526
|
let columnId = column.params?.columnId;
|
|
1420
1527
|
if (columnId && footerColumnIds.includes(columnId)) {
|
|
1421
1528
|
let footerDataType = column.params.footerDataType;
|
|
1422
|
-
if (footerDataType
|
|
1529
|
+
if (footerDataType === "1") {
|
|
1423
1530
|
//求和
|
|
1424
1531
|
return this.sumNum(data, column.field);
|
|
1425
|
-
} else if (footerDataType
|
|
1532
|
+
} else if (footerDataType === "2") {
|
|
1426
1533
|
//求平均值
|
|
1427
1534
|
return this.meanNum(data, column.field);
|
|
1428
|
-
} else if (footerDataType
|
|
1535
|
+
} else if (footerDataType === "3") {
|
|
1429
1536
|
if (column.params.footerMethodConfg) {
|
|
1430
1537
|
let n = new Function(
|
|
1431
1538
|
"dataId",
|
|
@@ -1510,12 +1617,12 @@ modules = {
|
|
|
1510
1617
|
item.filter = "between";
|
|
1511
1618
|
} else if (
|
|
1512
1619
|
["input-batch", "checkbox"].includes(wType)
|
|
1513
|
-
|| (wType
|
|
1620
|
+
|| (wType === "select" && wItem.options.multiple)
|
|
1514
1621
|
) {
|
|
1515
1622
|
item.filter = "in";
|
|
1516
1623
|
} else if (
|
|
1517
1624
|
["radio", "time", "date"].includes(wType)
|
|
1518
|
-
|| (wType
|
|
1625
|
+
|| (wType === "select" && !wItem.options.multiple)
|
|
1519
1626
|
) {
|
|
1520
1627
|
item.filter = "eq";
|
|
1521
1628
|
} else {
|
|
@@ -1542,14 +1649,14 @@ modules = {
|
|
|
1542
1649
|
);
|
|
1543
1650
|
let result = vailColumns
|
|
1544
1651
|
.filter((item) => {
|
|
1545
|
-
return item.formatS
|
|
1652
|
+
return item.formatS === "editAttachment";
|
|
1546
1653
|
})
|
|
1547
1654
|
.map((item) => item.prop); */
|
|
1548
1655
|
|
|
1549
1656
|
let result = [];
|
|
1550
1657
|
this.loodHandleColumns(this.widget.options.tableColumns, (item) => {
|
|
1551
1658
|
if (!item.children?.length && item.prop && item.label) {
|
|
1552
|
-
if (item.formatS
|
|
1659
|
+
if (item.formatS === "editAttachment") {
|
|
1553
1660
|
result.push(item.prop);
|
|
1554
1661
|
}
|
|
1555
1662
|
}
|
|
@@ -1563,7 +1670,7 @@ modules = {
|
|
|
1563
1670
|
let result = vailColumns
|
|
1564
1671
|
.filter((item) => {
|
|
1565
1672
|
return (
|
|
1566
|
-
item.formatS
|
|
1673
|
+
item.formatS === "editSearch" && item.columnOption.multipleChoices
|
|
1567
1674
|
);
|
|
1568
1675
|
})
|
|
1569
1676
|
.map((item) => item.prop); */
|
|
@@ -1571,7 +1678,7 @@ modules = {
|
|
|
1571
1678
|
this.loodHandleColumns(this.widget.options.tableColumns, (item) => {
|
|
1572
1679
|
if (!item.children?.length && item.prop && item.label) {
|
|
1573
1680
|
if (
|
|
1574
|
-
item.formatS
|
|
1681
|
+
item.formatS === "editSearch"
|
|
1575
1682
|
&& item.widget?.options?.multipleChoices
|
|
1576
1683
|
) {
|
|
1577
1684
|
result.push(item.prop);
|
|
@@ -1611,7 +1718,20 @@ modules = {
|
|
|
1611
1718
|
},
|
|
1612
1719
|
callback: (res) => {
|
|
1613
1720
|
let $grid = this.getGridTable();
|
|
1614
|
-
let rows = res.objx ? res.objx.records || res.objx || [] : [];
|
|
1721
|
+
// let rows = res.objx ? res.objx.records || res.objx || [] : [];
|
|
1722
|
+
|
|
1723
|
+
let items = this.handleTreeData((res.objx?.records || res.objx || []));
|
|
1724
|
+
if(res.objx?.records !== undefined){
|
|
1725
|
+
res.objx.records = items;
|
|
1726
|
+
}else{
|
|
1727
|
+
res.objx = items;
|
|
1728
|
+
}
|
|
1729
|
+
let rows = res.objx
|
|
1730
|
+
? res.objx.records || res.objx || []
|
|
1731
|
+
: [];
|
|
1732
|
+
|
|
1733
|
+
|
|
1734
|
+
// that.handleNullValue(rows);
|
|
1615
1735
|
let defaultRow = this.createNewTableData();
|
|
1616
1736
|
rows = rows.map((row) => {
|
|
1617
1737
|
return {
|
|
@@ -1644,9 +1764,9 @@ modules = {
|
|
|
1644
1764
|
getScriptCode() {
|
|
1645
1765
|
let accessReturnType = this.widget.options.accessReturnType;
|
|
1646
1766
|
let defaultScriptCode = "getList";
|
|
1647
|
-
if (accessReturnType
|
|
1767
|
+
if (accessReturnType === "1") {
|
|
1648
1768
|
defaultScriptCode = "getList";
|
|
1649
|
-
} else if (accessReturnType
|
|
1769
|
+
} else if (accessReturnType === "2") {
|
|
1650
1770
|
defaultScriptCode = "getPage";
|
|
1651
1771
|
}
|
|
1652
1772
|
let scriptCode = this.widget.options.formScriptCode || defaultScriptCode;
|
|
@@ -1661,9 +1781,9 @@ modules = {
|
|
|
1661
1781
|
let scriptCode = this.getScriptCode();
|
|
1662
1782
|
let accessParam = {};
|
|
1663
1783
|
let otherParam = {};
|
|
1664
|
-
if (customParam?.exportParam?.type
|
|
1784
|
+
if (customParam?.exportParam?.type === "exportItem") {
|
|
1665
1785
|
let $grid = this.getGridTable();
|
|
1666
|
-
let originOption = $grid.originOption;
|
|
1786
|
+
let originOption = $grid.params.originOption;
|
|
1667
1787
|
let exportItemConfig = originOption.exportItemConfig || {};
|
|
1668
1788
|
if (exportItemConfig.scriptCode) {
|
|
1669
1789
|
scriptCode = exportItemConfig.scriptCode;
|
|
@@ -1801,7 +1921,7 @@ modules = {
|
|
|
1801
1921
|
|| (widgetType === "vabsearch" && !widget.options.multipleChoices);
|
|
1802
1922
|
return result;
|
|
1803
1923
|
},
|
|
1804
|
-
getColumnNullValue(widget) {
|
|
1924
|
+
getColumnNullValue(widget, defaultValueEnabled) {
|
|
1805
1925
|
if (!widget) return null;
|
|
1806
1926
|
let nullValue = null;
|
|
1807
1927
|
let widgetType = widget.type;
|
|
@@ -1818,11 +1938,12 @@ modules = {
|
|
|
1818
1938
|
defaultValue !== undefined
|
|
1819
1939
|
&& defaultValue !== null
|
|
1820
1940
|
&& defaultValue !== ""
|
|
1941
|
+
&& defaultValueEnabled !== false
|
|
1821
1942
|
) {
|
|
1822
1943
|
nullValue = defaultValue;
|
|
1823
1944
|
} else if (widgetType === "select" && widget.options.multiple) {
|
|
1824
1945
|
nullValue = [];
|
|
1825
|
-
} else if (widgetType === "date" && widget.options.type
|
|
1946
|
+
} else if (widgetType === "date" && widget.options.type === "dates") {
|
|
1826
1947
|
nullValue = [];
|
|
1827
1948
|
} else if (widgetType === "vabsearch" && widget.options.multipleChoices) {
|
|
1828
1949
|
nullValue = [];
|
|
@@ -1853,7 +1974,7 @@ modules = {
|
|
|
1853
1974
|
}
|
|
1854
1975
|
}
|
|
1855
1976
|
},
|
|
1856
|
-
createNewTableData(isEdit) {
|
|
1977
|
+
createNewTableData(isEdit, defaultValueEnabled=true) {
|
|
1857
1978
|
let newData = {};
|
|
1858
1979
|
this.loodHandleColumns(this.widget.options.tableColumns, (item) => {
|
|
1859
1980
|
if (!item.children?.length && item.prop && item.label) {
|
|
@@ -1864,46 +1985,21 @@ modules = {
|
|
|
1864
1985
|
} else {
|
|
1865
1986
|
widget = item.widget;
|
|
1866
1987
|
}
|
|
1867
|
-
if (formatS
|
|
1988
|
+
if (formatS === "widgetRender") {
|
|
1868
1989
|
if (item.widgetList) {
|
|
1869
1990
|
loopHandleWidget(item.widgetList, (w, p) => {
|
|
1870
|
-
this.handleWidgetNullValue(w, newData);
|
|
1991
|
+
this.handleWidgetNullValue(w, newData, defaultValueEnabled);
|
|
1871
1992
|
});
|
|
1872
1993
|
}
|
|
1873
1994
|
} else {
|
|
1874
1995
|
if (widget) {
|
|
1875
|
-
this.handleWidgetNullValue(widget, newData);
|
|
1996
|
+
this.handleWidgetNullValue(widget, newData, defaultValueEnabled);
|
|
1876
1997
|
} else {
|
|
1877
1998
|
newData[item.prop] = null;
|
|
1878
1999
|
}
|
|
1879
2000
|
}
|
|
1880
2001
|
}
|
|
1881
2002
|
});
|
|
1882
|
-
/* let vailColumns = this.widget.options.tableColumns.filter(
|
|
1883
|
-
(item) => item.prop && item.label
|
|
1884
|
-
);
|
|
1885
|
-
vailColumns.forEach((item) => {
|
|
1886
|
-
let formatS = !isEdit ? item.formatS : item.editFormatS;
|
|
1887
|
-
let columnOption = !isEdit ? item.columnOption : item.editColumnOption;
|
|
1888
|
-
if (formatS == "editSearch") {
|
|
1889
|
-
newData[item.prop] = null;
|
|
1890
|
-
let vabSearchName = item?.columnOption?.vabSearchName;
|
|
1891
|
-
if (vabSearchName) newData[vabSearchName] = null;
|
|
1892
|
-
}
|
|
1893
|
-
if (formatS == "editAttachment") {
|
|
1894
|
-
newData[item.prop] = [];
|
|
1895
|
-
} else {
|
|
1896
|
-
newData[item.prop] = null;
|
|
1897
|
-
if (
|
|
1898
|
-
columnOption &&
|
|
1899
|
-
columnOption.defaultValue !== undefined &&
|
|
1900
|
-
columnOption.defaultValue !== null &&
|
|
1901
|
-
columnOption.defaultValue !== ""
|
|
1902
|
-
) {
|
|
1903
|
-
newData[item.prop] = columnOption.defaultValue;
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
}); */
|
|
1907
2003
|
return newData;
|
|
1908
2004
|
},
|
|
1909
2005
|
addTableData(rows, field) {
|
|
@@ -1979,55 +2075,55 @@ modules = {
|
|
|
1979
2075
|
if (columnOption && Object.keys(columnOption).length) {
|
|
1980
2076
|
columnOption.required = row.required || false;
|
|
1981
2077
|
columnSelectedWidget.options = columnOption;
|
|
1982
|
-
if ("editDelete"
|
|
2078
|
+
if ("editDelete" === formatS) {
|
|
1983
2079
|
columnSelectedWidget.options.hiddenByWf
|
|
1984
2080
|
= columnSelectedWidget.options.hiddenByWf ?? true;
|
|
1985
2081
|
columnSelectedWidget.options.prefixIcon
|
|
1986
2082
|
= columnSelectedWidget.options.prefixIcon || "el-icon-delete";
|
|
1987
|
-
} else if ("editButton"
|
|
2083
|
+
} else if ("editButton" === formatS) {
|
|
1988
2084
|
columnSelectedWidget.options.prefixIcon
|
|
1989
2085
|
= columnSelectedWidget.options.prefixIcon || "el-icon-edit";
|
|
1990
2086
|
}
|
|
1991
2087
|
} else {
|
|
1992
2088
|
columnSelectedWidget.options.required = row.required || false;
|
|
1993
|
-
if ("editDelete"
|
|
2089
|
+
if ("editDelete" === formatS) {
|
|
1994
2090
|
columnSelectedWidget.options.prefixIcon = "el-icon-delete";
|
|
1995
2091
|
columnSelectedWidget.options.label = "删除";
|
|
1996
2092
|
columnSelectedWidget.options.labelHidden = true;
|
|
1997
2093
|
columnSelectedWidget.options.hiddenByWf = true;
|
|
1998
2094
|
columnSelectedWidget.options.onClick
|
|
1999
2095
|
= "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.deleteRow(tableParam.row,tableParam.rowIndex);";
|
|
2000
|
-
} else if ("editButton"
|
|
2096
|
+
} else if ("editButton" === formatS) {
|
|
2001
2097
|
columnSelectedWidget.options.prefixIcon = "el-icon-edit";
|
|
2002
2098
|
columnSelectedWidget.options.label = "查看";
|
|
2003
2099
|
columnSelectedWidget.options.labelHidden = true;
|
|
2004
2100
|
columnSelectedWidget.options.onClick
|
|
2005
2101
|
= "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.openEditDialog(tableParam.row)";
|
|
2006
|
-
} else if ("addSiblingEditRow"
|
|
2102
|
+
} else if ("addSiblingEditRow" === formatS) {
|
|
2007
2103
|
columnSelectedWidget.options.prefixIcon = "el-icon-plus";
|
|
2008
2104
|
columnSelectedWidget.options.label = "新增兄弟节点";
|
|
2009
2105
|
columnSelectedWidget.options.labelHidden = false;
|
|
2010
2106
|
columnSelectedWidget.options.onClick
|
|
2011
2107
|
= "let tableParam = this.tableParam;\nthis.getParentTarget().addSiblingTreeRow(null,tableParam);";
|
|
2012
|
-
} else if ("addChildTreeRow"
|
|
2108
|
+
} else if ("addChildTreeRow" === formatS) {
|
|
2013
2109
|
columnSelectedWidget.options.prefixIcon = "el-icon-plus";
|
|
2014
2110
|
columnSelectedWidget.options.label = "新增子节点";
|
|
2015
2111
|
columnSelectedWidget.options.labelHidden = false;
|
|
2016
2112
|
columnSelectedWidget.options.onClick
|
|
2017
2113
|
= "let tableParam = this.tableParam;\nthis.getParentTarget().addChildTreeRow(null,tableParam);";
|
|
2018
|
-
} else if ("moveUpRow"
|
|
2114
|
+
} else if ("moveUpRow" === formatS) {
|
|
2019
2115
|
// columnSelectedWidget.options.prefixIcon = "el-icon-plus";
|
|
2020
2116
|
columnSelectedWidget.options.label = "↑上移";
|
|
2021
2117
|
columnSelectedWidget.options.labelHidden = false;
|
|
2022
2118
|
columnSelectedWidget.options.onClick
|
|
2023
2119
|
= "let tableParam = this.tableParam;\nthis.getParentTarget().moveUpRow(tableParam);";
|
|
2024
|
-
} else if ("moveDownRow"
|
|
2120
|
+
} else if ("moveDownRow" === formatS) {
|
|
2025
2121
|
// columnSelectedWidget.options.prefixIcon = "el-icon-plus";
|
|
2026
2122
|
columnSelectedWidget.options.label = "↓下移";
|
|
2027
2123
|
columnSelectedWidget.options.labelHidden = false;
|
|
2028
2124
|
columnSelectedWidget.options.onClick
|
|
2029
2125
|
= "let tableParam = this.tableParam;\nthis.getParentTarget().moveDownRow(tableParam);";
|
|
2030
|
-
} else if ("removeTreeRow"
|
|
2126
|
+
} else if ("removeTreeRow" === formatS) {
|
|
2031
2127
|
columnSelectedWidget.options.prefixIcon = "el-icon-delete";
|
|
2032
2128
|
columnSelectedWidget.options.label = "删除";
|
|
2033
2129
|
columnSelectedWidget.options.labelHidden = true;
|
|
@@ -2042,7 +2138,7 @@ modules = {
|
|
|
2042
2138
|
} else {
|
|
2043
2139
|
columnSelectedWidget.options.name = row.prop;
|
|
2044
2140
|
}
|
|
2045
|
-
if (type
|
|
2141
|
+
if (type !== "button" && type !== "a-link") {
|
|
2046
2142
|
columnSelectedWidget.options.label = row.label;
|
|
2047
2143
|
columnSelectedWidget.options.labelHidden = true;
|
|
2048
2144
|
}
|
|
@@ -2070,7 +2166,7 @@ modules = {
|
|
|
2070
2166
|
validateCheckRow() {
|
|
2071
2167
|
let $grid = this.getGridTable();
|
|
2072
2168
|
let checkRows = $grid.getCheckboxRecords(true);
|
|
2073
|
-
if (checkRows.length
|
|
2169
|
+
if (checkRows.length === 0) {
|
|
2074
2170
|
this.$message({
|
|
2075
2171
|
message: "请选择要操作的行",
|
|
2076
2172
|
type: "warning",
|
|
@@ -2142,6 +2238,14 @@ modules = {
|
|
|
2142
2238
|
let fieldKeyName = this.getFieldKeyName(this.widget);
|
|
2143
2239
|
let rowIndex = Math.max(obj.rowIndex, 0);
|
|
2144
2240
|
|
|
2241
|
+
let isTreeTable = this.widget.options.isTreeTable || false;
|
|
2242
|
+
if(isTreeTable){
|
|
2243
|
+
rowIndex = this.getValue().findIndex((item) => item._X_ROW_KEY === obj.row._X_ROW_KEY);
|
|
2244
|
+
if(rowIndex<0){
|
|
2245
|
+
return "false";
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2145
2249
|
let property = this.getFieldKeyName(fieldWidget);
|
|
2146
2250
|
if (obj.row[property] && Array.isArray(obj.row[property])) {
|
|
2147
2251
|
return "false";
|
|
@@ -2159,12 +2263,12 @@ modules = {
|
|
|
2159
2263
|
isVabsearchFlagWidget(widget) {
|
|
2160
2264
|
let type = widget?.type;
|
|
2161
2265
|
return (
|
|
2162
|
-
type
|
|
2266
|
+
type === "vabsearch" || type === "singerSearch" || type === "multiSearch"
|
|
2163
2267
|
);
|
|
2164
2268
|
},
|
|
2165
2269
|
getColumnWidgetName(e) {
|
|
2166
2270
|
if (e && e.type) {
|
|
2167
|
-
if (e.category
|
|
2271
|
+
if (e.category === "container") {
|
|
2168
2272
|
return this.getContainerWidgetName(e);
|
|
2169
2273
|
} else {
|
|
2170
2274
|
return e.type + "-widget";
|
|
@@ -2223,7 +2327,7 @@ modules = {
|
|
|
2223
2327
|
},
|
|
2224
2328
|
advancedClear() {
|
|
2225
2329
|
let formModel = this.formModel;
|
|
2226
|
-
let searchColumns = this.getGridTable().searchColumns;
|
|
2330
|
+
let searchColumns = this.getGridTable().params.searchColumns;
|
|
2227
2331
|
searchColumns.forEach((form1Field) => {
|
|
2228
2332
|
if (!form1Field.common) {
|
|
2229
2333
|
let field = form1Field.field;
|
|
@@ -2241,7 +2345,7 @@ modules = {
|
|
|
2241
2345
|
},
|
|
2242
2346
|
|
|
2243
2347
|
//editTable begin
|
|
2244
|
-
saveEditRow(obj) {
|
|
2348
|
+
async saveEditRow(obj) {
|
|
2245
2349
|
let formRef = this.getFormRef();
|
|
2246
2350
|
let formConfig = this.formConfig;
|
|
2247
2351
|
let entity = formConfig.entity;
|
|
@@ -2253,11 +2357,18 @@ modules = {
|
|
|
2253
2357
|
|
|
2254
2358
|
let that = this;
|
|
2255
2359
|
let $grid = obj.$table.$xegrid;
|
|
2256
|
-
let originOption = $grid.originOption;
|
|
2360
|
+
let originOption = $grid.params.originOption;
|
|
2257
2361
|
|
|
2258
2362
|
let formModel = this.formModel;
|
|
2259
2363
|
let dataMap = this.getGridTable().getTableData();
|
|
2260
2364
|
|
|
2365
|
+
/* const errMap = await $grid.validate(obj.row).catch(errMap => errMap)
|
|
2366
|
+
if (errMap) {
|
|
2367
|
+
let title = errMap[Object.keys(errMap)[0]][0].column.title
|
|
2368
|
+
this.$message.error(`[${title}]不能为空`)
|
|
2369
|
+
return
|
|
2370
|
+
} */
|
|
2371
|
+
|
|
2261
2372
|
formRef.validate((valid) => {
|
|
2262
2373
|
if (valid) {
|
|
2263
2374
|
$grid.clearActived().then(() => {
|
|
@@ -2296,7 +2407,7 @@ modules = {
|
|
|
2296
2407
|
confirmText: "您确定要保存吗?",
|
|
2297
2408
|
success: (res0) => {
|
|
2298
2409
|
this.getRowData(res0.objx, (res) => {
|
|
2299
|
-
if (obj.row.id
|
|
2410
|
+
if (obj.row.id === res.objx.id) {
|
|
2300
2411
|
$grid.clearActived().then(() => {
|
|
2301
2412
|
Object.assign(obj.row, res.objx);
|
|
2302
2413
|
});
|
|
@@ -2360,10 +2471,10 @@ modules = {
|
|
|
2360
2471
|
}
|
|
2361
2472
|
let parentField = $grid.treeConfig.parentField;
|
|
2362
2473
|
let newRow = {};
|
|
2363
|
-
let originOption = $grid.originOption;
|
|
2474
|
+
let originOption = $grid.params.originOption;
|
|
2364
2475
|
let editDefaultRow;
|
|
2365
2476
|
if (originOption.editDefaultRow) {
|
|
2366
|
-
if (typeof originOption.editDefaultRow
|
|
2477
|
+
if (typeof originOption.editDefaultRow === "function") {
|
|
2367
2478
|
editDefaultRow = originOption.editDefaultRow() || {};
|
|
2368
2479
|
} else {
|
|
2369
2480
|
editDefaultRow = originOption.editDefaultRow || {};
|
|
@@ -2389,7 +2500,7 @@ modules = {
|
|
|
2389
2500
|
} else if (toSibling === true) {
|
|
2390
2501
|
let addIndex
|
|
2391
2502
|
= tableRows.findIndex(
|
|
2392
|
-
(item) => item._X_ROW_KEY
|
|
2503
|
+
(item) => item._X_ROW_KEY === obj.row._X_ROW_KEY
|
|
2393
2504
|
) + 1;
|
|
2394
2505
|
tableRows.splice(addIndex, 0, newRow);
|
|
2395
2506
|
} else {
|
|
@@ -2411,7 +2522,7 @@ modules = {
|
|
|
2411
2522
|
} else if (toSibling === true) {
|
|
2412
2523
|
let addIndex
|
|
2413
2524
|
= tableRows.findIndex(
|
|
2414
|
-
(item) => item._X_ROW_KEY
|
|
2525
|
+
(item) => item._X_ROW_KEY === obj.row._X_ROW_KEY
|
|
2415
2526
|
) + 1;
|
|
2416
2527
|
tableRows.splice(addIndex, 0, newRow);
|
|
2417
2528
|
} else {
|
|
@@ -2483,10 +2594,10 @@ modules = {
|
|
|
2483
2594
|
}
|
|
2484
2595
|
|
|
2485
2596
|
let newRow = {};
|
|
2486
|
-
let originOption = $grid.originOption;
|
|
2597
|
+
let originOption = $grid.params.originOption;
|
|
2487
2598
|
let editDefaultRow;
|
|
2488
2599
|
if (originOption.editDefaultRow) {
|
|
2489
|
-
if (typeof originOption.editDefaultRow
|
|
2600
|
+
if (typeof originOption.editDefaultRow === "function") {
|
|
2490
2601
|
editDefaultRow = originOption.editDefaultRow() || {};
|
|
2491
2602
|
} else {
|
|
2492
2603
|
editDefaultRow = originOption.editDefaultRow || {};
|
|
@@ -2515,7 +2626,7 @@ modules = {
|
|
|
2515
2626
|
} else if (toSibling === true) {
|
|
2516
2627
|
let addIndex
|
|
2517
2628
|
= tableRows.findIndex(
|
|
2518
|
-
(item) => item._X_ROW_KEY
|
|
2629
|
+
(item) => item._X_ROW_KEY === obj.row._X_ROW_KEY
|
|
2519
2630
|
) + 1;
|
|
2520
2631
|
tableRows.splice(addIndex, 0, newRow);
|
|
2521
2632
|
} else {
|
|
@@ -2537,7 +2648,7 @@ modules = {
|
|
|
2537
2648
|
} else if (toSibling === true) {
|
|
2538
2649
|
let addIndex
|
|
2539
2650
|
= tableRows.findIndex(
|
|
2540
|
-
(item) => item._X_ROW_KEY
|
|
2651
|
+
(item) => item._X_ROW_KEY === obj.row._X_ROW_KEY
|
|
2541
2652
|
) + 1;
|
|
2542
2653
|
tableRows.splice(addIndex, 0, newRow);
|
|
2543
2654
|
} else {
|
|
@@ -2607,15 +2718,15 @@ modules = {
|
|
|
2607
2718
|
);
|
|
2608
2719
|
if (siblingRows.length > 1) {
|
|
2609
2720
|
let currentIndex = tableRows.findIndex(
|
|
2610
|
-
(item) => item[rowField]
|
|
2721
|
+
(item) => item[rowField] === row[rowField]
|
|
2611
2722
|
);
|
|
2612
2723
|
let index1 = siblingRows.findIndex(
|
|
2613
|
-
(item) => item[rowField]
|
|
2724
|
+
(item) => item[rowField] === row[rowField]
|
|
2614
2725
|
);
|
|
2615
2726
|
if (index1 > 0) {
|
|
2616
2727
|
let prevRow = siblingRows[index1 - 1];
|
|
2617
2728
|
let prevIndex = tableRows.findIndex(
|
|
2618
|
-
(item) => item[rowField]
|
|
2729
|
+
(item) => item[rowField] === prevRow[rowField]
|
|
2619
2730
|
);
|
|
2620
2731
|
tableRows.splice(currentIndex, 1);
|
|
2621
2732
|
tableRows.splice(prevIndex, 0, row);
|
|
@@ -2651,15 +2762,15 @@ modules = {
|
|
|
2651
2762
|
);
|
|
2652
2763
|
if (siblingRows.length > 1) {
|
|
2653
2764
|
let currentIndex = tableRows.findIndex(
|
|
2654
|
-
(item) => item[rowField]
|
|
2765
|
+
(item) => item[rowField] === row[rowField]
|
|
2655
2766
|
);
|
|
2656
2767
|
let index1 = siblingRows.findIndex(
|
|
2657
|
-
(item) => item[rowField]
|
|
2768
|
+
(item) => item[rowField] === row[rowField]
|
|
2658
2769
|
);
|
|
2659
2770
|
if (index1 < siblingRows.length - 1) {
|
|
2660
2771
|
let nextRow = siblingRows[index1 + 1];
|
|
2661
2772
|
let nextIndex = tableRows.findIndex(
|
|
2662
|
-
(item) => item[rowField]
|
|
2773
|
+
(item) => item[rowField] === nextRow[rowField]
|
|
2663
2774
|
);
|
|
2664
2775
|
tableRows.splice(currentIndex, 1);
|
|
2665
2776
|
tableRows.splice(nextIndex, 0, row);
|
|
@@ -3068,6 +3179,19 @@ modules = {
|
|
|
3068
3179
|
this.setGridDisabled(false);
|
|
3069
3180
|
},
|
|
3070
3181
|
//xk end
|
|
3182
|
+
handleNullValue(rows) {
|
|
3183
|
+
let newData = this.createNewTableData(true, false);
|
|
3184
|
+
let keys = Object.keys(newData);
|
|
3185
|
+
if(keys.length){
|
|
3186
|
+
rows.forEach((row) => {
|
|
3187
|
+
keys.forEach((key) => {
|
|
3188
|
+
if (row[key] === undefined) {
|
|
3189
|
+
row[key] = newData[key];
|
|
3190
|
+
}
|
|
3191
|
+
});
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
},
|
|
3071
3195
|
},
|
|
3072
3196
|
};
|
|
3073
3197
|
|