<!--
  @description:参与项目记录
  @Modifier: haofengxian
  @routerPath:
  @date: 2020-7-8-15:26
-->
<template>
  <div>
    <div>
      <el-table
        ref="smallTable"
        :data="tableData"
        width="100%"
      >
        <el-table-column
          type="index"
          label="序号"
          width="60px"
          align="center"
        />
        <el-table-column
          header-align="center"
          prop="tenderNo"
          align="center"
          label="项目编号"
          width="160"
        />
        <el-table-column
          header-align="center"
          prop="tenderName"
          label="项目名称"
          min-width="260"
        />
        <el-table-column
          header-align="center"
          prop="supplierName"
          label="采购人"
          min-width="200"
        />
        <el-table-column
          prop="isWinBiding"
          label="是否中标"
          align="center"
          width="100"
        >
          <template slot-scope="scope">
            <span v-if="scope.row.isBidWinning === '00'">未中标</span>
            <span v-else-if="scope.row.isBidWinning === '01'">中标</span>
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination :pagination-data="paginationData" />
    </div>
  </div>
</template>

<script>
/* api*/
import { listProjectRecords } from '@/api/supplier/declaraTionrecord'
/* 公用方法*/
import { filterObj, filterDictText } from '@/assets/js/utils'// 常用方法
/* 混合开发方法-参数字段*/
import { ListMixin } from '@/mixins/ListMixin'// 分页
import { supplierGroupMixin } from '../mixins/supplierGroupMixin'
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
export default {
  name: 'ProjectRecordList',
  components: {
    pagination
  },
  mixins: [ListMixin, supplierGroupMixin],
  props: {
    // 查看状态
    judgePageData: {
      type: Object,
      default: function() {
        return {
          departId: ''// 机构主键id
        }
      }
    }
  },
  data() {
    return {
      tableData: [], // 列表信息
      projectRecordListDto: {
        departId: ''// 机构Id
      },
      loading: true
    }
  },
  created() {
    this.projectRecordListDto.departId = this.$route.query.departId || this.judgePageData.departId// 供应商id
    // 获取列表信息
    this.loadData()
  },
  methods: {
    filterDictText,
    // 获取数据
    loadData() {
      const params = this.getQueryParams()// 查询条件
      listProjectRecords(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.projectRecordListDto)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      return filterObj(param)
    }
  }
}
</script>

<style scoped>

</style>
