fix(接口测试): 修复由保存前一页而引起的全选相关问题

--bug=1021777 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001021777
--bug=1021772 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001021772
This commit is contained in:
guoyuqi 2023-01-10 18:58:28 +08:00 committed by xiaomeinvG
parent 0bd8f2644f
commit 8c06f57b04
2 changed files with 10 additions and 7 deletions

View File

@ -341,6 +341,9 @@ export default {
}); });
} }
}, },
pageSize() {
this.clear();
},
selectDataCounts(value) { selectDataCounts(value) {
this.$emit("selectCountChange", value); this.$emit("selectCountChange", value);
}, },
@ -417,7 +420,7 @@ export default {
this.selectRows, this.selectRows,
this.condition this.condition
); );
setUnSelectIds(this.data, this.condition, this.selectRows); setUnSelectIds(selection, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts( this.selectDataCounts = getSelectDataCounts(
this.condition, this.condition,
this.total, this.total,
@ -447,8 +450,6 @@ export default {
}, },
isSelectDataAll(data) { isSelectDataAll(data) {
this.condition.selectAll = data; this.condition.selectAll = data;
//
toggleAllSelection(this.$refs.table, this.data, this.selectRows);
// //
_handleSelectAll(this, this.data, this.data, this.selectRows); _handleSelectAll(this, this.data, this.data, this.selectRows);
//ID() //ID()

View File

@ -10,18 +10,20 @@ import {CUSTOM_FIELD_TYPE_OPTION, SYSTEM_FIELD_NAME_MAP} from "./table-constants
import {generateColumnKey} from "../components/search/custom-component"; import {generateColumnKey} from "../components/search/custom-component";
export function _handleSelectAll(component, selection, tableData, selectRows, condition) { export function _handleSelectAll(component, selection, tableData, selectRows, condition) {
selectRows.clear();
if (selection.length > 0) { if (selection.length > 0) {
selection.forEach((item) => {
selectRows.add(item);
});
if (selection.length === 1) { if (selection.length === 1) {
selection.hashTree = []; selection.hashTree = [];
tableData.forEach((item) => { tableData.forEach((item) => {
component.$set(item, "showMore", true); component.$set(item, "showMore", true);
selectRows.add(item);
}); });
} else { } else {
tableData.forEach((item) => { tableData.forEach((item) => {
item.hashTree = []; item.hashTree = [];
component.$set(item, "showMore", true); component.$set(item, "showMore", true);
selectRows.add(item);
}); });
} }
} else { } else {
@ -83,8 +85,8 @@ export function getSelectDataCounts(condition, total, selectRows) {
// 全选操作 // 全选操作
export function toggleAllSelection(table, tableData, selectRows) { export function toggleAllSelection(table, tableData, selectRows) {
//如果已经全选,不需要再操作了 //如果已经全选,不需要再操作了
if (selectRows.size != tableData.length) { if (selectRows.size !== tableData.length) {
table.toggleAllSelection(true); table.toggleAllSelection();
} }
} }