fix: 调整表格列弹框的展开位置

mengfanliang-0726-businessPerson_table
DESKTOP-2ESM03N\zcloud 2024-07-26 18:00:35 +08:00
parent 1e28240f58
commit b8d7e40317
1 changed files with 50 additions and 42 deletions

View File

@ -48,7 +48,40 @@
@row-click="rowClick" @row-click="rowClick"
> >
<el-table-column :selectable="handleSelectWithDifferentStatus" type="selection" width="55" fixed align="center" /> <el-table-column :selectable="handleSelectWithDifferentStatus" type="selection" width="55" fixed align="center" />
<el-table-column type="index" label="序号" align="center" width="50" /> <el-table-column type="index" label="序号" align="center" width="90">
<template slot="header">
<el-popover
ref="tablePopover"
v-model="popoverVisible"
width="240"
trigger="manual"
>
<span slot="reference" style="cursor: pointer;" @click="openPopover">
操作
<i class="el-icon-finished" style="font-weight: bold;" />
</span>
<div class="popoverCheckBoxArea">
<el-checkbox :indeterminate="isIndeterminate" @change="handleCheckAllChange"></el-checkbox>
<div style="margin: 10px 0;" />
<el-tree
ref="treeRef"
:data="optionsColumns"
:props="defaultProps"
:default-expand-all="true"
:default-checked-keys="checkedColumns"
show-checkbox
node-key="id"
class="treeColumnStyle"
@check-change="handleCheckChange"
/>
</div>
<div class="popoverCheckBoxButton">
<el-button size="mini" @click="canclePopover"></el-button>
<el-button type="primary" size="mini" @click="confirmPopover"></el-button>
</div>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="enterpriseName" label="企业名称" align="center" show-overflow-tooltip width="120" /> <el-table-column prop="enterpriseName" label="企业名称" align="center" show-overflow-tooltip width="120" />
<el-table-column prop="groupUnit" label="集团单位" show-overflow-tooltip align="center" width="120" /> <el-table-column prop="groupUnit" label="集团单位" show-overflow-tooltip align="center" width="120" />
<el-table-column prop="shareSuperdepart" label="股份主管部门" align="center" width="120" /> <el-table-column prop="shareSuperdepart" label="股份主管部门" align="center" width="120" />
@ -104,41 +137,6 @@
<el-table-column prop="motorVehiclesWork" label="企业内机动车辆作业" align="center" width="130" /> <el-table-column prop="motorVehiclesWork" label="企业内机动车辆作业" align="center" width="130" />
<el-table-column prop="otherSpecialWork" label="其他特种作业" align="center" width="120" /> <el-table-column prop="otherSpecialWork" label="其他特种作业" align="center" width="120" />
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" min-width="100" fixed="right">
<template slot="header">
<el-popover
ref="tablePopover"
v-model="popoverVisible"
width="240"
trigger="manual"
>
<span slot="reference" style="cursor: pointer;" @click="openPopover">
操作
<i class="el-icon-arrow-down" style="font-weight: bold;" />
</span>
<div class="popoverCheckBoxArea">
<el-checkbox :indeterminate="isIndeterminate" @change="handleCheckAllChange"></el-checkbox>
<div style="margin: 10px 0;" />
<el-tree
ref="treeRef"
:data="optionsColumns"
:props="defaultProps"
:default-expand-all="true"
:default-checked-keys="checkedColumns"
show-checkbox
node-key="id"
class="treeColumnStyle"
@check-change="handleCheckChange"
/>
</div>
<div class="popoverCheckBoxButton">
<el-button size="mini" @click="canclePopover"></el-button>
<el-button type="primary" size="mini" @click="confirmPopover"></el-button>
</div>
</el-popover>
</template>
</el-table-column>
</el-table> </el-table>
<div class="page-btn-group"> <div class="page-btn-group">
@ -550,15 +548,25 @@ export default {
// //
openPopover() { openPopover() {
this.popoverVisible = true this.popoverVisible = true
this.$nextTick(() => {
document.getElementsByClassName('el-popover el-popper')[0].style.display = 'none'
})
}, },
// //
handleCheckAllChange(val) { handleCheckAllChange(val) {
const treeRef = this.$refs.treeRef const columnsValueList = []
if (val) { this.getIds(this.optionsColumns).map(item => {
treeRef.setCheckedNodes(this.getIds(this.optionsColumns)) columnsValueList.push(item)
} else { })
treeRef.setCheckedNodes([]) this.checkedColumns = val ? columnsValueList : []
}
console.log('this.checkedColumns :>> ', this.checkedColumns)
// const treeRef = this.$refs.treeRef
// if (val) {
// treeRef.setCheckedNodes(this.getIds(this.optionsColumns))
// } else {
// treeRef.setCheckedNodes([])
// }
}, },
canclePopover() { canclePopover() {
this.popoverVisible = false this.popoverVisible = false