<!--
  @description: 集约化评标列表
  @author:肖文龙
  @routerPath: /intensiveeval/intensiveevalCommittee-list
  @date: 2020年3月5日10:52:57
-->
<template>
  <div>
    <!--标题-->
    <div class="title title_border p0-16">
      <i class="el-icon-s-home" />集约化评标
    </div>
    <section class="p0-16">
      <!--查询条件-->
      <div class="crud_menu_title clearfix">
        <span class="icon-line fl">查询条件</span>
      </div>
      <div :class="{'SearchContent_show':toggleSearchStatus}" class=" clearfix SearchContent">
        <div class="SearchContent_leftInput fl">
          <el-form
            ref="searchForm"
            :model="searchForm"
            inline
            label-position="right"
          >
            <!--批次号-->
            <el-form-item ref="batchNumber" label="批次号" prop="batchNumber">
              <el-input v-model="searchForm.batchNumber" maxlength="200" placeholder="批次号" />
            </el-form-item>
            <!--批次号-->
            <el-form-item ref="groupName" label="分组名称" prop="groupName">
              <el-input v-model="searchForm.groupName" maxlength="600" placeholder="分组名称" />
            </el-form-item>
            <!--分组状态-->
            <el-form-item ref="judgesStatus" label="评委会状态" prop="judgesStatus">
              <el-select v-model="searchForm.judgesStatus" style="width: 228px" placeholder="请选择">
                <el-option
                  v-for="(item,index) in judgesStatusList"
                  :key="index"
                  :label="item.typename"
                  :value="item.typecode"
                />
              </el-select>
            </el-form-item>
          </el-form>
        </div>
        <div class="fr">
          <el-button type="primary" size="small" @click="onSearch">
            搜索
          </el-button>
          <el-button plain type="info" size="small" @click="resetForm('searchForm')">
            重置
          </el-button>
        </div>
      </div>
      <!--查询结果-->
      <div class="crud_menu_title">
        <span class="icon-line">查询结果</span>
      </div>
      <div>
        <el-table
          v-loading="loading"
          :data="tableData"
        >
          <el-table-column
            type="index"
            label="序号"
            width="45px"
            fixed="left"
            align="center"
          />
          <el-table-column

            prop="batchNumber"
            align="center"
            label="批次号"
            fixed="left"
            width="100"
          />
          <el-table-column

            header-align="center"
            prop="groupName"
            label="分组名称"
            fixed="left"
            min-width="200"
          />
          <el-table-column
            header-align="center"
            prop="judgesNumber"
            label="评标委员会个数"
            min-width="110"
          >
            <template slot-scope="scope">
              <!--评委会是否分组(00否 01是)-->
              <span>{{ scope.row.judgesGroupedStatus==='00'?scope.row.judgesNumber:'-' }}</span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            prop="expertsSelectedNumber"
            label="抽取专家人数"
            min-width="100"
          >
            <template slot-scope="scope">
              <!--评委会是否分组(00否 01是)-->
              <span>{{ scope.row.judgesGroupedStatus==='00'?scope.row.expertsSelectedNumber:'-' }}</span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            prop="technicalGroupsNumber"
            label="技术组数"
            min-width="80"
          >
            <template slot-scope="scope">
              <!--评委会是否分组(00否 01是)-->
              <span>{{ scope.row.judgesGroupedStatus==='01'?scope.row.technicalGroupsNumber:'-' }}</span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            prop="technicalExpertsSelectedNumber"
            label="技术抽取专家人数"
            min-width="120"
          >
            <template slot-scope="scope">
              <!--评委会是否分组(00否 01是)-->
              <span>{{ scope.row.judgesGroupedStatus==='01'?scope.row.technicalExpertsSelectedNumber:'-' }}</span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            prop="businessGroupNumber"
            label="商务组数"
            min-width="80"
          >
            <template slot-scope="scope">
              <!--评委会是否分组(00否 01是)-->
              <span>{{ scope.row.judgesGroupedStatus==='01'?scope.row.businessGroupNumber:'-' }}</span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            prop="businessExpertsSelectedNumber"
            label="商务抽取专家人数"
            min-width="120"
          >
            <template slot-scope="scope">
              <!--评委会是否分组(00否 01是)-->
              <span>{{ scope.row.judgesGroupedStatus==='01'?scope.row.businessExpertsSelectedNumber:'-' }}</span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            label="项目单位个数"
            prop="projectDepartNumber"
            min-width="100"
          />
          <el-table-column
            label="评标委员会组建方式"
            prop="juryBuildType"
            align="center"
            min-width="130"
          >
            <template slot-scope="scope">
              <span
                v-for="(item,index) in juryOrganizeWayList"
                v-if="scope.row.juryBuildType===item.typecode"
                :key="index"
              >{{ item.typename }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="提交抽取时间"
            prop="submitTime"
            align="center"
            width="140"
          />
          <el-table-column
            label="评委会状态"
            prop="judgesStatus"
            align="center"
            min-width="120"
          >
            <template slot-scope="scope">
              <span
                v-for="(item,index) in judgesStatusList"
                v-if="scope.row.judgesStatus===item.typecode"
                :key="index"
              >{{ item.typename }}</span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            label="操作"
            width="320px"
          >
            <template slot-scope="scope">
              <!--
              评评委会状态（00待申请 02抽取失败）
              -->
              <el-link
                v-if="scope.row.judgesStatus==='00'||scope.row.judgesStatus==='02'"
                type="primary"
                @click="organize(scope.row)"
              >
                [组建评标委员会]
              </el-link>
              <!--
              评评委会状态（05已生效）
              -->
              <el-link
                v-if="scope.row.judgesStatus==='05'"
                type="primary"
                @click="see(scope.row)"
              >
                [查看评标委员会]
              </el-link>

              <!--
              评评委会状态（03抽取成功）
              -->
              <el-link
                v-if="scope.row.judgesStatus==='03'||scope.row.judgesStatus==='07'"
                type="primary"
                @click="extractingResults(scope.row)"
              >
                [查看抽取结果]
              </el-link>

              <!--
              评评委会状态（ 01抽取中 03抽取成功 ）
              -->
              <el-link
                v-if="scope.row.judgesStatus==='01'||scope.row.judgesStatus==='03'||scope.row.judgesStatus==='07'"
                type="primary"
                @click="see(scope.row)"
              >
                [查看抽取申请]
              </el-link>
              <el-link
                type="primary"
                @click="lookGroupInfo(scope.row)"
              >
                [查看分组信息]
              </el-link>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页 -->
        <pagination :pagination-data="paginationData" @change="loadData" />
      </div>
    </section>
  </div>
</template>

<script>
/* api*/
import { queryIntensiveevalPlansToGroupPages } from '@/api/intensiveeval/intensiveeval'
/* 混合开发*/
import { groupMixin } from '@/views/intensiveeval/mixins/intensiveevalGroupMixin'// 字典信息
import { ListMixin } from '@/mixins/ListMixin'// 分页
/* 公用方法*/
import { filterObj } from '@/assets/js/utils'// 常用方法
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
export default {
  name: 'IntensiveevalCommitteeList',
  components: {
    pagination
  },
  mixins: [groupMixin, ListMixin],
  data() {
    return {
      loading: false, // 刷新loading
      searchForm: {
        batchNumber: '', // 批次号
        groupName: '', // 分组名称
        judgesStatus: '' // 评评委会状态（00待申请 01抽取中 02抽取失败 03抽取成功 04待指定 05已生效）
      },
      // 评标委员会列表
      tableData: []
    }
  },
  created() {
    this.loadData()// 获取数据
  },
  methods: {
    // 组建评标委员会
    organize(row) {
      this.$router.push({
        path: '/intensiveeval/formEvalCommittee-add',
        query: {
          batchNumber: row.batchNumber, // 批次号
          juryId: row.juryId, // 评委会Id
          groupId: row.id, // 分组id
          judgesStatus: row.judgesStatus // 评委会状态
        }
      })
    },
    // 查看组建评标委员会(查看抽取申请)
    see(row) {
      this.$router.push({
        path: '/intensiveeval/formEvalCommittee-detail',
        query: {
          batchNumber: row.batchNumber, // 批次号
          juryId: row.juryId, // 评委会Id
          groupId: row.id// 分组id
        }
      })
    },
    // 查看抽取结果
    extractingResults(row) {
      this.$router.push({
        path: '/intensiveeval/expertExtractingResults-detail',
        query: {
          batchNumber: row.batchNumber, // 批次号
          juryId: row.juryId, // 评委会Id
          groupId: row.id, // 分组id
          groupedStatus: row.groupedStatus // 评委会状态
        }
      })
    },
    // 查看评标分组信息
    lookGroupInfo(row) {
      this.$router.push({
        path: '/intensiveeval/intensiveevalZJPBWYHGroupContent',
        query: {
          groupId: row.id, // 分组Id
          batchNumber: row.batchNumber// 批次号
        }})
    },
    // 搜索
    onSearch() {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      // 获取列表信息
      this.loadData()
    },
    // 重置
    resetForm(formName) {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      this.$refs[formName].resetFields()
      // 获取列表信息
      this.loadData()
    },
    // 获取数据
    loadData() {
      this.loading = true
      const params = this.getQueryParams()// 查询条件
      queryIntensiveevalPlansToGroupPages(params).then(response => {
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
        this.loading = false
      }).catch(() => {

      })
    },
    // 查询条件
    getQueryParams() {
      const param = Object.assign({}, this.searchForm)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      return filterObj(param)
    }
  }
}
</script>

<style lang="less" scoped>

</style>
