<!--
  @description: 业绩信息列表
  @Modifier: ht
  @date: 2020-7-17-10:57
-->
<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>
            </div>
            <div class="clearfix SearchContent">
                <div class="SearchContent_leftInput fl">
                    <el-form
                            ref="searchForm"
                            :model="searchForm"
                            inline
                            label-position="right"
                    >
                        <el-form-item ref="supplierName" label="企业名称" prop="supplierName">
                            <el-input v-model.trim="searchForm.supplierName" placeholder="企业名称" width="228px" />
                        </el-form-item>
                        <el-form-item ref="purchasingUnit" label="采购单位" prop="purchasingUnit">
                            <el-input v-model.trim="searchForm.purchasingUnit" placeholder="采购单位" width="228px" />
                        </el-form-item>
                        <el-form-item ref="projectName" label="项目名称" prop="projectName">
                            <el-input v-model.trim="searchForm.projectName" placeholder="项目名称" width="228px" />
                        </el-form-item>
                        <el-form-item ref="chapterType" label="业绩类型" prop="articleType">
                            <el-select v-model="searchForm.chapterType" placeholder="请选择" style="width: 200px">
                                <el-option
                                        v-for="item in chapterTypeList"
                                        :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="purchasingUnit"
                            align="center"
                            label="采购单位"
                            width="140"
                    />
                    <el-table-column
                            header-align="center"
                            prop="supplierName"
                            label="企业名称"
                            min-width="230"
                    />
                    <el-table-column
                            header-align="center"
                            label="项目名称"
                            prop="projectName"
                            align="left"
                            min-width="200"
                    />
                    <el-table-column
                            header-align="center"
                            label="买方业务代表"
                            prop="purchaser"
                            align="center"
                            width="100"
                    >
                    </el-table-column>
                    <el-table-column
                            header-align="center"
                            label="操作"
                            width="120"
                    >
                        <template slot-scope="scope">
                            <el-link
                                    type="primary"
                                    @click="examineBulletin(scope.row)"
                            >
                                [查看]
                            </el-link>
                        </template>
                    </el-table-column>
                </el-table>
                <!--分页组件-->
                <pagination :pagination-data="paginationData" @change="loadData" />
            </div>
        </section>
        <div class="but_footer">
            <div class="but_footer-h" />
            <div class="but_footer-but">
                <el-button @click="back()">
                    返 回
                </el-button>
            </div>
        </div>
    </div>
</template>

<script>
/* 接口*/
import { achievementAllList } from '@/api/bidding/bidderRepresentative'// 公告列表
/* 公用方法*/
import { filterObj } from '@/assets/js/utils'// 常用方法
/* 混合开发方法-参数字段*/
import { ListMixin } from '@/mixins/ListMixin'// 分页
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
import achievemenyInfo from './achievement-info'
export default {
  name: 'AchievementList',
  components: {
    pagination, // 分页
    achievemenyInfo
  },
  mixins: [ListMixin],
  data() {
    return {
      loading: false,
      // 搜索
      searchForm: {
        supplierName: '', // 企业名称
        purchasingUnit: '', // 采购单位
        projectName: '', // 项目名称
        chapterType: '', // 业绩类型
        chapterName: '', // 业绩类型名称
        companName: this.$route.query.companName,
        companId: this.$route.query.companId
      },

      tableData: [],
      chapterTypeList: [{
        typecode: 'EQ_InformationService',
        typename: '信息化服务业绩' },
      {
        typecode: 'EQ_Procurement',
        typename: '采购业绩' },
      {
        typecode: 'EQ_Construction',
        typename: '施工业绩' },
      {
        typecode: 'EQ_EngineeringConsult',
        typename: '工程咨询业绩' },
      {
        typecode: 'EQ_Debugging',
        typename: '调试业绩' },
      {
        typecode: 'EQ_SurveyDesign',
        typename: '勘察设计' },
      {
        typecode: 'EQ_Supervision',
        typename: '监理业绩' }
      ]
    }
  },
  created() {
    // 获取列表信息
    this.loadData()
  },
  methods: {
    // 获取数据
    loadData() {
      this.loading = true
      const params = this.getQueryParams()// 查询条件
      achievementAllList(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
        this.$forceUpdate()
      }).catch(() => {
        this.loading = false
      })
    },
    // 查询条件
    getQueryParams() {
      const param = Object.assign({}, this.searchForm)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      return filterObj(param)
    },
    // 查看公告
    examineBulletin(row) {
      this.$router.push({
        path: '/bidderRepresentative/achievementInfo',
        query: {
          id: row.id
        }
      })
    },
    // 搜索
    onSearch() {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      this.loadData()
    },
    // 重置
    resetForm(formName) {
      this.$refs[formName].resetFields()
      this.onSearch()
    },
    back() {
      this.$router.push({
        path: '/bidderRepresentative/bidderList'
      })
    }
  }
}
</script>

<style lang="less"  scoped>
</style>
