<!--分配入库--> <template> <div class="sendRecord"> <a-form layout="inline" class="search_form"> <a-form-item label="收货状态"> <a-select v-model="searchForm.status" placeholder="请选择" style="width: 250px"> <a-select-option value="">全部</a-select-option> <a-select-option v-for="item in statusList" :key="item.enumValue" :value="item.enumValue"> {{item.enumName}} </a-select-option> </a-select> </a-form-item> <a-form-item label="发货日期"> <dateRangePicker :date.sync="searchForm.date"></dateRangePicker> </a-form-item> <a-button type="primary" class="search_btn" icon="search" @click="searchList">搜索</a-button> <a-button class="search_btn" style="margin-left: 10px" icon="sync" @click="restSearchForm">清空</a-button> <!-- <a-button type="primary" class="search_btn" icon="download" style="float: right" @click="downloadExcel">--> <!-- 导出Excel--> <!-- </a-button>--> <div style="clear: both"></div> </a-form> <div style="clear: both"></div> <a-table :dataSource="tableData" :columns="columns" rowKey="id" :loading="loading" :pagination="false" bordered > <template slot="statusName" slot-scope="record"> <a-button type="link" size="small">{{record.statusName}}</a-button> </template> <a-table slot="expandedRowRender" slot-scope="record" :columns="innerColumns" :data-source="record.detailedList" :pagination="false" > <template slot="statusName" slot-scope="record"> <a-button type="link" size="small">{{record.statusName}}</a-button> </template> </a-table> </a-table> <myPagination v-model="pagination" :pagination="pagination" @getList="getSendRecord"></myPagination> </div> </template> <script> import myPagination from '../../components/myPagination' import dateRangePicker from '../../components/dateRangePicker' import {getEnumByFlag, isEmptyParams} from "../../utils/common"; import moment from 'moment'; const columns = [ { title: '收货单位', dataIndex: 'receiveNodeName', width:"240px", ellipsis: true }, { title: '发货人', width:"160px", dataIndex: 'sendContact', ellipsis: true }, { title: '发货人电话', width:"240px", dataIndex: 'sendPhone', ellipsis: true }, { title: '发货日期', width:"160px", dataIndex: 'sendDate', ellipsis: true }, { title: '收货人', width:"160px", dataIndex: 'receiver', ellipsis: true }, { title: '收货人电话', dataIndex: 'receivePhone', width:"160px", ellipsis: true }, // { // title: '收货时间', // dataIndex: 'receiveDate', // ellipsis: true // }, { title: '收货状态', scopedSlots: {customRender: 'statusName'}, ellipsis: true }, // { // title: '备注', // dataIndex: 'remarks', // ellipsis: true // }, ]; const innerColumns = [ { title: '供应商名称', dataIndex: 'supplierName', width:"240px", ellipsis: true }, { title: '品牌', width:"160px", dataIndex: 'brandName', ellipsis: true }, { title: '批次号', width:"240px", dataIndex: 'batchNumber', ellipsis: true }, { title: '生产日期', width:"160px", dataIndex: 'produceDate', ellipsis: true }, { title: '有效期至', width:"160px", dataIndex: 'expireDate', }, { title: '分配数量', width:"160px", dataIndex: 'sendNum', ellipsis: true }, { title: '收货状态', width:"160px", scopedSlots: {customRender: 'statusName'}, ellipsis: true }, { title: '收货日期', width:"160px", dataIndex: 'receiveDate', ellipsis: true }, { title: '备注', dataIndex: 'remarks', ellipsis: true }, ]; export default { name: "sendRecord", components: {myPagination, dateRangePicker}, data() { return { // 搜索框对象 searchForm: { breedId: undefined, medicalName: '', factoryId: '', date:[], produceDate: undefined }, statusList: [], pagination: { pageIndex: 1, pageSize: 10, total: 0, pageSizeOptions: ['10', '20', '30', '40', '50'], }, columns, innerColumns, tableData: [], loading: false, allSupplyInfo: [], routerParams:{} } }, created() { this.routerParams = this.$route.query if (this.routerParams.menuId) { window.sessionStorage.setItem('menuId', this.routerParams.menuId) } this.getEnumListInfo() }, mounted() { // let allEnum = JSON.parse(sessionStorage.getItem("allEnum")); // this.statusList = allEnum["folacin_stock_record_status"]; this.getSendRecord() }, methods: { getEnumListInfo() { if (window.sessionStorage.getItem('allEnum')) { this.statusList = getEnumByFlag("folacin_resident_info_status"); } else { let par = {} this.$api.fyManage.fetchFYLoginUser(par).then(({data}) => { window.sessionStorage.setItem('allEnum', JSON.stringify(data.enumValueList)) window.sessionStorage.setItem('userInfo', JSON.stringify(data.userInfo)); this.statusList = getEnumByFlag("folacin_resident_info_status"); }) } }, searchList() { this.pagination.pageIndex = 1 this.getSendRecord() }, getSendRecord() { this.loading = true let pars = isEmptyParams(this.searchForm) let par = { ...pars, startDate: this.searchForm.date[0], endDate: this.searchForm.date[1], pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize } this.$api.stockManage.fetchSendRecordList(par).then(({data = {}}) => { const {dataList = [], total = 0} = data this.tableData = dataList this.pagination.total = total this.loading = false }).catch(() => { this.loading = false }) }, restSearchForm() { this.searchForm = { breedId: undefined, medicalName: '', factoryId: '', produceDate: undefined, date:[] } this.searchList() }, downloadExcel() { }, }, } </script> <style lang="less" scoped> // 文件上传样式 .ant-upload-select-picture-card i { font-size: 32px; color: #999; } .ant-upload-select-picture-card .ant-upload-text { margin-top: 6px; color: #666; } .btn_space { margin-right: 5px; } </style>