<!--
  @description: 邀请函名单分包-已选供应商列表
  @Modifier: haoFx
  @routerPath:
  @date: 2020/3/7-10:49
-->
<template>
  <div>
    <el-dialog
      v-dialogDrag
      :visible.sync="dialogData.dialog"
      :close-on-click-modal="false"
      title="已选供应商"
      width="840px"
      append-to-body
      custom-class="el-dialog__body-p8 el-dialog_table"
    >
      <div>
        <el-table
          ref="multipleTable"
          :data="dialogData.suppliersList"
          size="mini"
        >
          <el-table-column
            type="index"
            label="序号"
            width="60"
            align="center"
          />
          <el-table-column
            header-align="center"
            prop="supplierName"
            min-width="200"
            label="投标人/投标人名称"
          />
          <el-table-column
            header-align="center"
            prop="linkName"
            width="70"
            label="联系人"
          />
          <el-table-column
            header-align="center"
            prop="linkTel"
            min-width="130"
            label="联系电话"
          />
          <el-table-column
            header-align="center"
            min-width="130"
            prop="email"
            label="邮箱"
          />
          <el-table-column
            v-if="!dialogData.isShowRemoveBtn"
            prop="invitationStateType"
            label="状态"
            width="70"
            align="center"
          >
            <template slot-scope="scope">
              <span v-if="scope.row.invitationStageType==='00'" class="status3">拒绝</span>
              <span v-if="scope.row.invitationStageType==='01'" class="status1">接受</span>
              <span v-if="scope.row.invitationStageType==='02'" class="status2">待接受</span>
            </template>
          </el-table-column>
          <el-table-column
            v-if="invitationType!=='02' && dialogData.isShowRemoveBtn === true"
            align="center"
            width="70"
            label="操作"
          >
            <template slot-scope="scope">
              <el-link
                type="primary"
                @click="deleteRow(scope.$index)"
              >
                [移除]
              </el-link>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogData.dialog = false">
          关闭
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'PackageSelectedSuppliersListDialog',
  props: {
    dialogData: {
      type: Object,
      default: function() {
        return {
          dialog: false, // 弹框展示状态
          suppliersList: []// 供应商列表
        }
      }
    }
  },
  data() {
    return {
      invitationType: this.$store.getters.tenderBase.invitationType // 邀请函类型
    }
  },
  methods: {
    // 移除已邀请的投标人
    deleteRow(index) {
      this.$confirm('确认移除此供应商?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        confirmButtonClass: 'confirmBtn',
        cancelButtonClass: 'cancelBtn',
        type: 'warning'
      }).then(() => {
        this.dialogData.suppliersList.splice(index, 1)
        this.$emit('supplierSelect', this.dialogData.suppliersList, this.dialogData.packIndex, '02')
      }).catch(() => {
      })
    }
  }
}
</script>

<style scoped>

</style>
