<!--
  @description: 专家库-专家信息列表
  @Modifier: 徐媛媛
  @routerPath: /exoert/expertQuitInfoAudit-list
  @date: 2020/9/3
-->
<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="realName" label="专家姓名" prop="realName">
              <el-input
                v-model.trim="searchForm.realName"
                placeholder="专家姓名"
                style="width:220px"
                @keyup.enter.native="onSearch"
              />
            </el-form-item>
            <el-form-item ref="specialtyName" label="主评专业" prop="specialtyName">
              <el-input
                v-model.trim="searchForm.specialtyName"
                placeholder="主评专业"
                style="width:220px"
                @keyup.enter.native="onSearch"
              />
            </el-form-item>

            <!-- 审核状态 -->
            <el-form-item
              label="审核状态"
              prop="auditStatus"
            >
              <el-select v-model="searchForm.auditStatus" placeholder="请选择" style="width: 220px">
                <el-option
                  v-for="item in expertAuditStatusList"
                  :key="item.typecode"
                  :label="item.typename"
                  :value="item.typecode"
                />
              </el-select>
            </el-form-item>
            <!-- 冻结状态 -->
            <el-form-item
              label="冻结状态"
              prop="frozen"
            >
              <el-select v-model="searchForm.frozen" placeholder="请选择" style="width: 220px">
                <el-option
                  v-for="item in frozenList"
                  :key="item.typecode"
                  :label="item.typename"
                  :value="item.typecode"
                />
              </el-select>
            </el-form-item>
            <!--请假状态-->
            <el-form-item
              label="请假状态"
              prop="isleave"
            >
              <el-select v-model="searchForm.isleave" placeholder="请选择" style="width: 220px">
                <el-option
                  v-for="item in isleaveList"
                  :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>
      <div class="crud_menu_title clearfix">
        <span class="icon-line fl">查询结果</span>
      </div>
      <div>
        <el-table
          ref="smallTable"
          v-loading="loading"
          :data="tableData"
          class="tableLimit"
        >
          <el-table-column
            type="index"
            label="序号"
            width="60px"
            align="center"
          />
          <el-table-column
            prop="realName"
            align="center"
            label="专家姓名"
            min-width="100"
          />
          <el-table-column
            align="center"
            prop="certificateCode"
            label="身份证号"
            min-width="140"
          />
          <el-table-column
            align="center"
            prop="mobile"
            label="联系方式"
            min-width="120"
          />
          <el-table-column
            align="center"
            prop="comName"
            label="工作单位"
            min-width="120"
          />
          <el-table-column
            header-align="center"
            align="center"
            prop="specialtyName"
            label="主评专业"
            min-width="90"
          />
          <el-table-column
            header-align="center"
            align="center"
            prop="area"
            label="所在区域"
            min-width="90"
          />
          <el-table-column
            header-align="center"
            align="center"
            prop="auditStatus"
            label="审核状态"
            min-width="90"
          >
            <template slot-scope="scope">
              <span
                v-if="scope.row.auditStatus==='00'"
                type="primary"
              >
                待审核
              </span>
              <span
                v-if="scope.row.auditStatus==='02'"
                type="primary"
              >
                审核不通过
              </span>
              <span
                v-if="scope.row.auditStatus==='01'"
                type="primary"
              >
                审核通过
              </span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            align="center"
            label="专家状态"
            min-width="90"
          >
            <template slot-scope="scope">
              {{ scope.row.auditStatus=='01'? '正式专家':'临时专家' }}
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            align="center"
            prop="createTime"
            label="创建时间"
            min-width="110"
          />
          <el-table-column
            align="center"
            label="操作"
            width="160"
          >
            <template slot-scope="scope">
              <el-link
                type="primary"
                @click.stop="edit(scope.row)"
              >
                [变更]
              </el-link>
              <el-link
                type="primary"
                @click.stop="preview(scope.row)"
              >
                [查看]
              </el-link>
            </template>
          </el-table-column>
        </el-table>

        <!--分页组件-->
        <pagination :pagination-data="paginationData" @change="loadData" />
      </div>
    </section>
  </div>
</template>
<script>
/* 接口*/
import { getALLExpertListByManager } from '@/api/expert/expertscloud.js'// 项目列表
/* 公用方法*/
import { filterObj, filterDictText, restoreInitialValue } from '@/assets/js/utils'// 常用方法
/* 混合开发方法-参数字段*/
import { ListMixin } from '@/mixins/ListMixin'// 分页
import { expertQuit } from '../mixins/expertQuit'// 字典信息
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
export default {
  name: 'TenderProjectList',
  components: {
    pagination // 分页

  },
  mixins: [ListMixin, expertQuit],
  data() {
    return {
      loading: true,
      // 搜索
      searchForm: {
        frozen: '', // 冻结状态
        auditStatus: '', // 审核状态
        isleave: '', //  请假状态
        realName: '', //  专家姓名
        specialtyName: '' // 主评专业
      },
      tableData: []
    }
  },
  created() {
    sessionStorage.clear()
    // 获取列表信息
    this.loadData()
  },
  methods: {
    filterDictText, // 字典值替换文本通用方法
    // 获取数据
    loadData() {
      const params = this.getQueryParams()// 查询条件
      getALLExpertListByManager(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
      }).catch(() => {
        this.loading = false
      })
    },
    // 查询条件
    getQueryParams() {
      const param = Object.assign({}, this.searchForm)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      return filterObj(param)
    },
    // 搜索
    onSearch() {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      // 获取列表信息
      this.loadData()
    },
    // 重置
    resetForm(formName) {
      restoreInitialValue(this.searchForm)
      // 获取列表信息
      this.onSearch()
    },
    // 查看
    preview(row) {
      this.$router.push({
        name: 'BasicInfo',
        params: {
          expertId: row.id
        }
      })
    },
    // 编辑
    edit(row) {
      this.$router.push({
        path: 'perfectInfo',
        query: {
          // type: 'declarationChange', // 页面类型
          auditStatus: row.auditStatus,
          id: row.id // 变更id
        }
      })
      // this.$router.push({
      //   name: 'BasicInfo',
      //   params: {
      //     expertId: row.id
      //   }
      // })
    }
  }
}
</script>
<style lang="less" scoped>

</style>
