<!--
  @description: 抽取项目列表-
  @author: 徐媛媛
  @routerPath:/expert/extractApplyList
  @date: 2020-8-24 8:35:58
-->
<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>
      <section :class="{'SearchContent_show':toggleSearchStatus}" class="clearfix SearchContent">
        <div class="SearchContent_leftInput fl">
          <el-form ref="searchForm" :model="searchForm" inline>
            <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.createTimeStart"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="创建开始时间"
              />
              至
              <el-date-picker
                v-model="searchForm.createEndTime"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="创建结束时间"
              />
            </el-form-item>
            <!--申请时间-->
            <el-form-item label="评标开始时间">
              <el-date-picker
                v-model="searchForm.evaluationDateStart"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="评标开始时间"
              />
              至
              <el-date-picker
                v-model="searchForm.evaluationDateEnd"
                :format="elValueFormatDate"
                :value-format="elValueFormatDate"
                type="date"
                placeholder="评标结束时间"
              />
            </el-form-item>
            <el-form-item label="审核状态">
              <el-select v-model="searchForm.auditStatus">
                <el-option value label="暂存">
                  暂存
                </el-option>
                <el-option value="00" label="待审核">
                  待审核
                </el-option>
                <el-option value="01" label="审核通过">
                  审核通过
                </el-option>
                <el-option value="02" label="审核不通过">
                  审核不通过
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="抽取状态">
              <el-select v-model="searchForm.resultStatus">
                <el-option value="00" label="待抽取">
                  待抽取
                </el-option>
                <el-option value="01" label="抽取中">
                  抽取中
                </el-option>
                <el-option value="02" label="抽取完成">
                  抽取完成
                </el-option>
              </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>
      </section>
      <el-tabs v-model="activeName">
        <el-tab-pane :table-data="tableData" label="随机抽取" name="00">
          <allocation-tenderPlan-list
            ref="allocationTenderPlan"
            :alldata="tableData"
          />
        </el-tab-pane>
        <el-tab-pane label="直接指定" name="01">
          <addSelf-tenderPlan-list
            ref="addSelfTenderPlan"
            :adddata="addTableData"
          />
        </el-tab-pane>
      </el-tabs>
    </section>
  </div>
</template>
<script>
import {
} from '@/api/expert/extractExpert/extractExpert'
import { ListMixin } from '@/mixins/ListMixin'
import { commonMxin } from '@/mixins/commonMxin'
import allocationTenderPlanList from './allocationTenderPlan-list'
import addSelfTenderPlanList from './addSelfTenderPlan-list'
import { filterObj, restoreInitialValue, filterDictText } from '@/assets/js/utils'// 常用方法
import { getExtractExpertApplyListByCreateUser } from '@/api/expert/expertscloud.js'// 项目列表 项目删除

export default {
  components: {
    'allocation-tenderPlan-list': allocationTenderPlanList, // 随机抽取列表
    'addSelf-tenderPlan-list': addSelfTenderPlanList // 直接指定列表
  },
  mixins: [ListMixin, commonMxin],
  data() {
    return {
      allTableData: [],
      addTableData: [],
      activeName: '00', // 默认选中第一个tab页 随机抽取 直接指定
      page: 1,
      pageSize: 10,
      totalPage: 0,
      info: {
        main: this.$t('components.headerBar.main'),
        second: this.$t('components.headerBar.second')
      },
      tableData: [],
      searchForm: {
        activeName: '', // 随机抽取 直接指定
        createTimeStart: '', // 创建时间
        createTimeEnd: '', // 创建结束时间
        evaluationDateStart: '', // 评标开始时间
        evaluationDateEnd: '', // 评标结束时间
        auditStatus: '', // 审核状态,空 暂存 00待审核 01审核通过 02审核不通过
        resultStatus: '', // 抽取状态 00代抽取 01抽取中 02抽取完成 03抽取完成
        page: 1,
        pageSize: 10,
        applyCode: '' // 抽取申请编号
      },
      createTime: [],
      evaluationDate: []
    }
  },
  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(() => {
      })
    },
    onSearch() {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      // 获取列表信息
      this.loadData()
    },
    getQueryParams() {
      const param = Object.assign({}, this.searchForm)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      param.activeName = this.activeName // 列表类型  随机抽取 00     直接指定 01
      return filterObj(param)
    },
    // 重置
    resetForm(formName) {
      restoreInitialValue(this.searchForm)
      // 获取列表信息
      this.onSearch()
    }

  }
}
</script>

