cloud-web-corejs 1.0.54-dev.626 → 1.0.54-dev.628

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.
@@ -81,7 +81,7 @@ modules = {
81
81
  },
82
82
  vxeOption: {},
83
83
  requestAccess: null,
84
- columnFormatMap: {
84
+ /* columnFormatMap: {
85
85
  editInput: "input",
86
86
  editNumber: "number",
87
87
  editDate: "date",
@@ -102,7 +102,7 @@ modules = {
102
102
  text: "text",
103
103
  checkbox: "checkbox",
104
104
  radio: "radio",
105
- },
105
+ }, */
106
106
  dataTableConfig: {},
107
107
  widgets: [],
108
108
  editWidgets: [],
@@ -153,8 +153,8 @@ modules = {
153
153
  buttonsColumnFixed: function () {
154
154
  return void 0 === this.widget.options.buttonsColumnFixed
155
155
  ? "right"
156
- : !!this.widget.options.buttonsColumnFixed
157
- && this.widget.options.buttonsColumnFixed;
156
+ : !!this.widget.options.buttonsColumnFixed &&
157
+ this.widget.options.buttonsColumnFixed;
158
158
  },
159
159
  formModel: {
160
160
  cache: !1,
@@ -188,8 +188,8 @@ modules = {
188
188
  },
189
189
  methods: {
190
190
  initTableCustomEvent() {
191
- let tableConfig
192
- = this.handleCustomEvent(this.widget.options.tableConfig) || {};
191
+ let tableConfig =
192
+ this.handleCustomEvent(this.widget.options.tableConfig) || {};
193
193
  this.eventConfig = tableConfig.eventConfig || {};
194
194
  },
195
195
  getTableColumnStatusWidgetLabelKey(obj) {
@@ -255,8 +255,8 @@ modules = {
255
255
  if (!formScriptEnabledTypes.includes(widgetType)) return;
256
256
 
257
257
  let formScriptEnabled = widget.options.formScriptEnabled || false;
258
- let commonAttributeEnabled
259
- = widget.options.commonAttributeEnabled || false;
258
+ let commonAttributeEnabled =
259
+ widget.options.commonAttributeEnabled || false;
260
260
  let commonAttributeCode = widget.options.commonAttributeCode;
261
261
  if (commonAttributeEnabled) {
262
262
  if (!commonAttributeCode) return;
@@ -434,25 +434,30 @@ modules = {
434
434
  let isTreeTable = this.widget.options.isTreeTable;
435
435
  if (isTreeTable) {
436
436
  let $grid = this.getGridTable();
437
- if(!$grid)return
437
+ if (!$grid) return;
438
438
  let parentField = $grid.treeConfig.parentField;
439
- if(parentField) {
439
+ if (parentField) {
440
440
  // 构建树结构并排序
441
441
  let sortedRows = [];
442
442
  let nodeMap = new Map();
443
443
 
444
444
  // 第一步:构建节点映射
445
- rows.forEach(row => {
445
+ rows.forEach((row) => {
446
446
  if (row.id !== undefined && row.id !== null) {
447
447
  nodeMap.set(row.id, row);
448
448
  }
449
449
  });
450
450
 
451
451
  // 第二步:按层次排序,先根节点,然后子节点
452
- rows.forEach(row => {
452
+ rows.forEach((row) => {
453
453
  let parentValue = row[parentField];
454
454
  // 根节点(parentField为null、undefined、空字符串或0)
455
- if (parentValue === null || parentValue === undefined || parentValue === '' || parentValue === 0) {
455
+ if (
456
+ parentValue === null ||
457
+ parentValue === undefined ||
458
+ parentValue === "" ||
459
+ parentValue === 0
460
+ ) {
456
461
  sortedRows.push(row);
457
462
  // 递归添加子节点
458
463
  this.addChildNodes(row.id, nodeMap, parentField, sortedRows);
@@ -574,8 +579,8 @@ modules = {
574
579
  let ignoreFields = options?.ignoreFields || [];
575
580
  this.widget.widgetList.forEach((subWidget) => {
576
581
  if (
577
- !ignoreFields.length
578
- || !ignoreFields.includes(subWidget.options.name)
582
+ !ignoreFields.length ||
583
+ !ignoreFields.includes(subWidget.options.name)
579
584
  ) {
580
585
  let widgetRef = this.getWidgetRef(subWidget.options.name);
581
586
  if (widgetRef && widgetRef.setValue) widgetRef.setValue(null);
@@ -615,9 +620,9 @@ modules = {
615
620
  formCode = formConfig.addFormCode || formConfig.editFormCode;
616
621
  }
617
622
  let parentTarget = formRef.$attrs["parent-target"];
618
- parentTarget
619
- && parentTarget.$attrs.openEditDialog
620
- && parentTarget.$attrs.openEditDialog(row, param, {
623
+ parentTarget &&
624
+ parentTarget.$attrs.openEditDialog &&
625
+ parentTarget.$attrs.openEditDialog(row, param, {
621
626
  formCode,
622
627
  ...option,
623
628
  });
@@ -702,8 +707,8 @@ modules = {
702
707
  }
703
708
  } */
704
709
  col.titlePrefix = {
705
- icon: "vxe-cell--required-icon"
706
- }
710
+ icon: "vxe-cell--required-icon",
711
+ };
707
712
  }
708
713
  if (t.treeNode) {
709
714
  col.treeNode = true;
@@ -784,68 +789,83 @@ modules = {
784
789
  };
785
790
 
786
791
  Object.assign(col.params, params);
787
- let types = ['input','number', 'text','select','checkbox','radio','status','vabsearch','date']
788
- if(widget && types.includes(widget.type)){
789
- const func = (obj)=>{
790
- let value = obj.row[obj.column.field]
792
+ let types = [
793
+ "input",
794
+ "number",
795
+ "text",
796
+ "select",
797
+ "checkbox",
798
+ "radio",
799
+ "status",
800
+ "vabsearch",
801
+ "date",
802
+ "textarea",
803
+ ];
804
+ if (widget && types.includes(widget.type)) {
805
+ const func = (obj) => {
806
+ let value = obj.row[obj.column.field];
791
807
  let fieldWidget = null;
792
- if(!!obj.column?.params?.widget){
793
- fieldWidget = this.getRowWidget(obj)
808
+ if (!!obj.column?.params?.widget) {
809
+ fieldWidget = this.getRowWidget(obj);
794
810
  }
795
- if(fieldWidget && !fieldWidget.options.hidden){
811
+ if (fieldWidget && !fieldWidget.options.hidden) {
796
812
  let widgetType = fieldWidget.type;
797
- if(['input','number'].includes(widgetType)){
813
+ if (["input", "number", "textarea"].includes(widgetType)) {
798
814
  return value;
799
815
  }
800
- let widgetRef = this.getWidgetRefByTableParam(obj)
801
- if('text' === widgetType){
816
+ let widgetRef = this.getWidgetRefByTableParam(obj);
817
+ if ("text" === widgetType) {
802
818
  return widgetRef ? widgetRef.showVaule : value;
803
- }else if('select' === widgetType){
819
+ } else if ("select" === widgetType) {
804
820
  return this.getOptionLabel(fieldWidget, value);
805
- }else if('checkbox' === widgetType){
821
+ } else if ("checkbox" === widgetType) {
806
822
  return this.getOptionLabel(fieldWidget, value);
807
- }else if('radio' === widgetType){
823
+ } else if ("radio" === widgetType) {
808
824
  return this.getOptionLabel(fieldWidget, value);
809
- }else if('status' === widgetType){
825
+ } else if ("status" === widgetType) {
810
826
  let statusParam = fieldWidget.options.statusParam || [];
811
- let statusItem = statusParam.find(item => item.value === value)
812
- return statusItem ? this.$t1(statusItem.label): null;
813
- }else if('vabsearch' === widgetType){
827
+ let statusItem = statusParam.find(
828
+ (item) => item.value === value
829
+ );
830
+ return statusItem ? this.$t1(statusItem.label) : null;
831
+ } else if ("vabsearch" === widgetType) {
814
832
  let result = null;
815
833
  let currentData = obj.row;
816
834
  let fieldKeyName = this.getFieldKeyName(fieldWidget);
817
835
  let vabSearchName = fieldWidget.options.vabSearchName;
818
- let multipleChoices = fieldWidget.options.multipleChoices || false;
836
+ let multipleChoices =
837
+ fieldWidget.options.multipleChoices || false;
819
838
  let labelField = vabSearchName || fieldKeyName;
820
839
  if (!multipleChoices) {
821
840
  result = currentData[labelField] ?? null;
822
841
  } else {
823
842
  if (value) {
824
- result = value.map(item => item[labelField]).join(",");
843
+ result = value.map((item) => item[labelField]).join(",");
825
844
  }
826
845
  }
827
846
  return result;
828
- }else if('date' === widgetType){
847
+ } else if ("date" === widgetType) {
829
848
  let dateType = fieldWidget.options.type;
830
- if(['date','week'].includes(dateType)){
831
- return value?value.substring(0,10):null;
832
- }else if(dateType === 'dates'){
833
- if(value){
834
- if(Array.isArray(value)){
835
- return value.map(item => item.substring(0,10)).join(",");
836
- }else{
849
+ if (["date", "week"].includes(dateType)) {
850
+ return value ? value.substring(0, 10) : null;
851
+ } else if (dateType === "dates") {
852
+ if (value) {
853
+ if (Array.isArray(value)) {
854
+ return value
855
+ .map((item) => item.substring(0, 10))
856
+ .join(",");
857
+ } else {
837
858
  return value;
838
859
  }
839
860
  }
840
861
  return null;
841
- }else{
842
- return value
862
+ } else {
863
+ return value;
843
864
  }
844
865
  }
845
- }else{
846
- return null
866
+ } else {
867
+ return null;
847
868
  }
848
-
849
869
  };
850
870
  col.slots.filterVal = func;
851
871
  }
@@ -871,8 +891,8 @@ modules = {
871
891
  }
872
892
  }
873
893
  if (t.tableColumnConfig) {
874
- let tableColumnConfig
875
- = this.handleCustomEvent(t.tableColumnConfig) || {};
894
+ let tableColumnConfig =
895
+ this.handleCustomEvent(t.tableColumnConfig) || {};
876
896
  col = extendDeeply(col, tableColumnConfig);
877
897
  }
878
898
  return col;
@@ -907,19 +927,22 @@ modules = {
907
927
  return this.$baseLodash.cloneDeep(newColumns);
908
928
  },
909
929
  //begin
910
- getOptionLabel(fieldWidget, fieldModel){
930
+ getOptionLabel(fieldWidget, fieldModel) {
911
931
  if (fieldModel === null) {
912
- return null
932
+ return null;
913
933
  } else {
914
- let resultList = []
934
+ let resultList = [];
915
935
  let labelField = fieldWidget.options.labelKey || "label";
916
936
  let valueField = fieldWidget.options.valueKey || "value";
917
- fieldWidget.options.optionItems.forEach(oItem => {
918
- if ((oItem[valueField] === fieldModel) || (this.findInArray(fieldModel, oItem[valueField])) !== -1) {
919
- resultList.push(this.$t1(oItem[labelField]))
937
+ fieldWidget.options.optionItems.forEach((oItem) => {
938
+ if (
939
+ oItem[valueField] === fieldModel ||
940
+ this.findInArray(fieldModel, oItem[valueField]) !== -1
941
+ ) {
942
+ resultList.push(this.$t1(oItem[labelField]));
920
943
  }
921
- })
922
- return resultList.join(",")
944
+ });
945
+ return resultList.join(",");
923
946
  }
924
947
  },
925
948
  findInArray: function (e, t) {
@@ -929,12 +952,11 @@ modules = {
929
952
  e.forEach(function (e, n) {
930
953
  e === t && (i = n);
931
954
  }),
932
- i
955
+ i
933
956
  );
934
957
  },
935
958
  //end
936
959
 
937
-
938
960
  async initTableList() {
939
961
  let that = this;
940
962
  let tableOption = null;
@@ -954,8 +976,8 @@ modules = {
954
976
 
955
977
  let isQueryAllPage = !this.widget.options.isNotQueryAllPage;
956
978
 
957
- let tableConfig
958
- = this.handleCustomEvent(this.widget.options.tableConfig) || {};
979
+ let tableConfig =
980
+ this.handleCustomEvent(this.widget.options.tableConfig) || {};
959
981
  this.tableConfig = tableConfig;
960
982
 
961
983
  let tableConfig2 = this.$baseLodash.cloneDeep(tableConfig);
@@ -1071,12 +1093,12 @@ modules = {
1071
1093
  .filter((column) => !!column?.params?.editWidget)
1072
1094
  .map((column) => column.params.editWidget);
1073
1095
 
1074
- let height
1075
- = this.widget.options.tableHeight || (isQueryTable ? "auto" : null);
1096
+ let height =
1097
+ this.widget.options.tableHeight || (isQueryTable ? "auto" : null);
1076
1098
  if (
1077
- !this.widget.options.tableHeight
1078
- && isQueryTable
1079
- && this.previewState
1099
+ !this.widget.options.tableHeight &&
1100
+ isQueryTable &&
1101
+ this.previewState
1080
1102
  ) {
1081
1103
  height = "550px";
1082
1104
  }
@@ -1116,7 +1138,7 @@ modules = {
1116
1138
  parentField: "f_parent",
1117
1139
  transform: true,
1118
1140
  expandAll: true,
1119
- loadMethod:({ $table, row })=> {
1141
+ loadMethod: ({ $table, row }) => {
1120
1142
  // 模拟后台接口
1121
1143
  let $grid = that.getGridTable();
1122
1144
  let parentField = $grid.treeConfig.parentField;
@@ -1145,15 +1167,17 @@ modules = {
1145
1167
  },
1146
1168
  callback: (res) => {
1147
1169
  if (res.type === "success") {
1148
- let items = this.handleTreeData((res.objx?.records || res.objx || []));
1149
- if(res.objx?.records !== undefined){
1170
+ let items = this.handleTreeData(
1171
+ res.objx?.records || res.objx || []
1172
+ );
1173
+ if (res.objx?.records !== undefined) {
1150
1174
  res.objx.records = items;
1151
- }else{
1175
+ } else {
1152
1176
  res.objx = items;
1153
1177
  }
1154
1178
  let rows = res.objx
1155
- ? res.objx.records || res.objx || []
1156
- : [];
1179
+ ? res.objx.records || res.objx || []
1180
+ : [];
1157
1181
  // let rows = res.objx
1158
1182
  // ? res.objx.records || res.objx || []
1159
1183
  // : [];
@@ -1181,9 +1205,11 @@ modules = {
1181
1205
  } */
1182
1206
  that.$nextTick(() => {
1183
1207
  setTimeout(function () {
1184
- dataTableConfig.callback && dataTableConfig.callback(rows);
1208
+ dataTableConfig.callback &&
1209
+ dataTableConfig.callback(rows);
1185
1210
  tableOption.callback && tableOption.callback(rows);
1186
- tableConfig.treeCallback && tableConfig.treeCallback(rows);
1211
+ tableConfig.treeCallback &&
1212
+ tableConfig.treeCallback(rows);
1187
1213
  }, 0);
1188
1214
  });
1189
1215
  } else {
@@ -1201,7 +1227,7 @@ modules = {
1201
1227
  this.loodHandleColumns(this.widget.options.tableColumns, (item) => {
1202
1228
  if (!item.children?.length) {
1203
1229
  let editWidget = item.editWidget;
1204
- if(editWidget && editWidget.options.required){
1230
+ if (editWidget && editWidget.options.required) {
1205
1231
  let formField = this.getFieldKeyName(editWidget);
1206
1232
  /* editRules[formField] = [
1207
1233
  { required: true, message: `[${editWidget.options.label}]不能为空` }
@@ -1276,8 +1302,8 @@ modules = {
1276
1302
 
1277
1303
  let exportItemConfig = null;
1278
1304
  if (
1279
- this.widget.options.exportItemColumns
1280
- && this.widget.options.exportItemColumns.length > 0
1305
+ this.widget.options.exportItemColumns &&
1306
+ this.widget.options.exportItemColumns.length > 0
1281
1307
  ) {
1282
1308
  let formatKeys = [
1283
1309
  "d1",
@@ -1328,19 +1354,21 @@ modules = {
1328
1354
  );
1329
1355
  exportItemConfig = {
1330
1356
  scriptCode:
1331
- this.widget.options.exportItemScriptCode
1332
- || this.widget.options.formScriptCode,
1357
+ this.widget.options.exportItemScriptCode ||
1358
+ this.widget.options.formScriptCode,
1333
1359
  columns: exportItemColumns,
1334
1360
  param: () => {
1335
1361
  if (this.widget.options.exportItemParam) {
1336
- return this.handleCustomParam(this.widget.options.exportItemParam);
1362
+ return this.handleCustomParam(
1363
+ this.widget.options.exportItemParam
1364
+ );
1337
1365
  }
1338
1366
  },
1339
1367
  };
1340
1368
  }
1341
1369
  let rowConfig = {};
1342
- if(this.widget.options.tableRowHeight){
1343
- rowConfig.height = this.widget.options.tableRowHeight
1370
+ if (this.widget.options.tableRowHeight) {
1371
+ rowConfig.height = this.widget.options.tableRowHeight;
1344
1372
  }
1345
1373
 
1346
1374
  tableOption = {
@@ -1465,7 +1493,8 @@ modules = {
1465
1493
  }
1466
1494
 
1467
1495
  let reqPath = typeof path === "function" ? path() : path;
1468
- let accessReturnType = this.widget.options.accessReturnType || "2";
1496
+ let accessReturnType =
1497
+ this.widget.options.accessReturnType || "2";
1469
1498
 
1470
1499
  return new Promise((resolve, reject) => {
1471
1500
  let reqData = {
@@ -1478,13 +1507,15 @@ modules = {
1478
1507
  let done = (res) => {
1479
1508
  // this.clearRowWidgets();
1480
1509
 
1481
- let items = this.handleTreeData((res.objx?.records || res.objx || []));
1482
- if(res.objx?.records !== undefined){
1483
- res.objx.records = items;
1484
- }else{
1485
- res.objx = items;
1486
- }
1487
- let rows = res.objx
1510
+ let items = this.handleTreeData(
1511
+ res.objx?.records || res.objx || []
1512
+ );
1513
+ if (res.objx?.records !== undefined) {
1514
+ res.objx.records = items;
1515
+ } else {
1516
+ res.objx = items;
1517
+ }
1518
+ let rows = res.objx
1488
1519
  ? res.objx.records || res.objx || []
1489
1520
  : [];
1490
1521
  // that.handleNullValue(rows);
@@ -1499,8 +1530,8 @@ modules = {
1499
1530
  if (res.type === "success") {
1500
1531
  if (that.widget.options.isTreeTable) {
1501
1532
  if (rows.length > 0) {
1502
- let fullAllDataRowMap
1503
- = $grid.$refs.xTable.fullAllDataRowMap;
1533
+ let fullAllDataRowMap =
1534
+ $grid.$refs.xTable.fullAllDataRowMap;
1504
1535
  let parentField = $grid.treeConfig.parentField;
1505
1536
  let expandAll = $grid.treeConfig.expandAll || false;
1506
1537
  let isLazy = $grid.treeConfig.lazy;
@@ -1523,8 +1554,8 @@ modules = {
1523
1554
  lineData
1524
1555
  )
1525
1556
  ) {
1526
- let rest
1527
- = fullAllDataRowMap.get(lineData);
1557
+ let rest =
1558
+ fullAllDataRowMap.get(lineData);
1528
1559
  rest.treeLoaded = true;
1529
1560
  }
1530
1561
  });
@@ -1536,8 +1567,8 @@ modules = {
1536
1567
 
1537
1568
  let row = rows.find((item) => !item[parentField]);
1538
1569
  if (
1539
- row
1540
- && (!expandAll || !expandIds.includes(row.id))
1570
+ row &&
1571
+ (!expandAll || !expandIds.includes(row.id))
1541
1572
  ) {
1542
1573
  let hasChild = $grid.treeConfig.hasChild;
1543
1574
  if (row[hasChild]) {
@@ -1552,7 +1583,8 @@ modules = {
1552
1583
  }
1553
1584
  that.$nextTick(() => {
1554
1585
  setTimeout(function () {
1555
- dataTableConfig.callback && dataTableConfig.callback(rows);
1586
+ dataTableConfig.callback &&
1587
+ dataTableConfig.callback(rows);
1556
1588
  tableOption.callback && tableOption.callback(rows);
1557
1589
  that.handleCustomEvent(
1558
1590
  that.widget.options.formScriptCallback,
@@ -1710,13 +1742,13 @@ modules = {
1710
1742
  if (["date-range", "time-range"].includes(wType)) {
1711
1743
  item.filter = "between";
1712
1744
  } else if (
1713
- ["input-batch", "checkbox"].includes(wType)
1714
- || (wType === "select" && wItem.options.multiple)
1745
+ ["input-batch", "checkbox"].includes(wType) ||
1746
+ (wType === "select" && wItem.options.multiple)
1715
1747
  ) {
1716
1748
  item.filter = "in";
1717
1749
  } else if (
1718
- ["radio", "time", "date"].includes(wType)
1719
- || (wType === "select" && !wItem.options.multiple)
1750
+ ["radio", "time", "date"].includes(wType) ||
1751
+ (wType === "select" && !wItem.options.multiple)
1720
1752
  ) {
1721
1753
  item.filter = "eq";
1722
1754
  } else {
@@ -1772,8 +1804,8 @@ modules = {
1772
1804
  this.loodHandleColumns(this.widget.options.tableColumns, (item) => {
1773
1805
  if (!item.children?.length && item.prop && item.label) {
1774
1806
  if (
1775
- item.formatS === "editSearch"
1776
- && item.widget?.options?.multipleChoices
1807
+ item.formatS === "editSearch" &&
1808
+ item.widget?.options?.multipleChoices
1777
1809
  ) {
1778
1810
  result.push(item.prop);
1779
1811
  }
@@ -1814,16 +1846,13 @@ modules = {
1814
1846
  let $grid = this.getGridTable();
1815
1847
  // let rows = res.objx ? res.objx.records || res.objx || [] : [];
1816
1848
 
1817
- let items = this.handleTreeData((res.objx?.records || res.objx || []));
1818
- if(res.objx?.records !== undefined){
1849
+ let items = this.handleTreeData(res.objx?.records || res.objx || []);
1850
+ if (res.objx?.records !== undefined) {
1819
1851
  res.objx.records = items;
1820
- }else{
1852
+ } else {
1821
1853
  res.objx = items;
1822
1854
  }
1823
- let rows = res.objx
1824
- ? res.objx.records || res.objx || []
1825
- : [];
1826
-
1855
+ let rows = res.objx ? res.objx.records || res.objx || [] : [];
1827
1856
 
1828
1857
  // that.handleNullValue(rows);
1829
1858
  let defaultRow = this.createNewTableData();
@@ -1940,8 +1969,8 @@ modules = {
1940
1969
  },
1941
1970
  loadAccessData(flag) {
1942
1971
  if (
1943
- this.formModel[this.fieldKeyName]
1944
- && this.formModel[this.fieldKeyName].length
1972
+ this.formModel[this.fieldKeyName] &&
1973
+ this.formModel[this.fieldKeyName].length
1945
1974
  ) {
1946
1975
  this.initValue(this.formModel[this.fieldKeyName]);
1947
1976
  }
@@ -2010,9 +2039,9 @@ modules = {
2010
2039
  },
2011
2040
  isSingerlSearch(widget) {
2012
2041
  let widgetType = widget?.type;
2013
- let result
2014
- = widgetType === "singerSearch"
2015
- || (widgetType === "vabsearch" && !widget.options.multipleChoices);
2042
+ let result =
2043
+ widgetType === "singerSearch" ||
2044
+ (widgetType === "vabsearch" && !widget.options.multipleChoices);
2016
2045
  return result;
2017
2046
  },
2018
2047
  getColumnNullValue(widget, defaultValueEnabled) {
@@ -2029,10 +2058,10 @@ modules = {
2029
2058
 
2030
2059
  let defaultValue = widget.options.defaultValue;
2031
2060
  if (
2032
- defaultValue !== undefined
2033
- && defaultValue !== null
2034
- && defaultValue !== ""
2035
- && defaultValueEnabled !== false
2061
+ defaultValue !== undefined &&
2062
+ defaultValue !== null &&
2063
+ defaultValue !== "" &&
2064
+ defaultValueEnabled !== false
2036
2065
  ) {
2037
2066
  nullValue = defaultValue;
2038
2067
  } else if (widgetType === "select" && widget.options.multiple) {
@@ -2068,7 +2097,7 @@ modules = {
2068
2097
  }
2069
2098
  }
2070
2099
  },
2071
- createNewTableData(isEdit, defaultValueEnabled=true) {
2100
+ createNewTableData(isEdit, defaultValueEnabled = true) {
2072
2101
  let newData = {};
2073
2102
  this.loodHandleColumns(this.widget.options.tableColumns, (item) => {
2074
2103
  if (!item.children?.length && item.prop && item.label) {
@@ -2140,7 +2169,7 @@ modules = {
2140
2169
  let columnSelectedWidget = null;
2141
2170
  let columnEditFields = null;
2142
2171
 
2143
- let type = this.columnFormatMap[formatS];
2172
+ let type = columnFormatMap[formatS];
2144
2173
 
2145
2174
  if (type) {
2146
2175
  columnSelectedWidget = this.$baseLodash.cloneDeep(
@@ -2170,13 +2199,13 @@ modules = {
2170
2199
  columnOption.required = row.required || false;
2171
2200
  columnSelectedWidget.options = columnOption;
2172
2201
  if ("editDelete" === formatS) {
2173
- columnSelectedWidget.options.hiddenByWf
2174
- = columnSelectedWidget.options.hiddenByWf ?? true;
2175
- columnSelectedWidget.options.prefixIcon
2176
- = columnSelectedWidget.options.prefixIcon || "el-icon-delete";
2202
+ columnSelectedWidget.options.hiddenByWf =
2203
+ columnSelectedWidget.options.hiddenByWf ?? true;
2204
+ columnSelectedWidget.options.prefixIcon =
2205
+ columnSelectedWidget.options.prefixIcon || "el-icon-delete";
2177
2206
  } else if ("editButton" === formatS) {
2178
- columnSelectedWidget.options.prefixIcon
2179
- = columnSelectedWidget.options.prefixIcon || "el-icon-edit";
2207
+ columnSelectedWidget.options.prefixIcon =
2208
+ columnSelectedWidget.options.prefixIcon || "el-icon-edit";
2180
2209
  }
2181
2210
  } else {
2182
2211
  columnSelectedWidget.options.required = row.required || false;
@@ -2185,44 +2214,44 @@ modules = {
2185
2214
  columnSelectedWidget.options.label = "删除";
2186
2215
  columnSelectedWidget.options.labelHidden = true;
2187
2216
  columnSelectedWidget.options.hiddenByWf = true;
2188
- columnSelectedWidget.options.onClick
2189
- = "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.deleteRow(tableParam.row,tableParam.rowIndex);";
2217
+ columnSelectedWidget.options.onClick =
2218
+ "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.deleteRow(tableParam.row,tableParam.rowIndex);";
2190
2219
  } else if ("editButton" === formatS) {
2191
2220
  columnSelectedWidget.options.prefixIcon = "el-icon-edit";
2192
2221
  columnSelectedWidget.options.label = "查看";
2193
2222
  columnSelectedWidget.options.labelHidden = true;
2194
- columnSelectedWidget.options.onClick
2195
- = "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.openEditDialog(tableParam.row)";
2223
+ columnSelectedWidget.options.onClick =
2224
+ "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.openEditDialog(tableParam.row)";
2196
2225
  } else if ("addSiblingEditRow" === formatS) {
2197
2226
  columnSelectedWidget.options.prefixIcon = "el-icon-plus";
2198
2227
  columnSelectedWidget.options.label = "新增兄弟节点";
2199
2228
  columnSelectedWidget.options.labelHidden = false;
2200
- columnSelectedWidget.options.onClick
2201
- = "let tableParam = this.tableParam;\nthis.getParentTarget().addSiblingTreeRow(null,tableParam);";
2229
+ columnSelectedWidget.options.onClick =
2230
+ "let tableParam = this.tableParam;\nthis.getParentTarget().addSiblingTreeRow(null,tableParam);";
2202
2231
  } else if ("addChildTreeRow" === formatS) {
2203
2232
  columnSelectedWidget.options.prefixIcon = "el-icon-plus";
2204
2233
  columnSelectedWidget.options.label = "新增子节点";
2205
2234
  columnSelectedWidget.options.labelHidden = false;
2206
- columnSelectedWidget.options.onClick
2207
- = "let tableParam = this.tableParam;\nthis.getParentTarget().addChildTreeRow(null,tableParam);";
2235
+ columnSelectedWidget.options.onClick =
2236
+ "let tableParam = this.tableParam;\nthis.getParentTarget().addChildTreeRow(null,tableParam);";
2208
2237
  } else if ("moveUpRow" === formatS) {
2209
2238
  // columnSelectedWidget.options.prefixIcon = "el-icon-plus";
2210
2239
  columnSelectedWidget.options.label = "↑上移";
2211
2240
  columnSelectedWidget.options.labelHidden = false;
2212
- columnSelectedWidget.options.onClick
2213
- = "let tableParam = this.tableParam;\nthis.getParentTarget().moveUpRow(tableParam);";
2241
+ columnSelectedWidget.options.onClick =
2242
+ "let tableParam = this.tableParam;\nthis.getParentTarget().moveUpRow(tableParam);";
2214
2243
  } else if ("moveDownRow" === formatS) {
2215
2244
  // columnSelectedWidget.options.prefixIcon = "el-icon-plus";
2216
2245
  columnSelectedWidget.options.label = "↓下移";
2217
2246
  columnSelectedWidget.options.labelHidden = false;
2218
- columnSelectedWidget.options.onClick
2219
- = "let tableParam = this.tableParam;\nthis.getParentTarget().moveDownRow(tableParam);";
2247
+ columnSelectedWidget.options.onClick =
2248
+ "let tableParam = this.tableParam;\nthis.getParentTarget().moveDownRow(tableParam);";
2220
2249
  } else if ("removeTreeRow" === formatS) {
2221
2250
  columnSelectedWidget.options.prefixIcon = "el-icon-delete";
2222
2251
  columnSelectedWidget.options.label = "删除";
2223
2252
  columnSelectedWidget.options.labelHidden = true;
2224
- columnSelectedWidget.options.onClick
2225
- = "let tableParam = this.tableParam;\nthis.getParentTarget().removeTreeRow(tableParam);";
2253
+ columnSelectedWidget.options.onClick =
2254
+ "let tableParam = this.tableParam;\nthis.getParentTarget().removeTreeRow(tableParam);";
2226
2255
  }
2227
2256
  columnOption = columnSelectedWidget.options;
2228
2257
  }
@@ -2333,9 +2362,11 @@ modules = {
2333
2362
  let rowIndex = Math.max(obj.rowIndex, 0);
2334
2363
 
2335
2364
  let isTreeTable = this.widget.options.isTreeTable || false;
2336
- if(isTreeTable){
2337
- rowIndex = this.getValue().findIndex((item) => item._X_ROW_KEY === obj.row._X_ROW_KEY);
2338
- if(rowIndex<0){
2365
+ if (isTreeTable) {
2366
+ rowIndex = this.getValue().findIndex(
2367
+ (item) => item._X_ROW_KEY === obj.row._X_ROW_KEY
2368
+ );
2369
+ if (rowIndex < 0) {
2339
2370
  return "false";
2340
2371
  }
2341
2372
  }
@@ -2357,7 +2388,9 @@ modules = {
2357
2388
  isVabsearchFlagWidget(widget) {
2358
2389
  let type = widget?.type;
2359
2390
  return (
2360
- type === "vabsearch" || type === "singerSearch" || type === "multiSearch"
2391
+ type === "vabsearch" ||
2392
+ type === "singerSearch" ||
2393
+ type === "multiSearch"
2361
2394
  );
2362
2395
  },
2363
2396
  getColumnWidgetName(e) {
@@ -2398,8 +2431,8 @@ modules = {
2398
2431
  }
2399
2432
  let formRef = this.getFormRef();
2400
2433
  let dataTableConfig = formRef.$attrs.dataTableOption || {};
2401
- dataTableConfig.onCheckboxChange
2402
- && dataTableConfig.onCheckboxChange(param);
2434
+ dataTableConfig.onCheckboxChange &&
2435
+ dataTableConfig.onCheckboxChange(param);
2403
2436
  },
2404
2437
  handleCheckboxAll(param) {
2405
2438
  if (this.widget.options.onCheckboxAll) {
@@ -2456,7 +2489,7 @@ modules = {
2456
2489
  let formModel = this.formModel;
2457
2490
  let dataMap = this.getGridTable().getTableData();
2458
2491
 
2459
- /* const errMap = await $grid.validate(obj.row).catch(errMap => errMap)
2492
+ /* const errMap = await $grid.validate(obj.row).catch(errMap => errMap)
2460
2493
  if (errMap) {
2461
2494
  let title = errMap[Object.keys(errMap)[0]][0].column.title
2462
2495
  this.$message.error(`[${title}]不能为空`)
@@ -2482,9 +2515,9 @@ modules = {
2482
2515
 
2483
2516
  Object.keys(mainData).forEach((key) => {
2484
2517
  if (key.startsWith("attachments_")) {
2485
- formData[key] = mainData[key]
2518
+ formData[key] = mainData[key];
2486
2519
  }
2487
- })
2520
+ });
2488
2521
 
2489
2522
  let reqData = {
2490
2523
  formCode: formCode,
@@ -2508,9 +2541,11 @@ modules = {
2508
2541
  } else {
2509
2542
  // $grid.remove(obj.row);
2510
2543
  // $grid.insertAt(res.objx);
2511
- let items = that.getValue()
2512
- let index = items.findIndex((item) => item.id === obj.row.id)
2513
- items.splice(index, 1,res.objx)
2544
+ let items = that.getValue();
2545
+ let index = items.findIndex(
2546
+ (item) => item.id === obj.row.id
2547
+ );
2548
+ items.splice(index, 1, res.objx);
2514
2549
  that.setValue(items);
2515
2550
  }
2516
2551
  delete obj.$table.editCloneRow;
@@ -2576,8 +2611,8 @@ modules = {
2576
2611
  }
2577
2612
 
2578
2613
  // Object.assign(newRow, editDefaultRow, rowData);
2579
- newRow.id
2580
- = "row_" + new Date().valueOf() + Math.floor(Math.random() * 1000000);
2614
+ newRow.id =
2615
+ "row_" + new Date().valueOf() + Math.floor(Math.random() * 1000000);
2581
2616
  if (!toSibling) {
2582
2617
  newRow[parentField] = parent?.id || 0;
2583
2618
  } else {
@@ -2592,8 +2627,8 @@ modules = {
2592
2627
  if (toEnd === true) {
2593
2628
  tableRows.push(newRow);
2594
2629
  } else if (toSibling === true) {
2595
- let addIndex
2596
- = tableRows.findIndex(
2630
+ let addIndex =
2631
+ tableRows.findIndex(
2597
2632
  (item) => item._X_ROW_KEY === obj.row._X_ROW_KEY
2598
2633
  ) + 1;
2599
2634
  tableRows.splice(addIndex, 0, newRow);
@@ -2614,8 +2649,8 @@ modules = {
2614
2649
  if (toEnd === true) {
2615
2650
  tableRows.push(newRow);
2616
2651
  } else if (toSibling === true) {
2617
- let addIndex
2618
- = tableRows.findIndex(
2652
+ let addIndex =
2653
+ tableRows.findIndex(
2619
2654
  (item) => item._X_ROW_KEY === obj.row._X_ROW_KEY
2620
2655
  ) + 1;
2621
2656
  tableRows.splice(addIndex, 0, newRow);
@@ -2643,7 +2678,7 @@ modules = {
2643
2678
  let delIds = [];
2644
2679
  let loopDo = (item) => {
2645
2680
  if (item._X_ROW_KEY) delIds.push(item._X_ROW_KEY);
2646
- if(childrenField && item[childrenField]){
2681
+ if (childrenField && item[childrenField]) {
2647
2682
  item[childrenField].forEach((subItem) => {
2648
2683
  loopDo(subItem);
2649
2684
  });
@@ -2657,9 +2692,9 @@ modules = {
2657
2692
  this.deleteRowWidgets(delRow);
2658
2693
  }); */
2659
2694
  let tableRows = this.getValue();
2660
- let delIndex = []
2661
- tableRows.map((item,index) => {
2662
- if(delIds.includes(item._X_ROW_KEY)){
2695
+ let delIndex = [];
2696
+ tableRows.map((item, index) => {
2697
+ if (delIds.includes(item._X_ROW_KEY)) {
2663
2698
  delIndex.push(index);
2664
2699
  }
2665
2700
  });
@@ -2698,9 +2733,9 @@ modules = {
2698
2733
  }
2699
2734
  }
2700
2735
 
2701
- newRow.id
2702
- = "row_" + new Date().valueOf() + Math.floor(Math.random() * 1000000);
2703
- if(isTreeTable){
2736
+ newRow.id =
2737
+ "row_" + new Date().valueOf() + Math.floor(Math.random() * 1000000);
2738
+ if (isTreeTable) {
2704
2739
  let parentField = $grid.treeConfig.parentField;
2705
2740
  if (!toSibling) {
2706
2741
  newRow[parentField] = parent?.id || 0;
@@ -2709,7 +2744,6 @@ modules = {
2709
2744
  }
2710
2745
  }
2711
2746
 
2712
-
2713
2747
  let newData = this.createNewTableData(isEditTable);
2714
2748
  newRow = Object.assign({}, newData, newRow, editDefaultRow, rowData);
2715
2749
 
@@ -2718,8 +2752,8 @@ modules = {
2718
2752
  if (toEnd === true) {
2719
2753
  tableRows.push(newRow);
2720
2754
  } else if (toSibling === true) {
2721
- let addIndex
2722
- = tableRows.findIndex(
2755
+ let addIndex =
2756
+ tableRows.findIndex(
2723
2757
  (item) => item._X_ROW_KEY === obj.row._X_ROW_KEY
2724
2758
  ) + 1;
2725
2759
  tableRows.splice(addIndex, 0, newRow);
@@ -2740,8 +2774,8 @@ modules = {
2740
2774
  if (toEnd === true) {
2741
2775
  tableRows.push(newRow);
2742
2776
  } else if (toSibling === true) {
2743
- let addIndex
2744
- = tableRows.findIndex(
2777
+ let addIndex =
2778
+ tableRows.findIndex(
2745
2779
  (item) => item._X_ROW_KEY === obj.row._X_ROW_KEY
2746
2780
  ) + 1;
2747
2781
  tableRows.splice(addIndex, 0, newRow);
@@ -2786,8 +2820,8 @@ modules = {
2786
2820
  let loopDo = (item, wbs) => {
2787
2821
  item.f_wbs = wbs;
2788
2822
  map[item._X_ROW_KEY] = wbs;
2789
- item[childrenField]
2790
- && item[childrenField].forEach((subitem, subindex) => {
2823
+ item[childrenField] &&
2824
+ item[childrenField].forEach((subitem, subindex) => {
2791
2825
  let sub_wbs = wbs + "." + (subindex + 1) + "";
2792
2826
  loopDo(subitem, sub_wbs);
2793
2827
  });
@@ -3276,7 +3310,7 @@ modules = {
3276
3310
  handleNullValue(rows) {
3277
3311
  let newData = this.createNewTableData(true, false);
3278
3312
  let keys = Object.keys(newData);
3279
- if(keys.length){
3313
+ if (keys.length) {
3280
3314
  rows.forEach((row) => {
3281
3315
  keys.forEach((key) => {
3282
3316
  if (row[key] === undefined) {