<template>
  <div class="page">
    <el-tabs v-model="activeName">
      <el-tab-pane label="未处理" name="1">
        <LayoutTable :data="tableData" notAdd notDel :config="tableConfig">
        </LayoutTable>
      </el-tab-pane>
      <el-tab-pane label="已处理" name="2">
        <LayoutTable :data="tableData" notAdd notDel :config="tableConfig">
        </LayoutTable>
      </el-tab-pane>
      <el-tab-pane label="数据分析" name="3">
        <div class="content">
          <div class="search_box">
            <div class="search">
              <el-select
                v-model="dateValue"
                placeholder="请选择"
                style="margin: 0 10px;"
              >
                <el-option
                  v-for="item in optionsMonths"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
              <el-button type="primary">搜索</el-button>
            </div>
          </div>
          <div class="data_box">
            <div class="top">
              <div class="box">
                <bar-charts
                  :title="'申诉次数部门排名TOP20'"
                  :id="'dept_20'"
                  :legendName="'申诉次数'"
                  :styleObj="{ width: '800px', height: '360px' }"
                />
              </div>
              <div class="box">
                <bar-charts
                  :title="'申诉次数个人排名TOP20'"
                  :id="'person_20'"
                  :legendName="'申诉次数'"
                  :styleObj="{ width: '800px', height: '360px' }"
                />
              </div>
            </div>
            <div class="down">
              <bar-charts
                :title="'申诉次数规则排名TOP20'"
                :id="'rule_20'"
                :legendName="'申诉次数'"
                :styleObj="{ width: '1800px', height: '320px' }"
              />
            </div>
          </div>
        </div>
      </el-tab-pane>
    </el-tabs>
    <!-- <bar-charts
      :title="'部门扣分排名TOP10'"
      :id="'koufen_10'"
      :legendName="'部门扣分分值'"
      :styleObj="{ width: '100%', height: '300px' }"
    /> -->
    <drawer-show ref="drawerform" @ok="getData" />
  </div>
</template>

<script>
/** 表单弹出框模式需引入 */
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table";
import BarCharts from "./components/BarCharts.vue";
export default {
  name: "PerformAttendAppealList",
  components: {
    drawerShow,
    BarCharts,
  },
  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}
                />
              );
            },
          },
        ],
      },
      activeName: "1",
      optionsMonths: [
        {
          value: "1",
          label: "1月",
        },
        {
          value: "2",
          label: "2月",
        },
        {
          value: "3",
          label: "3月",
        },
        {
          value: "4",
          label: "4月",
        },
        {
          value: "5",
          label: "5月",
        },
        {
          value: "6",
          label: "6月",
        },
        {
          value: "7",
          label: "7月",
        },
        {
          value: "8",
          label: "8月",
        },
        {
          value: "9",
          label: "9月",
        },
        {
          value: "10",
          label: "10月",
        },
        {
          value: "11",
          label: "11月",
        },
        {
          value: "12",
          label: "12月",
        },
      ],
      dateValue: "1",
    };
  },
};
</script>
<style lang="less" scoped>
.page {
  width: 100%;
  height: 100%;
  overflow: hidden;
  /deep/.el-tabs__item {
    width: 120px;
    font-size: 14px;
    text-align: center;
  }
  .content {
    width: 100%;
    height: 730px;
    overflow: hidden;
    .search_box {
      width: 100%;
      height: auto;
      text-align: right;
    }
    .data_box {
      width: 100%;
      height: 100%;
      .top {
        width: 100%;
        height: 380px;
        display: flex;
        justify-content: space-between;
        .box {
          width: 49%;
          height: 100%;
        }
      }
    }
  }
}
</style>
