<template>
  <div class="page">
    <div class="btn_box" style="position: absolute;top: 52px;left: 10px;">
      <el-radio-group v-model="radio1" @input="changeRadio">
        <el-radio-button label="1">窗口考核</el-radio-button>
        <el-radio-button label="2">工作人员考核</el-radio-button>
      </el-radio-group>
      <el-button
        slot="table-head-left2"
        style="margin-left: 10px"
        icon="el-icon-tickets"
        size="mini"
        @click="doExport"
        :disabled="isExport"
        >导出</el-button
      >
    </div>

    <LayoutTable :data="tableData" notAdd notDel :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: "CheckWindowPerformList",
  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);
    },
    /** 导出Excel */
    doExport() {
      this.isExport = true;
      this.$download(
        "/check/review/record/exportExcel",
        {
          page: 1,
          size: -1,
        },
        { type: "excel" }
      )
        .then(() => (this.isExport = false))
        .catch((error) => {
          this.isExport = false;
          this.$message.error(error.message);
        });
    },
    // 切换表格
    changeRadio() {
      console.log(this.radio1);
      this.radio1 == 2
        ? this.$router.push("/check/window/workman/perform/list?page=1")
        : "";
    },
  },
  data() {
    return {
      radio1: "1",
      isExport: false,
      config: {
        isshowTabPane: true,
        search: [
          {
            name: "year",
            type: "text",
            label: "考核年度",
            fuzzy: true,
          },
          {
            name: "windowId",
            type: "text",
            label: "窗口ID",
            fuzzy: true,
          },
          {
            name: "ownerId",
            type: "text",
            label: "窗口负责人id",
            fuzzy: true,
          },
        ],
        columns: [
          { type: "selection", width: 60 },
          { type: "index", label: "序号", width: 50 },

          {
            label: "管理组核查时间",
            prop: "manageCheckTime",
            formatter: this.formatterDate,
          },

          { label: "管理组核查说明", prop: "manageCheckDesc" },

          { label: "管理组核查结果", prop: "manageCheckResult" },

          {
            label: "领导组核查时间",
            prop: "leaderCheckTime",
            formatter: this.formatterDate,
          },

          { label: "领导组核查说明", prop: "leaderCheckDesc" },

          { label: "领导组核查结果", prop: "leaderCheckResult" },

          { label: "处理状态", prop: "checkStatus", formatter: this.formatter },
          {
            label: "操作",
            width: 240,
            formatter: (row) => {
              return (
                <table-buttons
                  noAdd
                  row={row}
                  onEdit={this.toEdit}
                  onView={this.toView}
                  onDel={this.toDel}
                />
              );
            },
          },
        ],
      },
    };
  },
};
</script>
<style lang="less" scoped>
/deep/.el-radio-button__inner {
  border: 1px solid #eee !important;
  height: 28px;
  line-height: 3px;
}
/deep/.el-radio-button__orig-radio:checked + .el-radio-button__inner {
  background: #00b565;
  border: none !important;
  color: #fff !important;
  line-height: 3px;
}
</style>
