fix:全选自动提示

This commit is contained in:
wenyann 2021-06-29 18:35:22 +08:00 committed by 刘瑞斌
parent 2804488979
commit b325f42598
3 changed files with 32 additions and 5 deletions

View File

@ -29,7 +29,8 @@
:resizable="false" align="center">
<template v-slot:default="scope">
<!-- 选中记录后浮现的按钮提供对记录的批量操作 -->
<show-more-btn :is-show="scope.row.showMore" :buttons="batchOperators" :size="selectDataCounts"/>
<show-more-btn :is-show-tool="scope.row.showTool" :is-show="scope.row.showMore" :buttons="batchOperators"
:size="selectDataCounts"/>
</template>
</el-table-column>

View File

@ -2,7 +2,8 @@
<div v-if="isShow">
<el-dropdown placement="bottom" trigger="click" size="medium">
<div @click.stop class="show-more-btn">
<el-tooltip class="item" effect="dark" :content="$t('test_track.case.batch_operate')" placement="top-start">
<el-tooltip :value="showTool" class="item" effect="dark" :content="$t('test_track.case.batch_operate')"
placement="top-start">
<i class="el-icon-more ms-icon-more"/>
</el-tooltip>
@ -24,7 +25,8 @@
name: "ShowMoreBtn",
data() {
return {
disabled: false
disabled: false,
showTool: false
};
},
props: {
@ -32,10 +34,24 @@
type: Boolean,
default: false
},
isShowTool: {
type: Boolean,
default: false
},
buttons: Array,
row: Object,
size: Number
},
watch: {
isShowTool(val) {
if (val) {
this.showTool = val;
setTimeout(() => {
this.showTool = false;
}, 1000);
}
}
},
created() {
if (this.trashEnable) {
this.buttons.splice(1, 1);

View File

@ -7,13 +7,19 @@ export function _handleSelectAll(component, selection, tableData, selectRows, co
if (selection.length > 0) {
if (selection.length === 1) {
selection.hashTree = [];
tableData.forEach(item => {
tableData.forEach((item, index) => {
if (index === 0) {
component.$set(item, "showTool", true);
}
component.$set(item, "showMore", true);
selectRows.add(item);
});
} else {
tableData.forEach(item => {
tableData.forEach((item, index) => {
item.hashTree = [];
if (index === 0) {
component.$set(item, "showTool", true);
}
component.$set(item, "showMore", true);
selectRows.add(item);
});
@ -21,6 +27,7 @@ export function _handleSelectAll(component, selection, tableData, selectRows, co
} else {
selectRows.clear();
tableData.forEach(item => {
component.$set(item, "showTool", false);
component.$set(item, "showMore", false);
});
if (condition) {
@ -32,14 +39,17 @@ export function _handleSelectAll(component, selection, tableData, selectRows, co
export function _handleSelect(component, selection, row, selectRows) {
row.hashTree = [];
if (selectRows.has(row)) {
component.$set(row, "showTool", false);
component.$set(row, "showMore", false);
selectRows.delete(row);
} else {
component.$set(row, "showTool", true);
component.$set(row, "showMore", true);
selectRows.add(row);
}
let arr = Array.from(selectRows);
arr.forEach(row => {
component.$set(row, "showTool", true);
component.$set(row, "showMore", true);
});
}