<template> <div class="app-container"> <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> <base-table :page="listQuery.current" :limit="listQuery.size" :height="tableH" :table-config="tableProps" :table-data="list" /> <pagination v-show="total > 0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="getList()" /> </div> </template> <script> import HeadForm from '@/components/basicData/HeadForm' import BaseTable from '@/components/BaseTable' import Pagination from '@/components/Pagination' import { tableHeight } from '@/utils/index' import { getMaterialCodeList, getKQList, getProductSpecList, getGoodsList } from '@/utils/wmsDic' const tableProps = [ { prop: 'productName', label: '盖板玻璃或背板玻璃' }, { prop: 'spec', label: '规格' }, { prop: 'materialCode', label: '物料编码' }, { prop: 'storeArea', label: '库区' }, { prop: 'num', label: '库存数量' } ] export default { name: 'Inventory', components: { HeadForm, BaseTable, Pagination }, data() { return { headFormConfig: [ { type: 'input', label: '关键字', placeholder: '盖板玻璃或背板玻璃,物料编码,库区', param: 'name', width: 250 }, { type: 'button', btnName: 'btn.search', name: 'search', color: 'primary' } ], listQuery: { current: 1, size: 20 }, tableH: tableHeight(275), tableProps, list: [], listLoading: false, total: 0, showTitle: '' } }, mounted() { window.addEventListener('resize', () => { this.tableH = tableHeight(275) }) this.getList() }, methods: { getList() { const temp = [] const num = 20 for (let i = 0; i < num; i++) { const obj = {} obj.productName = getGoodsList() obj.spec = getProductSpecList() obj.materialCode = getMaterialCodeList() obj.storeArea = getKQList() + '区' obj.num = Math.floor(Math.random() * 2000) temp.push(obj) } this.list = temp this.total = num }, btnClick(val) { console.log(val) this.getList() } } } </script>