<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="purposeConfId" v-model="form.purposeConfId" placeholder="请输入考核目标id"/>
                            <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="number" v-model="form.number" placeholder="请输入工号"/>
                            <Field label="备注" prop="remark" v-model="form.remark" type="textarea" placeholder="请输入备注"/>

            </el-row>

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

    </el-drawer>
</template>

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

        },
        created() {
            this.changePath("perform/perpose/staff")
        },
        data() {
            return {
                // 遮罩层
                loading: true,
                // 弹出层标题
                title: "员工考核目标详细信息",
                // 是否显示弹出层
                open: false,
                direction:"rtl",
                toString:[
                ],
                toDate:[
                ],
                // 表单校验
                rules: {
                }
            };
        },

        methods: {
            /** 编辑 */
            edit(row) {
                this.reset()
                this.query = { Id: row.Id };
                this.urls.currUrl ="perform/perpose/staff/edit";
                this.getData();
                this.pageInfo.type="edit"
                this.title = "修改员工考核目标详细信息";
            },
            /** 新增 */
            add(row) {
                this.reset()
                this.urls.currUrl = "perform/perpose/staff/add";
                this.getData();
                this.pageInfo.type="add"
                this.title = "新增员工考核目标详细信息";
            },
            /** 查看*/
            view(row) {
                this.reset()
                this.query = { Id: row.Id };
                this.urls.currUrl ="perform/perpose/staff/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 = {
                    purposeConfId : null,
                    staffId : null,
                    staffName : "",
                    number : "",
                    remark : "",
                };
                this.resetForm("form");
            },
            resetForm(refName) {
                if (this.$refs[refName]) {
                    this.$refs[refName].resetFields();
                }
            },
        },
    };
</script>
