<template>
  <div :style="{height:height,width:width}">
    <h3>我的待办
      <el-button
        size="mini"
        type="text"
        icon="el-icon-top-right"
        @click="toPending"
      >去处理
      </el-button>
    </h3>
    <el-table :data="approvedangerList" v-loading="loading">
      <el-table-column label="流程名称" align="center" prop="processName" :show-overflow-tooltip="true"/>
      <el-table-column label="待办任务名称" align="center" prop="taskName" :show-overflow-tooltip="true"/>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      layout="prev, pager, next"
      :background="false"
      @pagination="getList"
    />
  </div>
</template>
<script>
import {getPendinglist} from "@/api/ehs/approvedanger";

export default {
  name: 'pendingChart',
  props: {
    height: {
      type: String,
      default: '610px'
    },
    width: {
      type: String,
      default: '100%'
    }
  },
  data() {
    return {
      // 总条数
      total: 0,
      // 遮罩层
      loading: true,
      approvedangerList: [],
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        plantCode: null,
        recorderId: null,
        hiddendangerLevel: null,
        hiddendangerContent: null,
        measures: null,
        completeTime: null,
        status: null,
        creattime: null,
        endtime: null,
        processId: null,
        approveNo: null,
        deptId: null,
      },
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询隐患申请列表 */
    getList() {
      this.loading = true;
      getPendinglist(this.queryParams).then(response => {
        this.approvedangerList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    toPending() {
      this.$router.push({path: '/approve/pending'})
    }
  }
}
</script>
