zhaowei
2025-06-18 1ff7e79fccfc7396941e3a5a7d6cc24bc952fd32
src/views/tms/modules/inbound/InboundModel.vue
@@ -102,7 +102,15 @@
    <j-select-tooling-modal ref="toolingModalForm" @ok="modalFormOk" :classifyId="classifyId"></j-select-tooling-modal>
    <j-select-return-list-modal ref="returnModalForm" @ok="modalFormOk" :classifyId="classifyId"></j-select-return-list-modal>
    <j-select-sharpen-list-modal ref="sharpenModalForm" @ok="modalFormOk" :classifyId="classifyId"></j-select-sharpen-list-modal>
    <div id="printArea" style="display: block;">
      <div v-for="(item, index) in qrList" :key="index" class="qrcode-item">
        <img :src="item.base64" alt="QR Code">
        <p>{{ item.content }}</p>
      </div>
    </div>
  </a-modal>
</template>
<script>
@@ -117,6 +125,7 @@
import { filterObj } from '@/utils/util'
import JSelectReturnListModal from '.././inboundOrder/JSelectReturnListModal'
import JSelectSharpenListModal from '.././inboundOrder/JSelectSharpenListModal'
import printJS from 'print-js';
export default {
  name: 'InboundModel',
@@ -252,7 +261,8 @@
        },
      ],
      classifyId:'',
      locationCodeOptions:[]
      locationCodeOptions:[],
      qrList: []
    }
  },
  created() {
@@ -325,7 +335,15 @@
          postAction(this.url.addInStorage, formData)
            .then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                if(formData.inStorehouseType === '1'){
                  this.qrList = res.result.map((content, i) => ({
                  content:res.result[i].content,
                  base64: res.result[i].image
                  }));
                  this.handleBacthPrint();
                }else{
                   that.$message.success("保存成功")
                }
                that.$emit('ok', new Date())
              } else {
                that.$message.warning(res.message)
@@ -412,6 +430,25 @@
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      );
    },
    // 执行打印
    handleBacthPrint() {
      this.$nextTick(() => {
        printJS({
          printable: 'printArea',
          type: 'html',
          style: `
            .qrcode-item {
              page-break-inside: avoid;
              margin: 10px;
              text-align: center;
            }
            img { width: 100px; height: 100px; }
          `,
          scanStyles: false
        });
      });
    }
  },
  watch: {},
  mounted() {