<!--
  @description:供应商管理-审批历史列表
  @Modifier:qk/肖文龙
  @routerPath:supperManagement/supplierAuditHistoryList
  @date:2020/5/23-17:27
-->
<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="98px"
            label-position="left"
          >
            <el-form-item ref="bizType" label="审批类型" prop="bizType">
              <el-select v-model="searchForm.bizType" placeholder="请选择" width="228px">
                <el-option
                  v-for="item in supplierBizTypeGroupList"
                  :key="item.typecode"
                  :label="item.typename"
                  :value="item.typecode"
                />
              </el-select>
            </el-form-item>
            <el-form-item ref="businesslicence" label="业务编号" prop="businesslicence">
              <el-input v-model="searchForm.businesslicence" placeholder="请输入业务编号" width="228px" />
            </el-form-item>
            <el-form-item ref="supplierName" label="业务名称" prop="supplierName">
              <el-input v-model="searchForm.supplierName" placeholder="请输入业务名称" width="228px" />
            </el-form-item>
            <el-form-item ref="date" label="审核时间" prop="date">
              <el-date-picker
                v-model="date"
                type="daterange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                style="width:228px"
                value-format="yyyy-MM-dd"
              />
            </el-form-item>
            <el-form-item ref="createUserName" label="发起人" prop="createUserName">
              <el-input v-model="searchForm.createUserName" placeholder="请输入当前发起人" width="228px" />
            </el-form-item>
            <el-form-item ref="auditStatus" label="审核状态" prop="auditStatus">
              <el-select v-model="searchForm.auditStatus" placeholder="请选择" style="width:188px">
                <el-option
                  v-for="item in auditStatusList"
                  :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">
        <span class="icon-line">查询结果</span>
      </div>
      <div>
        <el-table
          ref="smallTable"
          v-loading="loading"
          :data="tableData"
        >
          <el-table-column
            type="index"
            label="序号"
            width="60px"
            align="center"
          />
          <el-table-column
            prop="bizType"
            align="center"
            label="审核类型"
            width="160"
          >
            <template slot-scope="scope">
              <span
                v-for="(item,index) in supplierBizTypeGroupList"
                v-if="scope.row.bizType===item.typecode"
                :key="index"
              >{{ item.typename }}</span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            prop="businesslicence"
            label="业务编号"
            min-width="110"
          />
          <el-table-column
            header-align="center"
            prop="supplierName"
            label="业务名称"
            min-width="300"
          >
            <template slot-scope="scope">
              <el-link
                :underline="false"
                type="primary"
                @click="examineSupplierInfo(scope.row)"
              >
                {{ scope.row.supplierName }}
              </el-link>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            label="发起人"
            prop="createUserName"
            align="left"
            min-width="110"
          />
          <el-table-column
            label="提交时间"
            prop="updateTimeBegin"
            align="center"
            min-width="110"
          />
          <el-table-column
            label="审核时间"
            prop="updateTimeEnd"
            align="center"
            min-width="110"
          />
          <el-table-column
            label="审核状态"
            prop="auditStatus"
            align="center"
            min-width="110"
          >
            <template slot-scope="scope">
              <span v-if="scope.row.useStatus ==='01' && scope.row.auditStatus === '01'">审核通过</span>
              <span v-if="scope.row.useStatus ==='01' && scope.row.auditStatus === '02'">审核不通过</span>
            </template>
          </el-table-column>
          <el-table-column
            header-align="center"
            label="操作"
            align="center"
            width="146"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="info"
                plain
                @click="intoProject(scope.row)"
              >
                查看
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <!--分页组件-->
        <pagination :pagination-data="paginationData" @change="loadData" />
      </div>
    </section>
    <!-- 供应商信息查看-弹框 -->
    <editorDeclarationDetailDialong ref="supplierInfo" />
  </div>
</template>
<script>
/* 接口*/
import { listHiTaskPages } from '@/api/supplier/wareHousingApprovalaudit'// 列表
/* 公用方法*/
import { filterObj, restoreInitialValue } from '@/assets/js/utils'// 常用方法
/* 混合开发方法-参数字段*/
import { ListMixin } from '@/mixins/ListMixin'// 分页
import { supplierGroupMixin } from '../../mixins/supplierGroupMixin'
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
import editorDeclarationDetailDialong from '@/views/supplier/editorDeclaration/editorDeclarationContent/editorDeclarationDetail-dialog'// 供应商信息查看

export default {
  name: 'ProjectManagerTenderList',
  components: {
    pagination, // 分页
    editorDeclarationDetailDialong // 供应商信息查看-弹框
  },
  mixins: [ListMixin, supplierGroupMixin],
  data() {
    return {
      loading: true,
      // 搜索
      searchForm: {
        bizType: '', // 审批类型
        createUserName: '', // 发起人
        businesslicence: '', // 业务编号
        supplierName: '', // 业务名称
        updateTimeBegin: '', // 审核时间开始
        updateTimeEnd: '', // 审核时间结束
        auditStatus: '' // 审核状态
      },
      tableData: []
    }
  },
  created() {
    // 字典信息
    this.initGetTaskDictionaries()
    // 获取列表信息
    this.loadData()
  },
  methods: {
    // 获取数据
    loadData() {
      const params = this.getQueryParams()// 查询条件
      listHiTaskPages(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
      }).catch(() => {

      })
    },
    // 查询条件
    getQueryParams() {
      const param = Object.assign({}, this.searchForm)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      return filterObj(param)
    },
    // 查看
    intoProject(row) {
    },
    // 供应商信息-弹框
    examineSupplierInfo(row) {
      this.$refs.supplierInfo.open(row.supplierId)// 供应商主键id
    },
    // 搜索
    onSearch() {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      // 获取列表信息
      this.loadData()
    },
    // 重置
    resetForm(formName) {
      restoreInitialValue(this.searchForm)
      this.$refs[formName].resetFields()
      this.onSearch()
    }
  }
}
</script>
<style lang="less" scoped>
</style>
