cloud-web-corejs 1.0.245 → 1.0.247

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.
@@ -1,20 +1,27 @@
1
1
  <template>
2
2
  <el-dialog
3
- custom-class="dialog-style list-dialog"
3
+ custom-class="dialog-style list-dialog table-column-config-dialog"
4
4
  :title="i18nt('designer.setting.tableColEdit')"
5
5
  :visible.sync="showDialog"
6
6
  :modal="false"
7
7
  :show-close="!0"
8
8
  :close-on-click-modal="!1"
9
9
  :close-on-press-escape="!1"
10
- :destroy-on-close="!0"
10
+ :destroy-on-close="false"
11
11
  top="5vh"
12
12
  width="1220px"
13
13
  v-dialog-drag
14
14
  :before-close="closeHandle"
15
15
  >
16
- <div class="cont">
16
+ <div
17
+ class="cont table-column-dialog-cont"
18
+ v-loading="!tableReady"
19
+ element-loading-background="rgba(0, 0, 0, 0)"
20
+ element-loading-text="数据正在加载中"
21
+ element-loading-spinner="el-icon-loading"
22
+ >
17
23
  <el-table
24
+ v-if="tableReady"
18
25
  ref="singleTable"
19
26
  width="100%"
20
27
  :data="tableData"
@@ -23,11 +30,7 @@
23
30
  row-key="columnId"
24
31
  stripe=""
25
32
  :tree-props="{ children: 'children' }"
26
- default-expand-all
27
- v-loading="pictLoading"
28
- element-loading-background="rgba(0, 0, 0, 0)"
29
- element-loading-text="数据正在加载中"
30
- element-loading-spinner="el-icon-loading"
33
+ :default-expand-all="shouldExpandAllTable"
31
34
  >
32
35
  <el-table-column label="" width="80" fixed="left">
33
36
  <template #default="scope">
@@ -130,7 +133,8 @@
130
133
  @click="openFormatConfigDialog(scope.row, scope.$index)"
131
134
  :disabled="
132
135
  !columnFormatMap[scope.row.formatS] &&
133
- 'widgetRender' !== scope.row.formatS
136
+ 'widgetRender' !== scope.row.formatS &&
137
+ 'editTreeButtonGroup' !== scope.row.formatS
134
138
  "
135
139
  ></el-button>
136
140
  </template>
@@ -174,6 +178,14 @@
174
178
  <el-switch v-model="scope.row.filterable"></el-switch>
175
179
  </template>
176
180
  </el-table-column>
181
+ <el-table-column label="UTC时差转换" width="90" align="center">
182
+ <template #default="scope">
183
+ <el-switch
184
+ v-if="isUtcTransformColumn(scope.row)"
185
+ v-model="scope.row.utcTransformEnabled"
186
+ ></el-switch>
187
+ </template>
188
+ </el-table-column>
177
189
  <el-table-column
178
190
  label="编辑更多属性"
179
191
  width="100"
@@ -265,6 +277,12 @@
265
277
  :visiable.sync="showColumnRenderDialog"
266
278
  @confirm="confirmWidgetRenderDialog"
267
279
  ></columnRenderDialog>
280
+ <editTreeButtonGroupConfigDialog
281
+ v-if="showEditTreeButtonGroupConfigDialog && editTreeButtonGroupRowData"
282
+ :visible.sync="showEditTreeButtonGroupConfigDialog"
283
+ :row="editTreeButtonGroupRowData"
284
+ @confirm="confirmEditTreeButtonGroupConfig"
285
+ />
268
286
  </div>
269
287
  <div class="dialog-footer" slot="footer">
270
288
  <el-button @click="closeHandle" class="button-sty" icon="el-icon-close">
@@ -417,7 +435,7 @@
417
435
  </el-dialog>
418
436
 
419
437
  <el-dialog
420
- custom-class="dialog-style list-dialog"
438
+ custom-class="dialog-style list-dialog table-column-row-edit-dialog"
421
439
  :title="i18nt('designer.setting.tableColEdit')"
422
440
  :visible.sync="showRowEditDialog"
423
441
  v-if="showRowEditDialog"
@@ -426,11 +444,13 @@
426
444
  :close-on-click-modal="!1"
427
445
  :close-on-press-escape="!1"
428
446
  :destroy-on-close="!0"
447
+ :append-to-body="true"
448
+ :modal-append-to-body="true"
429
449
  top="5vh"
430
- width="409px"
450
+ width="480px"
431
451
  v-dialog-drag
432
452
  >
433
- <div class="cont">
453
+ <div class="cont table-column-row-edit-cont">
434
454
  <el-form :model="rowData" class="form-m2" label-position="top">
435
455
  <el-form-item :label="i18nt('designer.setting.columnLabel')">
436
456
  <el-input
@@ -490,7 +510,8 @@
490
510
  @click="openFormatConfigDialog(rowData, rowDataIndex)"
491
511
  :disabled="
492
512
  !columnFormatMap[rowData.formatS] &&
493
- 'widgetRender' !== rowData.formatS
513
+ 'widgetRender' !== rowData.formatS &&
514
+ 'editTreeButtonGroup' !== rowData.formatS
494
515
  "
495
516
  ></el-button>
496
517
  </el-form-item>
@@ -504,9 +525,25 @@
504
525
  @click="showRenderDialog(rowData)"
505
526
  ></el-button>
506
527
  </el-form-item>
528
+ <el-form-item
529
+ v-if="isUtcTransformColumn(rowData)"
530
+ label="UTC时差转换"
531
+ >
532
+ <el-switch v-model="rowData.utcTransformEnabled"></el-switch>
533
+ </el-form-item>
507
534
  <el-form-item :label="i18nt('designer.setting.visibleColumn')">
508
535
  <el-switch v-model="rowData.show"></el-switch>
509
536
  </el-form-item>
537
+ <el-form-item label="动态显示脚本">
538
+ <a
539
+ href="javascript:void(0);"
540
+ class="a-link link-oneLind"
541
+ @click="openColumnShowDialog(rowData)"
542
+ >
543
+ <span>{{ rowData.columnShow }}</span>
544
+ <i class="el-icon-edit"></i>
545
+ </a>
546
+ </el-form-item>
510
547
  <el-form-item :label="i18nt('designer.setting.sortableColumn')">
511
548
  <el-switch v-model="rowData.sortable"></el-switch>
512
549
  </el-form-item>
@@ -588,8 +625,78 @@
588
625
  <el-option value="#ea5353" label="红"></el-option>
589
626
  </el-select>
590
627
  </el-form-item>
628
+ <el-form-item label-width="0" class="form-item-full">
629
+ <el-divider class="custom-divider">{{
630
+ i18nt("designer.setting.customLabelIcon")
631
+ }}</el-divider>
632
+ </el-form-item>
633
+ <el-form-item :label="i18nt('designer.setting.labelIconClass')">
634
+ <icon-picker v-model="rowData.labelIconClass"></icon-picker>
635
+ </el-form-item>
636
+ <el-form-item :label="i18nt('designer.setting.labelIconPosition')">
637
+ <el-select
638
+ v-model="rowData.labelIconPosition"
639
+ clearable
640
+ placeholder="默认后面"
641
+ >
642
+ <el-option label="前面" value="front"></el-option>
643
+ <el-option label="后面" value="rear"></el-option>
644
+ </el-select>
645
+ </el-form-item>
646
+ <el-form-item
647
+ :label="i18nt('designer.setting.labelTooltip')"
648
+ class="form-item-full"
649
+ >
650
+ <a
651
+ href="javascript:void(0);"
652
+ class="a-link link-oneLind"
653
+ @click="openLabelTooltipDialog"
654
+ >
655
+ <span>{{ rowData.labelTooltip }}</span>
656
+ <i class="el-icon-edit"></i>
657
+ </a>
658
+ </el-form-item>
591
659
  </el-form>
592
660
  </div>
661
+ <el-dialog
662
+ v-if="labelTooltipDialogVisible"
663
+ custom-class="dialog-style"
664
+ :title="i18nt('designer.setting.labelTooltip')"
665
+ :visible.sync="labelTooltipDialogVisible"
666
+ :show-close="true"
667
+ :append-to-body="true"
668
+ :modal="false"
669
+ :close-on-click-modal="false"
670
+ :close-on-press-escape="false"
671
+ :destroy-on-close="true"
672
+ width="520px"
673
+ v-dialog-drag
674
+ >
675
+ <el-input
676
+ type="textarea"
677
+ :rows="14"
678
+ class="label-tooltip-textarea"
679
+ v-model="labelTooltipValue"
680
+ clearable
681
+ ></el-input>
682
+ <div class="dialog-footer" slot="footer">
683
+ <el-button
684
+ @click="labelTooltipDialogVisible = false"
685
+ class="button-sty"
686
+ icon="el-icon-close"
687
+ >
688
+ {{ i18nt("designer.hint.cancel") }}
689
+ </el-button>
690
+ <el-button
691
+ type="primary"
692
+ @click="submitLabelTooltipDialog"
693
+ class="button-sty"
694
+ icon="el-icon-check"
695
+ >
696
+ {{ i18nt("designer.hint.confirm") }}
697
+ </el-button>
698
+ </div>
699
+ </el-dialog>
593
700
  <div class="dialog-footer" slot="footer">
594
701
  <el-button
595
702
  @click="closeRowEditDialog"
@@ -620,6 +727,8 @@ import {
620
727
  columnFormatMap,
621
728
  } from "../../../../../../components/xform/utils/util";
622
729
  import columnRenderDialog from "./columnRenderDialog.vue";
730
+ import editTreeButtonGroupConfigDialog from "./edit-tree-button-group-config-dialog.vue";
731
+ import IconPicker from "@base/components/xform/icon-picker/index.vue";
623
732
 
624
733
  let businessOptions = [
625
734
  {
@@ -647,18 +756,27 @@ export default {
647
756
  designer: Object,
648
757
  selectedWidget: Object,
649
758
  optionModel: Object,
759
+ visiable: {
760
+ type: Boolean,
761
+ default: false,
762
+ },
763
+ },
764
+ components: {
765
+ columnRenderDialog,
766
+ editTreeButtonGroupConfigDialog,
767
+ IconPicker,
650
768
  },
651
- components: { columnRenderDialog },
652
769
  inject: ["openWidgetPropertyDialog"],
653
770
  data() {
654
771
  return {
655
- pictLoading: true,
772
+ tableReady: false,
656
773
  tableColumnConfigTitle: null,
657
774
  showTableColumnConfigDialog: false,
658
775
  tableColumnConfigHeader: null,
659
776
  tableColumnConfigCode: null,
660
- showDialog: true,
661
- dialogVisible: true,
777
+ showEditTreeButtonGroupConfigDialog: false,
778
+ currentEditTreeButtonGroupRow: null,
779
+ editTreeButtonGroupRowData: null,
662
780
  alignOptions: [
663
781
  {
664
782
  value: "left",
@@ -695,6 +813,10 @@ export default {
695
813
  value: "textarea",
696
814
  label: "多行文本输入框",
697
815
  },
816
+ {
817
+ value: "editScriptInput",
818
+ label: "脚本输入框",
819
+ },
698
820
  {
699
821
  value: "editSelect",
700
822
  label: "下拉框",
@@ -896,6 +1018,7 @@ export default {
896
1018
 
897
1019
  eventParamsMap: {
898
1020
  footerMethodConfg: "footerMethodConfg(dataId,formCode,param) {",
1021
+ columnShow: "columnShow(dataId,formCode,columnConfig) {",
899
1022
  },
900
1023
 
901
1024
  showColumnRenderDialog: false,
@@ -904,16 +1027,163 @@ export default {
904
1027
  rowData: null,
905
1028
  rowDataIndex: 0,
906
1029
  showRowEditDialog: false,
1030
+ labelTooltipDialogVisible: false,
1031
+ labelTooltipValue: "",
1032
+ sourceTableColumnsSnapshot: null,
907
1033
  };
908
1034
  },
909
1035
  beforeDestroy() {
910
1036
  if (this.dragSort) this.dragSort.destroy();
911
1037
  },
1038
+ computed: {
1039
+ showDialog: {
1040
+ get() {
1041
+ return this.visiable;
1042
+ },
1043
+ set(val) {
1044
+ this.$emit("update:visiable", val);
1045
+ },
1046
+ },
1047
+ shouldExpandAllTable() {
1048
+ return this.countTreeRows(this.tableData) <= 30;
1049
+ },
1050
+ },
1051
+ watch: {
1052
+ visiable(val) {
1053
+ if (val) {
1054
+ this.onDialogOpen();
1055
+ } else {
1056
+ this.onDialogClose();
1057
+ }
1058
+ },
1059
+ },
912
1060
  created() {},
913
1061
  mounted() {
914
- this.init();
1062
+ if (this.visiable) {
1063
+ this.onDialogOpen();
1064
+ }
915
1065
  },
916
1066
  methods: {
1067
+ countTreeRows(rows) {
1068
+ if (!Array.isArray(rows) || !rows.length) {
1069
+ return 0;
1070
+ }
1071
+ let count = 0;
1072
+ const walk = (list) => {
1073
+ list.forEach((item) => {
1074
+ count += 1;
1075
+ if (item.children && item.children.length) {
1076
+ walk(item.children);
1077
+ }
1078
+ });
1079
+ };
1080
+ walk(rows);
1081
+ return count;
1082
+ },
1083
+ cloneTableColumnsForEdit(columns) {
1084
+ if (!Array.isArray(columns)) {
1085
+ return [];
1086
+ }
1087
+ const refKeys = ["widget", "editWidget", "widgetList"];
1088
+ const cloneRow = (row) => {
1089
+ if (!row || typeof row !== "object") {
1090
+ return row;
1091
+ }
1092
+ const cloned = {};
1093
+ Object.keys(row).forEach((key) => {
1094
+ const val = row[key];
1095
+ if (key === "children" && Array.isArray(val) && val.length) {
1096
+ cloned.children = val.map(cloneRow);
1097
+ return;
1098
+ }
1099
+ if (refKeys.includes(key)) {
1100
+ cloned[key] = val;
1101
+ return;
1102
+ }
1103
+ if (key === "columnOption") {
1104
+ if (!row.widget) {
1105
+ cloned.columnOption =
1106
+ val !== null && typeof val === "object" ? deepClone(val) : val;
1107
+ }
1108
+ return;
1109
+ }
1110
+ if (key === "editColumnOption") {
1111
+ if (!row.editWidget) {
1112
+ cloned.editColumnOption =
1113
+ val !== null && typeof val === "object" ? deepClone(val) : val;
1114
+ }
1115
+ return;
1116
+ }
1117
+ if (val !== null && typeof val === "object") {
1118
+ try {
1119
+ cloned[key] = deepClone(val);
1120
+ } catch (e) {
1121
+ cloned[key] = val;
1122
+ }
1123
+ return;
1124
+ }
1125
+ cloned[key] = val;
1126
+ });
1127
+ if (row.widget && !cloned.widget) {
1128
+ cloned.widget = row.widget;
1129
+ }
1130
+ if (row.editWidget && !cloned.editWidget) {
1131
+ cloned.editWidget = row.editWidget;
1132
+ }
1133
+ return cloned;
1134
+ };
1135
+ return columns.map(cloneRow);
1136
+ },
1137
+ buildColumnWidgetMap(columns, map = {}) {
1138
+ if (!Array.isArray(columns)) {
1139
+ return map;
1140
+ }
1141
+ columns.forEach((col) => {
1142
+ if (col && col.columnId) {
1143
+ map[col.columnId] = col;
1144
+ }
1145
+ if (col.children && col.children.length) {
1146
+ this.buildColumnWidgetMap(col.children, map);
1147
+ }
1148
+ });
1149
+ return map;
1150
+ },
1151
+ restoreColumnWidgetRefs(columns, widgetMap) {
1152
+ if (!Array.isArray(columns)) {
1153
+ return [];
1154
+ }
1155
+ return columns.map((row) => {
1156
+ const next = Object.assign({}, row);
1157
+ const orig = widgetMap[next.columnId];
1158
+ if (orig) {
1159
+ // 仅 formatS 未变更时补回 widget,避免清空 formatS 后又被快照还原
1160
+ const formatUnchanged = next.formatS === orig.formatS;
1161
+ const editFormatUnchanged = next.editFormatS === orig.editFormatS;
1162
+ if (formatUnchanged && !next.widget && orig.widget) {
1163
+ next.widget = orig.widget;
1164
+ }
1165
+ if (editFormatUnchanged && !next.editWidget && orig.editWidget) {
1166
+ next.editWidget = orig.editWidget;
1167
+ }
1168
+ if (
1169
+ formatUnchanged &&
1170
+ next.formatS === "widgetRender" &&
1171
+ (!next.widgetList || !next.widgetList.length) &&
1172
+ orig.widgetList &&
1173
+ orig.widgetList.length
1174
+ ) {
1175
+ next.widgetList = orig.widgetList;
1176
+ }
1177
+ }
1178
+ if (next.children && next.children.length) {
1179
+ next.children = this.restoreColumnWidgetRefs(
1180
+ next.children,
1181
+ widgetMap
1182
+ );
1183
+ }
1184
+ return next;
1185
+ });
1186
+ },
917
1187
  editFormEventHandler(row, index, eventName) {
918
1188
  this.curEventRow = row;
919
1189
  this.curEventName = eventName;
@@ -942,26 +1212,52 @@ export default {
942
1212
  this.curEventRow[this.curEventName] = this.formEventHandlerCode;
943
1213
  this.showFormEventDialogFlag = false;
944
1214
  },
945
- init() {
946
- setTimeout(() => {
947
- this.tableData = this.$baseLodash.cloneDeep(
948
- this.optionModel.tableColumns
949
- );
950
- this.$nextTick(() => {
951
- this.rowDrop();
952
- setTimeout(() => {
953
- this.pictLoading = false;
954
- }, 200);
955
- });
956
- }, 10);
957
-
958
- /*this.$nextTick(() => {
959
- this.rowDrop();
960
- });*/
1215
+ onDialogClose() {
1216
+ this.tableReady = false;
1217
+ this.sourceTableColumnsSnapshot = null;
1218
+ if (this.dragSort) {
1219
+ this.dragSort.destroy();
1220
+ this.dragSort = null;
1221
+ }
1222
+ },
1223
+ onDialogOpen() {
1224
+ this.tableReady = false;
1225
+ if (this.dragSort) {
1226
+ this.dragSort.destroy();
1227
+ this.dragSort = null;
1228
+ }
1229
+ this.$nextTick(() => {
1230
+ const load = () => {
1231
+ this.loadTableData();
1232
+ this.tableReady = true;
1233
+ this.$nextTick(() => {
1234
+ requestAnimationFrame(() => {
1235
+ this.rowDrop();
1236
+ });
1237
+ });
1238
+ };
1239
+ if (typeof requestIdleCallback === "function") {
1240
+ requestIdleCallback(load, { timeout: 80 });
1241
+ } else {
1242
+ setTimeout(load, 0);
1243
+ }
1244
+ });
1245
+ },
1246
+ loadTableData() {
1247
+ const source = this.optionModel.tableColumns || [];
1248
+ this.sourceTableColumnsSnapshot = source;
1249
+ this.tableData = this.cloneTableColumnsForEdit(source);
961
1250
  },
962
1251
  colSubmit() {
963
1252
  this.dialogVisible = !1;
964
- this.optionModel.tableColumns = this.tableData;
1253
+ const widgetMap = this.buildColumnWidgetMap(
1254
+ this.sourceTableColumnsSnapshot || []
1255
+ );
1256
+ this.optionModel.tableColumns = this.restoreColumnWidgetRefs(
1257
+ this.tableData,
1258
+ widgetMap
1259
+ );
1260
+ this.sourceTableColumnsSnapshot = null;
965
1261
  this.closeHandle();
966
1262
  },
967
1263
  openWidgetRenderDialog(row, sourceData) {
@@ -1059,6 +1355,9 @@ export default {
1059
1355
  getUuid() {
1060
1356
  return new Date().getTime();
1061
1357
  },
1358
+ createRowAuthName(type) {
1359
+ return `row${type}` + generateId();
1360
+ },
1062
1361
  /**
1063
1362
  * 生成一行数据
1064
1363
  */
@@ -1082,10 +1381,35 @@ export default {
1082
1381
  footerMethodConfg: null,
1083
1382
  widgetList: [],
1084
1383
  labelColor: null,
1384
+ rowAddAuthName: this.createRowAuthName("Add"),
1385
+ rowEditAuthName: this.createRowAuthName("Edit"),
1386
+ rowAddShow: null,
1387
+ rowEditShow: null,
1388
+ columnShow: null,
1389
+ utcTransformEnabled: false,
1390
+ labelIconClass: null,
1391
+ labelIconPosition: "rear",
1392
+ labelTooltip: null,
1085
1393
  // treeNode: false,
1086
1394
  };
1087
1395
  return row;
1088
1396
  },
1397
+ isUtcTransformColumn(row) {
1398
+ const formatS = row.formatS;
1399
+ if (!formatS) {
1400
+ return true;
1401
+ }
1402
+ return [
1403
+ "d1",
1404
+ "d2",
1405
+ "d3",
1406
+ "d4",
1407
+ "d5",
1408
+ "render",
1409
+ "create_date",
1410
+ "modify_date",
1411
+ ].includes(formatS);
1412
+ },
1089
1413
  // 添加根节点
1090
1414
  onAddRoot() {
1091
1415
  this.tableData.push(this.generateRow());
@@ -1279,31 +1603,24 @@ export default {
1279
1603
  changeFormatS(row, isEdit) {
1280
1604
  let formatS = isEdit ? row.editFormatS : row.formatS;
1281
1605
  let isButtontCell = this.getIsButtontCell(formatS);
1282
- // let columnWidgetConfig = this.getColumnWidgetConfig(row, true, isEdit);
1283
- // let { columnSelectedWidget, columnEditFields } = columnWidgetConfig;
1284
1606
  let attachmentPrefix = this.designer.getAttachmentPrefix();
1285
1607
  let columnSelectedWidget = this.designer.createColumnWidget(row, isEdit);
1286
1608
  if (!isEdit) {
1287
- //格式化类型
1288
1609
  if (columnSelectedWidget) {
1289
- row.columnOption = columnSelectedWidget.options;
1290
1610
  row.widget = columnSelectedWidget;
1291
1611
  } else {
1292
- row.columnOption = {};
1293
1612
  row.widget = null;
1294
1613
  }
1614
+ row.utcTransformEnabled = false;
1295
1615
  } else {
1296
1616
  if (row.prop && row.prop.startsWith(attachmentPrefix)) {
1297
1617
  let suffix = row.prop.replace(attachmentPrefix, "");
1298
1618
  columnSelectedWidget.options.keyName = row.prop;
1299
1619
  columnSelectedWidget.options.keyNameSuffix = suffix;
1300
1620
  }
1301
- //编辑插槽类型
1302
1621
  if (columnSelectedWidget) {
1303
- row.columnOption = columnSelectedWidget.options;
1304
1622
  row.editWidget = columnSelectedWidget;
1305
1623
  } else {
1306
- row.editColumnOption = {};
1307
1624
  row.editWidget = null;
1308
1625
  }
1309
1626
  }
@@ -1314,6 +1631,7 @@ export default {
1314
1631
  row.label = null;
1315
1632
  row.sortable = false;
1316
1633
  row.width = 150;
1634
+ row.widget = null;
1317
1635
  } else if (isButtontCell) {
1318
1636
  if (row.formatS == "dropdown") {
1319
1637
  row.width = 100;
@@ -1325,6 +1643,7 @@ export default {
1325
1643
  row.prop = null;
1326
1644
  row.label = null;
1327
1645
  row.sortable = false;
1646
+ row.filterable = false;
1328
1647
  } else {
1329
1648
  let tmpId = "column" + generateId();
1330
1649
  if (!row.width || row.width == 47) row.width = 150;
@@ -1361,92 +1680,79 @@ export default {
1361
1680
  let type = this.columnFormatMap[formatS];
1362
1681
 
1363
1682
  if (type) {
1364
- // columnSelectedWidget = this.$baseLodash.cloneDeep(this.designer.getFieldWidgetByType(type));
1365
- columnSelectedWidget = this.designer.copyNewFieldWidget(
1366
- this.designer.getFieldWidgetByType(type)
1367
- );
1368
- /*let tmpId = generateId();
1369
- let idVal = row.prop ? row.prop : (type + tmpId);*/
1370
- /*columnSelectedWidget.id = idVal;*/
1371
- // columnSelectedWidget.options.name = idVal;
1372
- /*if (isEdit) {
1373
- columnSelectedWidget.id = "edit_" + row.columnId;
1374
- } else {
1375
- columnSelectedWidget.id = row.columnId;
1376
- }*/
1377
- // columnSelectedWidget.id = row.columnId;
1378
- let columnOption;
1379
- if (!isEdit) {
1380
- columnOption = row.columnOption;
1381
- } else {
1382
- columnOption = row.editColumnOption;
1383
- }
1384
- if (!isChange && columnOption && Object.keys(columnOption).length) {
1385
- columnOption.required = row.required || false;
1386
- columnSelectedWidget.options = columnOption;
1683
+ const applyNewWidgetDefaults = (widget) => {
1684
+ widget.options.required = row.required || false;
1387
1685
  if ("editDelete" == formatS) {
1388
- columnSelectedWidget.options.hiddenByWf =
1389
- columnSelectedWidget.options.hiddenByWf ?? true;
1390
- columnSelectedWidget.options.prefixIcon =
1391
- columnSelectedWidget.options.prefixIcon || "el-icon-delete";
1392
- } else if ("editButton" == formatS) {
1393
- columnSelectedWidget.options.prefixIcon =
1394
- columnSelectedWidget.options.prefixIcon || "el-icon-edit";
1395
- }
1396
- } else {
1397
- columnSelectedWidget.options.required = row.required || false;
1398
-
1399
- if ("editDelete" == formatS) {
1400
- columnSelectedWidget.options.prefixIcon = "el-icon-delete";
1401
- columnSelectedWidget.options.label = "删除";
1402
- columnSelectedWidget.options.labelHidden = true;
1403
- columnSelectedWidget.options.hiddenByWf = true;
1404
- columnSelectedWidget.options.onClick =
1686
+ widget.options.prefixIcon = "el-icon-delete";
1687
+ widget.options.label = "删除";
1688
+ widget.options.labelHidden = true;
1689
+ widget.options.hiddenByWf = true;
1690
+ widget.options.onClick =
1405
1691
  "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.deleteRow(tableParam.row,tableParam.rowIndex);";
1406
1692
  } else if ("editButton" == formatS) {
1407
- columnSelectedWidget.options.prefixIcon = "el-icon-edit";
1408
- columnSelectedWidget.options.label = "查看";
1409
- columnSelectedWidget.options.labelHidden = true;
1410
- columnSelectedWidget.options.onClick =
1693
+ widget.options.prefixIcon = "el-icon-edit";
1694
+ widget.options.label = "查看";
1695
+ widget.options.labelHidden = true;
1696
+ widget.options.onClick =
1411
1697
  "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.openEditDialog(tableParam.row)";
1412
1698
  } else if ("addSiblingEditRow" == formatS) {
1413
- columnSelectedWidget.options.prefixIcon = "el-icon-plus";
1414
- columnSelectedWidget.options.label = "新增兄弟节点";
1415
- columnSelectedWidget.options.labelHidden = false;
1416
- columnSelectedWidget.options.onClick =
1699
+ widget.options.prefixIcon = "el-icon-plus";
1700
+ widget.options.label = "新增兄弟节点";
1701
+ widget.options.labelHidden = false;
1702
+ widget.options.onClick =
1417
1703
  "let tableParam = this.tableParam;\nthis.getParentTarget().addSiblingTreeRow(null,tableParam);";
1418
1704
  } else if ("addChildTreeRow" == formatS) {
1419
- columnSelectedWidget.options.prefixIcon = "el-icon-plus";
1420
- columnSelectedWidget.options.label = "新增子节点";
1421
- columnSelectedWidget.options.labelHidden = false;
1422
- columnSelectedWidget.options.onClick =
1705
+ widget.options.prefixIcon = "el-icon-plus";
1706
+ widget.options.label = "新增子节点";
1707
+ widget.options.labelHidden = false;
1708
+ widget.options.onClick =
1423
1709
  "let tableParam = this.tableParam;\nthis.getParentTarget().addChildTreeRow(null,tableParam);";
1424
1710
  } else if ("moveUpRow" == formatS) {
1425
- // columnSelectedWidget.options.prefixIcon = "el-icon-plus";
1426
- columnSelectedWidget.options.label = "↑上移";
1427
- columnSelectedWidget.options.labelHidden = false;
1428
- columnSelectedWidget.options.onClick =
1711
+ widget.options.label = "↑上移";
1712
+ widget.options.labelHidden = false;
1713
+ widget.options.onClick =
1429
1714
  "let tableParam = this.tableParam;\nthis.getParentTarget().moveUpRow(tableParam);";
1430
1715
  } else if ("moveDownRow" == formatS) {
1431
- // columnSelectedWidget.options.prefixIcon = "el-icon-plus";
1432
- columnSelectedWidget.options.label = "↓下移";
1433
- columnSelectedWidget.options.labelHidden = false;
1434
- columnSelectedWidget.options.onClick =
1716
+ widget.options.label = "↓下移";
1717
+ widget.options.labelHidden = false;
1718
+ widget.options.onClick =
1435
1719
  "let tableParam = this.tableParam;\nthis.getParentTarget().moveDownRow(tableParam);";
1436
1720
  } else if ("removeTreeRow" == formatS) {
1437
- columnSelectedWidget.options.prefixIcon = "el-icon-delete";
1438
- columnSelectedWidget.options.label = "删除";
1439
- columnSelectedWidget.options.labelHidden = true;
1440
- columnSelectedWidget.options.onClick =
1721
+ widget.options.prefixIcon = "el-icon-delete";
1722
+ widget.options.label = "删除";
1723
+ widget.options.labelHidden = true;
1724
+ widget.options.onClick =
1441
1725
  "let tableParam = this.tableParam;\nthis.getParentTarget().removeTreeRow(tableParam);";
1442
1726
  }
1727
+ };
1443
1728
 
1444
- columnOption = columnSelectedWidget.options;
1729
+ if (!isChange) {
1730
+ const sourceWidget = this.designer.getColumnWidget(row, isEdit);
1731
+ if (sourceWidget) {
1732
+ columnSelectedWidget = this.$baseLodash.cloneDeep(sourceWidget);
1733
+ columnSelectedWidget.options.required = row.required || false;
1734
+ if ("editDelete" == formatS) {
1735
+ columnSelectedWidget.options.hiddenByWf =
1736
+ columnSelectedWidget.options.hiddenByWf ?? true;
1737
+ columnSelectedWidget.options.prefixIcon =
1738
+ columnSelectedWidget.options.prefixIcon || "el-icon-delete";
1739
+ } else if ("editButton" == formatS) {
1740
+ columnSelectedWidget.options.prefixIcon =
1741
+ columnSelectedWidget.options.prefixIcon || "el-icon-edit";
1742
+ }
1743
+ } else {
1744
+ columnSelectedWidget = this.designer.copyNewFieldWidget(
1745
+ this.designer.getFieldWidgetByType(type)
1746
+ );
1747
+ applyNewWidgetDefaults(columnSelectedWidget);
1748
+ }
1749
+ } else {
1750
+ columnSelectedWidget = this.designer.copyNewFieldWidget(
1751
+ this.designer.getFieldWidgetByType(type)
1752
+ );
1753
+ applyNewWidgetDefaults(columnSelectedWidget);
1445
1754
  }
1446
1755
 
1447
- // columnSelectedWidget.options.name = isEdit? (type + row.columnId) : row.prop;
1448
- // columnSelectedWidget.options.name = type + row.columnId;
1449
- // columnSelectedWidget.options.name = row.prop;
1450
1756
  if (columnSelectedWidget.options.hasOwnProperty("keyName")) {
1451
1757
  columnSelectedWidget.options.keyName = row.prop;
1452
1758
  columnSelectedWidget.options.keyNameEnabled = true;
@@ -1465,8 +1771,6 @@ export default {
1465
1771
  let result = null;
1466
1772
  if (columnList) {
1467
1773
  let column = columnList.find((item) => item.columnId == columnId);
1468
- if (!column) {
1469
- }
1470
1774
  for (let column of columnList) {
1471
1775
  if (column.columnId == columnId) {
1472
1776
  result = column;
@@ -1494,10 +1798,29 @@ export default {
1494
1798
  }
1495
1799
  return widget;
1496
1800
  },
1801
+ confirmEditTreeButtonGroupConfig(rowConfig) {
1802
+ if (this.currentEditTreeButtonGroupRow) {
1803
+ Object.assign(this.currentEditTreeButtonGroupRow, rowConfig);
1804
+ }
1805
+ this.currentEditTreeButtonGroupRow = null;
1806
+ this.editTreeButtonGroupRowData = null;
1807
+ },
1497
1808
  openFormatConfigDialog(row, index) {
1809
+ if (row.formatS === "editTreeButtonGroup") {
1810
+ this.currentEditTreeButtonGroupRow = row;
1811
+ this.editTreeButtonGroupRowData = this.$baseLodash.cloneDeep(row);
1812
+ this.showEditTreeButtonGroupConfigDialog = true;
1813
+ return;
1814
+ }
1498
1815
  if (row.formatS == "widgetRender") {
1499
1816
  let formWidgetList = deepClone(this.designer.widgetList);
1500
- let tableData = deepClone(this.tableData);
1817
+ const widgetMap = this.buildColumnWidgetMap(
1818
+ this.sourceTableColumnsSnapshot || this.optionModel.tableColumns || []
1819
+ );
1820
+ let tableData = this.restoreColumnWidgetRefs(
1821
+ this.cloneTableColumnsForEdit(this.tableData),
1822
+ widgetMap
1823
+ );
1501
1824
  let columnId = row.columnId;
1502
1825
 
1503
1826
  let dataTableName = this.optionModel.name;
@@ -1527,32 +1850,24 @@ export default {
1527
1850
  return;
1528
1851
  }
1529
1852
 
1530
- /*let option = row.columnOption;
1531
- let selectedWidget;
1532
- let columnWidgetConfig = this.getColumnWidgetConfig(row);
1533
- let {columnSelectedWidget, columnEditFields} = columnWidgetConfig;
1534
- if (columnSelectedWidget) {
1535
- option = columnSelectedWidget.options;
1536
- selectedWidget = columnSelectedWidget;
1537
- } else {
1538
- option = {};
1539
- selectedWidget = {};
1853
+ const { columnSelectedWidget, columnEditFields } =
1854
+ this.getColumnWidgetConfig(row);
1855
+ if (!columnSelectedWidget) {
1856
+ this.$message.warning(this.$t1("请先选择列格式化类型"));
1857
+ return;
1540
1858
  }
1541
-
1542
- let columnOption = this.$baseLodash.cloneDeep(option);
1543
- row.columnOption = columnOption;*/
1544
- let selectedWidget = row.widget;
1859
+ columnSelectedWidget.options = this.$baseLodash.cloneDeep(
1860
+ columnSelectedWidget.options
1861
+ );
1545
1862
  this.operateIndex = index;
1546
-
1547
- let tableColumns = this.tableData;
1548
1863
  this.openWidgetPropertyDialog({
1549
1864
  row: row,
1550
- columnSelectedWidget: selectedWidget,
1551
- tableColumns,
1865
+ columnSelectedWidget,
1866
+ tableColumns: this.tableData,
1552
1867
  index: index,
1553
- // columnEditFields: columnEditFields,
1554
- callback: (columnOption) => {
1555
- this.confirmFormatConfigDialog(columnOption, row);
1868
+ columnEditFields,
1869
+ callback: (confirmedWidget) => {
1870
+ this.confirmFormatConfigDialog(confirmedWidget, row);
1556
1871
  },
1557
1872
  });
1558
1873
  },
@@ -1560,61 +1875,44 @@ export default {
1560
1875
  let o = options.name;
1561
1876
  return (options.keyNameEnabled && options.keyName) || o;
1562
1877
  },
1563
- confirmFormatConfigDialog(columnOption, row) {
1564
- // let row = this.tableData[this.operateIndex];
1565
- row.columnOption = columnOption;
1566
-
1567
- if (row.widget) {
1568
- row.widget.options = columnOption;
1569
- } else {
1570
- let type = this.columnFormatMap[row.formatS];
1571
- let fieldWidget = this.designer.createColumnWidget(row, false);
1572
- fieldWidget.options = columnOption;
1573
- row.widget = fieldWidget;
1574
- this.$forceUpdate();
1575
- }
1878
+ confirmFormatConfigDialog(columnSelectedWidget, row) {
1879
+ row.widget = columnSelectedWidget;
1880
+ const options = columnSelectedWidget.options;
1576
1881
 
1577
1882
  let isButtontCell = this.getIsButtontCell(row.formatS);
1578
1883
  if (!isButtontCell) {
1579
- row.prop = this.getFieldKeyNameByOptions(columnOption);
1580
- row.label = columnOption.label;
1581
- row.required = columnOption.required;
1884
+ row.prop = this.getFieldKeyNameByOptions(options);
1885
+ row.label = options.label;
1886
+ row.required = options.required;
1582
1887
  }
1583
1888
  },
1584
1889
  openEditFormatConfigDialog(row, index) {
1585
- let selectedWidget = row.editWidget;
1890
+ const { columnSelectedWidget, columnEditFields } =
1891
+ this.getColumnWidgetConfig(row, false, true);
1892
+ if (!columnSelectedWidget) {
1893
+ this.$message.warning(this.$t1("请先选择编辑列格式化类型"));
1894
+ return;
1895
+ }
1896
+ columnSelectedWidget.options = this.$baseLodash.cloneDeep(
1897
+ columnSelectedWidget.options
1898
+ );
1586
1899
  this.operateIndex = index;
1587
-
1588
- let tableColumns = this.tableData;
1589
1900
  this.openWidgetPropertyDialog({
1590
1901
  row: row,
1591
- tableColumns,
1592
- columnSelectedWidget: selectedWidget,
1902
+ tableColumns: this.tableData,
1903
+ columnSelectedWidget,
1593
1904
  index: index,
1594
- // columnEditFields: columnEditFields,
1595
- callback: (columnOption) => {
1596
- this.confirmEditFormatConfigDialog(columnOption, row);
1905
+ columnEditFields,
1906
+ callback: (confirmedWidget) => {
1907
+ this.confirmEditFormatConfigDialog(confirmedWidget, row);
1597
1908
  },
1598
1909
  });
1599
1910
  },
1600
- confirmEditFormatConfigDialog(columnOption, row) {
1601
- // let row = this.tableData[this.operateIndex];
1602
- row.editColumnOption = columnOption;
1603
- // row.editWidget.options = columnOption;
1604
-
1605
- if (row.editWidget) {
1606
- row.editWidget.options = columnOption;
1607
- } else {
1608
- let type = this.columnFormatMap[row.editFormatS];
1609
- let fieldWidget = this.designer.createColumnWidget(row, true);
1610
- fieldWidget.options = columnOption;
1611
- row.editWidget = fieldWidget;
1612
- this.$forceUpdate();
1613
- }
1614
-
1615
- /*row.prop = columnOption.name;
1616
- row.label = columnOption.label;
1617
- row.required = columnOption.required;*/
1911
+ confirmEditFormatConfigDialog(columnSelectedWidget, row) {
1912
+ row.editWidget = columnSelectedWidget;
1913
+ },
1914
+ openColumnShowDialog(row) {
1915
+ this.editFormEventHandler(row, this.rowDataIndex, "columnShow");
1618
1916
  },
1619
1917
  openTableColumnConfigDialog(row, index) {
1620
1918
  this.operateIndex = index;
@@ -1632,7 +1930,6 @@ export default {
1632
1930
  this.showTableColumnConfigDialog = true;
1633
1931
  },
1634
1932
  saveTableColumnConfigDialog() {
1635
- // let row = this.tableData[this.operateIndex];
1636
1933
  let row = this.currentTableColumn;
1637
1934
  const codeHints = this.$refs.ecEditor.getEditorAnnotations();
1638
1935
  let syntaxErrorFlag = false;
@@ -1681,41 +1978,50 @@ export default {
1681
1978
  )
1682
1979
  : null;
1683
1980
 
1684
- if (newWidget.formItemFlag) {
1685
- if (row.widget) {
1686
- if (row.widget.options[key] !== undefined)
1687
- row.widget.options[key] = value;
1688
- }
1689
- if (row.columnOption) {
1690
- if (row.columnOption[key] !== undefined)
1691
- row.columnOption[key] = value;
1981
+ if (newWidget && newWidget.formItemFlag && row.widget) {
1982
+ if (row.widget.options[key] !== undefined) {
1983
+ row.widget.options[key] = value;
1692
1984
  }
1693
1985
  }
1694
1986
 
1695
- if (newWidget.formItemFlag) {
1696
- if (row.editWidget) {
1697
- if (row.editWidget.options[key] !== undefined)
1698
- row.editWidget.options[key] = value;
1699
- }
1700
- if (row.editColumnOption) {
1701
- if (row.editColumnOption[key] !== undefined)
1702
- row.editColumnOption[key] = value;
1987
+ if (newEditWidget && newEditWidget.formItemFlag && row.editWidget) {
1988
+ if (row.editWidget.options[key] !== undefined) {
1989
+ row.editWidget.options[key] = value;
1703
1990
  }
1704
1991
  }
1705
1992
  },
1706
1993
  openRowEditDialog(row, index) {
1707
1994
  this.editRowData = row;
1708
- this.rowData = this.$baseLodash.cloneDeep(row);
1995
+ this.rowData = this.cloneTableColumnsForEdit([row])[0];
1709
1996
  this.rowDataIndex = index;
1710
1997
  this.showRowEditDialog = true;
1711
1998
  },
1712
1999
  submitRowEditDialog() {
1713
- Object.assign(this.editRowData, this.$baseLodash.cloneDeep(this.rowData));
1714
- // this.editRowData = this.$baseLodash.cloneDeep(this.rowData);
2000
+ Object.assign(this.editRowData, this.rowData);
2001
+ if (this.rowData.widget) {
2002
+ this.editRowData.widget = this.rowData.widget;
2003
+ }
2004
+ if (this.rowData.editWidget) {
2005
+ this.editRowData.editWidget = this.rowData.editWidget;
2006
+ }
2007
+ if (this.rowData.widgetList && this.rowData.widgetList.length) {
2008
+ this.editRowData.widgetList = this.rowData.widgetList;
2009
+ }
1715
2010
  this.showRowEditDialog = false;
2011
+ this.labelTooltipDialogVisible = false;
1716
2012
  },
1717
2013
  closeRowEditDialog() {
1718
2014
  this.showRowEditDialog = false;
2015
+ this.labelTooltipDialogVisible = false;
2016
+ },
2017
+ openLabelTooltipDialog() {
2018
+ this.labelTooltipValue = this.rowData.labelTooltip || "";
2019
+ this.labelTooltipDialogVisible = true;
2020
+ },
2021
+ submitLabelTooltipDialog() {
2022
+ const value = (this.labelTooltipValue || "").trim();
2023
+ this.rowData.labelTooltip = value || null;
2024
+ this.labelTooltipDialogVisible = false;
1719
2025
  },
1720
2026
  },
1721
2027
  };
@@ -1724,4 +2030,70 @@ export default {
1724
2030
  .icon-drag:before {
1725
2031
  content: "\e61d";
1726
2032
  }
2033
+
2034
+ /* 固定弹框内容区高度,避免加载前后抖动 */
2035
+ ::v-deep .table-column-config-dialog.el-dialog {
2036
+ .el-dialog__body {
2037
+ height: 532px;
2038
+ max-height: 532px;
2039
+ overflow: hidden;
2040
+ box-sizing: border-box;
2041
+ }
2042
+ }
2043
+
2044
+ .table-column-dialog-cont {
2045
+ height: 516px;
2046
+ min-height: 516px;
2047
+ max-height: 516px;
2048
+ overflow: hidden;
2049
+ box-sizing: border-box;
2050
+ }
2051
+
2052
+ /* 完整列配置弹框:挂到 body,内容区可滚动 */
2053
+ ::v-deep .table-column-row-edit-dialog.el-dialog {
2054
+ .el-dialog__body {
2055
+ max-height: calc(90vh - 130px);
2056
+ overflow-y: auto;
2057
+ overflow-x: hidden;
2058
+ box-sizing: border-box;
2059
+
2060
+ .cont.table-column-row-edit-cont {
2061
+ overflow: visible;
2062
+ max-height: none;
2063
+ padding-bottom: 12px;
2064
+ }
2065
+
2066
+ .form-m2 {
2067
+ height: auto !important;
2068
+ overflow: visible !important;
2069
+
2070
+ .el-form-item.form-item-full:last-child {
2071
+ margin-bottom: 8px;
2072
+ }
2073
+ }
2074
+ }
2075
+ }
2076
+
2077
+ .table-column-row-edit-cont {
2078
+ box-sizing: border-box;
2079
+
2080
+ ::v-deep .form-m2 {
2081
+ .form-item-full {
2082
+ width: calc(100% - 20px) !important;
2083
+ display: block;
2084
+ }
2085
+
2086
+ .form-item-full .el-input {
2087
+ width: 100% !important;
2088
+ }
2089
+ }
2090
+
2091
+ ::v-deep .custom-divider.el-divider--horizontal {
2092
+ margin: 10px 0;
2093
+ }
2094
+ }
2095
+
2096
+ ::v-deep .label-tooltip-textarea textarea {
2097
+ min-height: 320px;
2098
+ }
1727
2099
  </style>