<template>
    <div class="page">
        <LayoutTable :data="tableData" :config="tableConfig">
                    </LayoutTable>


        <drawer-show ref="drawerform" @ok="getData" />
    </div>
</template>

<script>
    /** 表单弹出框模式需引入 */
    import drawerShow from "./drawershow";
    import table from "@/assets/mixins/table";
    export default {
        name: "AttendanceVacationBalanceList",
        components: {
            drawerShow
},
        mixins: [table],
        created() {
        },
        methods: {
            /** 重写新增方法 */
            toAdd(row) {
                this.$refs.drawerform.add(row);
            },
            /** 重写编辑方法 */
            toEdit(row) {
                this.$refs.drawerform.edit(row);
            },
            /** 重写查看方法 */
            toView(row) {
                this.$refs.drawerform.view(row);
            },

        },
        data() {
            return {
                config: {
                    search: [
                        {
                            name: "staffId",
                            type: "text",
                            label: "员工id",
                            fuzzy: true
                        },
                        {
                            name: "deptId",
                            type: "text",
                            label: "部门id",
                            fuzzy: true
                        },
                        {
                            name: "entryTime",
                            type: "date",
                            label: "入职时间",
                            fuzzy: true
                        },
                        {
                            name: "personalLeaveDays",
                            type: "text",
                            label: "事假",
                            fuzzy: true
                        },
                        {
                            name: "compensatedLeaveDays",
                            type: "text",
                            label: "调休",
                            fuzzy: true
                        },
                        {
                            name: "sickLeaveDays",
                            type: "text",
                            label: "病假",
                            fuzzy: true
                        },
                        {
                            name: "annualLeaveDays",
                            type: "text",
                            label: "年假",
                            fuzzy: true
                        },
                        {
                            name: "marriageLeaveDays",
                            type: "text",
                            label: "婚假",
                            fuzzy: true
                        },
                    ],
                    columns: [
                        {type: "selection", width: 60},
                        {type: "index",label: "序号",width: 50},

                        {label: "员工id", prop: "staffId", formatter: this.formatter},

                        {label: "员工姓名", prop: "staffName"},

                        {label: "部门id", prop: "deptId", formatter: this.formatter},

                        {label: "部门名称", prop: "deptName"},

                        {label: "入职时间", prop: "entryTime", formatter: this.formatterDate},

                        {label: "事假", prop: "personalLeaveDays", formatter: this.formatterMoney},

                        {label: "调休", prop: "compensatedLeaveDays", formatter: this.formatterMoney},

                        {label: "病假", prop: "sickLeaveDays", formatter: this.formatterMoney},

                        {label: "年假", prop: "annualLeaveDays", formatter: this.formatterMoney},

                        {label: "婚假", prop: "marriageLeaveDays", formatter: this.formatterMoney},

                        {label: "创建用户", prop: "createUserId", formatter: this.formatter},
                        {
                            label: "操作",
                            width: 240,
                            formatter: row => {
                                return (
                                    <table-buttons noAdd row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} />
                            );
                            }
                        }
                    ]
                }
            };
        }
    };
</script>