diff --git a/src/views/inout/DialogCheck.vue b/src/views/inout/DialogCheck.vue index 0b12a7d..4912f56 100644 --- a/src/views/inout/DialogCheck.vue +++ b/src/views/inout/DialogCheck.vue @@ -138,9 +138,10 @@ :action="this.uploadUrl" :on-preview="uploadHandlePreview" :on-remove="uploadHandleRemove" + :limit="1" :headers="headers" :on-exceed="uploadHandleExceed" - accept=".jpg,.png" + accept=".jpg,.png,.pdf" :on-change="uploadOnchange" :on-success="uploadHandleSuccess" :on-error="uploadHandleError" @@ -151,7 +152,7 @@ {{ choiceFile }} -
只能上传 jpg,png 文件,且不超过 10 MB
+
只能上传 jpg,png,pdf 文件,且不超过 10 MB
@@ -189,9 +190,10 @@ :action="this.uploadUrl" :on-preview="uploadHandlePreview" :on-remove="uploadHandleRemove1" + :limit="1" :headers="headers" :on-exceed="uploadHandleExceed" - accept=".jpg,.png" + accept=".jpg,.png,.pdf" :on-change="uploadOnchange1" :on-success="uploadHandleSuccess1" :on-error="uploadHandleError" @@ -202,7 +204,7 @@ {{ choiceFile1 }} -
只能上传 jpg,png 文件,且不超过 10 MB
+
只能上传 jpg,png,pdf 文件,且不超过 10 MB
@@ -217,8 +219,7 @@ style="text-align:right" @click="showImgViewerCold"> 冷链报告预览 - + @@ -226,6 +227,7 @@ + @@ -236,7 +238,7 @@ import draggable from "vuedraggable"; import store from "@/store"; import {updateBizById, updateById} from '@/api/inout/orderDetailBiz' -import {previewImage} from '@/api/purchase/supCompany' +import {previewImage,previewFile} from '@/api/purchase/supCompany' import ElImageViewer from "element-ui/packages/image/src/image-viewer"; @@ -261,9 +263,9 @@ export default { data() { return { imgList: [], - imgListCold: [], + imgListCold:[], imgViewerVisible: false, - imgViewerVisibleCold: false, + imgViewerVisibleCold:false, BASE_URL: process.env.VUE_APP_BASE_API, code: "", formData: { @@ -290,8 +292,7 @@ export default { headers: {}, choiceFile: "选取文件", choiceFile1: "选取文件", - isChangeCheck: false, - isChangeCold: false, + }; }, components: { @@ -372,7 +373,7 @@ export default { this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); }, uploadOnchange(file, fileList) { - // this.inputQuery.checkFileName = file.name; + this.inputQuery.checkFileName = file.name; let fileName = file.name; let uid = file.uid let pos = fileName.lastIndexOf("."); @@ -399,7 +400,7 @@ export default { return isLt; }, uploadOnchange1(file, fileList) { - // this.inputQuery.checkColdFileName = file.name; + this.inputQuery.checkColdFileName = file.name; let fileName = file.name; let uid = file.uid let pos = fileName.lastIndexOf("."); @@ -426,37 +427,20 @@ export default { return isLt; }, uploadHandleSuccess(response, file, fileList) { - if (response.code === 20000) { - if (this.inputQuery.filePath == null || this.isChangeCheck == true) { - this.inputQuery.filePath = response.data.name + ","; - this.inputQuery.checkFileName = file.name + ","; - this.isChangeCheck = false; - } else { - this.inputQuery.filePath += response.data.name + ","; - this.inputQuery.checkFileName += file.name + ","; - } + this.inputQuery.filePath = response.data.name; + // this.onSubmit(); } else { this.$message.error("文件上传失败:" + response.message); } - - }, uploadHandleSuccess1(response, file, fileList) { if (response.code === 20000) { - if (this.inputQuery.coldFilePath == null || this.isChangeCold == true) { - this.inputQuery.coldFilePath = response.data.name + ","; - this.inputQuery.checkColdFileName = file.name + ","; - this.isChangeCold = false; - } else { - this.inputQuery.coldFilePath += response.data.name + ","; - this.inputQuery.checkColdFileName += file.name + ","; - } + this.inputQuery.coldFilePath = response.data.name; + // this.onSubmit(); } else { this.$message.error("文件上传失败:" + response.message); } - - }, uploadHandleError() { @@ -471,36 +455,78 @@ export default { return isJPG || isPNG; }, showImgViewer(row) { - this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name="; + this.certFileUrl = + this.BASE_URL + + "/udiwms/image/register/file/getImage?type=image2&name="+this.inputQuery.filePath; this.imgList = []; - previewImage({imageUrl: this.inputQuery.filePath, 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.filePath.lastIndexOf('.'); + if(index===-1){ + this.$message.error("文件名异常!") + return false + } + if(this.inputQuery.filePath.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() + e.preventDefault(); }; - document.body.style.overflow = 'hidden'; + document.body.style.overflow = "hidden"; document.addEventListener("touchmove", m, false); // 禁止页面滑动 }, - showImgViewerCold(row) { - this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name="; + showImgViewerCold(row){ + this.certFileUrl = + this.BASE_URL + + "/udiwms/image/register/file/getImage?type=image2&name="+this.inputQuery.coldFilePath; this.imgList = []; - previewImage({imageUrl: this.inputQuery.coldFilePath, 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.coldFilePath.lastIndexOf('.'); + if(index===-1){ + this.$message.error("文件名异常!") + return false + } + if(this.inputQuery.coldFilePath.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() + e.preventDefault(); }; - document.body.style.overflow = 'hidden'; + document.body.style.overflow = "hidden"; document.addEventListener("touchmove", m, false); // 禁止页面滑动 }, @@ -514,11 +540,9 @@ export default { document.removeEventListener("touchmove", m, true); }, - closeImgViewerCold() { + closeImgViewerCold(){ this.imgViewerVisibleCold = false; - const m = (e) => { - e.preventDefault() - }; + const m = (e) => { e.preventDefault() }; document.body.style.overflow = 'auto'; document.removeEventListener("touchmove", m, true); }, @@ -547,13 +571,11 @@ export default { } if (this.inputQuery.filePath != null) { this.choiceFile = "更换检验报告"; - this.isChangeCheck = true; } else { this.choiceFile = "选取检验报告"; } if (this.inputQuery.coldFilePath != null) { - this.isChangeCold = true; this.choiceFile1 = "更换冷链报告"; } else { this.choiceFile1 = "选取冷链报告"; diff --git a/src/views/inout/IoDeliveryAuditOrder.vue b/src/views/inout/IoDeliveryAuditOrder.vue index ca4bddc..9fd0105 100644 --- a/src/views/inout/IoDeliveryAuditOrder.vue +++ b/src/views/inout/IoDeliveryAuditOrder.vue @@ -592,7 +592,7 @@ import { orderPDFFromTemplateFile } from '@/api/itextpdf/orderPrint' import {getBasicUnitMaintains} from "@/api/basic/basicUnitMaintain"; -import { previewImage } from '@/api/purchase/supCompany' +import { previewImage ,previewFile} from '@/api/purchase/supCompany' import ElImageViewer from "element-ui/packages/image/src/image-viewer"; @@ -794,33 +794,78 @@ export default { this.showSearch = !this.showSearch; }, showImgViewer(row){ - this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name="; - this.imgList=[]; - previewImage({imageUrl:row.filePath,certFileUrl:this.certFileUrl}).then(response => { - if (response.code === 20000) { - this.imgList=response.data; - } - console.log(this.imgList) - this.imgViewerVisible = true; - }); - const m = (e) => { e.preventDefault() }; - document.body.style.overflow = 'hidden'; + this.certFileUrl = + this.BASE_URL + + "/udiwms/image/register/file/getImage?type=image2&name="+row.filePath; + this.imgList = []; + this.imgList.push(this.certFileUrl) + let index = row.filePath.lastIndexOf('.'); + if(index===-1){ + this.$message.error("文件名异常!") + return false + } + if(row.filePath.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(); + }; + document.body.style.overflow = "hidden"; document.addEventListener("touchmove", m, false); // 禁止页面滑动 }, showImgViewerCold(row){ - this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name="; - console.log(this.certFileUrl+"========"); - this.imgListCold=[]; - previewImage({imageUrl:row.coldFilePath,certFileUrl:this.certFileUrl}).then(response => { - if (response.code === 20000) { - this.imgListCold=response.data; - } - console.log(this.imgListCold) - this.imgViewerVisibleCold = true; - }); - const m = (e) => { e.preventDefault() }; - document.body.style.overflow = 'hidden'; + this.certFileUrl = + this.BASE_URL + + "/udiwms/image/register/file/getImage?type=image2&name="+row.coldFilePath; + this.imgList = []; + this.imgList.push(this.certFileUrl) + let index = row.coldFilePath.lastIndexOf('.'); + if(index===-1){ + this.$message.error("文件名异常!") + return false + } + if(row.coldFilePath.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(); + }; + document.body.style.overflow = "hidden"; document.addEventListener("touchmove", m, false); // 禁止页面滑动 }, diff --git a/src/views/inout/IoDeliverySearchOrder.vue b/src/views/inout/IoDeliverySearchOrder.vue index 78cd29c..12d687d 100644 --- a/src/views/inout/IoDeliverySearchOrder.vue +++ b/src/views/inout/IoDeliverySearchOrder.vue @@ -614,7 +614,7 @@ import {getCodeList} from "@/api/inout/code"; import AcceptOrder from "@/views/inout/DialogReviewOrder"; import {inspectionOrderPDFFromTemplateFile, orderPDFFromTemplateFile} from "@/api/itextpdf/orderPrint" import {getBasicUnitMaintains} from "@/api/basic/basicUnitMaintain"; -import { previewImage } from '@/api/purchase/supCompany' +import { previewImage,previewFile } from '@/api/purchase/supCompany' import DialogCheck from "@/views/inout/DialogCheck"; import ElImageViewer from "element-ui/packages/image/src/image-viewer"; @@ -820,35 +820,79 @@ export default { this.getList(); }, showImgViewer(row){ - this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name="; - console.log(this.certFileUrl+"========"); - this.imgList=[]; - previewImage({imageUrl:row.filePath,certFileUrl:this.certFileUrl}).then(response => { - if (response.code === 20000) { - this.imgList=response.data; - } - console.log(this.imgList) - this.imgViewerVisible = true; - }); - const m = (e) => { e.preventDefault() }; - document.body.style.overflow = 'hidden'; + this.certFileUrl = + this.BASE_URL + + "/udiwms/image/register/file/getImage?type=image2&name="+row.filePath; + this.imgList = []; + this.imgList.push(this.certFileUrl) + let index = row.filePath.lastIndexOf('.'); + if(index===-1){ + this.$message.error("文件名异常!") + return false + } + if(row.filePath.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(); + }; + document.body.style.overflow = "hidden"; document.addEventListener("touchmove", m, false); // 禁止页面滑动 }, showImgViewerCold(row){ - this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name="; - console.log(this.certFileUrl+"========"); - this.imgListCold=[]; - previewImage({imageUrl:row.coldFilePath,certFileUrl:this.certFileUrl}).then(response => { - if (response.code === 20000) { - this.imgListCold=response.data; - } - console.log(this.imgListCold) - this.imgViewerVisibleCold = true; - }); - const m = (e) => { e.preventDefault() }; - document.body.style.overflow = 'hidden'; + this.certFileUrl = + this.BASE_URL + + "/udiwms/image/register/file/getImage?type=image2&name="+row.coldFilePath; + this.imgList = []; + this.imgList.push(this.certFileUrl) + let index = row.coldFilePath.lastIndexOf('.'); + if(index===-1){ + this.$message.error("文件名异常!") + return false + } + if(row.coldFilePath.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(); + }; + document.body.style.overflow = "hidden"; document.addEventListener("touchmove", m, false); // 禁止页面滑动 }, diff --git a/src/views/inout/IoSupSearchOrder.vue b/src/views/inout/IoSupSearchOrder.vue index e4ec3bc..9b169c2 100644 --- a/src/views/inout/IoSupSearchOrder.vue +++ b/src/views/inout/IoSupSearchOrder.vue @@ -498,7 +498,7 @@ import AcceptOrder from "@/views/inout/DialogReviewOrder"; import DialogCheck from "@/views/inout/DialogCheck"; import {getDeptListByUser} from "@/api/auth/authDept"; -import {previewImage} from '@/api/purchase/supCompany' +import {previewImage,previewFile} from '@/api/purchase/supCompany' import {getBizDetailList} from '@/api/inout/orderDetailBiz' import ElImageViewer from "element-ui/packages/image/src/image-viewer"; @@ -695,53 +695,92 @@ export default { }, showImgViewer(row) { - this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name="; - console.log(this.certFileUrl + "========"); + this.certFileUrl = + this.BASE_URL + + "/udiwms/image/register/file/getImage?type=image2&name="+row.filePath; this.imgList = []; - previewImage({imageUrl: row.filePath, 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 = row.filePath.lastIndexOf('.'); + if(index===-1){ + this.$message.error("文件名异常!") + return false + } + if(row.filePath.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() + e.preventDefault(); }; - document.body.style.overflow = 'hidden'; + document.body.style.overflow = "hidden"; document.addEventListener("touchmove", m, false); // 禁止页面滑动 }, showImgViewerCold(row) { - this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name="; - console.log(this.certFileUrl + "========"); - this.imgListCold = []; - previewImage({imageUrl: row.coldFilePath, certFileUrl: this.certFileUrl}).then(response => { - if (response.code === 20000) { - this.imgListCold = response.data; - } - console.log(this.imgListCold) - this.imgViewerVisibleCold = true; - }); + this.certFileUrl = + this.BASE_URL + + "/udiwms/image/register/file/getImage?type=image2&name="+row.coldFilePath; + this.imgList = []; + this.imgList.push(this.certFileUrl) + let index = row.coldFilePath.lastIndexOf('.'); + if(index===-1){ + this.$message.error("文件名异常!") + return false + } + if(row.coldFilePath.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() + e.preventDefault(); }; - document.body.style.overflow = 'hidden'; + document.body.style.overflow = "hidden"; document.addEventListener("touchmove", m, false); // 禁止页面滑动 }, - closeImgViewer() { - this.imgViewerVisible = false; + closeImgViewerCold() { + this.imgViewerVisibleCold = false; const m = (e) => { e.preventDefault() }; document.body.style.overflow = 'auto'; document.removeEventListener("touchmove", m, true); }, - - closeImgViewerCold() { - this.imgViewerVisibleCold = false; + closeImgViewer() { + this.imgViewerVisible = false; const m = (e) => { e.preventDefault() }; @@ -749,7 +788,6 @@ export default { document.removeEventListener("touchmove", m, true); }, - upload(row) { this.currentManufacturer = row; this.Upinvoice = true;