<!--
  @description: 分组变更记录
  @author:肖文龙
  @date: 2020年3月11日16:17:52
-->
<template>
  <div>
    <el-table
      ref="smallTable"
      v-loading="loading"
      :data="tableData"
    >
      <el-table-column
        type="index"
        label="序号"
        width="45px"
        align="center"
      />
      <el-table-column
        header-align="center"
        prop="tenderName"
        label="招标项目名称"
        min-width="300"
      />
      <el-table-column
        header-align="center"
        prop="packNo"
        label="标段（包）编号"
        min-width="200"
      />
      <el-table-column
        align="center"
        prop="changeTime"
        label="变更时间"
        min-width="200"
      >
        <template slot-scope="scope">
          {{ scope.row.changeTime && $Moment(scope.row.changeTime).format(momentDateTime) }}
        </template>
      </el-table-column>
      <el-table-column
        prop="changeReson"
        align="center"
        label="变更原因"
      >
        <template slot-scope="scope">
          <span
            v-for="(item,index) in changeResonList"
            v-if="scope.row.changeReson===item.typecode"
            :key="index"
          >{{ item.typename }}</span>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <pagination :pagination-data="paginationData" @change="loadData" />
  </div>
</template>

<script>
/* api*/
import { queryChangePlanListByBatchNumber } from '@/api/intensiveeval/intensiveeval'
/* 混合开发*/
import { groupMixin } from '@/views/intensiveeval/mixins/intensiveevalGroupMixin'// 字典信息
import { ListMixin } from '@/mixins/ListMixin'// 分页
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
export default {
  name: 'BidEvaluationPlanDetail',
  components: {
    pagination
  },
  mixins: [groupMixin, ListMixin],
  data() {
    return {
      flowStatus: this.$route.query.flowStatus, // true 工作流进入
      loading: false, // 刷新loading
      searchForm: {
        groupId: '', // 分组Id
        batchNumber: this.$route.query.batchNumber, // 批次号
        pageNo: 1,
        pageSize: 10
      },
      // 分组变更记录列表
      tableData: []
    }
  },
  created() {
    this.loadData()
  },
  methods: {
    // 获取数据
    loadData() {
      this.loading = true
      const params = this.getQueryParams()// 查询条件
      queryChangePlanListByBatchNumber(params).then(response => {
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
        this.loading = false
      }).catch(() => {

      })
    },
    // 查询条件
    getQueryParams() {
      // 工作流进入bizId  否则取groupId
      this.searchForm.groupId = this.flowStatus ? this.$route.query.bizId : this.$route.query.groupId // 分组Id
      const param = Object.assign({}, this.searchForm)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      return param
    }
  }
}
</script>

<style lang="less" scoped>

</style>
