bri-components 1.4.76 → 1.4.78
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
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
<span
|
|
85
85
|
class="DshFlatTable-sort"
|
|
86
86
|
:style="{ color: appColor }"
|
|
87
|
-
@click="
|
|
87
|
+
@click="changeDescSort()"
|
|
88
88
|
>
|
|
89
89
|
<dsh-icons
|
|
90
90
|
class="DshFlatTable-sort-icons"
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
<span
|
|
195
195
|
class="DshFlatTable-sort"
|
|
196
196
|
:style="{ color: appColor }"
|
|
197
|
-
@click="
|
|
197
|
+
@click="changeDescSort()"
|
|
198
198
|
>
|
|
199
199
|
<dsh-icons
|
|
200
200
|
class="DshFlatTable-sort-icons"
|
|
@@ -3,7 +3,15 @@ export default {
|
|
|
3
3
|
components: {},
|
|
4
4
|
props: {},
|
|
5
5
|
data () {
|
|
6
|
-
return {
|
|
6
|
+
return {
|
|
7
|
+
isUseDescSort: false,
|
|
8
|
+
pageMode: "small",
|
|
9
|
+
pagePropsObj: {
|
|
10
|
+
page: 1,
|
|
11
|
+
pagesize: 10,
|
|
12
|
+
pagesizeOpts: [10, 20, 30, 50]
|
|
13
|
+
}
|
|
14
|
+
};
|
|
7
15
|
},
|
|
8
16
|
computed: {
|
|
9
17
|
rowspanMap () {
|
|
@@ -11,14 +19,10 @@ export default {
|
|
|
11
19
|
},
|
|
12
20
|
selfBasePropsObj () {
|
|
13
21
|
return {
|
|
22
|
+
_isUseDescSort: false, // 是否使用使用倒序
|
|
14
23
|
_mergeRowColKeys: [] // 合并行的列
|
|
15
|
-
// _isUseDescSort: false // 是否使用使用倒序
|
|
16
24
|
};
|
|
17
25
|
},
|
|
18
|
-
// // 是否使用倒序
|
|
19
|
-
// isUseDescSort () {
|
|
20
|
-
// return this.selfPropsObj._isUseDescSort;
|
|
21
|
-
// },
|
|
22
26
|
mergeRowColKeys () {
|
|
23
27
|
const mergeRowColKeys = this.selfPropsObj._mergeRowColKeys || []; // 配置端有问题,高级依赖时值成undefined了
|
|
24
28
|
return this.selfColumns
|
|
@@ -75,6 +79,26 @@ export default {
|
|
|
75
79
|
? this.showListData
|
|
76
80
|
: this.curPageShowListData;
|
|
77
81
|
},
|
|
82
|
+
// 全部数据 或 筛选时符合条件的数据 -当前页的
|
|
83
|
+
curPageShowListData () {
|
|
84
|
+
return this.pagePropsObj.page >= 1
|
|
85
|
+
? (this.pagePropsObj.page - 1) * this.pagePropsObj.pagesize >= this.showListData.length
|
|
86
|
+
? this.showListData.slice(
|
|
87
|
+
(this.pagePropsObj.page - 2) * this.pagePropsObj.pagesize,
|
|
88
|
+
(this.pagePropsObj.page - 1) * this.pagePropsObj.pagesize
|
|
89
|
+
)
|
|
90
|
+
: this.showListData.slice(
|
|
91
|
+
(this.pagePropsObj.page - 1) * this.pagePropsObj.pagesize,
|
|
92
|
+
this.pagePropsObj.page * this.pagePropsObj.pagesize
|
|
93
|
+
)
|
|
94
|
+
: [];
|
|
95
|
+
},
|
|
96
|
+
// 全部数据 或 筛选时符合条件的数据 -共多少分页
|
|
97
|
+
PageNum () {
|
|
98
|
+
return this.selfTotal % this.pagePropsObj.pagesize > 0
|
|
99
|
+
? Math.ceil(this.selfTotal / this.pagePropsObj.pagesize)
|
|
100
|
+
: Math.floor(this.selfTotal / this.pagePropsObj.pagesize);
|
|
101
|
+
},
|
|
78
102
|
footerData () {
|
|
79
103
|
return this.isSearching
|
|
80
104
|
? []
|
|
@@ -129,6 +153,7 @@ export default {
|
|
|
129
153
|
}
|
|
130
154
|
},
|
|
131
155
|
created () {
|
|
156
|
+
this.isUseDescSort = this.selfPropsObj._isUseDescSort;
|
|
132
157
|
this.initRowspan();
|
|
133
158
|
},
|
|
134
159
|
methods: {
|
|
@@ -136,45 +161,22 @@ export default {
|
|
|
136
161
|
selfReset () {
|
|
137
162
|
this.initRowspan();
|
|
138
163
|
},
|
|
139
|
-
// 初始化合并单元格的rowspan
|
|
140
|
-
initRowspan () {
|
|
141
|
-
if (this.isMergeRowTable) {
|
|
142
|
-
this.$set(this.tableDataObj, "rowspanMap", this.tableDataObj.rowspanMap || {});
|
|
143
|
-
|
|
144
|
-
// TODO: 待删除
|
|
145
|
-
Object.entries(this.rowspanMap).forEach(arr => {
|
|
146
|
-
if (arr[0].includes("dsh")) {
|
|
147
|
-
this.rowspanMap[arr[0].split("dsh").join("--")] = this.rowspanMap[arr[1]];
|
|
148
|
-
delete this.rowspanMap[arr[0]];
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
this.allListData.forEach((rowItem, rowIndex) => {
|
|
153
|
-
this.mergeRowColKeys.forEach(colKey => {
|
|
154
|
-
const column = { _key: colKey };
|
|
155
|
-
|
|
156
|
-
// 新增页 -行的_id被置换,rowspanMap也要相应置换,还要清除rowspanMap里和默认行老_id相关的
|
|
157
|
-
const oldId = this.idRecordMap[rowItem._id];
|
|
158
|
-
const oldRow = { ...rowItem, _id: oldId };
|
|
159
|
-
if (oldId && ![undefined, null].includes(this.rowspanMap[this.getMixKey(oldRow, column)])) {
|
|
160
|
-
this.rowspanMap[this.getMixKey(rowItem, column)] = this.getRealRowspan({ row: oldRow, rowIndex, column });
|
|
161
|
-
delete this.rowspanMap[this.getMixKey(oldRow, column)];
|
|
162
|
-
} else {
|
|
163
|
-
this.rowspanMap[this.getMixKey(rowItem, column)] = this.getRealRowspan({ row: rowItem, rowIndex, column });
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
164
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
165
|
+
// 切换正倒序
|
|
166
|
+
changeDescSort () {
|
|
167
|
+
this.isUseDescSort = !this.isUseDescSort;
|
|
168
|
+
this.changePage(1);
|
|
169
|
+
},
|
|
170
|
+
// 切换分页
|
|
171
|
+
changePage (page) {
|
|
172
|
+
this.pagePropsObj.page = page;
|
|
173
|
+
this.loadingFunc();
|
|
174
|
+
},
|
|
175
|
+
// 切换分页条数
|
|
176
|
+
changePageSize (pagesize) {
|
|
177
|
+
this.pagePropsObj.page = 1;
|
|
178
|
+
this.pagePropsObj.pagesize = pagesize;
|
|
179
|
+
this.loadingFunc();
|
|
178
180
|
},
|
|
179
181
|
|
|
180
182
|
// 点击 -添加行
|
|
@@ -341,6 +343,46 @@ export default {
|
|
|
341
343
|
},
|
|
342
344
|
|
|
343
345
|
/* ----------- 方法 ---------- */
|
|
346
|
+
// 初始化合并单元格的rowspan
|
|
347
|
+
initRowspan () {
|
|
348
|
+
if (this.isMergeRowTable) {
|
|
349
|
+
this.$set(this.tableDataObj, "rowspanMap", this.tableDataObj.rowspanMap || {});
|
|
350
|
+
|
|
351
|
+
// TODO: 待删除
|
|
352
|
+
Object.entries(this.rowspanMap).forEach(arr => {
|
|
353
|
+
if (arr[0].includes("dsh")) {
|
|
354
|
+
this.rowspanMap[arr[0].split("dsh").join("--")] = this.rowspanMap[arr[1]];
|
|
355
|
+
delete this.rowspanMap[arr[0]];
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
this.allListData.forEach((rowItem, rowIndex) => {
|
|
360
|
+
this.mergeRowColKeys.forEach(colKey => {
|
|
361
|
+
const column = { _key: colKey };
|
|
362
|
+
|
|
363
|
+
// 新增页 -行的_id被置换,rowspanMap也要相应置换,还要清除rowspanMap里和默认行老_id相关的
|
|
364
|
+
const oldId = this.idRecordMap[rowItem._id];
|
|
365
|
+
const oldRow = { ...rowItem, _id: oldId };
|
|
366
|
+
if (oldId && ![undefined, null].includes(this.rowspanMap[this.getMixKey(oldRow, column)])) {
|
|
367
|
+
this.rowspanMap[this.getMixKey(rowItem, column)] = this.getRealRowspan({ row: oldRow, rowIndex, column });
|
|
368
|
+
delete this.rowspanMap[this.getMixKey(oldRow, column)];
|
|
369
|
+
} else {
|
|
370
|
+
this.rowspanMap[this.getMixKey(rowItem, column)] = this.getRealRowspan({ row: rowItem, rowIndex, column });
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
// 清除rowspanMap无用的(针对来回改mergeRowColKeys)
|
|
376
|
+
Object.entries(this.rowspanMap).forEach(arr => {
|
|
377
|
+
const keyArr = arr[0].split("--");
|
|
378
|
+
const id = keyArr[0];
|
|
379
|
+
const colKey = keyArr.slice(1).join("--");
|
|
380
|
+
if (!this.allListMap[id] || !this.mergeRowColKeys.includes(colKey)) {
|
|
381
|
+
delete this.rowspanMap[arr[0]];
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
},
|
|
344
386
|
// 加工单元格对应的配置
|
|
345
387
|
getSelfResetCol ({ row, rowIndex, column }) {
|
|
346
388
|
return this.mergeRowColKeys.includes(column._key)
|
|
@@ -45,10 +45,6 @@ export default {
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
|
|
48
|
-
total: {
|
|
49
|
-
type: Number,
|
|
50
|
-
default: 0
|
|
51
|
-
},
|
|
52
48
|
compareData: {
|
|
53
49
|
type: Array,
|
|
54
50
|
default () {
|
|
@@ -101,13 +97,6 @@ export default {
|
|
|
101
97
|
},
|
|
102
98
|
|
|
103
99
|
isLoading: false,
|
|
104
|
-
isUseDescSort: false,
|
|
105
|
-
pageMode: "small",
|
|
106
|
-
pagePropsObj: {
|
|
107
|
-
page: 1,
|
|
108
|
-
pagesize: 10,
|
|
109
|
-
pagesizeOpts: [10, 20, 30, 50]
|
|
110
|
-
},
|
|
111
100
|
|
|
112
101
|
dshRenderName: undefined,
|
|
113
102
|
hideStatus: true,
|
|
@@ -482,29 +471,9 @@ export default {
|
|
|
482
471
|
return rowItem;
|
|
483
472
|
});
|
|
484
473
|
},
|
|
485
|
-
// 全部数据 或 筛选时符合条件的数据 -当前页的
|
|
486
|
-
curPageShowListData () {
|
|
487
|
-
return this.pagePropsObj.page >= 1
|
|
488
|
-
? (this.pagePropsObj.page - 1) * this.pagePropsObj.pagesize >= this.showListData.length
|
|
489
|
-
? this.showListData.slice(
|
|
490
|
-
(this.pagePropsObj.page - 2) * this.pagePropsObj.pagesize,
|
|
491
|
-
(this.pagePropsObj.page - 1) * this.pagePropsObj.pagesize
|
|
492
|
-
)
|
|
493
|
-
: this.showListData.slice(
|
|
494
|
-
(this.pagePropsObj.page - 1) * this.pagePropsObj.pagesize,
|
|
495
|
-
this.pagePropsObj.page * this.pagePropsObj.pagesize
|
|
496
|
-
)
|
|
497
|
-
: [];
|
|
498
|
-
},
|
|
499
474
|
// 全部数据 或 筛选时符合条件的数据 -总数
|
|
500
475
|
selfTotal () {
|
|
501
|
-
return this.
|
|
502
|
-
},
|
|
503
|
-
// 全部数据 或 筛选时符合条件的数据 -共多少分页
|
|
504
|
-
PageNum () {
|
|
505
|
-
return this.selfTotal % this.pagePropsObj.pagesize > 0
|
|
506
|
-
? Math.ceil(this.selfTotal / this.pagePropsObj.pagesize)
|
|
507
|
-
: Math.floor(this.selfTotal / this.pagePropsObj.pagesize);
|
|
476
|
+
return this.showListData.length;
|
|
508
477
|
},
|
|
509
478
|
|
|
510
479
|
parentDataId () {
|
|
@@ -836,6 +805,12 @@ export default {
|
|
|
836
805
|
this.loadingFunc();
|
|
837
806
|
},
|
|
838
807
|
|
|
808
|
+
// 共外部使用
|
|
809
|
+
validate () {
|
|
810
|
+
this.showRuleMessage = true;
|
|
811
|
+
|
|
812
|
+
return this.allListData.every((row, rowIndex) => this.getRowRuleResult(row, rowIndex));
|
|
813
|
+
},
|
|
839
814
|
// 重置
|
|
840
815
|
reset () {
|
|
841
816
|
this.initFlag = true;
|
|
@@ -855,11 +830,12 @@ export default {
|
|
|
855
830
|
|
|
856
831
|
this.selfReset && this.selfReset();
|
|
857
832
|
},
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
833
|
+
loadingFunc () {
|
|
834
|
+
this.isLoading = true;
|
|
835
|
+
setTimeout(() => {
|
|
836
|
+
this.changeSelect();
|
|
837
|
+
this.isLoading = false;
|
|
838
|
+
});
|
|
863
839
|
},
|
|
864
840
|
|
|
865
841
|
// 筛选回调
|
|
@@ -871,29 +847,8 @@ export default {
|
|
|
871
847
|
}
|
|
872
848
|
},
|
|
873
849
|
// 列表选择项改变
|
|
874
|
-
changeSelect (...params) {
|
|
875
|
-
this.$emit("changeSelect",
|
|
876
|
-
},
|
|
877
|
-
// 切换正倒序
|
|
878
|
-
changeSort () {
|
|
879
|
-
this.isUseDescSort = !this.isUseDescSort;
|
|
880
|
-
this.changePage(1);
|
|
881
|
-
},
|
|
882
|
-
// 切换分页
|
|
883
|
-
changePage (page) {
|
|
884
|
-
this.pagePropsObj.page = page;
|
|
885
|
-
this.loadingFunc();
|
|
886
|
-
},
|
|
887
|
-
// 切换分页条数
|
|
888
|
-
changePageSize (pagesize) {
|
|
889
|
-
this.pagePropsObj.page = 1;
|
|
890
|
-
this.pagePropsObj.pagesize = pagesize;
|
|
891
|
-
},
|
|
892
|
-
loadingFunc () {
|
|
893
|
-
this.isLoading = true;
|
|
894
|
-
setTimeout(() => {
|
|
895
|
-
this.isLoading = false;
|
|
896
|
-
});
|
|
850
|
+
changeSelect (selections = [], ...params) {
|
|
851
|
+
this.$emit("changeSelect", selections.map(item => item._id), selections, ...params);
|
|
897
852
|
},
|
|
898
853
|
|
|
899
854
|
// 输入框失去焦点
|