bri-components 1.4.46 → 1.4.48

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.4.46",
3
+ "version": "1.4.48",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -80,6 +80,7 @@
80
80
 
81
81
  &-icons {
82
82
  display: flex;
83
+ flex-wrap: wrap;
83
84
 
84
85
  .item {
85
86
  min-width: 54px;
@@ -17,7 +17,7 @@
17
17
  class="DshFlatTable-form"
18
18
  >
19
19
  <div
20
- v-for="(row, rowIndex) in curPageListData"
20
+ v-for="(row, rowIndex) in selfShowListData"
21
21
  :key="row._id"
22
22
  class="item"
23
23
  >
@@ -52,22 +52,22 @@
52
52
  <!-- 表格展示模式 -->
53
53
  <template v-else>
54
54
  <bri-table
55
- v-show="curPageListData.length && !isSearching"
55
+ v-show="selfShowListData.length && !isSearching"
56
56
  ref="briTable"
57
57
  class="DshFlatTable-main"
58
58
  :columns="showColumns"
59
- :data="renderedShowListData"
59
+ :data="selfRenderedListData"
60
60
  :footer-data="footerData"
61
61
  :propsObj="tablePropsObj"
62
62
  @changeSelect="changeSelect"
63
63
  @selectAll="changeSelect"
64
64
  ></bri-table>
65
65
  <bri-table
66
- v-show="!curPageListData.length || isSearching"
66
+ v-show="!selfShowListData.length || isSearching"
67
67
  ref="briTable"
68
68
  class="DshFlatTable-main"
69
69
  :columns="showColumns"
70
- :data="curPageListData"
70
+ :data="selfShowListData"
71
71
  :footer-data="footerData"
72
72
  :propsObj="tablePropsObj"
73
73
  @changeSelect="changeSelect"
@@ -80,7 +80,10 @@
80
80
  <dsh-render :render="createBtnRender"></dsh-render>
81
81
 
82
82
  <!-- 分页 -->
83
- <div class="DshFlatTable-page">
83
+ <div
84
+ v-if="!isMergeRowTable"
85
+ class="DshFlatTable-page"
86
+ >
84
87
  <dsh-page
85
88
  :mode="pageMode"
86
89
  :total="total"
@@ -129,20 +132,20 @@
129
132
 
130
133
  <!-- 表格 -->
131
134
  <bri-table
132
- v-show="curPageListData.length && !isSearching"
135
+ v-show="selfShowListData.length && !isSearching"
133
136
  class="DshFlatTable-fullscreen-inner-main"
134
137
  :columns="showColumns"
135
- :data="renderedShowListData"
138
+ :data="selfRenderedListData"
136
139
  :footer-data="footerData"
137
140
  :propsObj="tableInModalPropsObj"
138
141
  @changeSelect="changeSelect"
139
142
  @selectAll="changeSelect"
140
143
  ></bri-table>
141
144
  <bri-table
142
- v-show="!curPageListData.length || isSearching"
145
+ v-show="!selfShowListData.length || isSearching"
143
146
  class="DshFlatTable-fullscreen-inner-main"
144
147
  :columns="showColumns"
145
- :data="curPageListData"
148
+ :data="selfShowListData"
146
149
  :footer-data="footerData"
147
150
  :propsObj="tableInModalPropsObj"
148
151
  @changeSelect="changeSelect"
@@ -153,7 +156,11 @@
153
156
  <dsh-render :render="createBtnRender"></dsh-render>
154
157
 
155
158
  <!-- 分页 -->
156
- <div class="DshFlatTable-page">
159
+ <div
160
+ v-if="!isMergeRowTable"
161
+ class="DshFlatTable-page"
162
+ style="padding: 16px 0px;"
163
+ >
157
164
  <dsh-page
158
165
  :mode="pageMode"
159
166
  :total="total"
@@ -36,7 +36,7 @@ export default {
36
36
  ];
37
37
  },
38
38
  // 顶替tableBaseMixin里的
39
- rowsNumStr () {
39
+ searchTitle () {
40
40
  return `${this.isSearching ? "筛选" : "全部"}数据,共 ${this.total} 条;`;
41
41
  },
42
42
 
@@ -3,15 +3,7 @@ export default {
3
3
  components: {},
4
4
  props: {},
5
5
  data () {
6
- return {
7
- isUseDescSort: false,
8
- pageMode: "small",
9
- pagePropsObj: {
10
- page: 1,
11
- pagesize: 10,
12
- pagesizeOpts: [10, 20, 30, 50]
13
- }
14
- };
6
+ return {};
15
7
  },
16
8
  computed: {
17
9
  rowspanMap () {
@@ -35,7 +27,7 @@ export default {
35
27
  },
36
28
  // 是不是合并行表格
37
29
  isMergeRowTable () {
38
- return this.mergeRowColKeys.length;
30
+ return !!this.mergeRowColKeys.length;
39
31
  },
40
32
  // 一级合并列keys(一级合并列:左侧第一合并列和右侧和并列)
41
33
  firstMergeRowColKeys () {
@@ -59,7 +51,7 @@ export default {
59
51
  return this.mergeRowColKeys.filter(colKey => !this.firstMergeRowColKeys.includes(colKey));
60
52
  },
61
53
  // 顶替tableBaseMixin里的
62
- rowsNumStr () {
54
+ searchTitle () {
63
55
  return `${this.isSearching ? "筛选" : "全部"}数据${this.isMergeRowTable ? `,共 ${this.total}条;` : ";"}`;
64
56
  },
65
57
 
@@ -78,17 +70,15 @@ export default {
78
70
  allListMap () {
79
71
  return this.$arrToMap(this.allListData, "_id");
80
72
  },
81
- // 渲染过的行 -但显示当前页
82
- renderedShowListData () {
73
+ selfRenderedListData () {
83
74
  return this.isMergeRowTable
84
75
  ? this.renderedListData
85
- : this.curPageListData;
76
+ : this.curPageShowListData;
86
77
  },
87
- // 全部数据或筛选时符合条件的数据
88
- curPageListData () {
78
+ selfShowListData () {
89
79
  return this.isMergeRowTable
90
80
  ? this.showListData
91
- : this.showListData.slice((this.pagePropsObj.page - 1) * this.pagePropsObj.pagesize, this.pagePropsObj.page * this.pagePropsObj.pagesize);
81
+ : this.curPageShowListData;
92
82
  },
93
83
  footerData () {
94
84
  return this.isSearching
@@ -114,12 +104,6 @@ export default {
114
104
  ]
115
105
  : [];
116
106
  },
117
- // 共多少分页
118
- PageNum () {
119
- return this.total % this.pagePropsObj.pagesize > 0
120
- ? Math.ceil(this.total / this.pagePropsObj.pagesize)
121
- : Math.floor(this.total / this.pagePropsObj.pagesize);
122
- },
123
107
 
124
108
  showColumns () {
125
109
  return [
@@ -198,20 +182,6 @@ export default {
198
182
  }
199
183
  },
200
184
 
201
- // 切换正倒序
202
- changeSort () {
203
- this.isUseDescSort = !this.isUseDescSort;
204
- this.pagePropsObj.page = 1;
205
- },
206
- // 切换分页
207
- changePage (page) {
208
- this.pagePropsObj.page = page;
209
- },
210
- // 切换分页条数
211
- changePageSize (pagesize) {
212
- this.pagePropsObj.page = 1;
213
- this.pagePropsObj.pagesize = pagesize;
214
- },
215
185
  // 点击 -添加行
216
186
  clickCreate (operationItem, row, rowIndex, column) {
217
187
  const curColKey = column ? column._key : undefined;
@@ -343,7 +313,8 @@ export default {
343
313
  });
344
314
  }
345
315
 
346
- list.splice(rowIndex, 1);
316
+ const listIndex = list.findIndex(rowItem => rowItem._id === row._id);
317
+ list.splice(listIndex, 1);
347
318
 
348
319
  this.change("deleteRow", row, rowIndex, null);
349
320
  }
@@ -95,6 +95,14 @@ export default {
95
95
  conditions: []
96
96
  },
97
97
 
98
+ isUseDescSort: false,
99
+ pageMode: "small",
100
+ pagePropsObj: {
101
+ page: 1,
102
+ pagesize: 10,
103
+ pagesizeOpts: [10, 20, 30, 50]
104
+ },
105
+
98
106
  dshRenderName: undefined,
99
107
  hideStatus: true,
100
108
  showQuoteModal: false,
@@ -415,15 +423,15 @@ export default {
415
423
  isSearching () {
416
424
  return this.$isAdvSearching(this.finalTableAdvSearch);
417
425
  },
418
- rowsNumStr () {
426
+ searchTitle () {
419
427
  return `${this.isSearching ? "筛选" : "全部"}数据;`;
420
- // return `${this.isSearching ? "筛选" : "全部"}数据;共 ${this.total}条;`;
421
428
  },
422
429
  controlShowKey () {
423
430
  return this.isSearching ? "__isSearchShow__" : "__isShow__";
424
431
  },
425
432
 
426
433
  /* --- 数据 --- */
434
+ // 默认数据
427
435
  defaultListData () {
428
436
  const loop = (tree = [], list = []) => {
429
437
  return tree.reduce((newList, rowItem) => {
@@ -452,7 +460,7 @@ export default {
452
460
  return rowItem.__isRendered__;
453
461
  });
454
462
  },
455
- // 全部数据或筛选时符合条件的数据 -但显示当前页
463
+ // 全部数据 或 筛选时符合条件的数据
456
464
  showListData () {
457
465
  return this.renderedListData
458
466
  .filter(rowItem => !!rowItem[this.controlShowKey])
@@ -461,10 +469,23 @@ export default {
461
469
  return rowItem;
462
470
  });
463
471
  },
464
- // 全部数据或筛选时符合条件的数据 总数
472
+ // 全部数据 筛选时符合条件的数据 -当前页的
473
+ curPageShowListData () {
474
+ return this.showListData.slice(
475
+ (this.pagePropsObj.page - 1) * this.pagePropsObj.pagesize,
476
+ this.pagePropsObj.page * this.pagePropsObj.pagesize
477
+ );
478
+ },
479
+ // 全部数据 或 筛选时符合条件的数据 -总数
465
480
  total () {
466
481
  return this.showListData.length;
467
482
  },
483
+ // 全部数据 或 筛选时符合条件的数据 -共多少分页
484
+ PageNum () {
485
+ return this.total % this.pagePropsObj.pagesize > 0
486
+ ? Math.ceil(this.total / this.pagePropsObj.pagesize)
487
+ : Math.floor(this.total / this.pagePropsObj.pagesize);
488
+ },
468
489
 
469
490
  parentDataId () {
470
491
  return this.parentObj._id;
@@ -788,11 +809,13 @@ export default {
788
809
  this.hoverRecordMap = {};
789
810
  this.ruleRecordMap = {};
790
811
 
812
+ this.changePage(1);
791
813
  this.dftAdvSearch = {
792
814
  logic: "and",
793
815
  conditions: []
794
816
  };
795
817
  this.hideStatus = true;
818
+
796
819
  this.selfReset && this.selfReset();
797
820
  },
798
821
  // 共外部使用
@@ -806,11 +829,26 @@ export default {
806
829
  searchCb (conditions) {
807
830
  this.isExpandAction = false;
808
831
  this.dftAdvSearch.conditions = conditions;
832
+ this.changePage(1);
809
833
  },
810
834
  // 列表选择项改变
811
835
  changeSelect (list) {
812
836
  this.$emit("changeSelect", list);
813
837
  },
838
+ // 切换正倒序
839
+ changeSort () {
840
+ this.isUseDescSort = !this.isUseDescSort;
841
+ this.changePage(1);
842
+ },
843
+ // 切换分页
844
+ changePage (page) {
845
+ this.pagePropsObj.page = page;
846
+ },
847
+ // 切换分页条数
848
+ changePageSize (pagesize) {
849
+ this.pagePropsObj.page = 1;
850
+ this.pagePropsObj.pagesize = pagesize;
851
+ },
814
852
 
815
853
  // 输入框失去焦点
816
854
  controlBlur (operationItem, row, rowIndex, column, params) {
@@ -1087,7 +1125,7 @@ export default {
1087
1125
  style: {
1088
1126
  "font-weight": "500"
1089
1127
  }
1090
- }, this.rowsNumStr),
1128
+ }, this.searchTitle),
1091
1129
 
1092
1130
  h("div", {
1093
1131
  style: {