<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="pjId" v-model="form.pjId" 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="windowId" v-model="form.windowId" placeholder="请输入窗口id"/>
                <Field :span="20" label="窗口名称" prop="windowName" v-model="form.windowName" type="textarea" placeholder="请输入窗口名称"/>
                <Field :span="20"  label="部门" prop="section" v-model="form.section" placeholder="请输入部门"/>
                <Field :span="20"  label="编号" prop="flounum" v-model="form.flounum" placeholder="请输入编号"/>
                <Field :span="20"  label="评价选项" prop="assessment" v-model="form.assessment" placeholder="请输入评价选项"/>
                <Field :span="20"  label="评价类型" prop="type" v-model="form.type" placeholder="请输入评价类型"/>
                <Field :span="20" label="评价内容"><editor v-model="form.content" :min-height="256"/></Field>
                <Field :span="20"  label="来源" prop="source" v-model="form.source" placeholder="请输入来源"/>
                <Field :span="20" label="评价时间" prop="pjTime" v-model="form.pjTime" type="date" />
                <Field :span="20"  label="告警次数" prop="careCount" v-model="form.careCount" placeholder="请输入告警次数"/>
                <Field :span="20"  label="消息发送次数" prop="smsCount" v-model="form.smsCount" 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: "CareCpRecordsDetail",
        mixins: [form],
        components: {

        },
        created() {
            this.changePath("care/cp/records")
        },
        data() {
            return {
                // 遮罩层
                loading: true,
                // 弹出层标题
                title: "差评预警",
                // 是否显示弹出层
                open: false,
                direction:"rtl",
                toString:[
                ],
                toDate:[
                    "pjTime",
                ],
                // 表单校验
                rules: {
                }
            };
        },

        methods: {
            /** 编辑 */
            edit(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="care/cp/records/edit";
                this.getData();
                this.pageInfo.type="edit"
                this.title = "修改差评预警";
            },
            /** 新增 */
            add(row) {
                this.reset()
                this.urls.currUrl = "care/cp/records/add";
                this.getData();
                this.pageInfo.type="add"
                this.title = "新增差评预警";
            },
            /** 查看*/
            view(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="care/cp/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,
                    pjId : null,
                    name : null,
                    contact : null,
                    idCard : null,
                    windowId : null,
                    windowName : null,
                    section : null,
                    flounum : null,
                    assessment : null,
                    type : null,
                    content : null,
                    source : null,
                    pjTime : null,
                    careCount : 0,
                    smsCount : 0,
                };
                this.resetForm("form");
            },
            resetForm(refName) {
                if (this.$refs[refName]) {
                    this.$refs[refName].resetFields();
                }
            },
        },
    };
</script>
