bri-components 1.3.57 → 1.3.60

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.57",
3
+ "version": "1.3.60",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -35,6 +35,7 @@
35
35
  :rowDefault="curVal.rowDefault"
36
36
  :columns="subForm"
37
37
  :data="curVal"
38
+ :treeColumns="treeForm"
38
39
  :propsObj="defaultPropsObj"
39
40
  :allFormList="allFormList"
40
41
  :parentObj="value"
@@ -129,8 +130,55 @@
129
130
  : this.selfPropsObj._treeForm;
130
131
  },
131
132
 
133
+ searchList () {
134
+ return this.selfPropsObj._searchList || []; // 级联表切层级表时 值会undefined覆盖selfPropsObj默认的[]
135
+ },
136
+ searchListMap () {
137
+ return this.$arrToMap(this.searchList, "_key");
138
+ },
139
+ searchListFields () {
140
+ return this.searchList.map(searchItem => searchItem._key);
141
+ },
142
+ tableAdvSearch () {
143
+ return this.$transformAdvSearch(this.selfPropsObj._tableAdvSearch, this.allFormList, this.value);
144
+ },
145
+ dftAdvSearch () {
146
+ return {
147
+ logic: ["and", "or"].includes(this.tableAdvSearch.logic) ? this.tableAdvSearch.logic : "and",
148
+ conditions: this.tableAdvSearch.conditions.filter(conditionItem =>
149
+ this.searchListFields.includes(conditionItem.fieldKey)
150
+ )
151
+ };
152
+ },
153
+ // 配置的默认筛选值里 隐藏的看不到的筛选条件
154
+ hideAdvSearch () {
155
+ return {
156
+ logic: ["and", "or"].includes(this.tableAdvSearch.logic) ? this.tableAdvSearch.logic : "and",
157
+ conditions: this.tableAdvSearch.conditions.filter(conditionItem =>
158
+ !this.searchListFields.includes(conditionItem.fieldKey)
159
+ )
160
+ };
161
+ },
162
+ // 过滤行数据的 最终的筛选条件
163
+ finalTableAdvSearch () {
164
+ return {
165
+ logic: "and",
166
+ conditions: [
167
+ this.hideAdvSearch,
168
+ this.dftAdvSearch
169
+ ]
170
+ };
171
+ },
132
172
  showVal () {
133
- return `${this.curVal ? this.$getTreeLeafTotal(this.curVal.tree, this.showMode === "treeTable") : 0} 行`;
173
+ return `${
174
+ this.curVal
175
+ ? this.$getTreeFlatArr(this.curVal.tree, (row) => {
176
+ return (this.showMode === "treeTable" ? true : row.isLeaf === true) &&
177
+ this.$isAdvRelyAccord(this.finalTableAdvSearch, row);
178
+ }).length
179
+ // ? this.$getTreeLeafTotal(this.curVal.tree, this.showMode === "treeTable")
180
+ : 0
181
+ } 行`;
134
182
  }
135
183
  },
136
184
  created () {},
@@ -199,18 +199,22 @@ export default {
199
199
  : fieldData.operators
200
200
  ) || [];
201
201
 
202
- const fieldOperator = ["_id"].includes(fieldKey)
203
- ? "eq"
204
- : ["reference"].includes(fieldType) && this.isSimpleSearch
202
+ const fieldOperator = initContion.fieldOperator || (
203
+ ["_id"].includes(fieldKey)
205
204
  ? "eq"
206
- : (operators[0] || {})._key;
205
+ : ["reference"].includes(fieldType) && this.isSimpleSearch
206
+ ? "eq"
207
+ : (operators[0] || {})._key
208
+ );
207
209
  const fieldOperatorName = (operators.find(operatorItem => operatorItem._key === fieldOperator) || { name: `${fieldOperator}不存在` }).name;
208
210
 
209
- const parameterType = (
210
- (initContion.fieldParams || []).length ||
211
- initContion.chainFieldKey ||
212
- (!!dynamicList.length && operators.some(operator => ["subSearch", "subTableSearch", "cascaderTableSearch", "treeTableSearch"].includes(operator._key)))
213
- ) ? "dynamicText" : "fixedText";
211
+ const parameterType = initContion.parameterType || (
212
+ (
213
+ (initContion.fieldParams || []).length ||
214
+ initContion.chainFieldKey ||
215
+ (!!dynamicList.length && operators.some(operator => ["subSearch", "subTableSearch", "cascaderTableSearch", "treeTableSearch"].includes(operator._key)))
216
+ ) ? "dynamicText" : "fixedText"
217
+ );
214
218
  const parameterTypeName = (this.parameterPropsObj._data.find(parameterTypeItem => parameterTypeItem._key === parameterType) || { name: `${parameterType}不存在` }).name;
215
219
 
216
220
  return {
@@ -358,7 +362,7 @@ export default {
358
362
  ? loop(item[key])
359
363
  : item[key]
360
364
  : item[key]
361
- })), {});
365
+ })), {});
362
366
  };
363
367
 
364
368
  return loop(list);
@@ -130,7 +130,7 @@
130
130
  }
131
131
  },
132
132
  dblclick: (event) => {
133
- this.$emit("db-click-row", row, rowIndex, event);
133
+ this.$emit("db-click-row", row, rowIndex, column, event);
134
134
  }
135
135
  };
136
136
  },
@@ -490,22 +490,6 @@
490
490
  allTreeData () {
491
491
  return this.getCalcuedTree();
492
492
  },
493
- showAllTreeData () {
494
- const loop = (list = []) => {
495
- return list.filter(row => {
496
- if (row.children && row.children.length) {
497
- row.children = loop(row.children);
498
- return !!row.children.length;
499
- } else {
500
- return this.$isAdvRelyAccord(this.finalTableAdvSearch, row);
501
- }
502
- });
503
- };
504
-
505
- return this.isSearching
506
- ? loop(this.allTreeData)
507
- : this.allTreeData;
508
- },
509
493
  allListData () {
510
494
  return this.$getTreeFlatArr(this.data.tree, node => !(node.children && node.children.length));
511
495
  },
@@ -770,8 +754,10 @@
770
754
  return this.data.tree;
771
755
  },
772
756
  // 转化渲染使用的columns数组
773
- transformRowColumnsArr (nodes = this.showAllTreeData, treeForm = this.treeColumns) {
757
+ transformRowColumnsArr (nodes = this.allTreeData, treeForm = this.treeColumns) {
774
758
  let loop = (nodes, rowColumnsArr) => {
759
+ nodes = this.getFilteredNodes(nodes);
760
+
775
761
  return nodes.reduce((rowColumnsArr, node, nodeIndex) => {
776
762
  if (nodeIndex !== 0 || rowColumnsArr.length === 0) {
777
763
  rowColumnsArr.push(this.transformColumns(treeForm.slice(node.level - 1)));
@@ -784,11 +770,14 @@
784
770
  }
785
771
  }, rowColumnsArr);
786
772
  };
773
+
787
774
  return loop(nodes, []);
788
775
  },
789
776
  // 转化表格数据
790
- transformRows (nodes = this.showAllTreeData, treeForm = this.treeColumns) {
777
+ transformRows (nodes = this.allTreeData, treeForm = this.treeColumns) {
791
778
  const loop = (nodes, rows) => {
779
+ nodes = this.getFilteredNodes(nodes);
780
+
792
781
  return nodes.reduce((rows, node, nodeIndex) => {
793
782
  // 创建行,并把节点数据(对象类型)注入到行对象内
794
783
  if (nodeIndex !== 0 || rows.length === 0) {
@@ -811,6 +800,20 @@
811
800
  };
812
801
  return loop(nodes, []);
813
802
  },
803
+ getFilteredNodes (nodes) {
804
+ const loop = (nodes = []) => {
805
+ return nodes.filter(node => {
806
+ if (node.children && node.children.length) {
807
+ const children = loop(node.children);
808
+ return !!children.length;
809
+ } else {
810
+ return this.$isAdvRelyAccord(this.finalTableAdvSearch, node);
811
+ }
812
+ });
813
+ };
814
+
815
+ return loop(nodes);
816
+ },
814
817
 
815
818
  // 清除节点到叶子节点
816
819
  clearNodeToLeaf (list) {
@@ -501,7 +501,7 @@ export default {
501
501
  methods: {
502
502
  baseInit () {
503
503
  this.dftAdvSearch = {
504
- logic: this.tableAdvSearch.logic || "and",
504
+ logic: ["and", "or"].includes(this.tableAdvSearch.logic) ? this.tableAdvSearch.logic : "and",
505
505
  conditions: this.tableAdvSearch.conditions.filter(conditionItem =>
506
506
  this.searchListFields.includes(conditionItem.fieldKey)
507
507
  )