bri-components 1.6.12 → 1.6.14

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.
@@ -442,9 +442,17 @@ export default {
442
442
  };
443
443
  },
444
444
 
445
+ // 新增数据状态
446
+ isCreateStatus () {
447
+ return this.parentObj.__isCreate__ === true;
448
+ },
449
+ // 表格行可增删状态
450
+ isRowCDStatus () {
451
+ return this.isCreateStatus;
452
+ },
445
453
  // 是否筛选状态
446
454
  isSearching () {
447
- return this.parentObj.__isCreate__ === true
455
+ return this.isRowCDStatus
448
456
  ? false
449
457
  : this.$isAdvSearching(this.finalTableAdvSearch);
450
458
  },
@@ -692,7 +700,7 @@ export default {
692
700
  : dftVal
693
701
  : dftInRowVal
694
702
  });
695
- }, {});
703
+ }, this.$deepCopy(this.rowDefault));
696
704
  },
697
705
  parentDataId () {
698
706
  return this.parentObj._id;
@@ -761,8 +769,7 @@ export default {
761
769
  ...(
762
770
  this.canEdit
763
771
  ? [
764
- ...(this.disabledBtns ? [] : this.baseOperationBtns.filter(btn => !["canMoveUp", "canMoveDown"].includes(btn))),
765
- ...(this.useMoveBtns ? ["canMoveUp", "canMoveDown"] : []),
772
+ ...(this.disabledBtns ? [] : this.baseOperationBtns.filter(btn => ["canMoveUp", "canMoveDown"].includes(btn) ? this.useMoveBtns : true)),
766
773
  ...this.otherOperationBtns,
767
774
  ...(this.isQuote ? ["canQuote"] : []),
768
775
  ...(this.isImport ? ["canImport"] : [])
@@ -852,7 +859,7 @@ export default {
852
859
 
853
860
  // 筛选回调
854
861
  searchCb (conditions) {
855
- if (this.parentObj.__isCreate__ !== true) {
862
+ if (!this.isRowCDStatus) {
856
863
  this.isExpandAction = false;
857
864
  this.dftAdvSearch.conditions = conditions;
858
865
 
@@ -868,11 +875,13 @@ export default {
868
875
  // 输入框失去焦点
869
876
  controlBlur (operationItem, row, rowIndex, column, params) {
870
877
  this.dealRuleRecord(row, column);
878
+ this.dealOtherColRuleRecord(row, column);
871
879
  },
872
880
  // 输入框值改变立即
873
881
  quickChangeVal (operationItem, row, rowIndex, column, params) {
874
882
  if (["text", "textarea", "idcard", "email", "phone", "url", "password"].includes(column._type)) {
875
883
  this.dealRuleRecord(row, column);
884
+ this.dealOtherColRuleRecord(row, column);
876
885
  this.change("quickChangeVal", row, rowIndex, column, ...params);
877
886
  }
878
887
  },
@@ -880,6 +889,7 @@ export default {
880
889
  changeVal (operationItem, row, rowIndex, column, params) {
881
890
  if (!["text", "textarea", "idcard", "email", "phone", "url", "password"].includes(column._type)) {
882
891
  this.dealRuleRecord(row, column);
892
+ this.dealOtherColRuleRecord(row, column);
883
893
  this.change("changeVal", row, rowIndex, column, ...params);
884
894
  }
885
895
  },
@@ -1132,7 +1142,7 @@ export default {
1132
1142
  };
1133
1143
  },
1134
1144
  topSummaryRender (h) {
1135
- return this.searchFormList.length
1145
+ return this.searchFormList.length && !this.isRowCDStatus
1136
1146
  ? h("div", {
1137
1147
  style: {
1138
1148
  "display": "flex",
@@ -1199,7 +1209,7 @@ export default {
1199
1209
  });
1200
1210
  },
1201
1211
  topSearchRender (h) {
1202
- return this.searchFormList.length
1212
+ return this.searchFormList.length && !this.isRowCDStatus
1203
1213
  ? h("dsh-default-search", {
1204
1214
  props: {
1205
1215
  formList: this.searchFormList,
@@ -1323,9 +1333,9 @@ export default {
1323
1333
  const operationList = this.rowOperationList.map(btnItem => ({
1324
1334
  ...btnItem,
1325
1335
  disabled: btnItem.type === "canMoveUp"
1326
- ? !(this.getRowDelBtnCanEdit(row, rowIndex) && ["last", "center"].includes(row.__position__))
1336
+ ? !(this.getRowMoveBtnCanEdit(row, rowIndex) && ["last", "center"].includes(row.__position__))
1327
1337
  : btnItem.type === "canMoveDown"
1328
- ? !(this.getRowDelBtnCanEdit(row, rowIndex) && ["first", "center"].includes(row.__position__))
1338
+ ? !(this.getRowMoveBtnCanEdit(row, rowIndex) && ["first", "center"].includes(row.__position__))
1329
1339
  : btnItem.type === "canDelete"
1330
1340
  ? !this.getRowDelBtnCanEdit(row, rowIndex)
1331
1341
  : btnItem.disabled
@@ -1352,76 +1362,76 @@ export default {
1352
1362
 
1353
1363
  return [
1354
1364
  // 插入一行图标
1355
- baseBool
1356
- ? this.getOperationIconRender(h, { row, rowIndex, column }, "canInsert", iconSize, ++sortNum)
1365
+ baseBool && this.operationMap.canInsert && this.operationMap.canInsert.disabled !== true
1366
+ ? this.getOperationIconRender(h, { row, rowIndex, column }, this.operationMap.canInsert, iconSize, ++sortNum)
1357
1367
  : h("span", ""),
1358
1368
 
1359
- // 添加一行下级图标
1360
- baseBool && ["treeTable"].includes(this.inTableType) && row.level < this.maxLevel // 只有层级表格要“添加下级”图标
1361
- ? this.getOperationIconRender(h, { row, rowIndex, column }, "canCreateChild", iconSize, ++sortNum)
1369
+ // 添加一行下级图标 (只有层级表格要“添加下级”图标)
1370
+ baseBool && this.operationMap.canCreateChild && this.operationMap.canCreateChild.disabled !== true &&
1371
+ ["treeTable"].includes(this.inTableType) && row.level < this.maxLevel
1372
+ ? this.getOperationIconRender(h, { row, rowIndex, column }, this.operationMap.canCreateChild, iconSize, ++sortNum)
1362
1373
  : h("span", ""),
1363
1374
 
1364
- // 删除该行图标
1365
- baseBool && ["cascaderTable"].includes(this.inTableType) && this.getRowDelBtnCanEdit(row, rowIndex)
1366
- ? this.getOperationIconRender(h, { row, rowIndex, column }, "canDelete", iconSize, ++sortNum)
1375
+ // 删除该行图标(得有删除能力)
1376
+ baseBool && this.operationMap.canDelete && this.operationMap.canDelete.disabled !== true &&
1377
+ ["cascaderTable"].includes(this.inTableType) && this.getRowDelBtnCanEdit(row, rowIndex)
1378
+ ? this.getOperationIconRender(h, { row, rowIndex, column }, this.operationMap.canDelete, iconSize, ++sortNum)
1367
1379
  : h("span", ""),
1368
1380
 
1369
1381
  // 下移图标
1370
- baseBool && !this.useMoveInOperationCol && this.getRowDelBtnCanEdit(row, rowIndex) && ["first", "center"].includes(row.__position__)
1371
- ? this.getOperationIconRender(h, { row, rowIndex, column }, "canMoveDown", iconSize, ++sortNum)
1382
+ baseBool && this.operationMap.canMoveDown && this.operationMap.canMoveDown.disabled !== true &&
1383
+ !this.useMoveInOperationCol && this.getRowMoveBtnCanEdit(row, rowIndex) && ["first", "center"].includes(row.__position__)
1384
+ ? this.getOperationIconRender(h, { row, rowIndex, column }, this.operationMap.canMoveDown, iconSize, ++sortNum)
1372
1385
  : h("span", ""),
1373
1386
 
1374
1387
  // 上移图标
1375
- baseBool && !this.useMoveInOperationCol && this.getRowDelBtnCanEdit(row, rowIndex) && ["last", "center"].includes(row.__position__)
1376
- ? this.getOperationIconRender(h, { row, rowIndex, column }, "canMoveUp", iconSize, ++sortNum)
1388
+ baseBool && this.operationMap.canMoveUp && this.operationMap.canMoveUp.disabled !== true &&
1389
+ !this.useMoveInOperationCol && this.getRowMoveBtnCanEdit(row, rowIndex) && ["last", "center"].includes(row.__position__)
1390
+ ? this.getOperationIconRender(h, { row, rowIndex, column }, this.operationMap.canMoveUp, iconSize, ++sortNum)
1377
1391
  : h("span", "")
1378
1392
  ];
1379
1393
  },
1380
- getOperationIconRender (h, { row, rowIndex, column }, operationType, iconSize = 14, sortNum = 0) {
1381
- const operationItem = this.operationMap[operationType];
1382
-
1383
- return operationItem && operationItem.disabled !== true
1384
- ? h("div", {
1385
- class: `dsh-color-border-${operationItem.btnType.includes("error") ? "error" : "primary"}${operationItem.triggerType === "hover" ? " dsh-tr-hover-show" : ""}`,
1386
- style: {
1387
- position: "absolute",
1388
- bottom: "0px",
1389
- right: `${(iconSize + 3) * sortNum}px`,
1390
- width: `${iconSize + 2}px`,
1391
- height: `${iconSize + 2}px`,
1392
- borderRadius: "2px",
1393
- backgroundColor: "#ffffff",
1394
- lineHeight: `${iconSize - 2}px`,
1395
- cursor: "pointer",
1396
- verticalAlign: "middle",
1397
- transition: "color .2s ease-in-out,border-color .2s ease-in-out"
1394
+ getOperationIconRender (h, { row, rowIndex, column }, operationItem, iconSize = 14, sortNum = 0) {
1395
+ return h("div", {
1396
+ class: `dsh-color-border-${operationItem.btnType.includes("error") ? "error" : "primary"}${operationItem.triggerType === "hover" ? " dsh-tr-hover-show" : ""}`,
1397
+ style: {
1398
+ position: "absolute",
1399
+ bottom: "0px",
1400
+ right: `${(iconSize + 3) * sortNum}px`,
1401
+ width: `${iconSize + 2}px`,
1402
+ height: `${iconSize + 2}px`,
1403
+ borderRadius: "2px",
1404
+ backgroundColor: "#ffffff",
1405
+ lineHeight: `${iconSize - 2}px`,
1406
+ cursor: "pointer",
1407
+ verticalAlign: "middle",
1408
+ transition: "color .2s ease-in-out,border-color .2s ease-in-out"
1409
+ }
1410
+ }, [
1411
+ h("Tooltip", {
1412
+ props: {
1413
+ content: operationItem.tip,
1414
+ maxWidth: "250",
1415
+ transfer: true
1398
1416
  }
1399
1417
  }, [
1400
- h("Tooltip", {
1418
+ h("Icon", {
1419
+ class: `dsh-color-${operationItem.btnType.includes("error") ? "error" : "primary"}`,
1420
+ style: {
1421
+ fontWeight: "500"
1422
+ },
1401
1423
  props: {
1402
- content: operationItem.tip,
1403
- maxWidth: "250",
1404
- transfer: true
1405
- }
1406
- }, [
1407
- h("Icon", {
1408
- class: `dsh-color-${operationItem.btnType.includes("error") ? "error" : "primary"}`,
1409
- style: {
1410
- fontWeight: "500"
1411
- },
1412
- props: {
1413
- type: operationItem.icon,
1414
- size: iconSize
1415
- },
1416
- on: {
1417
- click: () => {
1418
- this.$dispatchEvent(operationItem, row, rowIndex, column);
1419
- }
1424
+ type: operationItem.icon,
1425
+ size: iconSize
1426
+ },
1427
+ on: {
1428
+ click: () => {
1429
+ this.$dispatchEvent(operationItem, row, rowIndex, column);
1420
1430
  }
1421
- })
1422
- ])
1431
+ }
1432
+ })
1423
1433
  ])
1424
- : h("span", "");
1434
+ ]);
1425
1435
  },
1426
1436
  bodyCellClass ({ row, rowIndex, column }) {
1427
1437
  return "bri-table-td" +
@@ -1465,7 +1475,7 @@ export default {
1465
1475
  },
1466
1476
 
1467
1477
  /* ----------- 方法 ---------- */
1468
- // 整行校验结果
1478
+ // 校验-整行结果
1469
1479
  getRowRuleResult (row, rowIndex) {
1470
1480
  // return this.usedColumns.every(column => this.getColRuleResult({ row, rowIndex, column }).bool);
1471
1481
 
@@ -1482,36 +1492,7 @@ export default {
1482
1492
 
1483
1493
  return bool;
1484
1494
  },
1485
- getRowFormList (row, rowIndex) {
1486
- return this.selfColumns.map(column => {
1487
- column = this.$transformDynamicProperty(column, row, this.parentObj);
1488
- const unitCanEdit = this.getColCanEdit({ row, rowIndex, column });
1489
-
1490
- return {
1491
- ...column,
1492
- canEdit: unitCanEdit
1493
- };
1494
- });
1495
- },
1496
- // 是否默认行
1497
- getIsDftRow (row, rowIndex) {
1498
- return this.isDftSet ? false : row.__isDefault__;
1499
- },
1500
- // 行按钮是否可操作(删除按钮可编辑 不代表行内容是可编辑的)
1501
- getRowDelBtnCanEdit (row, rowIndex) {
1502
- return row.__readonly__ !== true && // 不能为只读数据
1503
- (this.disabledDeleteDftRow ? row.__isDefault__ !== true : true) && // 默认数据可删除
1504
- (this.disabledDeleteOldRow ? row.__old__ !== true : true); // 老数据可删除
1505
- },
1506
- // 行内容是否可编辑
1507
- getRowCanEdit (row, rowIndex) {
1508
- return this.canEdit && // 是编辑状态
1509
- (this.getIsDftRow(row) ? !this.dftReadonly : true) && // 默认数据可编辑
1510
- (row.__old__ === true ? !this.oldReadonly : true) && // 老数据可编辑
1511
- row.__readonly__ !== true; // 不能为只读数据
1512
- },
1513
-
1514
- // 单元格校验结果
1495
+ // 校验-单元格结果
1515
1496
  getColRuleResult ({ row, rowIndex, column }) {
1516
1497
  column = this.$transformDynamicProperty(column, row, this.parentObj);
1517
1498
 
@@ -1524,7 +1505,7 @@ export default {
1524
1505
  message: "未触发校验,通过!"
1525
1506
  };
1526
1507
  },
1527
- // 获取单元格校验对象
1508
+ // 校验-获取单元格校验对象
1528
1509
  getColRuleResultObj ({ row, rowIndex, column }) {
1529
1510
  // 校验必填不通过 => 校验对比
1530
1511
  const resultObj = {};
@@ -1534,7 +1515,32 @@ export default {
1534
1515
 
1535
1516
  return resultObj;
1536
1517
  },
1537
- // 加工单元格对应的配置
1518
+
1519
+ // 行-是否是默认行
1520
+ getIsDftRow (row, rowIndex) {
1521
+ return this.isDftSet ? false : row.__isDefault__;
1522
+ },
1523
+ // 行-删除按钮是否可操作(删除按钮可编辑 不代表行内容是可编辑的)
1524
+ getRowDelBtnCanEdit (row, rowIndex) {
1525
+ return row.__readonly__ !== true && // 只读数据不可删除
1526
+ (this.disabledDeleteDftRow ? row.__isDefault__ !== true : true) && // 默认数据不可删除
1527
+ (this.disabledDeleteOldRow ? row.__old__ !== true : true); // 老数据不可删除
1528
+ },
1529
+ // 行-移动按钮是否可操作
1530
+ getRowMoveBtnCanEdit (row, rowIndex) {
1531
+ return row.__readonly__ !== true && // 只读数据不可删除
1532
+ (this.disabledDeleteDftRow ? row.__isDefault__ !== true : true) && // 默认数据不可删除
1533
+ (this.disabledDeleteOldRow ? row.__old__ !== true : true); // 老数据不可删除
1534
+ },
1535
+ // 行-内容是否可编辑
1536
+ getRowCanEdit (row, rowIndex) {
1537
+ return this.canEdit && // 是编辑状态
1538
+ (this.getIsDftRow(row) ? !this.dftReadonly : true) && // 默认数据可编辑
1539
+ (row.__old__ === true ? !this.oldReadonly : true) && // 老数据可编辑
1540
+ row.__readonly__ !== true; // 不能为只读数据
1541
+ },
1542
+
1543
+ // 单元格-对应的配置
1538
1544
  getResetCol ({ row, rowIndex, column }) {
1539
1545
  return {
1540
1546
  // isShare: this.isShare,
@@ -1552,13 +1558,13 @@ export default {
1552
1558
  )
1553
1559
  };
1554
1560
  },
1555
- // 单元格最终是否可编辑性
1561
+ // 单元格-最终是否可编辑性
1556
1562
  getUnitCanEdit ({ row, rowIndex, column }) {
1557
1563
  return this.getRowCanEdit(row, rowIndex) &&
1558
1564
  this.getColCanEdit({ row, rowIndex, column }) &&
1559
1565
  this.$isAdvRelyShow(column, row, this.parentObj, true);
1560
1566
  },
1561
- // 单元格本身是否可编辑性
1567
+ // 单元格-本身是否可编辑性
1562
1568
  getColCanEdit ({ row, rowIndex, column }) {
1563
1569
  return (this.getIsDftRow(row) ? !this.dftReadonlyColKeys.includes(column._key) : true) && // 默认行的某列是否可编辑
1564
1570
  (row.__old__ === true ? !this.oldReadonlyColKeys.includes(column._key) : true) && // 老数据行里某些列不可编辑
@@ -1603,7 +1609,7 @@ export default {
1603
1609
  row._id = this.$ObjectID().str;
1604
1610
  }
1605
1611
 
1606
- row.__old__ = this.isDftSet ? false : this.parentObj.__isCreate__ !== true; // 标记老数据
1612
+ row.__old__ = this.isDftSet ? false : !this.isCreateStatus; // 标记老数据
1607
1613
  row.__isDefault__ = this.isDftSet ? true : !!row.__isDefault__; // 标记默认数据(配置端默认值)
1608
1614
 
1609
1615
  // 初次进来 把关于展示的状态值全部清除(只有层级表在用,按理说应放在DshTreeTableMixin.js,但为了清除三大表格的老数据,才放在这)
@@ -1651,10 +1657,24 @@ export default {
1651
1657
  getMixKey (row, column, splitStr = "--") {
1652
1658
  return `${row._id}${splitStr}${column._key}`;
1653
1659
  },
1654
- // 更新校验显示的标记
1660
+ // 校验显示映射上 添加上某单元格的
1655
1661
  dealRuleRecord (row, column) {
1656
- // this.$set(this.ruleRecordMap, this.getMixKey(row, column), true);
1657
- this.ruleRecordMap[this.getMixKey(row, column)] = true;
1662
+ this.$set(this.ruleRecordMap, this.getMixKey(row, column), true);
1663
+ // this.ruleRecordMap[this.getMixKey(row, column)] = true;
1664
+ },
1665
+ // 校验显示映射上 添加上某单元格有牵扯的单元格s
1666
+ dealOtherColRuleRecord (row, column) {
1667
+ this.usedColumns.forEach(otherCol => {
1668
+ if (
1669
+ // (otherCol._saveRuleConfigs && otherCol._saveRuleConfigs.length) ||
1670
+ (otherCol._saveRuleConfigs && otherCol._saveRuleConfigs.some(item => item._fieldKey === column._key)) ||
1671
+ (otherCol._dynamicRules && otherCol._dynamicRules.some(item => this.$getConditionFields(item._advRely).includes(column._key))) ||
1672
+ (otherCol._dynamicRule && otherCol._dynamicRule.some(item => this.$getConditionFields(item._advRely).includes(column._key)))
1673
+ ) {
1674
+ // this.$set(this.ruleRecordMap, this.getMixKey(row, otherCol), true);
1675
+ this.ruleRecordMap[this.getMixKey(row, otherCol)] = true;
1676
+ }
1677
+ });
1658
1678
  }
1659
1679
  }
1660
1680
  };
@@ -62,6 +62,13 @@
62
62
  &-default {
63
63
  .ivu-modal-wrap {
64
64
  .ivu-modal {
65
+ margin: 0px auto;
66
+ position: absolute;
67
+ top: 160px;
68
+ bottom: 0px;
69
+ left: 0px;
70
+ right: 0px;
71
+
65
72
  width: 750px !important;
66
73
  height: 550px !important;
67
74
  max-height: 100%;
@@ -190,26 +197,26 @@
190
197
  height: 100%;
191
198
  display: flex;
192
199
  flex-direction: column;
193
-
200
+
194
201
  .DshModal-close,
195
202
  .ivu-modal-close {
196
203
  top: 20px;
197
204
  right: 24px;
198
205
  color: @contentColor;
199
206
  font-size: @smallTitleSize;
200
-
207
+
201
208
  .ivu-icon-ios-close {
202
209
  font-size: 22px;
203
210
  color: @contentColor;
204
211
  }
205
212
  }
206
-
213
+
207
214
  .ivu-modal-header {
208
215
  width: 100%;
209
216
  height: 48px;
210
217
  padding: 16px 24px 8px 24px;
211
218
  // border-bottom: none;
212
-
219
+
213
220
  &-inner {
214
221
  color: rgba(0, 0, 0, 0.9);
215
222
  font-size: 16px;
@@ -218,7 +225,7 @@
218
225
  height: 24px;
219
226
  }
220
227
  }
221
-
228
+
222
229
  .ivu-modal-body {
223
230
  flex: 1;
224
231
  overflow: auto;
@@ -228,13 +235,13 @@
228
235
  }
229
236
  }
230
237
  }
231
-
238
+
232
239
  #bri-modal-common();
233
240
 
234
241
  // 小框 无固定高度,上下居中
235
242
  &-center {
236
243
  #bri-modal-common();
237
-
244
+
238
245
  .ivu-modal-wrap {
239
246
  width: 100%;
240
247
  height: 100%;
@@ -242,16 +249,16 @@
242
249
  flex-direction: column;
243
250
  align-items: center;
244
251
  justify-content: center;
245
-
252
+
246
253
  .ivu-modal {
247
254
  top: 0px;
248
255
  }
249
256
  }
250
257
  }
251
-
258
+
252
259
  // modal内部公用样式
253
260
  &-footer {
254
261
  text-align: right;
255
262
  margin-top: 16px;
256
263
  }
257
- }
264
+ }