<!--
  @description:代理机构-项目管理-监标人设置页面
  @Modifier: 张慢慢
  @routerPath:/bidding/projectDrive/inspectSetting/inspectSettingPack-add
  @date: 2021/8/9
  // isCanOperate: true可以操作 false不可以查看只有查看权限  00:否 01:是
  // flowStatus: true工作流进入
-->
<template>
  <div class="main" style="margin-top: 0;">
    <!--未设置标段-->
    <div>
      <div class="makeTenderDocument_title">
        <p>未设置标段（包）</p>
        <!--项目经理有权限 或 工作流驳回进入显示制作按钮-->
        <div v-if="tenderBase.isCanOperate" class="fr">
          <span class="makeTenderDocument_number">已选择
            <span class="makeTenderDocument_orange">{{ seletunPackList.length }}</span>标段
          </span>
          <el-button type="primary" :loading="confirmLoading" @click="setClick">
            设置监标人
          </el-button>
        </div>
      </div>
      <notSetPackComp ref="notSetPackComp" @unPackChange="unPackChange" />
    </div>
    <!--已设置标段-->
    <div>
      <div class="makeTenderDocument_title ">
        <p> 已设置标段（包）</p>
      </div>
      <haveSetPackComp ref="haveSetPackComp" @initData="initUnProcfilePackList" />
    </div>
    <!-- 选择监标人弹框 -->
    <inspectPeopleDialog ref="inspectPeopleDialog" @inspectPeopleInfo="inspectPeopleInfo" />
  </div>
</template>

<script>
/* api*/
// import { saveTenderDocPackage } from '@api/bidding/tenderDoc'
/* 混合开发*/
/* 组件*/
import notSetPackComp from './notSetPackComp'// 未设置标段
import haveSetPackComp from './haveSetPackComp'// 已制作招标文件组件
import inspectPeopleDialog from './inspectPeople-dialog' // 选择监标人弹框
export default {
  name: 'MakeTenderDocumentAdd',
  components: {
    notSetPackComp,
    haveSetPackComp,
    inspectPeopleDialog
  },
  // mixins: [tenderDoc],
  data() {
    return {
      tenderBase: this.$store.getters.tenderBase, // 项目信息
      confirmLoading: false, // 控制按钮重复点击Loding
      tenderId: this.$route.query.id, // 项目Id
      seletunPackList: [] // 当前选择的标段
    }
  },
  created() {
    // 取公共js里commonFileQualificationType
  },
  methods: {
    // 调用未设置标段查询接口
    initUnProcfilePackList() {
      this.$refs.notSetPackComp.initData()
    },
    // 设置监标人
    setClick() {
      if (this.seletunPackList.length > 0) { // 已选标段（包）
        this.$refs.inspectPeopleDialog.open(this.seletunPackList)
      } else {
        this.$message({
          message: '请选择要设置的标段（包）',
          type: 'warning'
        })
      }
    },
    // 选择设置作标段（包）
    unPackChange(val) {
      this.seletunPackList = val
    },
    // 选择监标人确定
    inspectPeopleInfo(data) {
      console.log(data, '1123232')
      if (data) {
        this.$refs.haveSetPackComp.initData()// 已设置列表
        this.$refs.notSetPackComp.initData() // 未设置列表
      }
    }
  }
}
</script>
<style lang="less" scoped>
  @import '~@assets/style/common/public.less';
  .makeTenderDocument_title{
    height: 50px;
    font-size: 14px;
    line-height: 49px;
    margin-bottom: 16px;
    border-bottom: 1px solid @cut-off;
    p{
      padding: 0 6px;
      font-weight: bold;
      box-sizing: border-box;
      float: left;
      border-bottom: 2px solid @hyacinthine;
    }
    .makeTenderDocument_number{
      .makeTenderDocument_orange{
        color: @orange;
        padding: 6px;
      }

      margin-right: 20px;
    }
  }
</style>
