<!--
  @description:启动视频会议-邀请投标人列表
  @Modifier: haofengxian
  @routerPath:
  @date: 2020-12-23-11:29
-->
<template>
  <el-dialog
    :visible.sync="dialogTableVisible"
    :close-on-click-modal="false"
    custom-class="el-dialog__body-p8 el-dialog_table"
    title="邀请投标人"
    top="6vh"
    width="840px"
  >
    <el-scrollbar class="pack_wrap_scrollbar scrollbar">
      <el-table
        :data="tableData"
      >
        <el-table-column
          type="index"
          label="序号"
          width="60px"
          align="center"
        />
        <el-table-column
          header-align="center"
          prop="supplierName"
          label="投标人名称"
          min-width="230"
        />
        <!--是否邀请参加视频会议 00未邀请 01已邀请 02已取消-->
        <el-table-column
          :formatter="formatterIsInvitationMeetRoom"
          header-align="center"
          prop="isInvitationMeetRoom"
          label="邀请状态"
          min-width="120"
          align="center"
        />
        <el-table-column
          header-align="center"
          label="操作"
          align="center"
          width="150"
        >
          <template slot-scope="scope">
            <el-link
              v-if="scope.row.isInvitationMeetRoom==='00' || scope.row.isInvitationMeetRoom==='02' "
              :underline="false"
              type="primary"
              @click="sendInvitations(scope.row,'01')"
            >
              [发送邀请]
            </el-link>
            <el-link
              v-if="scope.row.isInvitationMeetRoom==='01'"
              :underline="false"
              type="primary"
              @click="sendInvitations(scope.row,'02')"
            >
              [取消邀请]
            </el-link>
          </template>
        </el-table-column>
      </el-table>
    </el-scrollbar>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogTableVisible = false">关 闭</el-button>
    </span>
  </el-dialog>
</template>

<script>
/* 接口*/
import { getRoomInvitationSupplierList, saveInvitationSupplierStatus } from '@api/bidding/bidOpening'
/* 混合开发方法-参数字段*/
import { bidOpeningRedisConfigMixin } from '../mixins/bidOpeningRedisConfigMixin'
import { bidOpeningGroupMixin } from '../mixins/bidOpeningGroupMixin'

import { filterDictText } from '@assets/js/utils'// 常用方法
export default {
  name: 'SupplierVideoConferenceDialog',
  mixins: [bidOpeningRedisConfigMixin, bidOpeningGroupMixin],
  data() {
    return {
      dialogTableVisible: false, // 弹框是否打开
      tableData: [],
      openTypeStageIds: {}
    }
  },
  methods: {
    filterDictText, // 字典值替换文本通用方法
    // 打开弹框
    openDialogSupplierVideoConference(openTypeStageIds) {
      // 获取列表信息
      this.openTypeStageIds = openTypeStageIds
      this.loadData()
      this.dialogTableVisible = true
    },
    // 获取项目标段列表
    loadData() {
      const params = {
        openStageType: this.openTypeStageIds.openStageType,
        stageIds: this.openTypeStageIds.stageIds
      }
      getRoomInvitationSupplierList(params).then(response => {
        this.tableData = response.data
      }).catch(() => {
      })
    },
    // 发送邀请/取消邀请
    sendInvitations(row, val) {
      const params = {
        mainId: row.mainId, // 供应商主数据id
        openStageType: this.openTypeStageIds.openStageType,
        stageIds: this.openTypeStageIds.stageIds, // 阶段id集合
        isInvitationMeetRoom: val // 是否邀请参加视频会议 00未邀请 01已邀请 02已取消
      }
      saveInvitationSupplierStatus(params).then(res => {
        this.loadData()
      })
    },
    // 邀请状态
    formatterIsInvitationMeetRoom(row, column, cellValue) {
      return filterDictText(this.isInvitationMeetRoomList, cellValue)
    }
  }
}
</script>

<style scoped lang="less">
  @import "../index";
</style>
