<template>
    <el-container>
        <el-header>
            <div class="left-panel">
                <el-button type="primary" icon="el-icon-plus" @click="add"></el-button>
            </div>
            <div class="right-panel">
                <el-date-picker
                    v-model="query.date"
                    type="date"
                    value-format="YYYY-MM-DD"
                />
                <el-button
                    type="primary"
                    icon="el-icon-search"
                    @click="handleQuery"
                >查询</el-button>
            </div>
        </el-header>
        <el-main class="nopadding">
            <scTable
                ref="table"
                :apiObj="apiObj"
                row-key="id"
                stripe
                :params="query"
            >
                <el-table-column type="index" width="50"/>
                <el-table-column label="日期" prop="name" show-overflow-tooltip>
                </el-table-column>
                <el-table-column label="批次号" prop="number">
                </el-table-column>
                <el-table-column label="总数" prop="model">
                </el-table-column>
                <el-table-column label="操作" fixed="right" width="150">
                    <template #default="scope">
                        <el-link type="primary" @click="table_edit(scope.row)">编辑</el-link>
                        <el-divider direction="vertical"></el-divider>
                        <el-link type="primary" @click="table_check(scope.row)">检验</el-link>
                        <el-divider direction="vertical"></el-divider>
                        <el-link type="danger" @click="table_del(scope.row)">删除</el-link>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
        <check-dialog v-if="dialog.check" ref="checkDialog" @success="handleCheckSuccess" @closed="dialog.check = false">
        </check-dialog>
    </el-container>
</template>
<script>
import checkDialog from "./product_form.vue";
    export default {
        name: "rparty",
        components:{
            checkDialog
        },
        data() {
            return {
                // apiObj: this.$API.qm.list,
                dialog:{
                    check:false,
                },
                apiObj:null,
                query: {
                    page:1,
                    page_size:20,
                    type:10
                },
                selection: [],
                state_: {
                    'R': '不合格',
                    'S': '合格',
                },
            };
        },
        methods: {
            add() {
                this.dialog.check = true;
                this.$nextTick(() => {
                    this.$refs.checkDialog.open("add");
                });
            },
            table_edit(row) {
                this.dialog.check = true;
                this.$nextTick(() => {
                    this.$refs.checkDialog.open("edit").setData(row);
                });
            },
            table_del(){ },
            //查看
            table_show(row) {
                this.dialog.save = true;
                this.$nextTick(() => {
                    this.$refs.saveDialog.open("show",10).setData(row);
                });
            },
            table_check(){

            },
            handleQuery() {
                this.$refs.table.queryData(this.query)
            },
            resetQuery() {
                this.query = {};
            },
        },
    };
</script>