From 6ed5741fc5dfc654459a2f4247f9fd76e9ba3f12 Mon Sep 17 00:00:00 2001 From: yunuo970428 <405378304@qq.com> Date: Thu, 3 Aug 2023 15:58:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=80=80=E5=BA=93=E5=8A=9E?= =?UTF-8?q?=E7=90=86-=E5=A2=9E=E5=8A=A0=E4=B8=8B=E8=BD=BD=E9=80=80?= =?UTF-8?q?=E6=96=99=E5=8D=95=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/kucunguanli/changjiachuku.js | 8 +++ .../changjiatuikuguanli.vue | 61 ++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/anrui-scm/anrui-scm-ui/src/api/kucunguanli/changjiachuku.js b/anrui-scm/anrui-scm-ui/src/api/kucunguanli/changjiachuku.js index d521776d98..e47e3abe5d 100644 --- a/anrui-scm/anrui-scm-ui/src/api/kucunguanli/changjiachuku.js +++ b/anrui-scm/anrui-scm-ui/src/api/kucunguanli/changjiachuku.js @@ -50,5 +50,13 @@ export default { url: '/base/v1/basemanufacturerretware/fetchDetailsBySid/' + sid, method: 'get' }) + }, + // 下载 + createPdf: function(data) { + return request({ + url: '/base/v1/basemanufacturerretware/withdrawalPdf', + method: 'post', + params: data + }) } } diff --git a/anrui-scm/anrui-scm-ui/src/views/kucunguanli/changjiatuiku/changjiatuikuguanli/changjiatuikuguanli.vue b/anrui-scm/anrui-scm-ui/src/views/kucunguanli/changjiatuiku/changjiatuikuguanli/changjiatuikuguanli.vue index 49ed41638c..15f5e6e728 100644 --- a/anrui-scm/anrui-scm-ui/src/views/kucunguanli/changjiatuiku/changjiatuikuguanli/changjiatuikuguanli.vue +++ b/anrui-scm/anrui-scm-ui/src/views/kucunguanli/changjiatuiku/changjiatuikuguanli/changjiatuikuguanli.vue @@ -34,9 +34,10 @@ - + @@ -80,6 +81,27 @@ + + + + + 打印机类型 + + + + + 针孔式打印机 + 激光打印机 + + + + + + + 确定 + 取消 + + @@ -91,6 +113,7 @@ import req from '@/api/kucunguanli/changjiachuku' import changjiatuikuAdd from './changjiatuikuAdd' import changjiatuikuInfo from './changjiatuikuInfo' import { getOrgSidByPath } from '@/api/cheliang/dictcommons' +import {getStorage} from "@/utils/auth"; export default { name: 'changjiatuikuguanli', @@ -103,6 +126,9 @@ export default { }, data() { return { + dialogVisible: false, + printSid: '', + print: '', btndisabled: false, btnList: [ { @@ -237,6 +263,39 @@ export default { this.viewState = 3 this.$refs['divInfo'].showInfo(row) }, + handlePrint(row) { + this.printSid = row.sid + this.print = '' + this.dialogVisible = true + }, + handleConfirm() { + req.createPdf({ cgtkdSid: this.printSid, printerType: this.print }).then((resp) => { + if (resp.success && resp.data !== '') { + var xhr = new XMLHttpRequest() + xhr.open('GET', process.env.VUE_APP_BASE_API + '/base/file/download?filePath=' + resp.data + '&outFileName=' + '退料单', true) + xhr.setRequestHeader('token', getStorage()) + xhr.responseType = 'blob' + xhr.onload = function(e) { + // 如果请求执行成功 + var blob = this.response + var filename = '退料单.pdf' + var a = document.createElement('a') + // blob.type="application/octet-stream"; + // 创键临时url对象 + var url = URL.createObjectURL(blob) + a.href = url + a.download = filename + a.click() + // 释放之前创建的URL对象 + window.URL.revokeObjectURL(url) + } + // 发送请求 + xhr.send() + this.dialogVisible = false + this.printSid = '' + } + }) + }, resetState() { this.viewState = 1 },