<!--
  @description: 专家库-抽取项目列表
  @Modifier: 肖文龙
  @routerPath: /expert/extractProject-list
  @date: 2020/8/2
-->
<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>
        <span class="fr pointer" @click="handleToggleSearch">
          <el-link
            :underline="false"
            :class="toggleSearchStatus?'arrow-is-active':''"
            type="primary"
            class="toggleSearchStatus icon el-icon-arrow-down"
          />
          {{ toggleSearchStatus?'收起高级查询' :'展开高级查询' }}
        </span>
      </div>
      <div :class="{'SearchContent_show':toggleSearchStatus}" class="clearfix SearchContent">
        <div class="SearchContent_leftInput fl">
          <el-form
            ref="searchForm"
            :model="searchForm"
            inline
            label-width="100px"
            label-position="left"
          >
            <el-form-item ref="applyCode" label="抽取申请编号" prop="applyCode">
              <el-input
                v-model.trim="searchForm.applyCode"
                placeholder="抽取申请编号"
                style="width:220px"
                @keyup.enter.native="onSearch"
              />
            </el-form-item>
            <!--评标开始时间-->
            <el-form-item
              label="开始日期"
            >
              <el-date-picker
                v-model="searchForm.createBeginTime"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="开始日期"
              />
              至
              <el-date-picker
                v-model="searchForm.createBeginTime1"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="结束日期"
              />
            </el-form-item>
            <!-- 抽取状态 -->
            <el-form-item
              label="抽取状态"
              prop="resultStatus"
            >
              <el-select v-model="searchForm.resultStatus" placeholder="请选择" style="width: 220px">
                <el-option
                  v-for="item in extractStatusList"
                  :key="item.typecode"
                  :label="item.typename"
                  :value="item.typecode"
                />
              </el-select>
            </el-form-item>
            <!-- 评标结束时间 -->
            <el-form-item
              label="开始日期"
            >
              <el-date-picker
                v-model="searchForm.createEndTime"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="开始日期"
              />
              至
              <el-date-picker
                v-model="searchForm.createEndTime1"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="结束日期"
              />
            </el-form-item>
            <!--申请时间-->
            <el-form-item
              label="开始日期"
            >
              <el-date-picker
                v-model="searchForm.createEndTimwe"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="开始日期"
              />
              至
              <el-date-picker
                v-model="searchForm.createEndTwime1"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="结束日期"
              />
            </el-form-item>
            <!-- 抽取状态 -->
            <el-form-item
              label="抽取状态"
              prop="resultStatus"
            >
              <el-select v-model="searchForm.resultStatus" placeholder="请选择" style="width: 220px">
                <el-option
                  v-for="item in extractStatusList"
                  :key="item.typecode"
                  :label="item.typename"
                  :value="item.typecode"
                />
              </el-select>
            </el-form-item>
          </el-form>
        </div>
        <div class="fr">
          <el-button type="primary" @click="onSearch">
            搜 索
          </el-button>
          <el-button plain type="info" @click="resetForm('searchForm')">
            重 置
          </el-button>
        </div>
      </div>
      <el-tabs v-model="activeName">
        <el-tab-pane label="随机抽取" name="01" />
        <el-tab-pane label="直接指定" name="00" />
      </el-tabs>
      <div>
        <!-- 随机抽取列表组件 -->
        <extractProjectRandomComp v-show="activeName==='01'" :table-data="tableData" />
        <!-- 直接指定列表组件 -->
        <extractProjectAppointComp v-show="activeName==='00'" :table-data="tableData" />
        <!--分页组件-->
        <pagination :pagination-data="paginationData" @change="loadData" />
      </div>
    </section>
  </div>
</template>
<script>
/* 接口*/
import { getExtractExpertApplyListByCreateUser } from '@/api/expert/expertscloud.js'// 项目列表 项目删除
/* 公用方法*/
import { filterObj, filterDictText, restoreInitialValue } from '@/assets/js/utils'// 常用方法
/* 混合开发方法-参数字段*/
import { ListMixin } from '@/mixins/ListMixin'// 分页
import { extractProjectMixin } from '../mixins/extractProjectMixins'// 字典信息
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
import extractProjectRandomComp from './extractProjectRandomComp'// 随机抽取列表组件
import extractProjectAppointComp from './extractProjectAppointComp'// 直接指定列表组件

export default {
  name: 'TenderProjectList',
  components: {
    pagination, // 分页
    extractProjectRandomComp, // 随机抽取列表组件
    extractProjectAppointComp// 直接指定列表组件
  },
  mixins: [ListMixin, extractProjectMixin],
  props: {
    listData: {
      type: String,
      default: function() {
        return
      }
    }
  },
  data() {
    return {
      activeName: '01', // tabs切换 01 随机抽取 00 直接指定
      // 搜索
      searchForm: {
        rakeType: '', // 列表类型 01 随机抽取 00 直接指定
        createBeginTime: '', // 评标开始时间开始
        createBeginTime1: '', // 评标开始时间结束
        createEndTime: '', // 评标结束时间开始
        createEndTime1: '', // 评标结束时间结束
        createEndTimwe: '', // 申请时间开始
        createEndTwime1: '', // 申请时间结束
        tenderName: '', // 抽取状态
        applyCode: '', // 抽取申请编号
        applyId: '' // 抽取id
      },
      tableData: []
    }
  },
  watch: {
    // tabs切换
    activeName() {
      this.onSearch()
    }
  },
  created() {
    // 获取列表信息
    this.loadData()
  },
  methods: {
    filterDictText, // 字典值替换文本通用方法
    // 获取数据
    loadData() {
      const params = this.getQueryParams()// 查询条件
      getExtractExpertApplyListByCreateUser(params).then(response => {
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
      }).catch(() => {
      })
    },
    // 查询条件
    getQueryParams() {
      const param = Object.assign({}, this.searchForm)
      param.id = this.listData
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      param.rakeType = this.activeName // 列表类型 01 随机抽取 00 直接指定
      return filterObj(param)
    },
    // 搜索
    onSearch() {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      // 获取列表信息
      this.loadData()
    },
    // 重置
    resetForm(formName) {
      restoreInitialValue(this.searchForm)
      // 获取列表信息
      this.onSearch()
    }
  }
}
</script>
<style lang="less" scoped>

</style>
