<template>
  <!-- 监理入场 -->
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="auto">
      <el-form-item label="监理名称" prop="proName">
        <el-input
          v-model="queryParams.proName"
          placeholder="请输入监理名称"
          v-no-whitespace
          maxlength="30"
          show-word-limit
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- 监理入场列表 -->
    <el-table :data="supervisorList" border>
      <el-table-column
        type="index"
        width="55"
        label="序号"
        align="center"
        :index="indexContinuous(queryParams.pageNum, queryParams.pageSize)"
      />
      <el-table-column label="工程名称" align="center" prop="proName" />
      <el-table-column label="监理单位名称" align="center" prop="supName" />
      <el-table-column label="社会统一征信代码" align="center" prop="supCode" />
      <el-table-column label="法人姓名" align="center" prop="legalName" />
      <el-table-column label="审批状态" align="center" prop="intoStatus">
        <template slot-scope="scope">
          <!-- 检查是否存在身份证号 -->
          <span v-if="scope.row.intoStatus">{{ updateStatus(scope.row.intoStatus) }}</span>
          <span v-else>-</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" @click="handleApprove(scope.row)" v-if="scope.row.status === '1'">
            审批
          </el-button>
          <el-button size="mini" type="text" @click="handleView(scope.row)" v-else>查看</el-button>
          <el-button size="mini" type="text" v-hasPermi="['system:audit:query']" @click="handleAuditRecord(scope.row)">
            审核记录
          </el-button>
        </template>
      </el-table-column>
    </el-table>

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

<script>
export default {
  name: 'admission',
  data() {
    return {
      supervisorList: [],
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        proName: '',
      },
    }
  },

  methods: {
    handleQuery() {
      this.getList()
    },
    resetQuery() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
      }
    },
  },
}
</script>
