distributionWarehousing.vue 6.53 KB
<!--分配入库-->
<template>
    <div class="distributionWarehousing">
        <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="入库日期">
                <date-range-picker :date.sync="searchForm.date"></date-range-picker>
            </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="close" @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"
        >

            <template slot="expireDateS" slot-scope="record">
                {{record.expireDate | formatDate}}
            </template>
            <template slot="action" slot-scope="record">
                <a-button type="link" size="small" @click="toDetail(record)">查看</a-button>
                <a-button v-if="record.statusName=='未接收'" type="link" size="small" @click="toAdd(record)">入库</a-button>
            </template>
        </a-table>
        <myPagination v-model="pagination" :pagination="pagination" @getList="getReceiveRecord"></myPagination>
    </div>
</template>
<script>
    import {isEmptyParams} from "../../utils/common";
    import moment from 'moment'
    import myPagination from "../../components/myPagination";
    import dateRangePicker from "../../components/dateRangePicker";

    const columns = [
        {
            title: '发放单位',
            dataIndex: 'sendUnitName',
            ellipsis: true
        },
        {
            title: '供应商名称',
            dataIndex: 'supplierName',
            ellipsis: true
        },
        {
            title: '品牌',
            dataIndex: 'brandName',
            ellipsis: true
        },
        {
            title: '批次号',
            width: '120px',
            dataIndex: 'batchNumber',
            ellipsis: true
        },
        {
            title: '生产日期',
            dataIndex: 'produceDate',
            ellipsis: true
        },
        {
            title: '有效期',
            width: '120px',
            scopedSlots: {customRender: 'expireDateS'},
        },
        {
            title: '单价(元)',
            dataIndex: 'unitPrice',
            ellipsis: true
        },
        {
            title: '规格',
            dataIndex: 'specs',
            ellipsis: true
        },
        {
            title: '分配数量',
            dataIndex: 'sendNum',
            ellipsis: true
        },
        {
            title: '接收状态',
            dataIndex: 'statusName',
            ellipsis: true
        },
        {
            title: '入库日期',
            dataIndex: 'receiveDate',
            ellipsis: true
        },
        {
            title: '操作',
            align: 'center',
            width: 120,
            fixed: 'right',
            scopedSlots: {customRender: 'action'},
        },
    ]
    export default {
        components: {myPagination, dateRangePicker},
        data() {
            return {
                // 搜索框对象
                searchForm: {
                    status: '',
                    date: []
                },
                statusList: [],
                pagination: {
                    pageIndex: 1,
                    pageSize: 10,
                    total: 0,
                    pageSizeOptions: ['10', '20', '30', '40', '50'],
                },
                columns,
                tableData: [],
                loading: false,
                allSupplyInfo: [],
            }
        },
        created() {
            let allEnum = JSON.parse(sessionStorage.getItem("allEnum"));
            this.statusList = allEnum["folacin_stock_record_status"];
            this.getReceiveRecord()
        },
        methods: {
            searchList() {
                this.pagination.pageIndex = 1
                this.getReceiveRecord()
            },
            getReceiveRecord() {
                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.fetchReceiveRecordList(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 = {
                    status: '',
                    date: []
                }
                this.searchList()
            },
            downloadExcel() {

            },
            toDetail(record) {
                this.$router.push({path: '/distributionWarehousing/detail', query: record})
            },
            toAdd(record) {
                this.$router.push({path: '/distributionWarehousing/add', query: {id: record.id}})
            }
        },
    }
</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;
    }

    /*.search_form {
        margin-top: -17px;
        border: 1px solid rgba(255,77,128, .2);
        border-top: 0px;
        padding: 30px;
    }*/
</style>