bri-components 1.3.69 → 1.3.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.3.69",
3
+ "version": "1.3.70",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -119,7 +119,7 @@
119
119
  const curDateStr = this.$transformDate(date, "/", this.subType);
120
120
 
121
121
  // 日期字段的对比
122
- const compareResult = this.$validateComparedRuleFunc(
122
+ const compareResult = this.$normalComparedFunc(
123
123
  this.selfPropsObj,
124
124
  {
125
125
  ...this.value,
@@ -7,7 +7,7 @@ export default {
7
7
  },
8
8
  computed: {
9
9
  allListData () {
10
- console.log("allListData");
10
+ // console.log("allListData");
11
11
  this.data.forEach(item => {
12
12
  !item._id && this.$set(item, "_id", this.$ObjectID().str);
13
13
 
@@ -20,7 +20,6 @@ export default {
20
20
  item.__isSearchShow__ = false;
21
21
  });
22
22
 
23
- console.log(this.initFlag);
24
23
  this.initFlag = false;
25
24
  return this.data;
26
25
  },
@@ -22,31 +22,31 @@ export default {
22
22
  },
23
23
 
24
24
  allTreeData () {
25
- console.log("allTreeData");
25
+ // console.log("allTreeData");
26
26
  return this.getCalcuedTree(this.data, this.columns);
27
27
  },
28
28
  allListData () {
29
- console.log("allListData");
29
+ // console.log("allListData");
30
30
  return this.$getTreeFlatArr(this.allTreeData);
31
31
  },
32
32
  footerData () {
33
- console.log("footerData");
33
+ // console.log("footerData");
34
34
  return this.isSearching
35
35
  ? []
36
36
  : this.useSummary && this.allListData.length
37
37
  ? [
38
- this.filterColumns.reduce((obj, col) => {
38
+ this.filterColumns.reduce((obj, column) => {
39
39
  return {
40
40
  ...obj,
41
- [col._key]: col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType)
41
+ [column._key]: column._type === "number" && ![undefined, null, "", "no"].includes(column._summaryType)
42
42
  ? this.$calNumList(
43
43
  this.allListData
44
44
  .filter(item => item.level === 1)
45
- .map(item => item[col._key]),
46
- col._summaryType,
47
- { ...col, _defaultDigit: 2 }
45
+ .map(item => item[column._key]),
46
+ column._summaryType,
47
+ { ...column, _defaultDigit: 2 }
48
48
  )
49
- : (obj[col._key] || "--")
49
+ : (obj[column._key] || "--")
50
50
  };
51
51
  }, {
52
52
  _id: this.$ObjectID().str,
@@ -76,11 +76,11 @@ export default {
76
76
  ? row.__isSearchShow__ === false
77
77
  ? " bri-table-td-hide"
78
78
  : ""
79
- : row.__isShow__ === false
80
- ? " bri-table-td-hide"
81
- : this.isExpandAction
79
+ : row.__isShow__ === true
80
+ ? this.isExpandAction
82
81
  ? " bri-table-td-visible"
83
82
  : ""
83
+ : " bri-table-td-hide"
84
84
  }` +
85
85
  `${["__isExpand__"].includes(column._key)
86
86
  ? " bri-table-td-expand"
@@ -155,7 +155,7 @@ export default {
155
155
  return [
156
156
  h("div", {
157
157
  style: {
158
- paddingLeft: `${(row.level - 1) * 18}px`,
158
+ paddingLeft: `${(row.level - 1) * 18} px`,
159
159
  fontWeight: "500"
160
160
  }
161
161
  }, row.__treeIndex__),
@@ -214,7 +214,6 @@ export default {
214
214
  // 展开/隐藏节点
215
215
  toggleExpand (row, bool = true) {
216
216
  this.isExpandAction = true;
217
- // row.__isExpand__ = bool;
218
217
  this.$set(row, "__isExpand__", bool);
219
218
 
220
219
  this.toggleDescendantsShow(row, bool);
@@ -268,21 +267,18 @@ export default {
268
267
  getCalcuedTree (treeData = [], columns = []) {
269
268
  const loop = (list = [], parentRow) =>
270
269
  list.forEach((row) => {
271
- // 递归到叶子节点前 从上往下要处理的
272
- columns.reduce((newRow, col) => {
273
- const isNumberSummary = col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType);
274
- const isDateSummary = col._type === "date" && ![undefined, null, ""].includes(col._writeSort);
275
-
276
- if (isNumberSummary || isDateSummary) {
277
- const val = isNumberSummary
278
- ? newRow[col._key]
279
- : ["downToUp"].includes(col._writeSort)
280
- ? newRow[col._key]
281
- : !parentRow || parentRow[col._key]
282
- ? newRow[col._key]
283
- : undefined;
270
+ // 递归到叶子节点前 从上往下执行 要处理的
271
+ columns.reduce((newRow, column) => {
272
+ if (
273
+ ["number", "date"].includes(column._type) &&
274
+ ["upToDown"].includes(column._writeSort)
275
+ ) {
276
+ // 第一级的和父级有值的,否则置空
277
+ const val = parentRow && !parentRow[column._key]
278
+ ? this.$deepCopy(this.initDftValMap[column._type])
279
+ : newRow[column._key];
284
280
 
285
- this.$set(newRow, col._key, val);
281
+ this.$set(newRow, column._key, val);
286
282
  }
287
283
 
288
284
  return newRow;
@@ -292,34 +288,54 @@ export default {
292
288
  row.isLeaf = false;
293
289
  loop(row.children, row);
294
290
 
295
- // 递归到叶子节点后 从下往上要处理的
296
- columns.reduce((newRow, col) => {
297
- const isNumberSummary = col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType);
298
- const isDateSummary = col._type === "date" && ![undefined, null, ""].includes(col._writeSort);
291
+ // 递归到叶子节点后到 从下往上执行 要处理的(非叶子节点)
292
+ columns.reduce((newRow, column) => {
293
+ // if (
294
+ // ["number", "date"].includes(column._type) &&
295
+ // ["downToUp"].includes(column._writeSort)
296
+ // ) {
297
+ // // 第一级的和父级有值的,否则置空
298
+ // const val = newRow[column._key];
299
+
300
+ // this.$set(newRow, column._key, val);
301
+ // }
299
302
 
300
- if (isNumberSummary || isDateSummary) {
301
- const val = isNumberSummary
303
+ if (
304
+ ["number", "date"].includes(column._type) &&
305
+ ![undefined, null, "", "no"].includes(column._summaryType)
306
+ ) {
307
+ const val = ["number"].includes(column._type)
302
308
  ? this.$calNumList(
303
- newRow.children.map(subRow => subRow[col._key]),
304
- col._summaryType,
305
- { ...col, _defaultDigit: 2 },
309
+ newRow.children.map(subRow => subRow[column._key]),
310
+ column._summaryType,
311
+ { ...column, _defaultDigit: 2 },
306
312
  false
307
313
  )
308
- : ["downToUp"].includes(col._writeSort)
309
- ? this.$calDateList(
310
- newRow.children.map(subRow => subRow[col._key]),
311
- col._compareOperator,
312
- col._dateType
313
- )
314
- : newRow[col._key];
314
+ : this.$calDateList(
315
+ newRow.children.map(subRow => subRow[column._key]),
316
+ column._summaryType,
317
+ column._dateType
318
+ );
315
319
 
316
- this.$set(newRow, col._key, val);
320
+ this.$set(newRow, column._key, val);
317
321
  }
318
322
 
319
323
  return newRow;
320
324
  }, row);
321
325
  } else {
322
326
  row.isLeaf = true;
327
+
328
+ // 递归到叶子节点前 从上往下执行 要处理的(叶子节点)
329
+ columns.reduce((newRow, column) => {
330
+ if (
331
+ ["number", "date"].includes(column._type) &&
332
+ ![undefined, null, "", "no"].includes(column._summaryType)
333
+ ) {
334
+ this.$set(newRow, column._key, newRow[column._key]);
335
+ }
336
+
337
+ return newRow;
338
+ }, row);
323
339
  }
324
340
 
325
341
  // 初次进来把前端存的状态值全部清除(除了__readonly__)
@@ -329,6 +345,7 @@ export default {
329
345
  });
330
346
 
331
347
  row.__old__ = true; // 老的数据都打上标记 尽管不一定会用
348
+
332
349
  // row.__isExpand__ = false;
333
350
  // row.__isSearchShow__ = false;
334
351
  // 第一级的需要显示出来
@@ -337,7 +337,7 @@ export default {
337
337
  },
338
338
 
339
339
  renderedListData () {
340
- console.log("renderedListData");
340
+ // console.log("renderedListData");
341
341
  return this.allListData.filter(row => {
342
342
  if (this.isSearching) {
343
343
  const bool = this.$isAdvRelyAccord(this.finalTableAdvSearch, row);
@@ -354,7 +354,7 @@ export default {
354
354
  });
355
355
  },
356
356
  showListData () {
357
- console.log("showListData");
357
+ // console.log("showListData");
358
358
  return this.renderedListData.filter(row =>
359
359
  this.isSearching
360
360
  ? !!row.__isSearchShow__
@@ -453,11 +453,11 @@ export default {
453
453
  },
454
454
 
455
455
  filterColumns () {
456
- console.log("filterColumns");
456
+ // console.log("filterColumns");
457
457
  return this.columns.filter(col => this.$isAdvRelyShow(col, this.allListData, this.parentObj, true));
458
458
  },
459
459
  contentColumns () {
460
- console.log("contentColumns");
460
+ // console.log("contentColumns");
461
461
  return this.filterColumns.map(colItem => ({
462
462
  filter: undefined,
463
463
  sortBy: undefined,
@@ -718,15 +718,26 @@ export default {
718
718
  // 引用回调
719
719
  quoteCb (dataObj) {
720
720
  if (dataObj) {
721
- const cb = () => {
722
- this.$Message.success("引用成功!");
723
- this.reset();
724
- this.selfReset && this.selfReset();
721
+ const fieldVal = dataObj[this.controlKey];
722
+ const isEmpty = this.$isEmptyData(fieldVal) || (
723
+ ["flatTable"].includes(this.controlType)
724
+ ? !fieldVal.list || !fieldVal.list.length
725
+ : ["cascaderTable"].includes(this.controlType)
726
+ ? !fieldVal.tree || !fieldVal.tree.length
727
+ : false
728
+ );
725
729
 
730
+ if (isEmpty) {
731
+ this.$Modal.confirm({
732
+ title: "提示",
733
+ content: "该数据下此内容为空,无法引用!",
734
+ onOk: () => { }
735
+ });
736
+ } else {
726
737
  if (["flatTable"].includes(this.controlType)) {
727
738
  this.parentObj[this.controlKey] = {
728
- ...dataObj[this.controlKey],
729
- list: dataObj[this.controlKey].list.map(item => ({
739
+ ...fieldVal,
740
+ list: fieldVal.list.map(item => ({
730
741
  ...item,
731
742
  __isQuote__: true
732
743
  }))
@@ -744,28 +755,15 @@ export default {
744
755
  };
745
756
 
746
757
  this.parentObj[this.controlKey] = {
747
- ...dataObj[this.controlKey],
748
- tree: transformData(dataObj[this.controlKey].tree)
758
+ ...fieldVal,
759
+ tree: transformData(fieldVal.tree)
749
760
  };
750
761
  }
751
762
 
763
+ this.$Message.success("引用成功!");
764
+ this.reset();
765
+ this.selfReset && this.selfReset();
752
766
  this.change("quote");
753
- };
754
-
755
- const isEmpty = this.$isEmptyData(dataObj[this.controlKey]) ||
756
- (["flatTable"].includes(this.controlType)
757
- ? !dataObj[this.controlKey].list || !dataObj[this.controlKey].list.length
758
- : ["cascaderTable"].includes(this.controlType)
759
- ? !dataObj[this.controlKey].tree || !dataObj[this.controlKey].tree.length
760
- : false);
761
- if (isEmpty) {
762
- this.$Modal.confirm({
763
- title: "提示",
764
- content: "该数据下此内容为空,无法引用!",
765
- onOk: () => { }
766
- });
767
- } else {
768
- cb();
769
767
  }
770
768
  } else {
771
769
  this.$Message.error("未选择引用数据!");
@@ -1021,22 +1019,14 @@ export default {
1021
1019
  // 列本身是否可编辑
1022
1020
  getColCanEdit (col, row) {
1023
1021
  return (
1024
- ["cascaderTable"].includes(this.controlType)
1025
- ? (
1026
- // 树形表格 -“需要计算的数字列 且 不是叶子行的”不可编辑(必须用isLeaf !== false判断,因为牵扯内部表格也在用)
1027
- ["number"].includes(col._type) && ![undefined, null, "", "no"].includes(col._summaryType)
1028
- ? row.isLeaf === true
1029
- : true
1030
- ) && (
1031
- // 树形表格 -“需要限制的日期列 且 不是叶子行的”不可编辑(必须用isLeaf !== false判断,因为牵扯内部表格也在用)
1032
- ["date"].includes(col._type)
1033
- ? ["downToUp"].includes(col._writeSort)
1034
- ? row.isLeaf === true
1035
- : ["upToDown"].includes(col._writeSort)
1036
- ? row.level === 1 || !!this.getParentNode(row, this.allTreeData)[col._key]
1037
- : true
1022
+ ["cascaderTable"].includes(this.controlType) && ["number", "date"].includes(col._type)
1023
+ ? ![undefined, null, "", "no"].includes(col._summaryType)
1024
+ ? row.isLeaf === true
1025
+ // : ["downToUp"].includes(col._writeSort)
1026
+ // ? row.isLeaf === true
1027
+ : ["upToDown"].includes(col._writeSort)
1028
+ ? row.level === 1 || !!this.getParentNode(row, this.allTreeData)[col._key]
1038
1029
  : true
1039
- )
1040
1030
  : true
1041
1031
  ) &&
1042
1032
  (col._oldReadonly ? row.__old__ !== true : true) && // 老数据行里某些列不可编辑