<!--
  @description: 集约化评标计划
  @author:肖文龙
  @routerPath:/intensiveeval/intensiveevalLeadPerson-list
  @date: 2020-3-11 17:28:42
-->
<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>
      <section :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="groupedStatus" label="分组状态" prop="groupedStatus">
              <el-select v-model="searchForm.groupedStatus" style="width: 228px" placeholder="请选择">
                <el-option v-for="(item,index) in groupingStateList" :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>
      </section>
      <!--查询结果-->
      <div class="crud_menu_title">
        <span class="icon-line">查询结果</span>
      </div>
      <div>
        <el-table
          ref="smallTable"
          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"
          />
          <el-table-column
            label="分组状态"
            prop="groupedStatus"
            align="center"
            min-width="120"
          >
            <template slot-scope="scope">
              <span
                v-for="(item,index) in groupingStateList"
                v-if="scope.row.groupedStatus===item.typecode"
                :key="index"
              >{{ item.typename }}</span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            label="操作"
            align="center"
            width="140"
          >
            <template slot-scope="scope">
              <!--
              评标分组状态为：04评标分组审批通过
               -->
              <el-link
                v-if="scope.row.groupedStatus==='04'"
                type="primary"
                @click="setupLead(scope.row)"
              >
                [设置牵头人项目经理]
              </el-link>
              <!--
              评标分组状态为：06 已指定牵头人 || 07 已创建评委会信息 ||08 已抽取完成
              -->
              <el-link
                v-if="scope.row.groupedStatus==='06'||scope.row.groupedStatus==='07'||scope.row.groupedStatus==='08'"
                type="primary"
                @click="see(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: 'IntensiveevalLeadPersonList',
  components: {
    pagination
  },
  mixins: [groupMixin, ListMixin],
  data() {
    return {
      loading: false, // 刷新loading
      searchForm: {
        batchNumber: '', // 批次号
        groupName: '', // 分组名称
        groupedStatus: '', // 分组状态
        pageNo: 1,
        pageSize: 10
      },
      // 评标委员会列表
      tableData: [{ tenderNo: '1' }]
    }
  },
  created() {
    this.loadData()// 获取数据
  },
  methods: {
    /*
    * 设置牵头人
    *  row 某一行的信息
    * */
    setupLead(row) {
      this.$router.push(
        { path: '/intensiveeval/intensiveevalLeadPerson-add',
          query: {
            groupId: row.id, // 分组Id
            batchNumber: row.batchNumber// 批次号
          }}
      )
    },
    // 查看
    see(row) {
      this.$router.push(
        { path: '/intensiveeval/intensiveevalLeadPerson-detail',
          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>
