<!--
  @description:已选沿用投标人弹框
  @Modifier: haofengxian
  @routerPath:
  @date: 2020-5-18-9:28
-->
<template>
  <div>
    <el-dialog
      v-dialogDrag
      :visible.sync="supplierSelectVisible"
      :close-on-click-modal="false"
      title="已选供应商"
      width="840px"
      custom-class="el-dialog__body-p8 el-dialog_table"
    >
      <!--查询列表-->
      <section>
        <el-table
          ref="multipleTable"
          :data="supplierList"
          size="mini"
        >
          <el-table-column
            type="index"
            label="序号"
            width="60"
            align="center"
          />
          <el-table-column
            prop="supplierName"
            label="供应商名称"
          />
          <el-table-column
            v-if="isShowRemoveBtn === true"
            label="操作"
            align="center"
            width="70"
          >
            <template slot-scope="scope">
              <el-link
                type="primary"
                @click="deleteRow(scope.$index)"
              >
                [移除]
              </el-link>
            </template>
          </el-table-column>
        </el-table>
      </section>
      <div slot="footer" class="dialog-footer">
        <el-button @click="supplierSelectVisible = false">
          关 闭
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'FollowBidderDialog',
  data() {
    return {
      supplierSelectVisible: false, // 弹框
      isShowRemoveBtn: false, // 是否显示移除按钮
      packIndex: null,
      supplierList: [] // 供应商列表
    }
  },
  methods: {
    // 查看已选投标人 打开弹框 父组件传回已选供应商信息
    openDialog(row) {
      this.supplierList = row.rebiddingSupplierInfo // 已选投标人信息
      this.isShowRemoveBtn = row.isShowRemoveBtn// 是否显示操作
      this.packIndex = row.packIndex // 标段索引
      this.supplierSelectVisible = true // 打开弹框
    },
    // 移出已选供应商
    deleteRow(index) {
      this.$confirm('确认移除该供应商，是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        confirmButtonClass: 'confirmBtn',
        cancelButtonClass: 'cancelBtn',
        type: 'warning'
      }).then(() => {
        this.supplierList.splice(index, 1)
        this.$emit('supplierSelect', this.supplierList, this.packIndex, '02')
      }).catch(() => {
      })
    }
  }
}
</script>

<style scoped>

</style>
