<template>
    <div>
        <el-card>
            <el-table
                v-loading="loading"
                :data="list"
                style="width: 100%"
                @selection-change="handleSelectionChange"
            >
                <el-table-column label="序号" type="index"></el-table-column>
                <el-table-column
                    label="货位码"
                    prop="udiCode"
                    width="150"
                    show-overflow-tooltip
                ></el-table-column>

                <el-table-column
                    label="存货编码"
                    width="120"
                    prop="thirdId"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="存货名称"
                    width="230"
                    prop="thirdName"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="批次号"
                    prop="batchNo"
                    width="100"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="生产日期"
                    width="100"
                    prop="produceDate"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="失效日期"
                    width="100"
                    prop="expireDate"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="产品标识"
                    width="120"
                    prop="nameCode"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="产品通用名称"
                    width="200"
                    prop="cpmctymc"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="规格型号"
                    width="200"
                    prop="ggxh"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="仓位"
                    width="100"
                    prop="warehouseName"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="货位"
                    width="100"
                    prop="spaceName"
                    show-overflow-tooltip
                ></el-table-column>
                <el-table-column
                    label="生产企业"
                    width="230"
                    prop="ylqxzcrbarmc"
                    show-overflow-tooltip
                ></el-table-column>
            </el-table>
            <el-pagination
                :page-size="filterQuery.limit"
                @current-change="handleCurrentChange"
                layout="prev, pager, next"
                :total="total"
            ></el-pagination>

        </el-card>
    </div>
</template>

<script>
    import {
        getStockPrint,
    } from "../../api/inventory/stockPrint.js";

    export default {
        name: "incodeLogDetail",
        props: {
            currentRow: {
                type: Object,
                required: true,
            },

        },
        data() {
            return {
                filterQuery: {
                    genKeyFk: null,
                    page: 1,
                    limit: 20,
                },
                list: [],
                detailList: [],
                total: 0,
            };
        },

        methods: {
            onReset() {
                this.$router.push({
                    path: "",
                });
                this.filterQuery = {
                    genKeyFk: null,
                    page: 1,
                    limit: 20,
                };
                this.getList();
            },
            getList() {
                this.loading = true;
                console.log(" this.genKeyFk = "+ this.currentRow.genKey)
                this.filterQuery.genKeyFk = this.currentRow.genKey;
                getStockPrint(this.filterQuery)
                    .then((response) => {
                        this.loading = false;
                        this.list = response.data.list || [];
                        this.total = response.data.total || 0;
                    })
                    .catch(() => {
                        this.loading = false;
                        this.list = [];
                        this.total = 0;
                    });
            },
            handleCurrentChange(val) {
                this.filterQuery.page = val;
                this.getList();
            },
        },
        mounted() {
        },
        created() {
            this.getList();
        },
    };
</script>
<style>
    .itemTag {
        float: left;
        text-align: left;
        margin-top: 10px;
        width: 100px;
    }

    .text {
        font-size: 13px;
        font-family: "Microsoft YaHei";
    }

    .el-row {
        display: flex;
        flex-wrap: wrap;

    }

    .el-col {
        border-radius: 4px;
        flex-wrap: wrap;
    }
</style>
