<!--
  @description: 招标项目-归档台账管理列表
  @Modifier: 肖文龙
  @routerPath: /bidArchived/bidArchivedULC-list
  @date: 2019/10/25-17:52
-->
<template>
  <table-crud
    ref="tableCrud"
    :search-form="searchForm"
    search-label-width="100px"
    @on-load="loadData"
  >
    <template v-slot:header>
      查询归档台账信息
    </template>
    <template v-slot:search="search">
      <el-form-item label="项目编号">
        <el-input
          v-model.trim="searchForm.tenderNo"
          placeholder="项目编号"
          @keyup.enter.native="search.onSearch"
        />
      </el-form-item>
      <el-form-item label="项目名称">
        <el-input
          v-model.trim="searchForm.tenderName"
          placeholder="项目名称"
          @keyup.enter.native="search.tenderName"
        />
      </el-form-item>
      <el-form-item label="招标人">
        <el-input
          v-model.trim="searchForm.departName"
          placeholder="招标人"
          @keyup.enter.native="search.onSearch"
        />
      </el-form-item>
      <!--招标方式-->
      <el-form-item
        label="招标方式"
      >
        <el-select v-model="searchForm.tenderMethod" placeholder="请选择">
          <el-option
            v-for="(item,index) in bidTypeList"
            :key="index"
            :label="item.typename"
            :value="item.typecode"
          />
        </el-select>
      </el-form-item>
      <el-form-item
        label="项目分类"
      >
        <el-select v-model="searchForm.industryName" placeholder="请选择">
          <el-option
            v-for="item in financecloudGuaranteeTenderTypeList"
            :key="item.typecode"
            :label="item.typename"
            :value="item.typecode"
          />
        </el-select>
      </el-form-item>
      <el-form-item
        label="系统内/外"
        prop="auditStatus"
      >
        <el-select v-model="searchForm.systemSource" placeholder="请选择">
          <el-option
            v-for="item in systemSourceList"
            :key="item.typecode"
            :label="item.typename"
            :value="item.typecode"
          />
        </el-select>
      </el-form-item>
      <el-form-item
        label="创建时间"
      >
        <!--创建时间-->
        <el-date-picker
          v-model="createTime"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          @change="createTimeChange"
        />
      </el-form-item>
    </template>
    <template v-slot:GXTable>
      <el-table
        ref="smallTable"
        v-loading="loading"
        :data="tableData"
      >
        <el-table-column
          type="index"
          label="序号"
          width="60px"
          align="center"
        />
        <el-table-column
          prop="tenderNo"
          align="center"
          label="项目编号"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="tenderName"
          label="项目名称"
          min-width="230"
        />
        <el-table-column
          header-align="center"
          prop="tenderName"
          label="招标人"
          min-width="230"
        />
        <el-table-column
          label="创建时间"
          prop="packName"
          align="center"
          min-width="160"
        />
        <el-table-column
          header-align="center"
          prop="managerName"
          label="项目经理"
          min-width="90"
        />
        <el-table-column
          align="center"
          prop="managerName"
          label="项目分类"
          width="90"
        >
          <template slot-scope="scope">
            {{ filterDictText(financecloudGuaranteeTenderTypeList, scope.row.packStatus) }}
          </template>
        </el-table-column>
        <el-table-column
          prop="tenderMethod"
          label="招标方式"
          width="80"
          align="center"
        >
          <template slot-scope="scope">
            {{ filterDictText(bidTypeList, scope.row.tenderMethod) }}
          </template>
        </el-table-column>
        <el-table-column
          label="文档状态"
          prop="packStatus"
          align="center"
        >
          <template slot-scope="scope">
            {{ filterDictText(fileTOCStautsList, scope.row.packStatus) }}
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          label="操作"
          width="60"
        >
          <template slot-scope="scope">
            <el-link
              type="primary"
              @click.stop="archivedULCDetail(scope.row)"
            >
              [查看]
            </el-link>
          </template>
        </el-table-column>
      </el-table>
    </template>
  </table-crud>
</template>
<script>
/* 接口*/
// import { listTenderProjectPages } from '@/api/bidding/biddingProject'// 项目列表 项目删除
/* 公用方法*/
import { filterDictText } from '@/assets/js/utils'// 常用方法
/* 混入-字典信息 */
import { bidArchiveddGroup } from './../mixins/bidArchivedGroupMixin'// 字典信息

export default {
  name: 'BidArchivedULCList',
  data() {
    return {
      loading: true,
      /* 字典信息-start */
      ...bidArchiveddGroup,
      bidTypeList: [], // 招标方式
      systemSourceList: [], // 系统内/外
      financecloudGuaranteeTenderTypeList: [], // 项目分类
      /* 字典信息-end */
      // 搜索
      createTime: [], // 创建时间 不传给后端只做回显
      searchForm: {
        createBeginTime: '', // 创建开始时间
        createEndTime: '', // 创建结束时间
        tenderMethod: '', // 招标方式 : 公开招标 00 邀请招标
        systemSource: '', // 系统内/外
        industryName: '', // 项目分类
        departName: '', // 招标人名称
        tenderName: '', // 项目名称
        tenderNo: '' // 项目编号
      },
      tableData: []
    }
  },
  created() {
    // 字典信息
    this.initGroup()
  },
  methods: {
    filterDictText, // 字典值替换文本通用方法
    // 获取字典方法
    initGroup() {
      const data = [
        'bidType', // 招标方式
        'financecloudGuaranteeTenderType', // 项目分类
        'systemSource'// 系统内/外
      ]
      this.$store.dispatch('getGroupType', data).then(res => {
        Object.keys(res.bidTypeData).forEach((key) => {
          this[key] = res.bidTypeData[key]
        })
      })
    },
    // 创建时间选择
    createTimeChange(val) {
      this.searchForm.createBeginTime = val[0]// 开始日期
      this.searchForm.createEndTime = val[1]// 结束日期
    },
    // 获取数据
    loadData(params, callback) {
      // listTenderProjectPages(params).then(response => {
      //   this.loading = false
      //   this.tableData = response.data.records
      //   callback(response.data.total)
      // }).catch(() => {
      //   this.loading = false
      // })
    },
    // 查看
    archivedULCDetail(row) {
      this.$router.push({
        name: 'bidArchivedULC-detail',
        params: {
          id: row.id// 归档id
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>

</style>
