From bde96791b42358a6e08d429161a19e2b80b6ee1f Mon Sep 17 00:00:00 2001 From: chenhc <2369838784@qq.com> Date: Fri, 27 Sep 2024 21:18:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/dev/deviceContract.js | 68 +++ src/views/dev/DeptDeviceDetail.vue | 9 +- src/views/dev/invContractDialog.vue | 466 ++++++++++++++++++ src/views/dev/invDeviceEditDialog.vue | 44 +- src/views/dev/invTechniclDialog.vue | 42 +- src/views/inventory/cert/depCertAddDialog.vue | 12 +- .../contract/depContractAddDialog.vue | 406 +++++++++++++++ 7 files changed, 1017 insertions(+), 30 deletions(-) create mode 100644 src/api/dev/deviceContract.js create mode 100644 src/views/dev/invContractDialog.vue create mode 100644 src/views/inventory/contract/depContractAddDialog.vue diff --git a/src/api/dev/deviceContract.js b/src/api/dev/deviceContract.js new file mode 100644 index 00000000..eab56c90 --- /dev/null +++ b/src/api/dev/deviceContract.js @@ -0,0 +1,68 @@ +import axios from "@/utils/request"; + +export function filterDeviceContract(query) { + return axios( + { + url: "/inv/device/contract/filter", + method: "get", + params: query + } + ) +} + + +export function insertCompanyContract(query) { + return axios( + { + url: "/inv/info/insertDeviceContract", + method: "post", + data: query + } + ); +} + +export function updateDeviceContract(query) { + return axios( + { + url: "/inv/info/updateDeviceContract", + method: "post", + data: query + } + ); +} + +export function auditSupContract(query) { + return axios( + { + url: "/sale/sup/contract/audit", + method: "post", + data: query + } + ); +} + + +export function deleteDeviceContract(query) { + return axios( + { + url: "/inv/info/deleteDeviceContract", + method: "post", + data: query + } + ); +} + + +export function revokeSupContract(query) { + return axios( + { + url: "/sale/sup/contract/revoke", + method: "post", + data: query + } + ); +} + + + + diff --git a/src/views/dev/DeptDeviceDetail.vue b/src/views/dev/DeptDeviceDetail.vue index 22212622..63d429d1 100644 --- a/src/views/dev/DeptDeviceDetail.vue +++ b/src/views/dev/DeptDeviceDetail.vue @@ -65,7 +65,12 @@ - + + + + @@ -146,6 +151,7 @@ import DeviceModelDetail from "@/views/dev/DeviceModelDetail.vue"; import inspectSetModifyDialog from "@/views/dev/InspectSetModifyDialog.vue"; import checkResultPanel from "@/views/dev/invDeviceEditDialog.vue"; import technical from "@/views/dev/invTechniclDialog.vue"; +import contract from "@/views/dev/invContractDialog.vue"; import invDeviceUserEditDialog from "@/views/dev/invDeviceUserEditDialog.vue"; import invDeviceUsageEditDialog from "@/views/dev/invDeviceUsageEditDialog.vue"; import invDevicePurContractDialog from "@/views/dev/invDevicePurContractDialog.vue"; @@ -494,6 +500,7 @@ export default { invDevicePurOrderDialog, invDevicePurApplyDialog, invDeviceRepairEditDialog, + contract, invDeviceUpkeepEditDialog }, created() { diff --git a/src/views/dev/invContractDialog.vue b/src/views/dev/invContractDialog.vue new file mode 100644 index 00000000..75dfc1c9 --- /dev/null +++ b/src/views/dev/invContractDialog.vue @@ -0,0 +1,466 @@ + + + + diff --git a/src/views/dev/invDeviceEditDialog.vue b/src/views/dev/invDeviceEditDialog.vue index bbbe45c0..73f725ca 100644 --- a/src/views/dev/invDeviceEditDialog.vue +++ b/src/views/dev/invDeviceEditDialog.vue @@ -298,19 +298,39 @@ export default { }, //预览照片 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 - } - }) - this.imgViewerVisible = true - const m = (e) => { - e.preventDefault() + // 假设你的图片URL基础路径 + this.certFileUrl = this.BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name="; + this.imgList = []; + + // 检查文件是否为PDF + const isPdf = row.filePath.toLowerCase().includes('.pdf'); + if (isPdf) { + // 如果不是PDF,则尝试预览图片 + previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => { + if (response.code === 20000) { + // 如果是PDF,则在新标签页中打开 + this.imgList = response.data; + window.open(this.imgList, '_blank'); + // 你可以在这里添加一些逻辑来关闭图片查看器(如果它之前已经打开) + // 例如,如果你有一个模态框或类似的UI元素 + this.imgViewerVisible = false; + } + }); + } else { + // 如果不是PDF,则尝试预览图片 + previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => { + if (response.code === 20000) { + this.imgList = response.data; + this.imgViewerVisible = true; + // 禁止页面滑动 + const m = (e) => { + e.preventDefault(); + }; + document.body.style.overflow = 'hidden'; + document.addEventListener("touchmove", m, false); + } + }); } - document.body.style.overflow = 'hidden' - document.addEventListener('touchmove', m, false) // 禁止页面滑动 }, closeImgViewer() { this.imgViewerVisible = false diff --git a/src/views/dev/invTechniclDialog.vue b/src/views/dev/invTechniclDialog.vue index de748b27..fef1b3ce 100644 --- a/src/views/dev/invTechniclDialog.vue +++ b/src/views/dev/invTechniclDialog.vue @@ -294,19 +294,39 @@ export default { }, //预览照片 showImgViewer(row) { + // 假设你的图片URL基础路径 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; - } - }); - this.imgViewerVisible = true; - const m = (e) => { - e.preventDefault() - }; - document.body.style.overflow = 'hidden'; - document.addEventListener("touchmove", m, false); // 禁止页面滑动 + + // 检查文件是否为PDF + const isPdf = row.filePath.toLowerCase().includes('.pdf'); + if (isPdf) { + // 如果不是PDF,则尝试预览图片 + previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => { + if (response.code === 20000) { + // 如果是PDF,则在新标签页中打开 + this.imgList = response.data; + window.open(this.imgList, '_blank'); + // 你可以在这里添加一些逻辑来关闭图片查看器(如果它之前已经打开) + // 例如,如果你有一个模态框或类似的UI元素 + this.imgViewerVisible = false; + } + }); + } else { + // 如果不是PDF,则尝试预览图片 + previewImage({ imageUrl: row.filePath, certFileUrl: this.certFileUrl }).then(response => { + if (response.code === 20000) { + this.imgList = response.data; + this.imgViewerVisible = true; + // 禁止页面滑动 + const m = (e) => { + e.preventDefault(); + }; + document.body.style.overflow = 'hidden'; + document.addEventListener("touchmove", m, false); + } + }); + } }, closeImgViewer() { this.imgViewerVisible = false; diff --git a/src/views/inventory/cert/depCertAddDialog.vue b/src/views/inventory/cert/depCertAddDialog.vue index 1553f599..75f362aa 100644 --- a/src/views/inventory/cert/depCertAddDialog.vue +++ b/src/views/inventory/cert/depCertAddDialog.vue @@ -114,7 +114,7 @@ :on-remove="uploadHandleRemove" :headers="headers" :on-exceed="uploadHandleExceed" - accept=".jpg,.png" + accept=".jpg,.png,.pdf" :on-change="uploadOnchange" :on-success="uploadHandleSuccess" :on-error="uploadHandleError" @@ -124,7 +124,7 @@ {{ choiceFile }} -
只能上传 jpg,png 文件,且不超过 3 MB
+
只能上传 jpg,png,pdf 文件,且不超过 6 MB
@@ -313,8 +313,8 @@ export default { let uid = file.uid let pos = fileName.lastIndexOf("."); let lastName = fileName.substring(pos, fileName.length); - if (lastName.toLowerCase() !== ".jpg" && lastName.toLowerCase() !== ".png" && lastName.toLowerCase() !== ".doc") { - this.$message.error("上传文件只能是 jpg,png格式"); + if (lastName.toLowerCase() !== ".jpg" && lastName.toLowerCase() !== ".png" && lastName.toLowerCase() !== ".pdf") { + this.$message.error("上传文件只能是 jpg,png,pdf格式"); for (let i = 0; i < fileList.length; i++) {//从list删除 if (fileList[i].uid === uid) { fileList.splice(i, 1) @@ -323,9 +323,9 @@ export default { return; } // 限制上传文件的大小 - const isLt = file.size / 1024 / 1024 / 3 <= 1; + const isLt = file.size / 1024 / 1024 / 6 <= 1; if (!isLt) { - this.$message.error("上传文件大小不能超过 3MB"); + this.$message.error("上传文件大小不能超过 6MB"); for (let i = 0; i < fileList.length; i++) { if (fileList[i].uid === uid) { fileList.splice(i, 1) diff --git a/src/views/inventory/contract/depContractAddDialog.vue b/src/views/inventory/contract/depContractAddDialog.vue new file mode 100644 index 00000000..6fe01050 --- /dev/null +++ b/src/views/inventory/contract/depContractAddDialog.vue @@ -0,0 +1,406 @@ + + + + + + +