hberp/hb_client/src/components/Gantt/components/dashLeftMenu.vue

125 lines
2.7 KiB
Python

<template>
<div class="tableMneu">
<div
class="mask"
v-if="isShowHeaderBox || menuOpen"
@click="maskClick"
></div>
<el-table
ref="tableMenu"
:data="tableData"
size="mini"
fit
style="width: 100%;border-top: 1px solid #f5f5f5"
row-key="id"
height="100%"
default-expand-all
highlight-current-row
@row-click="handlerRowClick"
@expand-change="handlerExpand"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column label="任务编号" prop="name" width="140" show-overflow-tooltip>
</el-table-column>
<el-table-column label="产品名称" prop="productName" width="120" show-overflow-tooltip>
</el-table-column>
<el-table-column label="产品型号" prop="productNum">
</el-table-column>
<el-table-column label="生产数量" prop="per">
</el-table-column>
</el-table>
</div>
</template>
<script>
export default {
props: {
list: Array,
BGScrollTop: Number
},
computed: {
tableData() {
return this.list;
}
},
watch: {
BGScrollTop: {
handler: function(newValue) {
let table = this.$refs.tableMenu.bodyWrapper;
table.scrollTo(0, newValue);
}
}
},
data() {
return {
checkList: [],
isShowHeaderBox: false,
menuOpen: false,
//当前点击的row
currentRow: {}
};
},
methods: {
handlerWatchScroll() {
let table = this.$refs.tableMenu.bodyWrapper;
table.addEventListener("scroll", e => {
this.$emit("TableScrollTop", e.srcElement.scrollTop);
});
},
handlerSelect(row) {
this.$refs.tableMenu.setCurrentRow(row);
},
handlerExpand(row, expand) {
// console.log(row, expanded);
this.$emit("handlerExpand", row, expand);
},
maskClick() {
this.isShowHeaderBox = false;
this.menuOpen = false;
this.currentRow = {};
},
handlerRowClick(row) {
this.$emit("handlerRowClick", row);
},
},
mounted() {
this.handlerWatchScroll();
}
};
</script>
<style lang="scss" scoped>
.el-table__header>.has-gutter>tr>th{
height: 41px!important;
}
.tableMneu {
width: 100%;
position: relative;
height: 100%;
.mask {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: transparent;
z-index: 9999;
}
}
.tableMneu {
.el-table th.gutter {
display: table-cell !important;
}
.el-table td,
.el-table th {
padding: 8px 0;
}
.el-table--border td {
border-right: none;
}
}
.el-table th.el-table__cell>.cell{
font-size: 12px!important;
}
</style>