<!--
  @description: 供应商报价记录弹框
  @Modifier：gmy
  @routerPath:
  @date:2020-7-2- 11:39:19
-->
<template>
  <el-dialog
    v-dialogDrag
    :visible.sync="dialogData.dialog"
    :close-on-click-modal="false"
    :lock-scroll="false"
    append-to-body
    title="报价记录"
    width="840px"
    custom-class="el-dialog__body-p8 el-dialog_table"
  >
    <!--报价记录-->
    <div>
      <el-table
        ref="smallTable"
        v-loading="loading"
        :data="tableData"
        class="tableLimit pointer"
      >
        <el-table-column type="index" label="序号" align="center" width="60" />
        <el-table-column
          prop="purchasePlanName"
          label="操作类型"
          header-align="center"
          align="left"
          min-width="110"
        >
          <template slot-scope="scope">
            <p>{{ scope.row.useStatus==='01'? '报价': '撤销报价' }}</p>
          </template>
        </el-table-column>
        <el-table-column
          prop="purchaseNo"
          label="操作时间"
          min-width="150"
          header-align="center"
          align="center"
        >
          <template slot-scope="scope">
            <p>{{ $Moment(scope.row.createTime).format(momentSaveFormat) }}</p>
          </template>
        </el-table-column>
        <el-table-column
          prop="offerIp"
          label="Ip地址"
          width="125"
          header-align="center"
          align="left"
        />
        <el-table-column
          prop="offerBrowser"
          label="报价浏览器"
          width="110"
          header-align="center"
          align="left"
        />
      </el-table>
      <!--分页组件-->
      <pagination :pagination-data="paginationData" @change="loadData" />
    </div>
  </el-dialog>
</template>

<script>
/* api接口*/
import { getOfferRecordBySupplierId } from '@/api/procurement/procurementOffer'
/* 公共参数方法*/
import { ListMixin } from '@/mixins/ListMixin'
import { filterObj } from '@/assets/js/utils'
import { commonMxin } from '@/mixins/commonMxin'
/* 分页组件*/
import pagination from '@comp/common/pagination/pagination'
/* api接口*/
export default {
  name: 'MyPurchasePlanListDialog',
  components: {
    pagination
  },
  mixins: [ListMixin, commonMxin],
  props: {
    dialogData: {
      type: Object,
      default: function() {
        return
      }
    }
  },
  data() {
    return {
      purchaserType: '00', // 00采购员  01采购执行人
      loading: true,
      date: '',
      searchForm: {
        stageId: '', // 轮次id
        supplierId: '' // 供应商id
      },
      tableData: [],
      implementPurchaseList: '' // 自行采购选中集合
    }
  },
  watch: {
    'dialogData.dialog'(val) {
      // 打开弹框加载数据
      if (val) {
        // 根据项目信息选择的采购方式来动态改变数据
        this.searchForm.stageId = this.dialogData.stageId
        this.searchForm.supplierId = this.dialogData.supplierId
        this.loadData()
      }
    }
  },
  created() {},
  methods: {
    // 查询条件
    getQueryParams() {
      const param = Object.assign({}, this.searchForm)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      return filterObj(param)
    },
    // 加载数据
    loadData() {
      const params = this.getQueryParams() // 查询条件
      getOfferRecordBySupplierId(params)
        .then(response => {
          this.loading = false
          this.tableData = response.data.records
          this.paginationData.total = response.data.total
        })
        .catch(() => {
          this.loading = false
        })
    }
  }
}
</script>

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