Commit 0f70eae8 by cwq0219

表格优化

1 parent 806dd724
......@@ -17,6 +17,7 @@
:row-key="tableParams.uniqueKey || 'id'"
border
:max-height="tableMaxHeight"
:height="tableMaxHeight"
v-if="tableParams.dropCol.length"
>
<el-table-column
......@@ -256,12 +257,8 @@ export default {
// 表格高度
getHeight() {
setTimeout(() => {
// var parentHeight = document.querySelector('.table').parentElement.parentElement.clientHeight
var parentHeight = this.$refs.tableCom.parentElement.clientHeight
var pageHeight = this.hasPage ? this.$refs.page.clientHeight : 0
// console.log(parentHeight - pageHeight - 50 + 'px')
// document.querySelector('.table').style.height = parentHeight - pageHeight - 50 + 'px'
// this.loading = false
this.tableMaxHeight = parentHeight - pageHeight - 50
}, 400)
},
......@@ -290,8 +287,6 @@ export default {
},
handleSave() {
console.log('保存--')
// console.log(this.tableParams.dropCol)
this.saveTableCol({
tableName: 'database',
path: 'tableCol.' + this.tableParams.tableId,
......@@ -336,7 +331,6 @@ export default {
tableName: 'database',
path: 'tableCol.' + this.tableParams.tableId
}).then(res => {
// console.log(res)
this.tableParams.tableHead = []
if (res && (res.length === this.tableParams.tableColumns.length) && !isReset) {
res.forEach((item, index) => {
......@@ -357,9 +351,13 @@ export default {
handleOptShow() {
this.isShowOption = !this.isShowOption
},
refreshTable(clearMuti = true) {
refreshTable(obj) {
var opt = {
clearMuti: true,
...obj
}
// 清空多选
this.tableParams.dropCol.length && this.tableParams.isMuti && clearMuti && this.clearMutiSelect()
this.tableParams.dropCol.length && this.tableParams.isMuti && opt.clearMuti && this.clearMutiSelect()
this.loading = true
this.dealParams().then(res => {
var params = res || this.searchForm
......@@ -367,7 +365,6 @@ export default {
...params,
...this.page
}
// console.log(params)
if (this.sort) {
params.sortColum = this.sortColum
params.sort = this.sort === 'descending' ? 1 : 0
......@@ -393,12 +390,12 @@ export default {
// 页码
handleSizeChange(value) {
this.page.pageSize = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
this.getListApi ? this.refreshTable({ clearMuti: false }) : this.$emit('refreshTable', this.page)
},
handleCurrentChange(value) {
this.page.pageNum = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
this.getListApi ? this.refreshTable({ clearMuti: false }) : this.$emit('refreshTable', this.page)
}
}
}
......@@ -406,24 +403,29 @@ export default {
</script>
<style>
.table {
/* display: flex; */
/* align-items: center; */
/* position: relative; */
display: flex;
align-items: center;
}
/* .el-table {
overflow-y: scroll;
} */
.el-scrollbar__wrap {
/* .el-scrollbar__wrap {
overflow-x: hidden;
}
.table-scroll {
height: 100%;
width: 100%;
/* display: flex; */
} */
::-webkit-scrollbar {
width: 8px;
height: 8px;
/* width: 0;
height: 0; */
}
.sort-btns {
position: fixed;
top: 300px;
right: 36px;
::-webkit-scrollbar-thumb {
background-color: hsla(220, 4%, 58%, 0.3);
border-radius: 3px;
}
.refresh-btn {
display: block;
......
......@@ -487,7 +487,7 @@ export default {
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
tableId: 'assignOrder',
uniqueKey: 'id',
uniqueKey: 'merchantOrder',
isMuti: true,
listName: 'list',
tableHead: [],
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!