<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="staffConfId" v-model="form.staffConfId" 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="staffId" v-model="form.staffId" placeholder="请输入部门id"/>
                            <Field label="部门名称" prop="staffName" v-model="form.staffName" 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: "PerformStaffConfDetailDetail",
        mixins: [form],
        components: {

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