<template>
    <!-- 弹出框表单 -->
    <el-drawer
            :title="title"
            :visible.sync="open"
            :direction="direction"
            :destroy-on-close="true"
            size="50%">
        <el-form ref="form" :model="form" :rules="rules" label-width="120px">
            <el-row>
                                            <Field label="站点Id" prop="siteId" v-model="form.siteId" placeholder="请输入站点Id"/>
                            <Field label="站点编码" prop="siteCode" v-model="form.siteCode" placeholder="请输入站点编码"/>
                            <Field label="站点名称" prop="siteName" v-model="form.siteName" placeholder="请输入站点名称"/>
                            <Field label="业务名" prop="business" v-model="form.business" placeholder="请输入业务名"/>
                            <Field label="部门" prop="sectionName" v-model="form.sectionName" placeholder="请输入部门"/>
                            <Field label="窗口编号" prop="windowFromnum" v-model="form.windowFromnum" placeholder="请输入窗口编号"/>
                            <Field label="取号数量" prop="pjCount" v-model="form.pjCount" placeholder="请输入取号数量"/>
                            <Field label="年" prop="year" v-model="form.year" placeholder="请输入年"/>
                            <Field label="月" prop="month" v-model="form.month" placeholder="请输入月"/>
                            <Field label="日" prop="day" v-model="form.day" placeholder="请输入日"/>

            </el-row>

            <form-buttons @submit='submitForm' v-if="pageInfo.type!='view'" noCancelBtn />
        </el-form>

    </el-drawer>
</template>

<script>
    import form from "@/assets/mixins/formdialog";
    export default {
        name: "PhQueueStatDetail",
        mixins: [form],
        components: {

        },
        created() {
            this.changePath("ph/queue/stat")
        },
        data() {
            return {
                // 遮罩层
                loading: true,
                // 弹出层标题
                title: "排队叫号汇总统计",
                // 是否显示弹出层
                open: false,
                direction:"rtl",
                toString:[
                ],
                toDate:[
                ],
                // 表单校验
                rules: {
                    business: [
                        {required: true,message: "请输入业务名", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    sectionName: [
                        {required: true,message: "请输入部门", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    windowFromnum: [
                        {required: true,message: "请输入窗口编号", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    pjCount: [
                        {required: true,message: "请输入取号数量", trigger: "blur" },
                    ],
                    year: [
                        {required: true,message: "请输入年", trigger: "blur" },
                    ],
                    month: [
                        {required: true,message: "请输入月", trigger: "blur" },
                    ],
                    day: [
                        {required: true,message: "请输入日", trigger: "blur" },
                    ],
                    createTime: [
                        {required: true,message: "请选择创建时间" },
                    ],
                }
            };
        },

        methods: {
            /** 编辑 */
            edit(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="ph/queue/stat/edit";
                this.getData();
                this.pageInfo.type="edit"
                this.title = "修改排队叫号汇总统计";
            },
            /** 新增 */
            add(row) {
                this.reset()
                this.urls.currUrl = "ph/queue/stat/add";
                this.getData();
                this.pageInfo.type="add"
                this.title = "新增排队叫号汇总统计";
            },
            /** 查看*/
            view(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="ph/queue/stat/view";
                this.getData();
                this.pageInfo.type="view"
                this.title = "排队叫号汇总统计详细";
            },
            /**取消按钮 */
            cancel() {
                this.open = false;
            },
            /**获取数据后弹框 */
            afterRender(data) {
                this.open = true;
            },

            afterSubmit(data) {
                this.open = false;
                this.$emit("ok");
            },

            // 表单重置
            reset() {
                this.form = {
                    siteId : 0,
                    siteCode : null,
                    siteName : null,
                    business : null,
                    sectionName : null,
                    windowFromnum : null,
                    pjCount : null,
                    year : null,
                    month : null,
                    day : null,
                };
                this.resetForm("form");
            },
            resetForm(refName) {
                if (this.$refs[refName]) {
                    this.$refs[refName].resetFields();
                }
            },
        },
    };
</script>
