<template>
    <!-- 弹出框表单 -->
    <el-drawer
            :title="title"
            :visible.sync="open"
            :direction="direction"
            :destroy-on-close="true"
            size="60%">
        <el-form ref="form" :model="form" :rules="rules" label-width="120px">
            <el-row>
                                <Field :span="20"  label="站点Id" prop="siteId" v-model="form.siteId" placeholder="请输入站点Id"/>
                <Field :span="20" label="站点名称" prop="siteName" v-model="form.siteName" type="textarea" placeholder="请输入站点名称"/>
                <Field :span="20"  label="个人信息ID" prop="personId" v-model="form.personId" placeholder="请输入个人信息ID"/>
                <Field :span="20"  label="办理号ID与等待号id一致" prop="doWorkId" v-model="form.doWorkId" placeholder="请输入办理号ID与等待号id一致"/>
                <Field :span="20"  label="姓名" prop="name" v-model="form.name" placeholder="请输入姓名"/>
                <Field :span="20"  label="联系方式" prop="contact" v-model="form.contact" placeholder="请输入联系方式"/>
                <Field :span="20"  label="身份证号码" prop="idCard" v-model="form.idCard" placeholder="请输入身份证号码"/>
                <Field :span="20"  label="业务Id" prop="bussinessId" v-model="form.bussinessId" placeholder="请输入业务Id"/>
                <Field :span="20" label="预约业务" prop="bussinessName" v-model="form.bussinessName" type="textarea" placeholder="请输入预约业务"/>
                <Field :span="20"  label="办理业务" prop="service" v-model="form.service" placeholder="请输入办理业务"/>
                <Field :span="20"  label="排队编号" prop="queueNo" v-model="form.queueNo" placeholder="请输入排队编号"/>
                <Field :span="20" label="排队开始时间" prop="takeTime" v-model="form.takeTime" type="date" />
                <Field :span="20" label="排队结束时间-业务办理开始时间" prop="callTime" v-model="form.callTime" type="date" />
                <Field :span="20" label="办理结束时间" prop="endTime" v-model="form.endTime" type="date" />
                <Field :span="20"  label="最终办理时长，秒" prop="waitTime" v-model="form.waitTime" placeholder="请输入最终办理时长，秒"/>
                <Field :span="20"  label="告警次数" prop="careCount" v-model="form.careCount" placeholder="请输入告警次数"/>
                <Field :span="20"  label="短信发送次数" prop="smsCount" v-model="form.smsCount" placeholder="请输入短信发送次数"/>
                <Field :span="20" label="评价" prop="assessment" v-model="form.assessment" type="textarea" 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: "CareDoworkRecordsDetail",
        mixins: [form],
        components: {

        },
        created() {
            this.changePath("care/dowork/records")
        },
        data() {
            return {
                // 遮罩层
                loading: true,
                // 弹出层标题
                title: "办理时间",
                // 是否显示弹出层
                open: false,
                direction:"rtl",
                toString:[
                ],
                toDate:[
                    "takeTime",
                    "callTime",
                    "endTime",
                ],
                // 表单校验
                rules: {
                }
            };
        },

        methods: {
            /** 编辑 */
            edit(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="care/dowork/records/edit";
                this.getData();
                this.pageInfo.type="edit"
                this.title = "修改办理时间";
            },
            /** 新增 */
            add(row) {
                this.reset()
                this.urls.currUrl = "care/dowork/records/add";
                this.getData();
                this.pageInfo.type="add"
                this.title = "新增办理时间";
            },
            /** 查看*/
            view(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="care/dowork/records/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 : null,
                    siteName : null,
                    personId : null,
                    doWorkId : null,
                    name : null,
                    contact : null,
                    idCard : null,
                    bussinessId : null,
                    bussinessName : null,
                    service : null,
                    queueNo : null,
                    takeTime : null,
                    callTime : null,
                    endTime : null,
                    waitTime : null,
                    careCount : 0,
                    smsCount : 0,
                    assessment : null,
                };
                this.resetForm("form");
            },
            resetForm(refName) {
                if (this.$refs[refName]) {
                    this.$refs[refName].resetFields();
                }
            },
        },
    };
</script>
