<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="deptId" v-model="form.deptId" placeholder="请输入部门id号"/>
                            <Field label="部门名称" prop="deptName" v-model="form.deptName" placeholder="请输入部门名称"/>
                            <Field label="部门绩效总分数" prop="totalScore" v-model="form.totalScore" placeholder="请输入部门绩效总分数"/>
                            <Field label="考勤绩效指标增加分数" prop="attendScoreAdd" v-model="form.attendScoreAdd" placeholder="请输入考勤绩效指标增加分数"/>
                            <Field label="考勤绩效指标扣减分数" prop="attendScoreSub" v-model="form.attendScoreSub" placeholder="请输入考勤绩效指标扣减分数"/>
                            <Field label="评价绩效指标增加分数" prop="assessScoreAdd" v-model="form.assessScoreAdd" placeholder="请输入评价绩效指标增加分数"/>
                            <Field label="评价绩效指标扣减分数" prop="assessScoreSub" v-model="form.assessScoreSub" placeholder="请输入评价绩效指标扣减分数"/>
                            <Field label="办件绩效指标增加分数" prop="workScoreAdd" v-model="form.workScoreAdd" placeholder="请输入办件绩效指标增加分数"/>
                            <Field label="办件绩效指标扣减分数" prop="workScoreSub" v-model="form.workScoreSub" placeholder="请输入办件绩效指标扣减分数"/>
                            <Field label="效能绩效指标增加分数" prop="effectScoreAdd" v-model="form.effectScoreAdd" placeholder="请输入效能绩效指标增加分数"/>
                            <Field label="效能绩效指标扣减分数" prop="effectScoreSub" v-model="form.effectScoreSub" placeholder="请输入效能绩效指标扣减分数"/>
                            <Field label="其它绩效指标增加分数" prop="otherScoreAdd" v-model="form.otherScoreAdd" placeholder="请输入其它绩效指标增加分数"/>
                            <Field label="其它绩效指标扣减分数" prop="otherScoreSub" v-model="form.otherScoreSub" placeholder="请输入其它绩效指标扣减分数"/>
                            <Field label="备注" prop="remark" v-model="form.remark" type="textarea" placeholder="请输入备注"/>
                            <Field label="年" prop="year" v-model="form.year" placeholder="请输入年"/>
                            <Field label="月" prop="month" v-model="form.month" type="select" :enumData="dict.month" placeholder="请选择月"/>
                            <Field label="日" prop="day" v-model="form.day" type="select" :enumData="dict.day" placeholder="请选择日"/>

            </el-row>

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

    </el-drawer>
</template>

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

        },
        created() {
            this.changePath("dept/perform/stat")
        },
        data() {
            return {
                // 遮罩层
                loading: true,
                // 弹出层标题
                title: "部门绩效分数统计",
                // 是否显示弹出层
                open: false,
                direction:"rtl",
                toString:[
                    "month",
                    "day",
                ],
                toDate:[
                ],
                // 表单校验
                rules: {
                    totalScore: [
                        {required: true,message: "请输入部门绩效总分数",trigger: "blur" },
                    ],
                    year: [
                        {required: true,message: "请输入年", trigger: "blur" },
                    ],
                    month: [
                        {required: true,message: "请输入月", trigger: "blur" },
                    ],
                    day: [
                        {required: true,message: "请输入日", trigger: "blur" },
                    ],
                }
            };
        },

        methods: {
            /** 编辑 */
            edit(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="dept/perform/stat/edit";
                this.getData();
                this.pageInfo.type="edit"
                this.title = "修改部门绩效分数统计";
            },
            /** 新增 */
            add(row) {
                this.reset()
                this.urls.currUrl = "dept/perform/stat/add";
                this.getData();
                this.pageInfo.type="add"
                this.title = "新增部门绩效分数统计";
            },
            /** 查看*/
            view(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="dept/perform/stat/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 = {
                    deptId : 0,
                    deptName : "",
                    totalScore : null,
                    attendScoreAdd : null,
                    attendScoreSub : null,
                    assessScoreAdd : null,
                    assessScoreSub : null,
                    workScoreAdd : null,
                    workScoreSub : null,
                    effectScoreAdd : null,
                    effectScoreSub : null,
                    otherScoreAdd : null,
                    otherScoreSub : null,
                    remark : "",
                    year : null,
                    month : null,
                    day : null,
                };
                this.resetForm("form");
            },
            resetForm(refName) {
                if (this.$refs[refName]) {
                    this.$refs[refName].resetFields();
                }
            },
        },
    };
</script>
