bri-components 1.3.64 → 1.3.66

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.64",
3
+ "version": "1.3.66",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -186,6 +186,15 @@
186
186
  }
187
187
  },
188
188
  mounted () {},
189
- methods: {}
189
+ methods: {
190
+ // hidden columns
191
+ hideColumnsByKeys (keys = []) {
192
+ this.$refs["briTable"].hideColumnsByKeys(keys);
193
+ },
194
+ // show cloumns
195
+ showColumnsByKeys (keys = []) {
196
+ this.$refs["briTable"].showColumnsByKeys(keys);
197
+ }
198
+ }
190
199
  };
191
200
  </script>
@@ -686,7 +686,11 @@
686
686
  );
687
687
  }, [])
688
688
  .concat(
689
- subForm.map(subFormItem => (
689
+ subForm.filter(subFormItem =>
690
+ this.hideStatus === true
691
+ ? !this.hideColKeys.includes(subFormItem._key)
692
+ : true
693
+ ).map(subFormItem => (
690
694
  {
691
695
  ...subFormItem,
692
696
  nodeKey: treeForm[treeForm.length - 1]._key,
@@ -11,6 +11,7 @@
11
11
 
12
12
  <!-- 表格 -->
13
13
  <bri-table
14
+ ref="briTable"
14
15
  class="DshFlatTable-main"
15
16
  :columns="showColumns"
16
17
  :data="renderedListData"
@@ -11,6 +11,7 @@
11
11
 
12
12
  <!-- 表格 -->
13
13
  <bri-table
14
+ ref="briTable"
14
15
  class="DshTreeTable-main"
15
16
  :columns="showColumns"
16
17
  :data="renderedListData"
@@ -13,13 +13,14 @@ export default {
13
13
 
14
14
  if (this.initFlag) {
15
15
  item.__old__ = true; // 标记老数据(initFlag不用在data中声明)
16
- item.__isRendered__ = true;
17
- item.__isShow__ = true;
18
- item.__isTmpShow__ = true;
19
- item.__isSearchShow__ = false;
20
16
  }
17
+ item.__isRendered__ = true;
18
+ item.__isShow__ = true;
19
+ item.__isTmpShow__ = true;
20
+ item.__isSearchShow__ = false;
21
21
  });
22
22
 
23
+ console.log(this.initFlag);
23
24
  this.initFlag = false;
24
25
  return this.data;
25
26
  },
@@ -48,26 +49,6 @@ export default {
48
49
  : [];
49
50
  },
50
51
 
51
- tablePropsObj () {
52
- return {
53
- maxHeight: this.contentHeight,
54
- cellStyleOption: {
55
- bodyCellClass: ({ column, row, rowIndex }) => {
56
- return "bri-table-td" +
57
- `${this.getRowCanEdit(row)
58
- ? " bri-table-td-edit"
59
- : ""
60
- }` +
61
- `${this.isSearching
62
- ? !row.__isSearchShow__
63
- ? " bri-table-td-hide"
64
- : ""
65
- : ""
66
- }`;
67
- }
68
- }
69
- };
70
- },
71
52
  showColumns () {
72
53
  return [
73
54
  ...(this.useSelection === true ? [this.selectionColumn] : []),
@@ -8,7 +8,6 @@ export default {
8
8
  isExpandAction: false,
9
9
 
10
10
  searchMode: "flat" // "flat", "tree"
11
-
12
11
  };
13
12
  },
14
13
  computed: {
@@ -62,11 +61,10 @@ export default {
62
61
  tablePropsObj () {
63
62
  return {
64
63
  maxHeight: this.contentHeight,
65
- // rowStyleOption: {
66
- // hoverHighlight: true,
67
- // clickHighlight: true,
68
- // stripe: true // 斑马纹
69
- // },
64
+ // 通过实例方法 hideColumnsByKeys(keys)将列隐藏,通过实例方法 showColumnsByKeys(keys)将隐藏的列显示
65
+ columnHiddenOption: {
66
+ defaultHiddenColumnKeys: this.hideColKeys
67
+ },
70
68
  cellStyleOption: {
71
69
  bodyCellClass: ({ row, column, rowIndex }) => {
72
70
  return "bri-table-td" +
@@ -75,10 +73,10 @@ export default {
75
73
  : ""
76
74
  }` +
77
75
  `${this.isSearching
78
- ? !row.__isSearchShow__
76
+ ? row.__isSearchShow__ === false
79
77
  ? " bri-table-td-hide"
80
78
  : ""
81
- : !row.__isShow__
79
+ : row.__isShow__ === false
82
80
  ? " bri-table-td-hide"
83
81
  : this.isExpandAction
84
82
  ? " bri-table-td-visible"
@@ -91,10 +89,6 @@ export default {
91
89
  : ""
92
90
  }`;
93
91
  }
94
- },
95
- // 通过实例方法 hideColumnsByKeys(keys)将列隐藏,通过实例方法 showColumnsByKeys(keys)将隐藏的列显示
96
- columnHiddenOption: {
97
- defaultHiddenColumnKeys: []
98
92
  }
99
93
  };
100
94
  },
@@ -217,11 +211,6 @@ export default {
217
211
  };
218
212
  },
219
213
 
220
- // 筛选回调
221
- searchCb (conditions) {
222
- this.isExpandAction = false;
223
- this.dftAdvSearch.conditions = conditions;
224
- },
225
214
  // 展开/隐藏节点
226
215
  toggleExpand (row, bool = true) {
227
216
  this.isExpandAction = true;
@@ -67,6 +67,7 @@ export default {
67
67
  showRuleMessage: false, // 进行全体校验
68
68
  ruleRecordMap: {}, // 单元格是否发生校验的记录映射
69
69
 
70
+ hideStatus: true,
70
71
  dftAdvSearch: {
71
72
  logic: "and",
72
73
  conditions: []
@@ -90,6 +91,14 @@ export default {
90
91
  isEnlargeFlag: true, // 为重渲染膜态框内容而用
91
92
 
92
93
  topOperationMap: {
94
+ canHideOrShow: {
95
+ name: "显示/隐藏字段",
96
+ type: "canHideOrShow",
97
+ // icon: "md-share-alt",
98
+ size: "small",
99
+ btnType: "text",
100
+ event: "toggleHideOrShow"
101
+ },
93
102
  canQuote: {
94
103
  name: "引用",
95
104
  type: "canQuote",
@@ -186,9 +195,17 @@ export default {
186
195
  _disabledBtns: false, // 禁用增删按钮
187
196
  _disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
188
197
  _disabledOldDataRow: false, // 置灰老数据行包含删除
198
+
199
+ _hideColKeys: [], // 隐藏/查看列字段的keys
200
+ _searchList: [], // 作为搜索的字段
201
+ _searchLabelWidth: 100, // 搜索的label宽度
202
+ _tableAdvSearch: {
203
+ logic: "and",
204
+ conditions: []
205
+ }, // 筛选默认值(cascaderTable和flatTable组件里默认值情使用时,以及modSetForm里,会重置_tableAdvSearch)
206
+
189
207
  _isImport: false, // 导入
190
208
  _isExport: false, // 导出
191
-
192
209
  _isQuote: false, // 引用
193
210
  _quoteDataCanEdit: false, // 引用的数据是否能编辑
194
211
  _quoteListFields: [], // 引用列表的显示字段
@@ -196,13 +213,6 @@ export default {
196
213
  logic: "and",
197
214
  conditions: []
198
215
  }, // 引用列表筛选条件
199
-
200
- _searchList: [], // 作为搜索的字段
201
- _searchLabelWidth: 100, // 搜索的label宽度
202
- _tableAdvSearch: {
203
- logic: "and",
204
- conditions: []
205
- }, // 筛选默认值(cascaderTable和flatTable组件里默认值情使用时,以及modSetForm里,会重置_tableAdvSearch)
206
216
  ...this.propsObj,
207
217
 
208
218
  _contentHeight: this.propsObj._contentHeight || 500 // 表格最大高度
@@ -249,6 +259,7 @@ export default {
249
259
  disabledOldDataRow () {
250
260
  return this.selfPropsObj._disabledOldDataRow;
251
261
  },
262
+
252
263
  isImport () {
253
264
  return this.selfPropsObj._isImport;
254
265
  },
@@ -268,6 +279,9 @@ export default {
268
279
  return this.$transformAdvSearch(this.selfPropsObj._quoteAdvSearch, this.allFormList, this.parentObj);
269
280
  },
270
281
 
282
+ hideColKeys () {
283
+ return this.selfPropsObj._hideColKeys || [];
284
+ },
271
285
  searchList () {
272
286
  return this.selfPropsObj._searchList || []; // 级联表切层级表时 值会undefined覆盖selfPropsObj默认的[]
273
287
  },
@@ -373,13 +387,28 @@ export default {
373
387
 
374
388
  tablePropsObj () {
375
389
  return {
390
+ // rowStyleOption: {
391
+ // hoverHighlight: true,
392
+ // clickHighlight: true,
393
+ // stripe: true // 斑马纹
394
+ // },
376
395
  maxHeight: this.contentHeight,
396
+ // 通过实例方法 hideColumnsByKeys(keys)将列隐藏,通过实例方法 showColumnsByKeys(keys)将隐藏的列显示
397
+ columnHiddenOption: {
398
+ defaultHiddenColumnKeys: [...this.hideColKeys]
399
+ },
377
400
  cellStyleOption: {
378
401
  bodyCellClass: ({ column, row, rowIndex }) => {
379
402
  return "bri-table-td" +
380
403
  `${this.getRowCanEdit(row)
381
404
  ? " bri-table-td-edit"
382
405
  : ""
406
+ }` +
407
+ `${this.isSearching
408
+ ? row.__isSearchShow__ === false
409
+ ? " bri-table-td-hide"
410
+ : ""
411
+ : ""
383
412
  }`;
384
413
  }
385
414
  }
@@ -424,6 +453,7 @@ export default {
424
453
  return this.columns.filter(col => this.$isAdvRelyShow(col, this.allListData, this.parentObj, true));
425
454
  },
426
455
  contentColumns () {
456
+ console.log("contentColumns");
427
457
  return this.filterColumns.map(colItem => ({
428
458
  filter: undefined,
429
459
  sortBy: undefined,
@@ -553,6 +583,10 @@ export default {
553
583
  ...(this.topOperationMap || {}),
554
584
  ...(this.baseOperationMap || {}),
555
585
 
586
+ canHideOrShow: {
587
+ ...this.topOperationMap.canHideOrShow,
588
+ name: this.hideStatus ? "显示字段" : "隐藏字段"
589
+ },
556
590
  canCreate: {
557
591
  ...this.baseOperationMap.canCreate,
558
592
  disabled: !!this.disabledCreateBtn
@@ -566,6 +600,7 @@ export default {
566
600
  undefined,
567
601
  this.canEdit
568
602
  ? [
603
+ ...(this.hideColKeys.length ? ["canHideOrShow"] : []),
569
604
  ...(this.isQuote ? ["canQuote"] : []),
570
605
  ...(this.isImport ? ["canImport"] : []),
571
606
  ...(this.isExport ? ["canExport"] : []),
@@ -573,6 +608,7 @@ export default {
573
608
  ...(this.disabledBtns ? ["changeVal"] : this.baseOperationBtns)
574
609
  ]
575
610
  : [
611
+ ...(this.hideColKeys.length ? ["canHideOrShow"] : []),
576
612
  ...(this.isExport ? ["canExport"] : []),
577
613
  "canEnlarge"
578
614
  ]
@@ -632,6 +668,19 @@ export default {
632
668
  this.$emit("change", { list: this.allListData, rowDefault: this.rowDefault }, ...params);
633
669
  },
634
670
 
671
+ /* ----------- 隐藏/显示字段 ---------- */
672
+ toggleHideOrShow () {
673
+ if (this.$refs["briTable"]) {
674
+ if (this.hideStatus === true) {
675
+ this.$refs["briTable"].showColumnsByKeys(this.hideColKeys);
676
+ } else {
677
+ this.$refs["briTable"].hideColumnsByKeys(this.hideColKeys);
678
+ }
679
+ }
680
+
681
+ this.hideStatus = !this.hideStatus;
682
+ },
683
+
635
684
  /* ----------- 全屏 ---------- */
636
685
  // 打开全屏模态框
637
686
  clickEnlarge (operationItem) {