表格高度自适应

This commit is contained in:
季圣华
2021-09-05 00:36:51 +08:00
parent 6e21f03b57
commit e77b939111
2 changed files with 44 additions and 39 deletions

View File

@@ -7,8 +7,10 @@ import { filterObj } from '@/utils/util';
import { deleteAction, getAction, postAction, downFile, getFileAccessHttpUrl } from '@/api/manage'
import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types"
import {mixinDevice} from '@/utils/mixin.js'
export const JeecgListMixin = {
mixins: [mixinDevice],
data(){
return {
//token header
@@ -30,9 +32,7 @@ export const JeecgListMixin = {
total: 0
},
/* 控制table高度 */
scroll: {
y: document.documentElement.clientHeight-330
},
scroll: {},
/* 排序参数 */
isorter:{
column: 'createTime',
@@ -61,6 +61,7 @@ export const JeecgListMixin = {
}
},
created() {
this.initScroll()
if(!this.disableMixinCreated){
//console.log(' -- mixin created -- ')
this.loadData();
@@ -71,6 +72,13 @@ export const JeecgListMixin = {
}
},
methods:{
initScroll() {
if (this.isMobile()) {
this.scroll.y = ''
} else {
this.scroll.y = document.documentElement.clientHeight-330
}
},
loadData(arg) {
if(!this.url.list){
this.$message.error("请设置url.list属性!")

View File

@@ -80,10 +80,10 @@
size="middle"
bordered
rowKey="id"
:scroll="{ x: 1500, y: 500 }"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
@@ -153,43 +153,33 @@
},
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:40,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{title: '条码', dataIndex: 'mBarCode', width: 120},
{title: '名称', dataIndex: 'name', width: 120},
{title: '规格', dataIndex: 'standard', width: 80},
{title: '型号', dataIndex: 'model', width: 80},
{title: '颜色', dataIndex: 'color', width: 60},
{title: '类别', dataIndex: 'categoryName', width: 80},
{title: '扩展信息', dataIndex: 'materialOther', width: 100},
{title: '单位', dataIndex: 'unit', width: 100,
{title: '条码', dataIndex: 'mBarCode', width: '8%'},
{title: '名称', dataIndex: 'name', width: '8%'},
{title: '规格', dataIndex: 'standard', width: '5%'},
{title: '型号', dataIndex: 'model', width: '5%'},
{title: '颜色', dataIndex: 'color', width: '5%'},
{title: '类别', dataIndex: 'categoryName', width: '5%'},
{title: '扩展信息', dataIndex: 'materialOther', width: '6%'},
{title: '单位', dataIndex: 'unit', width: '6%',
scopedSlots: { customRender: 'customRenderUnit' }
},
{title: '安全存量', dataIndex: 'safetyStock', width: 80},
{title: '库存', dataIndex: 'stock', width: 70},
{title: '采购价', dataIndex: 'purchaseDecimal', width: 70},
{title: '零售价', dataIndex: 'commodityDecimal', width: 70},
{title: '销售价', dataIndex: 'wholesaleDecimal', width: 70},
{title: '最低售价', dataIndex: 'lowDecimal', width: 80},
{title: '状态', dataIndex: 'enabled', width: 55, align: "center",
{title: '安全存量', dataIndex: 'safetyStock', width: '5%'},
{title: '库存', dataIndex: 'stock', width: '5%'},
{title: '采购价', dataIndex: 'purchaseDecimal', width: '5%'},
{title: '零售价', dataIndex: 'commodityDecimal', width: '5%'},
{title: '销售价', dataIndex: 'wholesaleDecimal', width: '5%'},
{title: '最低售价', dataIndex: 'lowDecimal', width: '5%'},
{title: '状态', dataIndex: 'enabled', width: '4%', align: "center",
scopedSlots: { customRender: 'customRenderEnabled' }
},
{title: '序列号', dataIndex: 'enableSerialNumber', width: 55, align: "center",
{title: '序列号', dataIndex: 'enableSerialNumber', width: '4%', align: "center",
scopedSlots: { customRender: 'customRenderEnableSerialNumber' }
},
{
title: '操作',
dataIndex: 'action',
align:"center",
width: 120,
width: '10%',
scopedSlots: { customRender: 'action' },
}
],
@@ -213,6 +203,13 @@
}
},
methods: {
initScroll() {
if (this.isMobile()) {
this.scroll.y = ''
} else {
this.scroll.y = document.documentElement.clientHeight-370
}
},
loadTreeData(){
let that = this;
let params = {};