bri-components 1.3.56 → 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.56",
3
+ "version": "1.3.60",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "ali-oss": "^6.13.1",
34
34
  "axios": "^0.23.0",
35
- "bri-datas": "^1.1.63",
35
+ "bri-datas": "^1.1.65",
36
36
  "jshint": "^2.12.0",
37
37
  "jsonlint": "^1.6.3",
38
38
  "minio": "7.1.0",
@@ -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,13 +199,13 @@ export default {
199
199
  : fieldData.operators
200
200
  ) || [];
201
201
 
202
- const fieldOperator = ["_id"].includes(fieldKey)
203
- ? "eq"
204
- : initContion.fieldOperator
205
- ? initContion.fieldOperator
202
+ const fieldOperator = initContion.fieldOperator || (
203
+ ["_id"].includes(fieldKey)
204
+ ? "eq"
206
205
  : ["reference"].includes(fieldType) && this.isSimpleSearch
207
206
  ? "eq"
208
- : (operators[0] || {})._key;
207
+ : (operators[0] || {})._key
208
+ );
209
209
  const fieldOperatorName = (operators.find(operatorItem => operatorItem._key === fieldOperator) || { name: `${fieldOperator}不存在` }).name;
210
210
 
211
211
  const parameterType = initContion.parameterType || (
@@ -222,16 +222,16 @@ export default {
222
222
  logic: "field",
223
223
  fieldKey: fieldKey,
224
224
  fieldType: fieldType,
225
- fieldValue: [],
226
225
  fieldOperator: fieldOperator,
226
+ fieldValue: [],
227
227
  fieldSearch: {
228
228
  logic: "and",
229
229
  conditions: []
230
230
  },
231
+ parameterType: parameterType,
231
232
  fieldParams: [],
232
233
  chainFieldKey: "",
233
234
  ...initContion,
234
- parameterType: parameterType,
235
235
 
236
236
  // 下面的是前端所用
237
237
  dynamicList: dynamicList,
@@ -362,7 +362,7 @@ export default {
362
362
  ? loop(item[key])
363
363
  : item[key]
364
364
  : item[key]
365
- })), {});
365
+ })), {});
366
366
  };
367
367
 
368
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) {
@@ -1,7 +1,21 @@
1
1
  <template>
2
2
  <div class="DshTreeTable">
3
3
  <div class="DshTreeTable-top">
4
- <div class="DshTreeTable-top-total">{{ rowsNumStr }}</div>
4
+ <div class="DshTreeTable-top-status">
5
+ <span class="summary">{{ rowsNumStr }};</span>
6
+
7
+ <div
8
+ v-if="searchFormList.length"
9
+ class="logic"
10
+ >
11
+ <div class="logic-title">{{ selfLogicPropsObj._name }}:</div>
12
+ <dsh-select
13
+ class="logic-option"
14
+ :value="dftAdvSearch"
15
+ :propsObj="selfLogicPropsObj"
16
+ ></dsh-select>
17
+ </div>
18
+ </div>
5
19
 
6
20
  <dsh-buttons
7
21
  class="DshTreeTable-top-btns"
@@ -50,6 +64,24 @@
50
64
  v-if="isEnlargeFlag"
51
65
  class="DshTreeTable-fullscreen-inner"
52
66
  >
67
+ <div class="DshTreeTable-top">
68
+ <div class="DshTreeTable-top-status">
69
+ <span class="summary">{{ rowsNumStr }};</span>
70
+
71
+ <div
72
+ v-if="searchFormList.length"
73
+ class="logic"
74
+ >
75
+ <div class="logic-title">{{ selfLogicPropsObj._name }}:</div>
76
+ <dsh-select
77
+ class="logic-option"
78
+ :value="dftAdvSearch"
79
+ :propsObj="selfLogicPropsObj"
80
+ ></dsh-select>
81
+ </div>
82
+ </div>
83
+ </div>
84
+
53
85
  <!-- 搜索条件 -->
54
86
  <template v-if="searchFormList.length">
55
87
  <dsh-default-search
@@ -118,7 +150,7 @@
118
150
 
119
151
  allTreeData () {
120
152
  console.log("allTreeData");
121
- return this.getCalcuedTree(this.data, this.filterColumns);
153
+ return this.getCalcuedTree(this.data, this.columns);
122
154
  },
123
155
  allListData () {
124
156
  return this.$getTreeFlatArr(this.allTreeData);
@@ -225,9 +257,6 @@
225
257
  }
226
258
  };
227
259
  },
228
- filterColumns () {
229
- return this.columns;
230
- },
231
260
  showColumns () {
232
261
  return [
233
262
  ...(this.useSelection === true ? [this.selectionColumn] : []),
@@ -554,8 +583,30 @@
554
583
  justify-content: space-between;
555
584
  align-items: center;
556
585
 
557
- &-total {
558
- font-weight: 500;
586
+ &-status {
587
+ display: flex;
588
+ flex-direction: row;
589
+ align-items: center;
590
+
591
+ .summary {
592
+ font-weight: 500;
593
+ }
594
+
595
+ .logic {
596
+ display: flex;
597
+ flex-direction: row;
598
+ align-items: center;
599
+ margin-left: 16px;
600
+
601
+ &-title {
602
+
603
+ }
604
+
605
+ &-option {
606
+ margin-left: 8px;
607
+ margin-top: -4px;
608
+ }
609
+ }
559
610
  }
560
611
 
561
612
  &-btns {
@@ -1,5 +1,5 @@
1
1
  import DshListUnit from "../../unit/DshListUnit.vue";
2
- import quoteListModal from "./quoteListModal.vue";
2
+ import quoteListModal from "../common/quoteListModal.vue";
3
3
 
4
4
  export default {
5
5
  mixins: [],
@@ -63,6 +63,16 @@ export default {
63
63
  logic: "and",
64
64
  conditions: []
65
65
  },
66
+ selfLogicPropsObj: {
67
+ _name: "逻辑",
68
+ _key: "logic",
69
+ _optionKind: "flat",
70
+ _clearable: false,
71
+ _data: [
72
+ { _key: "and", name: "且" },
73
+ { _key: "or", name: "或" }
74
+ ]
75
+ },
66
76
 
67
77
  dshRenderName: undefined,
68
78
  showQuoteModal: false,
@@ -183,7 +193,7 @@ export default {
183
193
  _tableAdvSearch: {
184
194
  logic: "and",
185
195
  conditions: []
186
- }, // 筛选默认值
196
+ }, // 筛选默认值(cascaderTable和flatTable组件里默认值情使用时,以及modSetForm里,会重置_tableAdvSearch)
187
197
  ...this.propsObj,
188
198
 
189
199
  _contentHeight: this.propsObj._contentHeight || 500 // 表格最大高度
@@ -293,7 +303,7 @@ export default {
293
303
  return this.parentObj._id;
294
304
  },
295
305
  selfRowDefault () {
296
- return this.filterColumns.reduce((obj, column) => {
306
+ return this.columns.reduce((obj, column) => {
297
307
  const defaultVal = this.rowDefault[column._key];
298
308
  const initDftVal = this.initDftValMap[column._type];
299
309
 
@@ -490,9 +500,12 @@ export default {
490
500
  },
491
501
  methods: {
492
502
  baseInit () {
493
- this.dftAdvSearch.conditions = this.tableAdvSearch.conditions.filter(conditionItem =>
494
- this.searchListFields.includes(conditionItem.fieldKey)
495
- );
503
+ this.dftAdvSearch = {
504
+ logic: ["and", "or"].includes(this.tableAdvSearch.logic) ? this.tableAdvSearch.logic : "and",
505
+ conditions: this.tableAdvSearch.conditions.filter(conditionItem =>
506
+ this.searchListFields.includes(conditionItem.fieldKey)
507
+ )
508
+ };
496
509
  },
497
510
  // 重置
498
511
  reset () {
package/src/index.js CHANGED
@@ -38,6 +38,7 @@ import BriAvatar from "./components/other/BriAvatar.vue";
38
38
  import BriLoading from "./components/other/BriLoading.vue";
39
39
  import BriIframe from "./components/other/BriIframe.vue";
40
40
  import BriSvg from "./components/other/BriSvg.vue";
41
+ import DshColorPanel from "./components/other/DshColorPanel.vue";
41
42
 
42
43
  // small
43
44
  import DshRender from "./components/small/render.js";
@@ -91,7 +92,6 @@ import DshMenuNav from "./components/other/DshMenuNav.vue";
91
92
  import BriCode from "./components/other/BriCode.vue";
92
93
  import BriCollapseTree from "./components/other/BriCollapseTree.vue";
93
94
  import BriGantt from "./components/other/BriGantt.vue";
94
- import DshColorPanel from "./components/other/DshColorPanel.vue";
95
95
 
96
96
  // small
97
97
  import DshBtnModal from "./components/small/DshBtnModal.vue";
@@ -128,6 +128,7 @@ const map = {
128
128
  BriLoading,
129
129
  BriIframe,
130
130
  BriSvg,
131
+ DshColorPanel,
131
132
 
132
133
  // small
133
134
  BriButton,
@@ -208,6 +209,7 @@ export {
208
209
  BriLoading,
209
210
  BriIframe,
210
211
  BriSvg,
212
+ DshColorPanel,
211
213
 
212
214
  // small
213
215
  BriButton,
@@ -258,7 +260,6 @@ export {
258
260
  BriCode,
259
261
  BriCollapseTree,
260
262
  BriGantt,
261
- DshColorPanel,
262
263
 
263
264
  // small
264
265
  DshBtnModal