<template> <div class="app-container"> <!-- 搜索工作栏 --> <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> <!-- 列表 --> <base-table v-loading="dataListLoading" :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" :table-data="tableData"> <method-btn v-if="tableBtn.length" slot="handleBtn" :width="100" label="库位详情" :method-list="tableBtn" @clickBtn="handleClick" /> </base-table> <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total" @pagination="getDataList" /> <!-- 对话框(添加 / 修改) --> <base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="addOrUpdateVisible" :before-close="handleCancel" width="50%"> <add-or-update ref="addOrUpdate" @refreshDataList="successSubmit"></add-or-update> <slot name="footer"> <el-row slot="footer" type="flex" justify="end"> <el-col :span="24"> <el-button size="small" class="btnTextStyle" @click="handleCancel"> 取消 </el-button> </el-col> </el-row> </slot> </base-dialog> </div> </template> <script> import AddOrUpdate from './add-or-updata'; import basicPage from '../../mixins/basic-page'; import { parseTime } from '../../mixins/code-filter'; import { getWarehouseLocationHisPage, } from '@/api/warehouse/warehouseRealtimeLocation'; import { listByWarehouse } from '@/api/warehouse/warehouseLocation'; import { getWarehouseList } from '@/api/warehouse/warehouse-info'; import { listData } from '@/api/system/dict/data'; import { publicFormatter } from '@/utils/dict'; const tableProps = [ { prop: 'warehouseName', label: '仓库名称', }, { prop: 'name', label: '库位名称', }, { prop: 'code', label: '库位编码', }, { prop: 'type', label: '库位类型', filter: publicFormatter('location_type'), }, { prop: 'palletCode', label: '托盘编码', }, { prop: 'operateStatus', label: '操作状态', filter: publicFormatter('warehouse_operate_status'), }, { prop: 'createTime', label: '操作时间', filter: parseTime, minWidth: 150, }, { prop: 'creator', label: '操作人', }, ]; export default { mixins: [basicPage], data() { return { urlOptions: { getDataListURL: getWarehouseLocationHisPage, }, listQuery: { storageType: 4, }, tableData: [], tableProps, tableBtn: [ this.$auth.hasPermi(`part-material:warehouse-location-his:query`) ? { type: 'info', btnName: '详情', } : undefined, ].filter((v) => v), drawerVisible: false, formConfig: [ { type: 'select', label: '库位名', selectOptions: [], param: 'name', defaultSelect: '', filterable: true, }, { type: 'input', label: '托盘编码', placeholder: '托盘编码', param: 'code', }, { type: 'select', label: '操作状态', selectOptions: [], param: 'status', defaultSelect: '', filterable: true, labelField: 'label', valueField: 'value', }, { type: 'datePicker', label: '操作时间', dateType: 'daterange', format: 'yyyy-MM-dd', valueFormat: "timestamp", rangeSeparator: '-', startPlaceholder: '开始时间', endPlaceholder: '结束时间', param: 'searchTime', }, { type: 'button', btnName: '搜索', name: 'search', color: 'primary', }, ], }; }, components: { AddOrUpdate, }, created() { const queryParams = { pageNo: 1, pageSize: 99, dictType: 'warehouse_operate_status', }; listData(queryParams).then((response) => { this.formConfig[2].selectOptions = response.data.list; }); getWarehouseList().then((response) => { response.data.forEach((item) => { if (item.storageType === this.listQuery.storageType) { listByWarehouse(item.id).then((response) => { this.formConfig[0].selectOptions = response.data; }); } }); }); }, methods: { buttonClick(val) { switch (val.btnName) { case 'search': this.listQuery.pageNo = 1; this.listQuery.pageSize = 10; this.listQuery.locationId = val.name; this.listQuery.palletCode = val.code; this.listQuery.operateStatus = val.status; this.listQuery.createTime = val.searchTime?val.searchTime:null; this.getDataList(); break; default: console.log(val); } }, otherMethods(val) { if (val.type === 'info') { this.addOrUpdateVisible = true; this.addOrEditTitle = val.data.name + ' -产品信息'; this.$nextTick(() => { this.$refs.addOrUpdate.init(val.data.id); }); } }, handleCancel() { this.addOrUpdateVisible = false; this.addOrEditTitle = ''; }, }, }; </script> <style> .app-container .el-table .el-table__cell { padding: 0; height: 35px; } </style>