<template>
  <div style="page-break-after:always;padding: 0px 20px;box-sizing: border-box;" class="print-html-wrap" id="printDiv">
    <div class="print-title">{{dialogTitle}}</div>
    <table border="1px" class="table-write">
      <tr>
        <td class="keep">报价编号</td>
        <td class="tx-lf" colspan="5">{{infoForm.number}}</td>
      </tr>
      <tr>
        <td class="keep">产品名称</td>
        <td class="tx-lf" colspan="3">{{infoForm.productName}}</td>
        <td class="keep">招标方式</td>
        <td class="tx-lf">{{handleFilterStr(infoForm.type)}}</td>
      </tr>
      <tr>
        <td class="keep">申请人</td>
        <td class="tx-lf">{{infoForm.applicantName}}</td>
        <td class="keep" colspan="2">报价截止时间</td>
        <td class="tx-lf max200" colspan="2">{{ infoForm.cutoffTime && dayjs(infoForm.cutoffTime).format('YYYY-MM-DD')}}
        </td>
      </tr>
      <tr>
        <td class="keep">供应商信息列表</td>
        <td colspan="5">
          <table class="bottom-table-write">
            <tr>
              <td>序号</td>
              <td>供应商名称</td>
              <td>报价</td>
              <td>报价时间</td>
              <td>是否中标</td>
            </tr>
            <tr v-for="(item,index) in infoForm.supplierList" :key="index">
              <td>{{index + 1}}</td>
              <td>{{item.companyName}}</td>
              <td>{{ item.moldCost }}</td>
              <td>{{ parseTime(item.createTime) }}</td>
              <td>{{item.isWin == 1  ? '中标' : item.isWin == 2 ? '未中标' : item.isWin == 3 ? '已流标' :'' }}</td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td class="keep">备注信息</td>
        <td class="tx-lf" colspan="5">{{infoForm.remark}}</td>
      </tr>

    </table>
  </div>
</template>
<script>
import dayjs from "dayjs";
import { findAreaIdName } from '@/utils';
import { getDictDataLabel } from '@/utils/dict';
export default {
  props: {
    userList: Array,
    quotationList: Array,
    infoForm: {
      type: Object
    },
    dialogTitle: {
      type: String
    },
    tasks: Object
  },
  computed: {
    cn() {
      return window.localStorage.getItem('cn')
    }
  },
  methods: {
    dayjs,
    getDictDataLabel,
    handleFilterStr(val) {
      const { label } = this.quotationList.find((item) => item.value == val) || {}
      return label
    },
    handleTripPartners(list) {
      let nameArr = this.userList.map((item) => {
        // item.id
        if (Array.isArray(list)) {
          if (list.includes(item.id)) {
            return item.username
          } else {
            return ''
          }
        }
      })
      return nameArr.filter((item => item !== '')).join('、')
    },
    handleFindTitle(val) {
      return (findAreaIdName(this.$store.getters.areaTree, val) || {}).name
      // return (findAreaIdName(this.$store.getters.areaTree, val) || {}).name
    },
  },
  data() {
    return {
      // defaultImg: require('@/assets/Images/defaultHeader.png')
    }
  },
  filters: {

  }
}
</script>
<style lang="scss" scoped>
@import '@/assets/styles/index.scss';
</style>
<style media="print" scoped>
/*去除页眉页脚*/
@page {
  size: auto; /* auto is the initial value */
  margin: 3mm; /* this affects the margin in the printer settings */
}
html {
  background-color: #ffffff;
  margin: 0; /* this affects the margin on the html before sending to printer */
}
body {
  border: solid 1px blue;
  margin: 10mm 15mm 10mm 15mm; /* margin you want for the content */
}
/*去除页眉页脚*/
</style>
