表格高度自适应
This commit is contained in:
@@ -7,8 +7,10 @@ import { filterObj } from '@/utils/util';
|
|||||||
import { deleteAction, getAction, postAction, downFile, getFileAccessHttpUrl } from '@/api/manage'
|
import { deleteAction, getAction, postAction, downFile, getFileAccessHttpUrl } from '@/api/manage'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
||||||
|
import {mixinDevice} from '@/utils/mixin.js'
|
||||||
|
|
||||||
export const JeecgListMixin = {
|
export const JeecgListMixin = {
|
||||||
|
mixins: [mixinDevice],
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
//token header
|
//token header
|
||||||
@@ -30,9 +32,7 @@ export const JeecgListMixin = {
|
|||||||
total: 0
|
total: 0
|
||||||
},
|
},
|
||||||
/* 控制table高度 */
|
/* 控制table高度 */
|
||||||
scroll: {
|
scroll: {},
|
||||||
y: document.documentElement.clientHeight-330
|
|
||||||
},
|
|
||||||
/* 排序参数 */
|
/* 排序参数 */
|
||||||
isorter:{
|
isorter:{
|
||||||
column: 'createTime',
|
column: 'createTime',
|
||||||
@@ -61,6 +61,7 @@ export const JeecgListMixin = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.initScroll()
|
||||||
if(!this.disableMixinCreated){
|
if(!this.disableMixinCreated){
|
||||||
//console.log(' -- mixin created -- ')
|
//console.log(' -- mixin created -- ')
|
||||||
this.loadData();
|
this.loadData();
|
||||||
@@ -71,6 +72,13 @@ export const JeecgListMixin = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
initScroll() {
|
||||||
|
if (this.isMobile()) {
|
||||||
|
this.scroll.y = ''
|
||||||
|
} else {
|
||||||
|
this.scroll.y = document.documentElement.clientHeight-330
|
||||||
|
}
|
||||||
|
},
|
||||||
loadData(arg) {
|
loadData(arg) {
|
||||||
if(!this.url.list){
|
if(!this.url.list){
|
||||||
this.$message.error("请设置url.list属性!")
|
this.$message.error("请设置url.list属性!")
|
||||||
|
|||||||
@@ -80,10 +80,10 @@
|
|||||||
size="middle"
|
size="middle"
|
||||||
bordered
|
bordered
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
:scroll="{ x: 1500, y: 500 }"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:dataSource="dataSource"
|
:dataSource="dataSource"
|
||||||
:pagination="ipagination"
|
:pagination="ipagination"
|
||||||
|
:scroll="scroll"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||||
@change="handleTableChange">
|
@change="handleTableChange">
|
||||||
@@ -153,43 +153,33 @@
|
|||||||
},
|
},
|
||||||
// 表头
|
// 表头
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{title: '条码', dataIndex: 'mBarCode', width: '8%'},
|
||||||
title: '#',
|
{title: '名称', dataIndex: 'name', width: '8%'},
|
||||||
dataIndex: '',
|
{title: '规格', dataIndex: 'standard', width: '5%'},
|
||||||
key:'rowIndex',
|
{title: '型号', dataIndex: 'model', width: '5%'},
|
||||||
width:40,
|
{title: '颜色', dataIndex: 'color', width: '5%'},
|
||||||
align:"center",
|
{title: '类别', dataIndex: 'categoryName', width: '5%'},
|
||||||
customRender:function (t,r,index) {
|
{title: '扩展信息', dataIndex: 'materialOther', width: '6%'},
|
||||||
return parseInt(index)+1;
|
{title: '单位', dataIndex: 'unit', width: '6%',
|
||||||
}
|
|
||||||
},
|
|
||||||
{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,
|
|
||||||
scopedSlots: { customRender: 'customRenderUnit' }
|
scopedSlots: { customRender: 'customRenderUnit' }
|
||||||
},
|
},
|
||||||
{title: '安全存量', dataIndex: 'safetyStock', width: 80},
|
{title: '安全存量', dataIndex: 'safetyStock', width: '5%'},
|
||||||
{title: '库存', dataIndex: 'stock', width: 70},
|
{title: '库存', dataIndex: 'stock', width: '5%'},
|
||||||
{title: '采购价', dataIndex: 'purchaseDecimal', width: 70},
|
{title: '采购价', dataIndex: 'purchaseDecimal', width: '5%'},
|
||||||
{title: '零售价', dataIndex: 'commodityDecimal', width: 70},
|
{title: '零售价', dataIndex: 'commodityDecimal', width: '5%'},
|
||||||
{title: '销售价', dataIndex: 'wholesaleDecimal', width: 70},
|
{title: '销售价', dataIndex: 'wholesaleDecimal', width: '5%'},
|
||||||
{title: '最低售价', dataIndex: 'lowDecimal', width: 80},
|
{title: '最低售价', dataIndex: 'lowDecimal', width: '5%'},
|
||||||
{title: '状态', dataIndex: 'enabled', width: 55, align: "center",
|
{title: '状态', dataIndex: 'enabled', width: '4%', align: "center",
|
||||||
scopedSlots: { customRender: 'customRenderEnabled' }
|
scopedSlots: { customRender: 'customRenderEnabled' }
|
||||||
},
|
},
|
||||||
{title: '序列号', dataIndex: 'enableSerialNumber', width: 55, align: "center",
|
{title: '序列号', dataIndex: 'enableSerialNumber', width: '4%', align: "center",
|
||||||
scopedSlots: { customRender: 'customRenderEnableSerialNumber' }
|
scopedSlots: { customRender: 'customRenderEnableSerialNumber' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
align:"center",
|
align:"center",
|
||||||
width: 120,
|
width: '10%',
|
||||||
scopedSlots: { customRender: 'action' },
|
scopedSlots: { customRender: 'action' },
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -213,6 +203,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
initScroll() {
|
||||||
|
if (this.isMobile()) {
|
||||||
|
this.scroll.y = ''
|
||||||
|
} else {
|
||||||
|
this.scroll.y = document.documentElement.clientHeight-370
|
||||||
|
}
|
||||||
|
},
|
||||||
loadTreeData(){
|
loadTreeData(){
|
||||||
let that = this;
|
let that = this;
|
||||||
let params = {};
|
let params = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user