Commit a10ae227 by limin

Merge branch 'master' of http://192.168.3.233:8090/npm/glsx-components into master

2 parents 3db59efa 2ac76878
<!-- 表格+分页 v-show="tableShow"-->
<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" :height="height" :highlight-current-row="true" :stripe="true" @sort-change="sortChange" @selection-change="handleSelect" :size="size" :header-cell-style="headerStyle">
<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">
<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">
......@@ -37,21 +36,14 @@
</template>
<script>
import { Table, TableColumn, Pagination } from 'element-ui'
export default {
name: 'glsx-table',
data() {
return {
loading: false,
data: [],
// 页码
page: {},
total: 10,
// 多选数组
mutiSelectArr: {},
tableColumns: [],
showClass:false
}
name: 'GLTable',
components: {
[Table.name]: Table,
[TableColumn.name]: TableColumn,
[Pagination.name]: Pagination
},
props: {
......@@ -184,6 +176,21 @@ export default {
}
},
data() {
return {
loading: false,
data: [],
// 页码
page: {},
total: 10,
// 多选数组
mutiSelectArr: {},
tableColumns: [],
showClass:false
}
},
watch: {
customHeadShowList(val) {
this.isCustomHead && this.findShowHeadCol()
......@@ -197,33 +204,6 @@ export default {
}
},
mounted() {
this.isCustomHead ? this.findShowHeadCol() : (this.tableColumns = this.tableParams.tableColumns)
this.page = {}
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 ){
let offsettop = document.getElementById('initTable').offsetTop
console.log('表格距离顶部', offsettop)
let clientHeight = document.body.clientHeight
console.log(clientHeight)
// _this.height=(clientHeight - offsettop - 101)+''
document.getElementById('initTable').style.height= (clientHeight - offsettop - 231)+'px';
}
}, 200)
})
},
methods: {
findShowHeadCol() {
this.tableColumns = []
......@@ -257,6 +237,25 @@ export default {
this.mutiSelectArr[this.tableParams.mutiSelectName] = []
this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].clearSelection()
},
//设置表格高度
setTableHeightFun(){
let offsettop = document.getElementById('initTable').offsetTop
console.log('表格距离顶部', offsettop)
let clientHeight = document.documentElement.clientHeight
console.log('页面整体高度',clientHeight)
console.log(document.getElementsByClassName('scrm-base-nav').length)
if(document.getElementsByClassName('scrm-base-nav').length && document.getElementsByClassName('scrm-base-nav').length){
var baseNavHeight=document.getElementsByClassName('scrm-base-nav')[0].clientHeight;
var subNavHeight=document.getElementsByClassName('scrm-base-sub-nav')[0].clientHeight
document.getElementById('initTable').style.height= (clientHeight - offsettop - 121-baseNavHeight-subNavHeight)+'px';
}else{
document.getElementById('initTable').style.height= (clientHeight - offsettop - 121)+'px';
}
},
refreshTable(isResetPageNum = true, isClearMuti = true) {
this.beforeSearchFn().then(res => {
......@@ -304,9 +303,31 @@ export default {
this.page[this.pageConf.pageNum] = value
this.getListApi ? this.refreshTable(false, false) : this.$emit('refreshTable', this.page)
}
},
mounted() {
this.isCustomHead ? this.findShowHeadCol() : (this.tableColumns = this.tableParams.tableColumns)
this.page = {}
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>
};
</script>
<style>
.a-click {
cursor: pointer;
......@@ -331,7 +352,7 @@ export default {
}
.glsx-table .emptyBg {
display: inline-block;
margin-top: 150px;
/* margin-top: 150px; */
height: 100%;
}
.glsx-table .emptyBg div {
......@@ -344,4 +365,4 @@ export default {
/* .hasTableContent .el-table__body-wrapper{
height: 100%;
} */
</style>
</style>
\ No newline at end of file
......@@ -329,6 +329,12 @@ $dackColor: #4f48e6;
color: $defaultColor;
}
.el-pagination {
display: flex;
margin-top: 10px;
align-items: center;
}
.el-pagination button:hover {
color: $defaultColor;
}
......@@ -341,6 +347,14 @@ $dackColor: #4f48e6;
border-color: $defaultColor;
}
.el-pagination__jump {
margin-left: 5px;
}
.el-pagination .el-select .el-input {
margin-left: 10px;
}
.el-form-item__label {
font-size: 14px;
font-weight: 400;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!