|
|
|
@ -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}"> |
|
|
|
|