<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="80" 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" @cancel="handleCancel" @confirm="handleConfirm" :before-close="handleCancel" width="50%"> <add-or-update ref="addOrUpdate" @refreshDataList="successSubmit"></add-or-update> </base-dialog> </div> </template> <script> import AddOrUpdate from './add-or-updata'; import basicPage from '../../mixins/basic-page'; import { parseTime } from '../../mixins/code-filter'; import codeFilter from '../../mixins/code-filter'; import { deleteWarehouseGoods, getWarehouseGoodsPage, } from "@/api/warehouse/warehouseGoods"; import { publicFormatter } from '@/utils/dict'; const tableProps = [ { prop: 'name', label: '物品名称', }, { prop: 'code', label: '物品编码', }, { prop: 'spec', label: '物品规格', }, { prop: 'unit', label: '物品单位', filter: publicFormatter('unit_dict') }, { prop: 'allowTime', label: '允许留存时长(天)', width: 150 }, { prop: 'dailyUse', label: '单日消耗量', }, { prop: 'enabled', label: '是否可用', filter: codeFilter('deactivate'), }, { prop: 'remark', label: '备注', }, ]; export default { mixins: [basicPage], data() { return { urlOptions: { getDataListURL: getWarehouseGoodsPage, deleteURL: deleteWarehouseGoods, }, tableProps, listQuery:{ storageType:5 }, tableBtn: [ this.$auth.hasPermi(`out-material:warehouse-goods:update`) ? { type: 'edit', btnName: '编辑', } : undefined, this.$auth.hasPermi(`out-material:warehouse-goods:delete`) ? { type: 'delete', btnName: '删除', } : undefined, ].filter((v)=>v), tableData: [], formConfig: [ { type: 'input', label: '物品名称', placeholder: '物品名称', param: 'name', }, { type: 'button', btnName: '查询', name: 'search', color: 'primary', }, { type: 'separate', }, { type: this.$auth.hasPermi('out-material:warehouse-goods:create') ? 'button' : '', btnName: '新增', name: 'add', color: 'success', plain: true, }, ], }; }, components: { AddOrUpdate, }, created() {}, methods: { buttonClick(val) { switch (val.btnName) { case 'search': this.listQuery.pageNo = 1; this.listQuery.pageSize = 10; this.listQuery.name = val.name; this.getDataList(); break; case 'reset': this.$refs.searchBarForm.resetForm(); this.listQuery = { pageSize: 10, pageNo: 1, total: 1, }; this.getDataList(); break; case 'add': this.addOrEditTitle = '新增'; this.addOrUpdateVisible = true; this.addOrUpdateHandle(); break; case 'export': this.handleExport(); break; default: console.log(val); } }, }, }; </script>