Commit 4ba717c0 by ym

table

1 parent 049b7935
<template>
<div class="glsx-table" :class="{ hasTableContent: showClass }">
<el-table id="initTable" :ref="tableParams.mutiSelectName + 'MutiTable' || 'MutiTable'" :data="getListApi ? data : tableData" :row-key="tableParams.mutiSelectUniqueKey || ''" v-loading="loading" :border="border" :highlight-current-row="true" :stripe="true" @sort-change="sortChange" @selection-change="handleSelect" :size="size" :header-cell-style="headerStyle">
<div class="glsx-table">
<el-table id="initTable" :ref="tableParams.mutiSelectName + 'MutiTable' || 'MutiTable'" :data="getListApi ? data : tableData" :row-key="tableParams.mutiSelectUniqueKey || ''" v-loading="loading" :border="border" :tableId="tableId" :highlight-current-row="true" :stripe="true" @sort-change="sortChange" @selection-change="handleSelect" :size="size" :header-cell-style="headerStyle">
<el-table-column v-if="tableParams.mutiSelectUniqueKey && tableParams.mutiSelectName" type="selection" width="55" :selectable="checkSelectable" :reserve-selection="true"></el-table-column>
<el-table-column v-if="hasNum" align="center" width="60px" label="序号" type="index" :index="index => index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1"></el-table-column>
<el-table-column v-for="(item, index) in tableColumns" :key="index" :label="item.label" :prop="item.prop" :width="item.width" :min-width="item.minWidth" :align="item.align || 'center'" :sortable="item.sortable">
......@@ -75,6 +75,11 @@ export default {
type: Object,
default: () => {}
},
//表格需要多传入一个id的情况
tableId:{
type:String,
default:''
},
// 搜索条件
searchForm: {
type: Object,
......@@ -199,13 +204,13 @@ export default {
customHeadShowList(val) {
this.isCustomHead && this.findShowHeadCol()
},
data: {
immediate: true,
handler(val) {
this.showClass = val.length > 0 ? true : false
},
deep: true
}
// data: {
// immediate: true,
// handler(val) {
// this.showClass = val.length > 0 ? true : false
// },
// deep: true
// }
},
methods: {
......@@ -254,6 +259,7 @@ export default {
let clientHeight = document.documentElement.clientHeight
document.getElementById('initTable').style.height = clientHeight - offsettop - paginationHeight - navHeight + 'px'
document.querySelector('.el-table__empty-block').style.height=(clientHeight - offsettop - paginationHeight - navHeight)+'px';
},
refreshTable(isResetPageNum = true, isClearMuti = true) {
......@@ -266,6 +272,9 @@ export default {
...this.page,
...this.searchForm
}
if(this.tableId){
params.id=this.tableId
}
this.getListApi(params)
.then(res => {
console.log(res)
......@@ -310,18 +319,6 @@ export default {
this.page[this.pageConf.pageSize] = 10
this.page[this.pageConf.pageNum] = 1
this.getListApi && this.refreshTable()
// this.$nextTick(() => {
// var _this=this
// setTimeout(() => {
// // 使用getListApi获取和返回数组为空时算高度 !(_this.getListApi && _this.data.length==0)
// if(_this.getListApi ){
// }
// }, 200)
// })
}
}
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!