<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: "PerformAttendAppealList",
        components: {
            drawerShow
},
        mixins: [table],
        created() {
        },
        methods: {
            renderTable(tableData) {
                return (
                    <el-table stripe data={tableData} class="total-table">
                    {this.columnSet.map((item) => this.renderTableColumn(item))}
                    </el-table>
                );
            },
            renderTableColumn(options) {
                return (
                    <el-table-column
                        prop={options.prop}
                        label={options.label}
                        width={options.width}
                        formatter={options.formatter}
                    >
                    </el-table-column>
                 );
            },
            /** 重写新增方法 */
            toAdd(row) {
                this.$refs.drawerform.add(row);
            },
            /** 重写编辑方法 */
            toEdit(row) {
                this.$refs.drawerform.edit(row);
            },
            /** 重写查看方法 */
            toView(row) {
                this.$refs.drawerform.view(row);
            },

        },
        data() {
            return {
                /** 子表列元素 */
                columnSet:[
                    {label: "申诉Id", prop: "appealId", formatter: this.formatter},
                    {label: "文件名称", prop: "fileName"},
                    {label: "文件地址", prop: "filePath"},
                ],
                config: {
                  isshowTabPane:false,
                    search: [
                    ],
                    columns: [
                        {type: "selection", width: 60},
                        {type: "index",label: "序号",width: 50},

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

                        {label: "窗口工号", prop: "workNum"},

                        {label: "所属部门", prop: "deptName"},

                        {label: "违规类型", prop: "ruleName"},
                        {label: "绩效规则", prop: "ruleName"},

                        {label: "加分/扣分方式", prop: "subMethod",formatter: this.formatter},

                      {label: "加分/扣分时间", prop: "attendanceDate" , formatter: this.formatterDate },

                        {label: "分值", prop: "score", formatter: this.formatter},


                        {label: "申诉时间", prop: "appealTime", formatter: this.formatterDate},

                        {label: "处理状态", prop: "processStatus",formatter: this.formatter},

                       /* {label: "绩效记录申诉附件信息",
                          width: 120,
                          prop: "subColumns",
                          formatter: (row) => {
                              let widthsize = this.columnSet.reduce((pre, cur) => {
                                  return pre + Number(cur.width);
                              }, 50);
                              return (
                                  <el-popover placement="right" width={widthsize} trigger="click">
                                      {this.renderTable(row.performAttendAppealFilesList)}
                                      <el-button type="text" slot="reference">详细</el-button>
                                  </el-popover>
                              );
                          },
                        },*/
                        {
                            label: "操作",
                            width: 240,
                            formatter: row => {
                                return (
                                    <table-buttons noAdd row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} />
                            );
                            }
                        }
                    ]
                }
            };
        }
    };
</script>
