ShipPrintModal.vue 3.7 KB
<template>
  <a-modal
    :visible="visible"
    :confirm-loading="confirmLoading"
    @cancel="handleCancel"
    width="50%"
  >
    <div>
      <a-row>
        <div class="noprint container" style="text-align:right; padding: 20px;float: right">
          <a-button v-print="'#content2'" ghost type="primary" >打印</a-button>
        </div>

      </a-row>
      <div id="content2" ref="orderForm1">
        <a-row type="flex">
          <a-col :span="21">
            <h2 class="center">装车清单</h2>
            <span>项目名称:{{titleSource.projectName}}  </span>
            <span>收件人:{{titleSource.recipient}}  </span>
            <span>地址:{{titleSource.address}}   </span>
            <span>电话:{{titleSource.phone}}</span>
          </a-col>
<!--          <a-col :span="3">-->
<!--            <vue-qr :text="qrText()" :size="80" :margin="0"></vue-qr>-->
<!--          </a-col>-->
        </a-row>
        <a-row>
          <a-table
            ref="table"
            bordered
            size="middle"
            rowKey="id"
            :pagination="false"
            :dataSource="dataSource"
            :loading="loading"
            :columns="columns">
            <span slot="barcode" slot-scope="text, record">
<!--              <barcode  :value="record.materialCode+';'+record.qty" :height="30" :displayValue="false" width="1"></barcode>-->
               <vue-qr  :text="record.code" :size="70" :margin="0"></vue-qr>
            </span>
          </a-table>
        </a-row>
      </div>

    </div>
    <template slot="footer">
      <a-button @click="handleCancel" v-show="false"></a-button>
    </template>
  </a-modal>
</template>

<script>
import { queryDetailList,queryById} from '../../../api/api'
import VueQr from 'vue-qr'
import QRCode from "qrcodejs2";
// import html2canvas from 'html2canvas';
// import JsPdf from 'jspdf';

export default {
  name: 'ShipPrintModal',
  components: {
    VueQr,
    'barcode': QRCode
  },
  data() {
    return {
      confirmLoading: false,
      visible: false,
      loading: false,
      dataSource: [],
      titleSource:[],
      ids: [],
      columns: [
        {
          title: '工作令',
          dataIndex: 'workno',
          key: 'workno'
        },
        {
          title: '料号',
          dataIndex: 'no',
          key: 'no'
        },
        {
          title: '名称',
          dataIndex: 'name',
          key: 'name'
        },
        {
          title: '图号',
          dataIndex: 'drawno',
          key: 'drawno'
        },{
          title: '数量',
          dataIndex: 'num',
          key: 'num'
        }, {
          title: '重量',
          dataIndex: 'weight',
          key: 'weight'
        }, {
          title: '责任人',
          dataIndex: 'principal',
          key: 'principal'
        },   {
          title: '条码',
          dataIndex: 'code',
          scopedSlots: { customRender: 'barcode' },
          align: 'center',
        }
      ]
    }
  },
  methods: {
    handleCancel(e) {
      this.visible = false
    },
    open(id) {
      this.loading = true
      this.visible = true
      let params = {
        'headid': id
      }
      queryDetailList(params).then(res => {
        if (res.success) {
          this.dataSource = res.result
          this.loading = false
        }
      })
      let params2 = {
        'id': id
      }
      queryById(params2).then(res => {
        if (res.success) {

          this.titleSource = res.result
          this.loading = false
        }
      })
    },
    print() {
      window.print()
    },
    doPrint() { //方法

    },
    qrText() {
      return "http://localhost:8080/jeecg-boot/material/purchase/qrInfo?ids="+this.ids
    }
  }
}
</script>

<style scoped>
</style>