<template>
    <div>
      <el-table v-loading="loading" :data="inspectTaskList">
        <el-table-column label="用户" align="center" prop="receiveName" :show-overflow-tooltip="true"/>
        <el-table-column label="安检状态" align="center" prop="status" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <span v-if="scope.row.status == 0">到访不遇</span>
            <span v-if="scope.row.status == 1">拒绝安检</span>
            <span v-if="scope.row.status == 2">已安检</span>
            <span v-if="scope.row.status == 3">表前已安检</span>
          </template>
        </el-table-column>
        <el-table-column label="有无隐患" align="center" prop="danger" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <span v-if="scope.row.danger == 1">有</span>
            <span v-else>无</span>
          </template>
        </el-table-column>
        <el-table-column label="满意度" align="center" prop="satisfy">
          <template slot-scope="scope">
            <span v-if="scope.row.satisfy == 1">不满意</span>
            <span v-if="scope.row.satisfy == 2">一般</span>
            <span v-if="scope.row.satisfy == 3">满意</span>
            <span v-else>-</span>
          </template>
        </el-table-column>
        <el-table-column label="签字状态" align="center" prop="sign">
          <template slot-scope="scope">
            <span v-if="scope.row.sign == 0">未签字</span>
            <span v-if="scope.row.sign == 1">已签字</span>
          </template>
        </el-table-column>
        <el-table-column label="安检人" align="center" prop="memberName" :show-overflow-tooltip="true"/>
        <el-table-column label="安检时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
      </el-table>

      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="$parent.queryParams.pageNum"
        :limit.sync="$parent.queryParams.pageSize"
        @pagination="getInspectList"
      />
    </div>
</template>

<script>
  import { listInspect }from "@/api/checktask/inspect";
  export default {
    name: "inspect-task-table",
    data(){
      return{
        total: 0,
        inspectTaskList: [],
        loading: false
      }
    },
    methods:{
      getInspectList(){
        this.loading = true;
        listInspect(this.$parent.queryParams).then(res =>{
          this.loading = false;
          if(res.code == 200){
            this.total = res.total;
            this.inspectTaskList = res.rows;
          }
        })
      }

    }
  }
</script>

<style scoped>

</style>
