From b3b82dbf09b6bf0b8fb264bd88da4620ab23b902 Mon Sep 17 00:00:00 2001 From: huangyuxuan Date: Thu, 6 Feb 2025 14:41:15 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D](hyx=5F?= =?UTF-8?q?=E9=97=A8=E5=8F=A3=E9=97=A8=E7=A6=81):=20=20=20-=20bug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/carList.vue | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/views/firstLevelDoor/freightVehiclesPort/freightVehicleMaintenance/components/carList.vue b/src/views/firstLevelDoor/freightVehiclesPort/freightVehicleMaintenance/components/carList.vue index 794eae1..d277c75 100644 --- a/src/views/firstLevelDoor/freightVehiclesPort/freightVehicleMaintenance/components/carList.vue +++ b/src/views/firstLevelDoor/freightVehiclesPort/freightVehicleMaintenance/components/carList.vue @@ -114,7 +114,7 @@ @@ -125,7 +125,7 @@ @@ -136,7 +136,7 @@ @@ -147,7 +147,7 @@ @@ -158,7 +158,7 @@ @@ -224,7 +224,7 @@ @@ -235,7 +235,7 @@ @@ -246,7 +246,7 @@ @@ -257,7 +257,7 @@ @@ -268,7 +268,7 @@ @@ -297,6 +297,7 @@ export default { components: {Pagination, SelectTree}, data() { return { + uploadUrl: config.httpurl + '/mkmj/management/fileUpload', listQuery: { page: 1, limit: 10 @@ -483,6 +484,14 @@ export default { this.addForm.ENVIRONMENTAL_SCREENSHOTS = response.uploadPath; }, beforeUpload(file) { + //文件格式限制 + const isJPG = file.type === 'image/jpeg'; + const isPNG = file.type === 'image/png'; + + if (!isJPG && !isPNG) { + this.$message.error('上传图片只能是 JPG 或 PNG 格式!'); + return false; + } // 文件上传前的校验逻辑 const isLt2M = file.size / 1024 / 1024 < 2; if (!isLt2M) {