-
admin
2024-05-13 288790d3b02242a073769db87a20f0912adcdf56
jcdm-ui/src/views/main/om/productionOrde/index.vue
@@ -28,6 +28,14 @@
          />
        </el-select>
      </el-form-item>
      <div style="display: none">
        <div id="printMe" style="width: 500px;">
          <div ref="canvasWrapper" id="canvasWrapper" style="display: flex;justify-content: center;"></div>
          <p style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;">{{packCode}}</p>
        </div>
        <el-button @click="print">打印</el-button>
        <el-button @click="test1">生成二维码</el-button>
      </div>
      <el-form-item style="float: right">
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button type="warning" icon="el-icon-copy-document" size="mini" @click="advancedQuery">高级查询</el-button>
@@ -283,6 +291,7 @@
  updateProductionOrde,
  receivingWorkOrders
} from "@/api/main/om/productionOrde/productionOrde";
import QRCode from "qrcodejs2";
export default {
  name: "ProductionOrde",
@@ -292,6 +301,8 @@
  },
  data() {
    return {
      // packCode: '0RSPB001139E3AE4X0000011',
      packCode: 'test111',
      titleName: '',
      options: [],
      lineOptions: [],
@@ -383,12 +394,52 @@
    this.getList();
    this.initWorkshop();
  },
  mounted() {
    this.test1()
  },
  methods: {
    getWorkOrders(){
      receivingWorkOrders().then(response => {
        this.$modal.msgSuccess(response.msg);
     async getWorkOrders(){
      await receivingWorkOrders().then(response => {
        this.getList()
        this.packCode = response.msg;
        this.test1()
      });
      setTimeout(() => {
        this.print()
      },50)
    },
     print() {
      // 本页面直接打印(有bug单岁先不要删)
      // let oldStr = window.document.body.innerHTML;
      // let newStr = document.getElementById('printMe').innerHTML;
      // document.body.innerHTML = newStr;
      // window.print();
      // document.body.innerHTML = oldStr;
      // return false;
      // 新开页面打印
      //  document.getElementById('canvasWrapper').innerHTML = '';
      let newStr = document.getElementById('printMe').innerHTML;
      let newWin = window.open('', '_blank');
      newWin.document.body.innerHTML = newStr;
      newWin.print();
      return false;
    },
    test1(){
      document.getElementById('canvasWrapper').innerHTML = ''
      this.$nextTick(() => {
        let qrCode = new QRCode('canvasWrapper',{
          width: 80,
          height: 80,
          padding: 0,
          margin: 0,
          text: this.packCode,
          colorDark: '#000',
          colorLight: '#fff'
        })
      })
      // console.log(this.packCode)
      // this.print()
    },
    /** 导入按钮操作 */
    handleImport() {