<template>
    <!-- 弹出框表单 -->
    <el-drawer
            :title="title"
            :visible.sync="open"
            :direction="direction"
            size="50%">
        <el-form ref="form" :model="form" :rules="rules" label-width="120px">
            <el-row>
                                            <Field label="自动配置id" prop="deptConfId" v-model="form.deptConfId" placeholder="请输入自动配置id"/>
                            <Field label="绩效规则id" prop="ruleId" v-model="form.ruleId" placeholder="请输入绩效规则id"/>
                            <Field label="规则简称" prop="ruleName" v-model="form.ruleName" placeholder="请输入规则简称"/>
                            <Field label="部门id" prop="deptId" v-model="form.deptId" placeholder="请输入部门id"/>
                            <Field label="部门名称" prop="deptName" v-model="form.deptName" type="textarea" placeholder="请输入部门名称"/>
                            <Field label="分类名称" prop="categoryName" v-model="form.categoryName" placeholder="请输入分类名称"/>
                            <Field label="规则类型" prop="type" v-model="form.type" type="select" :enumData="dict.type" placeholder="请选择规则类型"/>
                            <Field label="备注" prop="remark" v-model="form.remark" type="textarea" placeholder="请输入备注"/>
                            <Field label="是否启用规则" prop="enable" v-model="form.enable" type="select" :enumData="dict.enable" placeholder="请选择是否启用规则"/>

            </el-row>

            <form-buttons @submit='submitForm' noCancelBtn />
        </el-form>

    </el-drawer>
</template>

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

        },
        created() {
            this.changePath("perform/dept/conf/detail")
        },
        data() {
            return {
                // 遮罩层
                loading: true,
                // 弹出层标题
                title: "部门考核内容详细信息",
                // 是否显示弹出层
                open: false,
                direction:"rtl",
                toString:[
                    "type",
                    "enable",
                ],
                toDate:[
                ],
                // 表单校验
                rules: {
                }
            };
        },

        methods: {
            /** 编辑 */
            edit(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="perform/dept/conf/detail/edit";
                this.getData();
                this.pageInfo.type="edit"
                this.title = "修改部门考核内容详细信息";
            },
            /** 新增 */
            add(row) {
                this.reset()
                this.urls.currUrl = "perform/dept/conf/detail/add";
                this.getData();
                this.pageInfo.type="add"
                this.title = "新增部门考核内容详细信息";
            },
            /** 查看*/
            view(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="perform/dept/conf/detail/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 = {
                    deptConfId : null,
                    ruleId : null,
                    ruleName : "",
                    deptId : null,
                    deptName : "",
                    categoryName : "",
                    type : 1,
                    remark : "",
                    enable : 1,
                };
                this.resetForm("form");
            },
            resetForm(refName) {
                if (this.$refs[refName]) {
                    this.$refs[refName].resetFields();
                }
            },
        },
    };
</script>
