Browse Source

2025/6/29

master
Aoi_Tori 7 months ago
parent
commit
d6182e6521
  1. 37
      src/views/common/filterSearch.vue

37
src/views/common/filterSearch.vue

@ -104,16 +104,24 @@ export default {
this.$message.error(error)
})
}else {
this.showSetting = true;
}
},
selectRow(selection,row){
if (row.visible === 'Y'){
row.visible = 'N'
}else {
row.visible = 'Y'
}
handleSelectionChange(selection) {
this.tableList.forEach(row => {
// 使 Object.is
const isSelected = selection.some(selectedRow => Object.is(selectedRow, row));
row.visible = isSelected ? 'Y' : 'N';
});
},
// selectRow(selection,row){
// // if (row.visible === 'Y'){
// // row.visible = 'N'
// // }else {
// // row.visible = 'Y'
// // }
// },
clearTableList(){
if (this.showSetting){
this.tableList = this.tableList.map(row=>{
@ -333,13 +341,13 @@ export default {
this.showSettingTableList = []
}
},
tableList(newVal,oldVal){
this.$nextTick(()=>{
this.tableList.forEach(row=>{
this.$refs.settingTable.toggleRowSelection(row,row.visible === 'Y')
})
})
}
// tableList(newVal,oldVal){
// this.$nextTick(()=>{
// this.tableList.forEach(row=>{
// this.$refs.settingTable.toggleRowSelection(row,row.visible === 'Y')
// })
// })
// }
},
created() {
@ -373,10 +381,11 @@ export default {
</div>
<div style="display: flex;gap: 5px">
<div style="width: 85%;height: 400px" v-loading="loadingTableList" element-loading-text="加载中">
<el-table :data="tableList" @select="selectRow" ref="settingTable" border height="100%" v-show="showSetting">
<el-table :data="tableList" @selection-change="handleSelectionChange" ref="settingTable" border height="100%" v-show="showSetting">
<el-table-column
type="selection"
width="40" align="center">
label="是否可见"
</el-table-column>
<el-table-column label="操作" align="left" header-align="center" width="65" >
<template slot-scope="{row,$index}">

Loading…
Cancel
Save