<template>
  <div>
    <div slot="header" class="clearfix">
      <span style="font-weight:bold">绩效评分</span>
      <div style="float: right; padding: 3px 0" type="text">
        <el-button size="mini" plain @click="btnBack">返回</el-button>
      </div>
    </div>
    <div class="app-container">
      <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true">
        <el-form-item label="员工" prop="staffCodeOrName">
          <el-input
            v-model="queryParams.params.staffCodeOrName"
            clearable
            @keyup.enter.native="btnSearch"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="btnSearch">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="btnResetQuery">重置</el-button>
        </el-form-item>
      </el-form>
      <div style="float:right">
      </div>
      <el-table size="mini" height="500px" v-loading="loading" :data="listData">
        <el-table-column label="编号" align="center" prop="id" />
        <el-table-column label="员工姓名" align="center" prop="staffName" />
        <el-table-column label="评估周期" align="center" prop="name" />
        <el-table-column label="月度" align="center" prop="month" />
        <el-table-column label="自评分" align="center" prop="saMark" />
        <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-search"
              @click="btnPmVerify(scope.row)"
            >待评分</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="paginationClass">
        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
      </div>
    </div>
  </div>
</template>

<script>
import { listPerformance} from "@/api/business/ehr/pm/pmmark";

export default {
  name: "PmMark",
  dicts: ['ehr_pm_status'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 表格数据
      listData: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        params:{
          staffCodeOrName: null,
        }
      },
      //详情id
      rowId: '',
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询绩效列表 */
    getList() {
      this.loading = true;
      listPerformance(this.queryParams).then(response => {
        this.listData = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    btnSearch() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    btnResetQuery() {
      this.resetForm("queryForm");
      this.queryParams.params.staffCodeOrName = null;
      this.btnSearch();
    },
    /** 刷新 */
    refresh(){
      this.resetForm("queryForm");
      this.getList();
    },
    //调整分数
    async btnPmVerify(row){
      console.log('row',row);
      this.$router.push({ name: 'PmMarkDetail', query: { performanceId: row.id,flowId: row.flowId } });
    },
    //返回
    btnBack(){
      this.$router.back();
    },
  }
};
</script>

<style lang="scss" scoped>
.btn_grooup {
  margin-bottom: 10px;
  display: flex;
  justify-content: flex-end;
}
.paginationClass {
  z-index: 500;
  position: fixed;
  bottom: 10px;
  right: 10px;
  width: 100%;
  line-height: var(--footer-height);
  color: #fff;
}
</style>
