bri-components 1.3.98 → 1.4.0

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.
@@ -45,6 +45,12 @@ export default {
45
45
  return {};
46
46
  }
47
47
  },
48
+ tableDataObj: {
49
+ type: Object,
50
+ default () {
51
+ return {};
52
+ }
53
+ },
48
54
 
49
55
  allFormList: {
50
56
  type: Array,
@@ -108,35 +114,15 @@ export default {
108
114
  disabled: false,
109
115
  event: "clickCreate"
110
116
  },
111
- canCreateChild: {
112
- name: "添加一行下级",
113
- type: "canCreateChild",
114
- btnType: "default",
115
- icon: "md-add-circle",
116
- size: "default",
117
- color: "#3DB8C5",
118
- disabled: false,
119
- event: "clickCreateChild"
120
- },
121
117
  canDelete: {
122
118
  name: "删除",
123
119
  type: "canDelete",
124
120
  btnType: "errorText",
125
- icon: "ios-trash-outline",
121
+ icon: "md-trash",
126
122
  size: "small",
127
123
  color: "#E83636",
128
124
  disabled: false,
129
125
  event: "clickDelete"
130
- },
131
- canDeleteChilds: {
132
- name: "删除所有子级",
133
- type: "canDeleteChilds",
134
- btnType: "errorText",
135
- icon: "ios-trash-outline",
136
- size: "small",
137
- color: "#E83636",
138
- disabled: false,
139
- event: "clickDeleteChilds"
140
126
  }
141
127
  },
142
128
  otherOperationMap: {
@@ -231,15 +217,15 @@ export default {
231
217
 
232
218
  _showRequired: true, // 表头显示校验符号*
233
219
  _showDescription: true, // 表头显示提示
220
+ _contentHeight: 500, // 表格最大高度
234
221
  _headHeightAuto: false, // 表头高度自适应
235
222
  _heightAuto: false, // 单元格高度自适应
236
223
  _useSelection: false, // 使用选择列 -配置端暂时用不到
237
224
  _useIndex: true, // 使用序号列
238
225
  _useSummary: false, // 使用汇总行
239
- _mergeRowColKeys: [], // 合并行的列
240
226
 
241
227
  _disabledBtns: false, // 禁用增删按钮
242
- _showCreateBtnColKeys: [], // 显示添加图标的列
228
+ _showCreateBtnColKeys: [], // 显示增删图标的列
243
229
  _disabledFootCreateBtn: false, // 禁用底部新增按钮
244
230
  _disabledDeleteDftRow: false, // 默认的数据行禁止删除
245
231
  _disabledDeleteOldRow: false, // 保存的数据行禁止删除
@@ -271,9 +257,9 @@ export default {
271
257
  list: [],
272
258
  tree: []
273
259
  },
260
+ ...(this.selfBasePropsObj || {}),
274
261
 
275
- ...this.propsObj,
276
- _contentHeight: this.propsObj._contentHeight || 500 // 表格最大高度
262
+ ...this.propsObj
277
263
  };
278
264
  },
279
265
  selfPropsObj () {
@@ -297,7 +283,7 @@ export default {
297
283
  },
298
284
 
299
285
  contentHeight () {
300
- return this.selfPropsObj._contentHeight;
286
+ return this.selfPropsObj._contentHeight || 500;
301
287
  },
302
288
  showRequired () {
303
289
  return this.selfPropsObj._showRequired;
@@ -320,15 +306,12 @@ export default {
320
306
  useSummary () {
321
307
  return this.selfPropsObj._useSummary;
322
308
  },
323
- mergeRowColKeys () {
324
- return this.selfPropsObj._mergeRowColKeys || []; // 配置端有问题,高级以依赖时候值成undefined了
325
- },
326
309
 
327
310
  disabledBtns () {
328
311
  return this.isDftSet ? false : this.selfPropsObj._disabledBtns;
329
312
  },
330
313
  showCreateBtnColKeys () {
331
- return this.selfPropsObj._showCreateBtnColKeys || []; // 配置端有问题,高级以依赖时候值成undefined了
314
+ return this.selfPropsObj._showCreateBtnColKeys || []; // 配置端有问题,高级依赖时值成undefined了
332
315
  },
333
316
  disabledFootCreateBtn () {
334
317
  return this.isDftSet ? false : this.selfPropsObj._disabledFootCreateBtn;
@@ -344,13 +327,13 @@ export default {
344
327
  return this.isDftSet ? false : this.selfPropsObj._dftReadonly;
345
328
  },
346
329
  dftReadonlyColKeys () {
347
- return this.isDftSet ? [] : this.selfPropsObj._dftReadonlyColKeys || []; // 配置端有问题,高级以依赖时候值成undefined了
330
+ return this.isDftSet ? [] : this.selfPropsObj._dftReadonlyColKeys || []; // 配置端有问题,高级依赖时值成undefined了
348
331
  },
349
332
  oldReadonly () {
350
333
  return this.isDftSet ? false : this.selfPropsObj._oldReadonly;
351
334
  },
352
335
  oldReadonlyColKeys () {
353
- return this.isDftSet ? [] : this.selfPropsObj._oldReadonlyColKeys || []; // 配置端有问题,高级以依赖时候值成undefined了
336
+ return this.isDftSet ? [] : this.selfPropsObj._oldReadonlyColKeys || []; // 配置端有问题,高级依赖时值成undefined了
354
337
  },
355
338
 
356
339
  searchLabelWidth () {
@@ -473,9 +456,6 @@ export default {
473
456
  selfColumns () {
474
457
  return this.columns;
475
458
  },
476
- mergeRowColumns () {
477
- return this.selfColumns.filter(colItem => this.mergeRowColKeys.includes(colItem._key));
478
- },
479
459
  filterColumns () {
480
460
  return this.selfColumns.filter(colItem => this.$isAdvRelyShow(colItem, this.allListData, this.parentObj, true));
481
461
  },
@@ -516,25 +496,14 @@ export default {
516
496
  _key: "__operation__",
517
497
  key: "__operation__",
518
498
  field: "__operation__",
499
+ _align: "center",
519
500
  align: "center",
501
+ _fixed: "right",
520
502
  fixed: "right",
503
+ _width: 100,
521
504
  width: 100,
522
505
  renderBodyCell: ({ row, rowIndex, column }, h) => {
523
- const operationList = this.$getOperationList(["canDelete"]);
524
-
525
- return h("dsh-buttons", {
526
- props: {
527
- list: operationList.map(btnItem => ({
528
- ...btnItem,
529
- disabled: !this.getRowBtnCanEdit(row, rowIndex)
530
- }))
531
- },
532
- on: {
533
- click: (operationItem) => {
534
- this.$dispatchEvent(operationItem, row, rowIndex);
535
- }
536
- }
537
- });
506
+ return this.operationTdCellRender(h, { row, rowIndex, column });
538
507
  }
539
508
  };
540
509
  },
@@ -551,37 +520,11 @@ export default {
551
520
  columnHiddenOption: {
552
521
  defaultHiddenColumnKeys: [...this.hideColKeys] // 必须这么写,不解构,切换一次隐藏/显示后,hideColKeys会变成空数组
553
522
  },
554
- cellStyleOption: this.cellStyleOption,
523
+ cellStyleOption: {
524
+ bodyCellClass: this.bodyCellClass
525
+ },
555
526
  cellSpanOption: {
556
- bodyCellSpan: ({ row, rowIndex, column }) => {
557
- // 合并单元格(单元格值为空时不合并)
558
- if (this.mergeRowColKeys.includes(column._key)) {
559
- if (this.$isEmptyData(row[column._key])) {
560
- return {
561
- rowspan: 1,
562
- colspan: 1
563
- };
564
- }
565
- else {
566
- if (
567
- rowIndex !== 0 &&
568
- row[column._key] === this.showListData[rowIndex - 1][column._key]
569
- ) {
570
- return {
571
- rowspan: 0,
572
- colspan: 0
573
- };
574
- } else {
575
- const newList = this.showListData.slice(rowIndex);
576
- const newIndex = newList.findIndex(rowItem => row[column._key] !== rowItem[column._key]);
577
- return {
578
- rowspan: newIndex === -1 ? newList.length : newIndex,
579
- colspan: 1
580
- };
581
- }
582
- }
583
- }
584
- }
527
+ bodyCellSpan: this.bodyCellSpan
585
528
  },
586
529
  eventCustomOption: {
587
530
  bodyCellEvents: ({ row, rowIndex, column }) => {
@@ -606,37 +549,6 @@ export default {
606
549
  }
607
550
  };
608
551
  },
609
- cellStyleOption () {
610
- return {
611
- bodyCellClass: ({ row, rowIndex, column }) => {
612
- return "bri-table-td" +
613
- `${this.mergeRowColKeys.includes(column._key)
614
- ? " bri-table-td-merge"
615
- : ""
616
- }` +
617
- `${this.getRowCanEdit(row, rowIndex)
618
- ? " bri-table-td-edit"
619
- : ""
620
- }` +
621
- `${this.isSearching
622
- ? row.__isSearchShow__ === false
623
- ? " bri-table-td-hide"
624
- : ""
625
- : row.__isShow__ === true
626
- ? this.isExpandAction
627
- ? " bri-table-td-visible"
628
- : ""
629
- : " bri-table-td-hide"
630
- }` +
631
- `${["__isExpand__"].includes(column._key)
632
- ? " bri-table-td-expand"
633
- : ["__index__"].includes(column._key)
634
- ? " bri-table-td-index"
635
- : ""
636
- }`;
637
- }
638
- };
639
- },
640
552
 
641
553
  hideColKeys () {
642
554
  return this.selfPropsObj._hideColKeys;
@@ -724,17 +636,12 @@ export default {
724
636
  : this.baseOperationMap.canCreate.name
725
637
  // disabled: !!this.disabledCreateBtn
726
638
  },
727
- canCreateChild: {
728
- ...this.baseOperationMap.canCreateChild,
729
- name: this.showMode === "form"
730
- ? this.baseOperationMap.canCreateChild.name.replace("行", "条")
731
- : this.baseOperationMap.canCreateChild.name
732
- // disabled: !!this.disabledCreateBtn
733
- },
734
639
  canHideOrShow: {
735
640
  ...this.topOperationMap.canHideOrShow,
736
641
  name: this.hideStatus ? "显示字段" : "隐藏字段"
737
- }
642
+ },
643
+
644
+ ...(this.selfAllOperationMap || {})
738
645
  };
739
646
  },
740
647
  operationMap () {
@@ -818,6 +725,9 @@ export default {
818
725
  this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
819
726
  this.change("changeVal", row, rowIndex, col, ...params);
820
727
  },
728
+ change (eventType, row, rowIndex, col, ...params) {
729
+ this.$emit("change", this.tableDataObj, eventType, col, row, rowIndex, ...params);
730
+ },
821
731
 
822
732
  /* ----------- 隐藏/显示字段 ---------- */
823
733
  toggleHideOrShow () {
@@ -990,7 +900,7 @@ export default {
990
900
  window.location.href = data.url;
991
901
  } else if (data.status === "failed") {
992
902
  this.$Message.info({
993
- content: "操作失败,请稍后再试"
903
+ content: "操作失败,请稍后再试!"
994
904
  });
995
905
  }
996
906
  },
@@ -1069,6 +979,7 @@ export default {
1069
979
  "font-weight": "500"
1070
980
  }
1071
981
  }, this.selfLogicPropsObj._name + ":"),
982
+
1072
983
  h("dsh-select", {
1073
984
  style: {
1074
985
  "margin-left": "8px",
@@ -1104,6 +1015,24 @@ export default {
1104
1015
  }
1105
1016
  });
1106
1017
  },
1018
+ createBtnRender (h) {
1019
+ return !this.isSearching && this.disabledFootCreateBtn !== true
1020
+ ? h("dsh-buttons", {
1021
+ style: {
1022
+ "margin-top": "3px"
1023
+ },
1024
+ props: {
1025
+ itemClass: undefined,
1026
+ list: this.$getOperationList(["canCreate"])
1027
+ },
1028
+ on: {
1029
+ click: (event) => {
1030
+ this.$dispatchEvent(event);
1031
+ }
1032
+ }
1033
+ })
1034
+ : undefined;
1035
+ },
1107
1036
  contentThCellRender (h, { column }) {
1108
1037
  column = this.$transformDynamicProperty(column, undefined, this.parentObj);
1109
1038
 
@@ -1113,7 +1042,7 @@ export default {
1113
1042
  headHeightAuto: this.headHeightAuto
1114
1043
  });
1115
1044
  },
1116
- contentTdCellRender (h, { row, rowIndex, column }) {
1045
+ contentTdCellRender (h, { row, rowIndex, column }, position) {
1117
1046
  column = this.$transformDynamicProperty(column, row, this.parentObj);
1118
1047
  column = this.getResetCol(row, rowIndex, column);
1119
1048
  const unitCanEdit = this.getUnitCanEdit(row, rowIndex, column);
@@ -1138,7 +1067,11 @@ export default {
1138
1067
  props: {
1139
1068
  canEdit: unitCanEdit,
1140
1069
  formData: row,
1141
- formItem: column,
1070
+ formItem: {
1071
+ ...column,
1072
+ _key: position === "tree" ? "name" : column._key,
1073
+ _heightAuto: column._heightAuto || position === "tree"
1074
+ },
1142
1075
  allFormList: this.selfColumns,
1143
1076
  inTableType: this.inTableType,
1144
1077
  allListRows: this.allListData,
@@ -1157,7 +1090,11 @@ export default {
1157
1090
  props: {
1158
1091
  canEdit: unitCanEdit,
1159
1092
  formData: row,
1160
- formItem: column,
1093
+ formItem: {
1094
+ ...column,
1095
+ _key: position === "tree" ? "name" : column._key,
1096
+ _heightAuto: column._heightAuto || position === "tree"
1097
+ },
1161
1098
  allFormList: this.selfColumns,
1162
1099
  inTableType: this.inTableType,
1163
1100
  allListRows: this.allListData,
@@ -1179,30 +1116,31 @@ export default {
1179
1116
  : undefined,
1180
1117
 
1181
1118
  // 添加符
1182
- ...this.createIconRender(h, { row, rowIndex, column }, 12)
1119
+ ...this.operationIconRender(h, { row, rowIndex, column }, 12)
1183
1120
  ];
1184
1121
  },
1185
- createBtnRender (h) {
1186
- return !this.isSearching && this.disabledFootCreateBtn !== true
1187
- ? h("dsh-buttons", {
1188
- style: {
1189
- "margin-top": "3px"
1190
- },
1122
+ operationTdCellRender (h, { row, rowIndex, column }) {
1123
+ const operationList = this.$getOperationList(["canDelete"]).map(btnItem => ({
1124
+ ...btnItem,
1125
+ disabled: !this.getRowDelBtnCanEdit(row, rowIndex)
1126
+ }));
1127
+
1128
+ return [
1129
+ h("dsh-buttons", {
1191
1130
  props: {
1192
- itemClass: undefined,
1193
- list: this.$getOperationList(["canCreate"])
1131
+ list: operationList
1194
1132
  },
1195
1133
  on: {
1196
- click: (event) => {
1197
- this.$dispatchEvent(event);
1134
+ click: (operationItem) => {
1135
+ this.$dispatchEvent(operationItem, row, rowIndex);
1198
1136
  }
1199
1137
  }
1200
1138
  })
1201
- : undefined;
1139
+ ];
1202
1140
  },
1203
- createIconRender (h, { row, rowIndex, column }, iconSize = 14) {
1141
+ operationIconRender (h, { row, rowIndex, column }, iconSize = 14) {
1204
1142
  return [
1205
- // 插入一行添加符
1143
+ // 插入一行图标
1206
1144
  (this.operationMap.canCreate && this.operationMap.canCreate.disabled !== true) &&
1207
1145
  !this.isSearching &&
1208
1146
  (column._key === "__index__" ? !this.showCreateBtnColKeys.length : this.showCreateBtnColKeys.includes(column._key)) &&
@@ -1215,6 +1153,7 @@ export default {
1215
1153
  width: `${iconSize + 2}px`,
1216
1154
  height: `${iconSize + 2}px`,
1217
1155
  border: `1px solid ${this.appColor}`,
1156
+ borderRadius: "2px",
1218
1157
  backgroundColor: "#ffffff",
1219
1158
  lineHeight: `${iconSize - 2}px`,
1220
1159
  cursor: "pointer",
@@ -1248,13 +1187,13 @@ export default {
1248
1187
  ])
1249
1188
  : h("span", ""),
1250
1189
 
1251
- // 添加一行下级添加符
1252
- ["treeTable"].includes(this.inTableType) &&
1253
- (this.operationMap.canCreateChild && this.operationMap.canCreateChild.disabled !== true) &&
1190
+ // 添加一行下级图标
1191
+ (this.operationMap.canCreateChild && this.operationMap.canCreateChild.disabled !== true) &&
1254
1192
  !this.isSearching &&
1255
1193
  (column._key === "__index__" ? !this.showCreateBtnColKeys.length : this.showCreateBtnColKeys.includes(column._key)) &&
1256
1194
  this.hoverRecordMap[`${row._id}dsh${column._key}`] &&
1257
- row.level < this.maxLevel
1195
+ row.level < this.maxLevel &&
1196
+ !["cascaderTable"].includes(this.inTableType) // 老版级联表格类型不要“添加下级”图标
1258
1197
  ? h("div", {
1259
1198
  style: {
1260
1199
  position: "absolute",
@@ -1264,6 +1203,7 @@ export default {
1264
1203
  width: `${iconSize + 2}px`,
1265
1204
  height: `${iconSize + 2}px`,
1266
1205
  border: `1px solid ${this.appColor}`,
1206
+ borderRadius: "2px",
1267
1207
  backgroundColor: "#ffffff",
1268
1208
  lineHeight: `${iconSize - 2}px`,
1269
1209
  cursor: "pointer",
@@ -1280,7 +1220,7 @@ export default {
1280
1220
  }, [
1281
1221
  h("Icon", {
1282
1222
  style: {
1283
- fontWeight: "600",
1223
+ fontWeight: "500",
1284
1224
  color: this.appColor
1285
1225
  },
1286
1226
  props: {
@@ -1295,9 +1235,85 @@ export default {
1295
1235
  })
1296
1236
  ])
1297
1237
  ])
1238
+ : h("span", ""),
1239
+
1240
+ // 删除该行图标
1241
+ (this.operationMap.canDelete && this.operationMap.canDelete.disabled !== true) &&
1242
+ !this.isSearching &&
1243
+ (column._key === "__index__" ? !this.showCreateBtnColKeys.length : this.showCreateBtnColKeys.includes(column._key)) &&
1244
+ this.hoverRecordMap[`${row._id}dsh${column._key}`] &&
1245
+ this.getRowDelBtnCanEdit(row, rowIndex) &&
1246
+ ["cascaderTable"].includes(this.inTableType)
1247
+ ? h("div", {
1248
+ style: {
1249
+ position: "absolute",
1250
+ bottom: "0px",
1251
+ right: `${iconSize + 3}px`,
1252
+ width: `${iconSize + 2}px`,
1253
+ height: `${iconSize + 2}px`,
1254
+ border: `1px solid ${this.operationMap.canDelete.color}`,
1255
+ borderRadius: "2px",
1256
+ backgroundColor: "#ffffff",
1257
+ lineHeight: `${iconSize - 2}px`,
1258
+ cursor: "pointer",
1259
+ verticalAlign: "middle",
1260
+ transition: "color .2s ease-in-out,border-color .2s ease-in-out"
1261
+ }
1262
+ }, [
1263
+ h("Tooltip", {
1264
+ props: {
1265
+ content: "删除该行",
1266
+ maxWidth: "250",
1267
+ transfer: true
1268
+ }
1269
+ }, [
1270
+ h("Icon", {
1271
+ style: {
1272
+ fontWeight: "500",
1273
+ color: this.operationMap.canDelete.color
1274
+ },
1275
+ props: {
1276
+ type: this.operationMap.canDelete.icon,
1277
+ size: iconSize
1278
+ },
1279
+ on: {
1280
+ click: () => {
1281
+ this.$dispatchEvent(this.operationMap.canDelete, row, rowIndex, column);
1282
+ }
1283
+ }
1284
+ })
1285
+ ])
1286
+ ])
1298
1287
  : h("span", "")
1299
1288
  ];
1300
1289
  },
1290
+ bodyCellClass ({ row, rowIndex, column }) {
1291
+ return "bri-table-td" +
1292
+ `${this.mergeRowColKeys && this.mergeRowColKeys.includes(column._key)
1293
+ ? " bri-table-td-merge"
1294
+ : ""
1295
+ }` +
1296
+ `${this.getRowCanEdit(row, rowIndex)
1297
+ ? " bri-table-td-edit"
1298
+ : ""
1299
+ }` +
1300
+ `${this.isSearching
1301
+ ? row.__isSearchShow__ === false
1302
+ ? " bri-table-td-hide"
1303
+ : ""
1304
+ : row.__isShow__ === true
1305
+ ? this.isExpandAction
1306
+ ? " bri-table-td-visible"
1307
+ : ""
1308
+ : " bri-table-td-hide"
1309
+ }` +
1310
+ `${["__isExpand__"].includes(column._key)
1311
+ ? " bri-table-td-expand"
1312
+ : ["__index__"].includes(column._key)
1313
+ ? " bri-table-td-index"
1314
+ : ""
1315
+ }`;
1316
+ },
1301
1317
 
1302
1318
  /* ----------- 方法 ---------- */
1303
1319
  // 生成新的一行数据
@@ -1358,7 +1374,7 @@ export default {
1358
1374
  return this.isDftSet ? false : row.__isDefault__;
1359
1375
  },
1360
1376
  // 行按钮是否可操作(删除按钮可编辑 不代表行内容是可编辑的)
1361
- getRowBtnCanEdit (row, rowIndex) {
1377
+ getRowDelBtnCanEdit (row, rowIndex) {
1362
1378
  return this.canEdit && // 是编辑状态
1363
1379
  (this.disabledDeleteDftRow ? row.__isDefault__ !== true : true) && // 默认数据可删除
1364
1380
  (this.disabledDeleteOldRow ? row.__old__ !== true : true) && // 老数据可删除
@@ -1406,18 +1422,10 @@ export default {
1406
1422
  },
1407
1423
  // 加工单元格对应的配置
1408
1424
  getResetCol (row, rowIndex, col) {
1409
- let resetMap = {
1410
- select: {
1411
- _optionKind: "dropdown"
1412
- },
1413
- checkbox: {
1414
- _optionKind: "dropdown"
1415
- }
1416
- };
1417
1425
  return {
1418
- ...col,
1419
- ...(resetMap[col._type] || {}),
1420
1426
  // isShare: this.isShare,
1427
+ ...col,
1428
+ _optionKind: "dropdown",
1421
1429
  _heightAuto: this.heightAuto
1422
1430
  };
1423
1431
  },
@@ -1443,7 +1451,8 @@ export default {
1443
1451
  (row.__isQuote__ ? !this.quoteReadonlyColKeys.includes(col._key) : true) && // 引用过来的数据是否可编辑
1444
1452
  !["calculate"].includes(col._enterType) && // 计算的不可编辑
1445
1453
  col._readonly !== true && // 只读
1446
- col.canEdit !== false; // 字段本身编辑权限 考虑为undefined时候
1454
+ col.canEdit !== false && // 字段本身编辑权限 考虑为undefined时候
1455
+ (!this.getTypeColCanEdit || this.getTypeColCanEdit(row, rowIndex, col));
1447
1456
  },
1448
1457
  // 单元格最终编辑状态
1449
1458
  getUnitCanEdit (row, rowIndex, col) {
@@ -6,30 +6,53 @@ export default {
6
6
  props: {},
7
7
  data () {
8
8
  return {
9
- searchMode: "flat" // "flat", "tree"
9
+ searchMode: "flat", // "flat", "tree"
10
+
11
+ baseOperationMap: {
12
+ canCreateChild: {
13
+ name: "添加一行下级",
14
+ type: "canCreateChild",
15
+ btnType: "default",
16
+ icon: "md-add-circle",
17
+ size: "default",
18
+ color: "#3DB8C5",
19
+ disabled: false,
20
+ event: "clickCreateChild"
21
+ }
22
+ // canDeleteChilds: {
23
+ // name: "删除所有子级",
24
+ // type: "canDeleteChilds",
25
+ // btnType: "errorText",
26
+ // icon: "ios-trash-outline",
27
+ // size: "small",
28
+ // color: "#E83636",
29
+ // disabled: false,
30
+ // event: "clickDeleteChilds"
31
+ // }
32
+ }
10
33
  };
11
34
  },
12
35
  computed: {
13
- selfPropsObj () {
36
+ treeTableBasePropsObj () {
14
37
  return {
15
38
  _treeForm: [],
16
- ...(this.typePropsObj || {}),
17
- ...this.commonPropsObj,
18
-
19
- _maxLevel: this.commonPropsObj._maxLevel || 3 // 最大级数
39
+ _maxLevel: 3 // 最大级数
20
40
  };
21
41
  },
42
+ treeForm () {
43
+ return this.selfPropsObj._treeForm;
44
+ },
22
45
  maxLevel () {
23
- return this.selfPropsObj._maxLevel;
46
+ return this.selfPropsObj._maxLevel || 3;
24
47
  },
25
48
 
26
49
  selfColumns () {
27
50
  return this.columns.map(column => {
28
- // 层级表格类型,level字段的进行特殊处理(_treeForm加工成_data)
51
+ // 层级表格类型,level字段的进行特殊处理(treeForm加工成_data)
29
52
  return column._key === "level"
30
53
  ? {
31
54
  ...column,
32
- _data: this.selfPropsObj._treeForm.map((treeFormItem, treeFormIndex) => ({
55
+ _data: this.treeForm.map((treeFormItem, treeFormIndex) => ({
33
56
  name: treeFormItem._name,
34
57
  _key: (treeFormIndex + 1),
35
58
  color: Object.keys(resourceData.colorMap)[treeFormIndex + 1]
@@ -37,6 +60,17 @@ export default {
37
60
  }
38
61
  : column;
39
62
  });
63
+ },
64
+ selfAllOperationMap () {
65
+ return {
66
+ canCreateChild: {
67
+ ...this.baseOperationMap.canCreateChild,
68
+ name: this.showMode === "form"
69
+ ? this.baseOperationMap.canCreateChild.name.replace("行", "条")
70
+ : this.baseOperationMap.canCreateChild.name
71
+ // disabled: !!this.disabledCreateBtn
72
+ }
73
+ };
40
74
  }
41
75
  },
42
76
  created () { },
@@ -85,18 +119,18 @@ export default {
85
119
  }
86
120
  });
87
121
  },
88
- // 节点操作 -删除所有子行
89
- clickDeleteChilds (operationItem, row, rowIndex, col) {
90
- this.$Modal.confirm({
91
- title: "警告",
92
- content: "确定删除所有下级吗?",
93
- onOk: () => {
94
- row.children.splice(0);
122
+ // // 节点操作 -删除所有子行
123
+ // clickDeleteChilds (operationItem, row, rowIndex, col) {
124
+ // this.$Modal.confirm({
125
+ // title: "警告",
126
+ // content: "确定删除所有下级吗?",
127
+ // onOk: () => {
128
+ // row.children.splice(0);
95
129
 
96
- this.change("deleteChildRows", row, rowIndex, null);
97
- }
98
- });
99
- },
130
+ // this.change("deleteChildRows", row, rowIndex, null);
131
+ // }
132
+ // });
133
+ // },
100
134
 
101
135
  // 展开/隐藏节点
102
136
  toggleExpand (row, bool = true) {