diff --git a/src/api/inout/order.js b/src/api/inout/order.js index 2f501fd4..903376ab 100644 --- a/src/api/inout/order.js +++ b/src/api/inout/order.js @@ -156,6 +156,14 @@ export function filterOrderList(query) { }); } +export function getUserBean(query) { + return axios({ + url: "/udiwms/inout/order/getUserBean", + method: "get", + params: query + }); +} + export function selectNew(query) { return axios({ url: "/admin/warehouse/inout/order/selectNew", diff --git a/src/api/purchase/supCompany.js b/src/api/purchase/supCompany.js index 8c026c19..cde50455 100644 --- a/src/api/purchase/supCompany.js +++ b/src/api/purchase/supCompany.js @@ -172,6 +172,14 @@ export function previewImage(data) { }); } +export function previewFile(url) { + return axios({ + url: url, + method: "get", + responseType: 'arraybuffer' + }); +} + diff --git a/src/views/inout/InvoiceCkeck.vue b/src/views/inout/InvoiceCkeck.vue index 0604724e..447d3d75 100644 --- a/src/views/inout/InvoiceCkeck.vue +++ b/src/views/inout/InvoiceCkeck.vue @@ -273,7 +273,7 @@ import AcceptOrder from "@/views/inout/DialogReviewOrder"; import DialogInvoice from "@/views/inout/DialogInvoice"; import InvoiceRegister from "@/views/inout/InvoiceRegister"; -import {previewImage} from "@/api/purchase/supCompany"; +import {previewImage,previewFile} from "@/api/purchase/supCompany"; import ElImageViewer from "element-ui/packages/image/src/image-viewer"; import store from "@/store"; @@ -613,8 +613,29 @@ export default { ); }, uploadHandlePreview(file) { - console.log(file); - console.log(this.fileList); + // console.log(file.raw.type); + // console.log(this.fileList); + // let pdf = "application/pdf" + // let type = file.raw.type + // if(type==pdf){ + // + // this.certFileUrl = + // this.BASE_URL + + // "/udiwms/image/register/file/getImage?type=image2&name="; + // this.imgList = []; + // previewImage({ + // imageUrl: this.inputQuery.licenseUrl, + // certFileUrl: this.certFileUrl, + // }).then((response) => { + // if (response.code === 20000) { + // this.imgList = response.data; + // window.open(this.imgList[0]) + // } + // console.log(this.imgList); + // }); + // }else{ + // + // } }, uploadHandleRemove(file, fileList) { this.inputQuery.licenseUrl = null; @@ -698,18 +719,34 @@ export default { showImgViewer(row) { this.certFileUrl = this.BASE_URL + - "/udiwms/image/register/file/getImage?type=image2&name="; + "/udiwms/image/register/file/getImage?type=image2&name="+this.inputQuery.licenseUrl; this.imgList = []; - previewImage({ - imageUrl: this.inputQuery.licenseUrl, - certFileUrl: this.certFileUrl, - }).then((response) => { - if (response.code === 20000) { - this.imgList = response.data; - } - console.log(this.imgList); - this.imgViewerVisible = true; - }); + this.imgList.push(this.certFileUrl) + let index = this.inputQuery.licenseUrl.lastIndexOf('.'); + if(index===-1){ + this.$message.error("文件名异常!") + return false + } + if(this.inputQuery.licenseUrl.substr(index+1)==='pdf'){ + let pdf = "application/pdf" + let binaryData = []; + previewFile(this.certFileUrl).then(res=>{ + binaryData.push(res); + let URL = window.URL.createObjectURL(new Blob(binaryData, {type: pdf})); + window.open(URL); + }) + // window.open(this.imgList[0]) + return false + } + this.imgViewerVisible = true; + // previewImage({ + // imageUrl: this.inputQuery.licenseUrl, + // certFileUrl: this.certFileUrl, + // }).then((response) => { + // if (response.code === 20000) { + // } + // console.log(this.imgList); + // }); const m = (e) => { e.preventDefault(); }; diff --git a/src/views/inout/InvoiceRegistration.vue b/src/views/inout/InvoiceRegistration.vue index 296b7308..96272545 100644 --- a/src/views/inout/InvoiceRegistration.vue +++ b/src/views/inout/InvoiceRegistration.vue @@ -529,7 +529,7 @@