Commit 4ab79b62 by limin

保存

1 parent 4ba717c0
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
.then((child) => { .then((child) => {
child.get("height").then((height) => { child.get("height").then((height) => {
child.frame.setAttribute("scrolling", "no"); child.frame.setAttribute("scrolling", "no");
child.frame.style.height = `${height}px`; child.frame.style.height = `${height+14}px`;
}); });
this.subscribe && this.subscribe(child); this.subscribe && this.subscribe(child);
}) })
......
<template> <template>
<div class="glsx-table"> <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 id="initTable" :ref="tableParams.mutiSelectName + 'MutiTable' || 'MutiTable'" :data="getListApi ? data : tableData" :row-key="tableParams.mutiSelectUniqueKey || ''" v-loading="loading" :height="tableHeightValues" :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="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-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"> <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">
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
<slot name="auth-button" :scope="scope.row"></slot> <slot name="auth-button" :scope="scope.row"></slot>
</template> </template>
</el-table-column> </el-table-column>
<div slot="empty" class="emptyBg"> <template slot="empty" class="emptyBg">
<img class="noDataImg" :src="noDataImg" v-if="noDataImg" alt="" /> <img class="noDataImg" :src="noDataImg" v-if="noDataImg" alt="" />
<div>{{ noDataText }}</div> <div>{{ noDataText }}</div>
<slot name="additionalContent"></slot> <slot name="additionalContent"></slot>
</div> </template>
</el-table> </el-table>
<el-pagination v-if="hasPage" background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page[this.pageConf.pageNum]" :page-sizes="[10, 20, 30, 40]" :page-size="page[this.pageConf.pageSize]" :total="getListApi ? total : tableTotal" :layout="layout"></el-pagination> <el-pagination v-if="hasPage" background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page[this.pageConf.pageNum]" :page-sizes="[10, 20, 30, 40]" :page-size="page[this.pageConf.pageSize]" :total="getListApi ? total : tableTotal" :layout="layout"></el-pagination>
</div> </div>
...@@ -75,10 +75,10 @@ export default { ...@@ -75,10 +75,10 @@ export default {
type: Object, type: Object,
default: () => {} default: () => {}
}, },
//表格需要多传入一个id的情况 //表格需要多传入一个id的情况
tableId:{ tableId: {
type:String, type: String,
default:'' default: ''
}, },
// 搜索条件 // 搜索条件
searchForm: { searchForm: {
...@@ -196,14 +196,15 @@ export default { ...@@ -196,14 +196,15 @@ export default {
mutiSelectArr: {}, mutiSelectArr: {},
tableColumns: [], tableColumns: [],
showClass: false showClass: false,
tableHeightValues: null
} }
}, },
watch: { watch: {
customHeadShowList(val) { customHeadShowList(val) {
this.isCustomHead && this.findShowHeadCol() this.isCustomHead && this.findShowHeadCol()
}, }
// data: { // data: {
// immediate: true, // immediate: true,
// handler(val) { // handler(val) {
...@@ -249,6 +250,14 @@ export default { ...@@ -249,6 +250,14 @@ export default {
//设置表格高度 //设置表格高度
setTableHeightFun(navHeight = 0) { setTableHeightFun(navHeight = 0) {
//navHeight 传值底部高度 //navHeight 传值底部高度
var baseNavEle = document.querySelector('.scrm-base-nav')
var baseSubNavEle = document.querySelector('.scrm-base-sub-nav')
var baseNavEleHeight = 0
var baseSubNavEleHeight = 0
if (baseNavEle && baseNavEle) {
baseNavEleHeight = baseNavEle.clientHeight //60
baseSubNavEleHeight = baseSubNavEle.clientHeight //14
}
let paginationHeight let paginationHeight
if (document.querySelector('.el-pagination')) { if (document.querySelector('.el-pagination')) {
paginationHeight = document.querySelector('.el-pagination').clientHeight + 20 paginationHeight = document.querySelector('.el-pagination').clientHeight + 20
...@@ -258,8 +267,9 @@ export default { ...@@ -258,8 +267,9 @@ export default {
let offsettop = document.getElementById('initTable').offsetTop let offsettop = document.getElementById('initTable').offsetTop
let clientHeight = document.documentElement.clientHeight let clientHeight = document.documentElement.clientHeight
document.getElementById('initTable').style.height = clientHeight - offsettop - paginationHeight - navHeight + 'px' // document.getElementById('initTable').style.height = clientHeight - offsettop - paginationHeight - navHeight + 'px'
document.querySelector('.el-table__empty-block').style.height=(clientHeight - offsettop - paginationHeight - navHeight)+'px'; // document.querySelector('.el-table__empty-block').style.height=(clientHeight - offsettop - paginationHeight - navHeight)+'px';
this.tableHeightValues = clientHeight - offsettop - paginationHeight - baseNavEleHeight - baseSubNavEleHeight - 10 - 30 - 20 + 'px'
}, },
refreshTable(isResetPageNum = true, isClearMuti = true) { refreshTable(isResetPageNum = true, isClearMuti = true) {
...@@ -272,8 +282,8 @@ export default { ...@@ -272,8 +282,8 @@ export default {
...this.page, ...this.page,
...this.searchForm ...this.searchForm
} }
if(this.tableId){ if (this.tableId) {
params.id=this.tableId params.id = this.tableId
} }
this.getListApi(params) this.getListApi(params)
.then(res => { .then(res => {
...@@ -281,6 +291,9 @@ export default { ...@@ -281,6 +291,9 @@ export default {
this.data = this.findVal(res, this.tableParams.listName) this.data = this.findVal(res, this.tableParams.listName)
this.total = this.findVal(res, this.pageConf.totalCount) this.total = this.findVal(res, this.pageConf.totalCount)
this.loading = false this.loading = false
if (this.data.length) {
this.$emit('setTableFinishFun', this.data) //表格请求到数据
}
}) })
.catch(() => { .catch(() => {
this.loading = false this.loading = false
...@@ -346,14 +359,61 @@ export default { ...@@ -346,14 +359,61 @@ export default {
padding-right: 14px !important; padding-right: 14px !important;
} }
.glsx-table .emptyBg { .glsx-table .emptyBg {
display: inline-block; display: flex;
/* margin-top: 150px; */ flex-direction: column;
justify-content: center;
align-items: center;
height: 100%; height: 100%;
} }
.glsx-table .emptyBg div { .el-table__body-wrapper::-webkit-scrollbar {
margin: -20px 0 10px; width: 10px;
height: 100%; height: 10px;
/* display: none; */
}
/*正常情况下滑块的样式*/
.el-table__body-wrapper::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.05);
border-radius: 10px;
box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.1);
}
/*鼠标悬浮在该类指向的控件上时滑块的样式*/
.el-table__body-wrapper::-webkit-scrollbar-thumb {
/* background-color: rgba(0, 0, 0, 0.2); */
background: #e9e8ff;
border-radius: 10px;
box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.1);
}
/*鼠标悬浮在滑块上时滑块的样式*/
/* &::-webkit-scrollbar-thumb:hover {
background-color: rgba(0, 0, 0, 0.4);
box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.1);
} */
/*正常时候的主干部分*/
.el-table__body-wrapper::-webkit-scrollbar-track {
border-radius: 10px;
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
background-color: white;
} }
/*鼠标悬浮在滚动条上的主干部分*/
/* .el-table__body-wrapper::-webkit-scrollbar-track:hover {
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
background-color: rgba(0, 0, 0, 0.01);
} */
/* .hasTableContent .el-table__body{ /* .hasTableContent .el-table__body{
height: 100%; height: 100%;
} */ } */
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!