<!--
  @description: 抽取申请-录入采购方代表-列表
  @author: qrf
  @routerPath:
  @date: 2020-10-30 13:35:58
-->
<template>
  <div class="projectInfoDetail">
    <el-form ref="form" label-width="160px">
      <div class="page-title">
        <span>4 录入采购方代表</span>
        <el-button
          style="margin-left:16px;"
          @click="getPurchaseList"
        >
          添加
        </el-button>
      </div>
      <div>
        <el-table :data="tableData" class="tableLimit">
          <el-table-column type="index" label="序号" width="60" align="center" />
          <el-table-column label="姓名" align="center" prop="purchaserName" />
          <el-table-column label="身份证号" align="center" prop="idCard" />
          <el-table-column label="手机号" align="center" prop="mobilePhone" />
          <el-table-column label="性别" align="center" prop="sex">
            <template slot-scope="scope">
              <span v-if="scope.row.sex==='00'">男</span>
              <span v-if="scope.row.sex==='01'">女</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" width="120">
            <template slot-scope="scope">
              <el-link type="primary" @click="removeConditList(scope.row,scope.$index)">
                [删除]
              </el-link>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-form>
    <!--添加采购方代表-弹框-->
    <buyerRepresentativeAddDialog :dialog-data="dialogData" />
  </div>
</template>
<script>
/* 组件 */
import buyerRepresentativeAddDialog from '@/views/expert/extractExpert/etractApplyDialog/buyerRepresentativeAdd-dialog' // 添加采购方代表-弹框
export default {
  name: 'BuyerRepresentativeList',
  components: {
    buyerRepresentativeAddDialog // 添加采购方代表-弹框
  },
  data() {
    return {
      // 添加采购方代表-弹框
      dialogData: {
        dialog: false
      }
    }
  },
  methods: {
    // 控制添加采购方代表-弹框
    getPurchaseList() {
      this.dialogData = {
        dialog: true
      }
    },
    //  删除
    removeConditList(index) {
      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.loading = true
        this.tableData.splice(index, 1)
        this.$message({
          type: 'success',
          message: '删除成功!'
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    }
  }
}
</script>
