<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="预约编号，为空现场取号" prop="ordernumber" v-model="form.ordernumber" placeholder="请输入预约编号，为空现场取号"/>
                            <Field label="叫号状态 " prop="style" v-model="form.style" type="select" :enumData="dict.style" placeholder="请选择叫号状态 "/>
                            <Field label="业务名" prop="business" v-model="form.business" placeholder="请输入业务名"/>
                            <Field label="窗口名" prop="windowName" v-model="form.windowName" placeholder="请输入窗口名"/>
                            <Field label="窗口编号" prop="windowFromnum" v-model="form.windowFromnum" placeholder="请输入窗口编号"/>
                            <Field label="流水编号,当天的第xxx号" prop="flownum" v-model="form.flownum" placeholder="请输入流水编号,当天的第xxx号"/>
                            <Field label="呼叫转移号" prop="formernum" v-model="form.formernum" placeholder="请输入呼叫转移号"/>
                            <Field label="身份证号" prop="peopleIdcard" v-model="form.peopleIdcard" placeholder="请输入身份证号"/>
                            <Field label="姓名" prop="peopleName" v-model="form.peopleName" placeholder="请输入姓名"/>
                            <Field label="性别" prop="peopleSex" v-model="form.peopleSex" placeholder="请输入性别"/>
                            <Field label="手机号" prop="peoplePhone" v-model="form.peoplePhone" placeholder="请输入手机号"/>
                            <Field label="工作人员姓名" prop="workmanName" v-model="form.workmanName" placeholder="请输入工作人员姓名"/>
                            <Field label="工作人员工号" prop="workmanNumber" v-model="form.workmanNumber" placeholder="请输入工作人员工号"/>
                            <Field label="取号时间" prop="taketime" v-model="form.taketime" type="date" />
                            <Field label="叫号时间" prop="calltime" v-model="form.calltime" type="date" />
                            <Field label="结束时间" prop="endtime" v-model="form.endtime" type="date" />
                            <Field label="等待时间,单位s" prop="waitTime" v-model="form.waitTime" placeholder="请输入等待时间,单位s"/>
                            <Field label="办理时间,单位s" prop="handleTime" v-model="form.handleTime" placeholder="请输入办理时间,单位s"/>
                            <Field label="取号设备名" prop="deviceName" v-model="form.deviceName" placeholder="请输入取号设备名"/>
                            <Field label="呼叫设备" prop="callName" v-model="form.callName" placeholder="请输入呼叫设备"/>
                            <Field label="事项名" prop="matterName" v-model="form.matterName" type="textarea" placeholder="请输入事项名"/>
                            <Field label="排号队列ID，唯一" prop="queueid" v-model="form.queueid" placeholder="请输入排号队列ID，唯一"/>
                            <Field label="取号方式 " prop="wySignin" v-model="form.wySignin" type="radio" :enumData="dict.wySignin" />
                            <Field label="部门名称" prop="sectionName" v-model="form.sectionName" placeholder="请输入部门名称"/>
                            <Field label="大厅名称" prop="hallName" v-model="form.hallName" placeholder="请输入大厅名称"/>
                            <Field label="取号设备类型" prop="deviceType" v-model="form.deviceType" placeholder="请输入取号设备类型"/>
                            <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="extNum" v-model="form.extNum" 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: "PhQueueDetail",
        mixins: [form],
        components: {

        },
        created() {
            this.changePath("ph/queue")
        },
        data() {
            return {
                // 遮罩层
                loading: true,
                // 弹出层标题
                title: "排号汇总",
                // 是否显示弹出层
                open: false,
                direction:"rtl",
                toString:[
                ],
                toDate:[
                    "taketime",
                    "calltime",
                    "endtime",
                ],
                // 表单校验
                rules: {
                    ordernumber: [
                        {required: true,message: "请输入预约编号，为空现场取号", trigger: "blur" },
                        {max: 64,message: "最多只能录入64个字符",trigger: "blur",},
                    ],
                    style: [
                        {required: true,message: "请输入叫号状态 ", trigger: "blur" },
                        {max: 8,message: "最多只能录入8个字符",trigger: "blur",},
                    ],
                    business: [
                        {required: true,message: "请输入业务名", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    windowName: [
                        {required: true,message: "请输入窗口名", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    windowFromnum: [
                        {required: true,message: "请输入窗口编号", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    flownum: [
                        {required: true,message: "请输入流水编号,当天的第xxx号", trigger: "blur" },
                        {max: 64,message: "最多只能录入64个字符",trigger: "blur",},
                    ],
                    formernum: [
                        {required: true,message: "请输入呼叫转移号", trigger: "blur" },
                        {max: 32,message: "最多只能录入32个字符",trigger: "blur",},
                    ],
                    peopleIdcard: [
                        {required: true,message: "请输入身份证号", trigger: "blur" },
                        {max: 64,message: "最多只能录入64个字符",trigger: "blur",},
                    ],
                    peopleName: [
                        {required: true,message: "请输入姓名", trigger: "blur" },
                        {max: 64,message: "最多只能录入64个字符",trigger: "blur",},
                    ],
                    peopleSex: [
                        {required: true,message: "请输入性别", trigger: "blur" },
                        {max: 6,message: "最多只能录入6个字符",trigger: "blur",},
                    ],
                    peoplePhone: [
                        {required: true,message: "请输入手机号", trigger: "blur" },
                        {max: 20,message: "最多只能录入20个字符",trigger: "blur",},
                    ],
                    workmanName: [
                        {required: true,message: "请输入工作人员姓名", trigger: "blur" },
                        {max: 32,message: "最多只能录入32个字符",trigger: "blur",},
                    ],
                    workmanNumber: [
                        {required: true,message: "请输入工作人员工号", trigger: "blur" },
                        {max: 20,message: "最多只能录入20个字符",trigger: "blur",},
                    ],
                    waitTime: [
                        {required: true,message: "请输入等待时间,单位s", trigger: "blur" },
                    ],
                    handleTime: [
                        {required: true,message: "请输入办理时间,单位s", trigger: "blur" },
                    ],
                    deviceName: [
                        {required: true,message: "请输入取号设备名", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    callName: [
                        {required: true,message: "请输入呼叫设备", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    matterName: [
                        {required: true,message: "请输入事项名", trigger: "blur" },
                        {max: 256,message: "最多只能录入256个字符",trigger: "blur",},
                    ],
                    queueid: [
                        {required: true,message: "请输入排号队列ID，唯一", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    wySignin: [
                        {required: true,message: "请输入取号方式 ", trigger: "blur" },
                        {max: 16,message: "最多只能录入16个字符",trigger: "blur",},
                    ],
                    sectionName: [
                        {required: true,message: "请输入部门名称", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    hallName: [
                        {required: true,message: "请输入大厅名称", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    deviceType: [
                        {required: true,message: "请输入取号设备类型", trigger: "blur" },
                        {max: 32,message: "最多只能录入32个字符",trigger: "blur",},
                    ],
                    extNum: [
                        {required: true,message: "请输入扩展编号", trigger: "blur" },
                        {max: 128,message: "最多只能录入128个字符",trigger: "blur",},
                    ],
                    createTime: [
                        {required: true,message: "请选择创建时间" },
                    ],
                }
            };
        },

        methods: {
            /** 编辑 */
            edit(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="ph/queue/edit";
                this.getData();
                this.pageInfo.type="edit"
                this.title = "修改排号汇总";
            },
            /** 新增 */
            add(row) {
                this.reset()
                this.urls.currUrl = "ph/queue/add";
                this.getData();
                this.pageInfo.type="add"
                this.title = "新增排号汇总";
            },
            /** 查看*/
            view(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="ph/queue/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 = {
                    ordernumber : "",
                    style : "未叫号",
                    business : "",
                    windowName : "",
                    windowFromnum : "",
                    flownum : "",
                    formernum : "",
                    peopleIdcard : "",
                    peopleName : "",
                    peopleSex : "",
                    peoplePhone : "",
                    workmanName : "",
                    workmanNumber : "",
                    taketime : null,
                    calltime : null,
                    endtime : null,
                    waitTime : 0,
                    handleTime : 0,
                    deviceName : "",
                    callName : "",
                    matterName : "",
                    queueid : "",
                    wySignin : "现场取号",
                    sectionName : "",
                    hallName : "",
                    deviceType : "排号机",
                    siteId : 0,
                    siteCode : "",
                    siteName : "",
                    extNum : "",
                };
                this.resetForm("form");
            },
            resetForm(refName) {
                if (this.$refs[refName]) {
                    this.$refs[refName].resetFields();
                }
            },
        },
    };
</script>
