refactor: 全选按钮颜色高亮
This commit is contained in:
parent
2c5ccaef5d
commit
21fb80adf6
|
@ -19,6 +19,7 @@
|
||||||
<ms-table-header-select-popover v-show="total>0"
|
<ms-table-header-select-popover v-show="total>0"
|
||||||
:page-size="pageSize>total?total:pageSize"
|
:page-size="pageSize>total?total:pageSize"
|
||||||
:total="total"
|
:total="total"
|
||||||
|
:select-data-counts="selectDataCounts"
|
||||||
@selectPageAll="isSelectDataAll(false)"
|
@selectPageAll="isSelectDataAll(false)"
|
||||||
@selectAll="isSelectDataAll(true)"/>
|
@selectAll="isSelectDataAll(true)"/>
|
||||||
|
|
||||||
|
@ -617,7 +618,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSelectAll(selection) {
|
handleSelectAll(selection) {
|
||||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
_handleSelectAll(this, selection, this.tableData, this.selectRows, this.condition);
|
||||||
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
||||||
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
||||||
this.$emit('selection', selection);
|
this.$emit('selection', selection);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<ms-table-header-select-popover v-show="total>0"
|
<ms-table-header-select-popover v-show="total>0"
|
||||||
:page-size="pageSize>total?total:pageSize"
|
:page-size="pageSize>total?total:pageSize"
|
||||||
:total="total"
|
:total="total"
|
||||||
|
:select-data-counts="selectDataCounts"
|
||||||
@selectPageAll="isSelectDataAll(false)"
|
@selectPageAll="isSelectDataAll(false)"
|
||||||
@selectAll="isSelectDataAll(true)"/>
|
@selectAll="isSelectDataAll(true)"/>
|
||||||
|
|
||||||
|
@ -411,7 +412,7 @@ export default {
|
||||||
this.initTable();
|
this.initTable();
|
||||||
},
|
},
|
||||||
handleSelectAll(selection) {
|
handleSelectAll(selection) {
|
||||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
_handleSelectAll(this, selection, this.tableData, this.selectRows, this.condition);
|
||||||
this.selectRowsCount(this.selectRows)
|
this.selectRowsCount(this.selectRows)
|
||||||
},
|
},
|
||||||
search() {
|
search() {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<ms-table-header-select-popover v-show="total>0"
|
<ms-table-header-select-popover v-show="total>0"
|
||||||
:page-size="pageSize>total?total:pageSize"
|
:page-size="pageSize>total?total:pageSize"
|
||||||
:total="total"
|
:total="total"
|
||||||
|
:select-data-counts="selectDataCounts"
|
||||||
@selectPageAll="isSelectDataAll(false)"
|
@selectPageAll="isSelectDataAll(false)"
|
||||||
@selectAll="isSelectDataAll(true)"/>
|
@selectAll="isSelectDataAll(true)"/>
|
||||||
|
|
||||||
|
@ -547,7 +548,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSelectAll(selection) {
|
handleSelectAll(selection) {
|
||||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
_handleSelectAll(this, selection, this.tableData, this.selectRows, this.condition);
|
||||||
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
||||||
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,9 +1,21 @@
|
||||||
<template>
|
<template>
|
||||||
<el-table-column width="1" :resizable="false" align="center">
|
<el-table-column v-if="isShow" width="1" :resizable="false" align="center">
|
||||||
<el-popover slot="header" placement="right" trigger="click" style="margin-right: 0px;">
|
<el-popover slot="header" placement="right" trigger="click" style="margin-right: 0px;">
|
||||||
<el-link @click.native.stop="$emit('selectAll')">{{$t('api_test.batch_menus.select_all_data',[total])}}</el-link>
|
<el-link
|
||||||
|
:class="{'selected-link': selectDataCounts === this.total}"
|
||||||
|
@click.native.stop="click('selectAll')"
|
||||||
|
ref="selectAllLink">
|
||||||
|
{{$t('api_test.batch_menus.select_all_data',[total])}}
|
||||||
|
</el-link>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<el-link @click.native.stop="$emit('selectPageAll')">{{$t('api_test.batch_menus.select_show_data',[pageSize])}}</el-link>
|
<el-link
|
||||||
|
:class="{'selected-link': selectDataCounts === this.pageSize}"
|
||||||
|
@click.native.stop="click('selectPageAll')"
|
||||||
|
ref="selectPageAllLink">
|
||||||
|
{{$t('api_test.batch_menus.select_show_data',[pageSize])}}
|
||||||
|
</el-link>
|
||||||
|
|
||||||
<i class="el-icon-arrow-down" slot="reference"></i>
|
<i class="el-icon-arrow-down" slot="reference"></i>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -12,14 +24,35 @@
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "MsTableSelectAll",
|
name: "MsTableSelectAll",
|
||||||
props: ['total', 'pageSize'],
|
props: ['total', 'pageSize', 'selectDataCounts'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
isShow: true
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
selectDataCounts() {
|
||||||
|
this.reload();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
click(even) {
|
||||||
|
this.$emit(even);
|
||||||
|
},
|
||||||
|
reload() {
|
||||||
|
this.isShow = false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.isShow = true;
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
.selected-link{
|
||||||
|
color: #783887 !important;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<ms-table-header-select-popover v-show="total>0"
|
<ms-table-header-select-popover v-show="total>0"
|
||||||
:page-size="pageSize>total?total:pageSize"
|
:page-size="pageSize>total?total:pageSize"
|
||||||
:total="total"
|
:total="total"
|
||||||
|
:select-data-counts="selectDataCounts"
|
||||||
@selectPageAll="isSelectDataAll(false)"
|
@selectPageAll="isSelectDataAll(false)"
|
||||||
@selectAll="isSelectDataAll(true)"/>
|
@selectAll="isSelectDataAll(true)"/>
|
||||||
<el-table-column v-if="!referenced" width="30" min-width="30" :resizable="false" align="center">
|
<el-table-column v-if="!referenced" width="30" min-width="30" :resizable="false" align="center">
|
||||||
|
@ -365,7 +366,7 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSelectAll(selection) {
|
handleSelectAll(selection) {
|
||||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
_handleSelectAll(this, selection, this.tableData, this.selectRows, this.condition);
|
||||||
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
||||||
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
||||||
this.$emit('selection', selection);
|
this.$emit('selection', selection);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<ms-table-header-select-popover v-show="total>0"
|
<ms-table-header-select-popover v-show="total>0"
|
||||||
:page-size="pageSize>total?total:pageSize"
|
:page-size="pageSize>total?total:pageSize"
|
||||||
:total="total"
|
:total="total"
|
||||||
|
:select-data-counts="selectDataCounts"
|
||||||
@selectPageAll="isSelectDataAll(false)"
|
@selectPageAll="isSelectDataAll(false)"
|
||||||
@selectAll="isSelectDataAll(true)"/>
|
@selectAll="isSelectDataAll(true)"/>
|
||||||
<el-table-column v-if="!referenced" width="30" min-width="30" :resizable="false" align="center">
|
<el-table-column v-if="!referenced" width="30" min-width="30" :resizable="false" align="center">
|
||||||
|
@ -746,7 +747,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSelectAll(selection) {
|
handleSelectAll(selection) {
|
||||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
_handleSelectAll(this, selection, this.tableData, this.selectRows, this.condition);
|
||||||
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
||||||
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
||||||
this.$emit('selection', selection);
|
this.$emit('selection', selection);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<ms-table-header-select-popover v-show="total>0"
|
<ms-table-header-select-popover v-show="total>0"
|
||||||
:page-size="pageSize>total?total:pageSize"
|
:page-size="pageSize>total?total:pageSize"
|
||||||
:total="total"
|
:total="total"
|
||||||
|
:select-data-counts="selectDataCounts"
|
||||||
@selectPageAll="isSelectDataAll(false)"
|
@selectPageAll="isSelectDataAll(false)"
|
||||||
@selectAll="isSelectDataAll(true)"/>
|
@selectAll="isSelectDataAll(true)"/>
|
||||||
<el-table-column v-if="!referenced" width="30" min-width="30" :resizable="false" align="center">
|
<el-table-column v-if="!referenced" width="30" min-width="30" :resizable="false" align="center">
|
||||||
|
@ -361,7 +362,7 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSelectAll(selection) {
|
handleSelectAll(selection) {
|
||||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
_handleSelectAll(this, selection, this.tableData, this.selectRows, this.condition);
|
||||||
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
||||||
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
||||||
this.$emit('selection', selection);
|
this.$emit('selection', selection);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<ms-table-header-select-popover v-show="total>0"
|
<ms-table-header-select-popover v-show="total>0"
|
||||||
:page-size="pageSize > total ? total : pageSize"
|
:page-size="pageSize > total ? total : pageSize"
|
||||||
:total="total"
|
:total="total"
|
||||||
|
:select-data-counts="selectDataCounts"
|
||||||
@selectPageAll="isSelectDataAll(false)"
|
@selectPageAll="isSelectDataAll(false)"
|
||||||
@selectAll="isSelectDataAll(true)"/>
|
@selectAll="isSelectDataAll(true)"/>
|
||||||
|
|
||||||
|
@ -494,7 +495,7 @@ export default {
|
||||||
this.$emit('testCaseDetail', row);
|
this.$emit('testCaseDetail', row);
|
||||||
},
|
},
|
||||||
handleSelectAll(selection) {
|
handleSelectAll(selection) {
|
||||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
_handleSelectAll(this, selection, this.tableData, this.selectRows, this.condition);
|
||||||
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
setUnSelectIds(this.tableData, this.condition, this.selectRows);
|
||||||
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import {getCurrentProjectID, getCurrentUser, humpToLine} from "@/common/js/utils";
|
import {getCurrentProjectID, getCurrentUser, humpToLine} from "@/common/js/utils";
|
||||||
import {TEST_CASE_LIST} from "@/common/js/constants";
|
|
||||||
|
|
||||||
export function _handleSelectAll(component, selection, tableData, selectRows) {
|
export function _handleSelectAll(component, selection, tableData, selectRows, condition) {
|
||||||
if (selection.length > 0) {
|
if (selection.length > 0) {
|
||||||
if (selection.length === 1) {
|
if (selection.length === 1) {
|
||||||
selection.hashTree = [];
|
selection.hashTree = [];
|
||||||
|
@ -19,6 +18,9 @@ export function _handleSelectAll(component, selection, tableData, selectRows) {
|
||||||
component.$set(item, "showMore", false);
|
component.$set(item, "showMore", false);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (selectRows.size < 1 && condition) {
|
||||||
|
condition.selectAll = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function _handleSelect(component, selection, row, selectRows) {
|
export function _handleSelect(component, selection, row, selectRows) {
|
||||||
|
|
Loading…
Reference in New Issue