diff --git a/src/axios.js b/src/axios.js index 4f6d000d..2adf1480 100644 --- a/src/axios.js +++ b/src/axios.js @@ -60,7 +60,7 @@ function removePendingRequest(config) { axios.interceptors.request.use( config => { // 检查 config.url 是否以 http 开头 - console.log(config,'config'); + // console.log(config,'config'); // 在请求开始前,对之前的请求做检查取消操作 removePendingRequest(config); // 将当前请求添加到pendingRequests对象中 diff --git a/src/views/aftersales/aftersalesWorkOrderAddCopy.vue b/src/views/aftersales/aftersalesWorkOrderAddCopy.vue index 436e8435..e95c8877 100644 --- a/src/views/aftersales/aftersalesWorkOrderAddCopy.vue +++ b/src/views/aftersales/aftersalesWorkOrderAddCopy.vue @@ -1950,15 +1950,14 @@ const isShowFormItem4 = computed(() => { } } .ResponsibilityBox { + width: 100%; + display: flex; + flex-direction: column; :deep(.asterisk-left) { .el-form-item__label { width: auto !important; } } - - width: 100%; - display: flex; - flex-direction: column; .leftbox { display: flex; justify-content: space-between; @@ -1967,7 +1966,6 @@ const isShowFormItem4 = computed(() => { width: 140px; margin-right: 50px; text-align: right; - :deep(.el-form-item__label) { width: auto !important; } diff --git a/src/views/aftersales/aftersalesWorkOrderAddTemp.vue b/src/views/aftersales/aftersalesWorkOrderAddTemp.vue index 8d38bd7b..3f91ba8e 100644 --- a/src/views/aftersales/aftersalesWorkOrderAddTemp.vue +++ b/src/views/aftersales/aftersalesWorkOrderAddTemp.vue @@ -1998,15 +1998,16 @@ const isShowFormItem4 = computed(() => { } } .ResponsibilityBox { + + + width: 100%; + display: flex; + flex-direction: column; :deep(.asterisk-left) { .el-form-item__label { width: auto !important; } } - - width: 100%; - display: flex; - flex-direction: column; .leftbox { display: flex; justify-content: space-between; @@ -2061,13 +2062,13 @@ const isShowFormItem4 = computed(() => { } } .ResponsibilityBoxS { - .el_packBtn { - margin-top: 10px; - } width: 100%; display: flex; flex-direction: column; margin-bottom: 10px; + .el_packBtn { + margin-top: 10px; + } .leftbox { display: flex; justify-content: space-between; diff --git a/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue b/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue index 967b21df..a10fc374 100644 --- a/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue +++ b/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue @@ -1,10 +1,7 @@ diff --git a/src/views/distribution/signfor/distributionSignfortreat.vue b/src/views/distribution/signfor/distributionSignfortreat.vue index 3f61b1ba..71da2678 100644 --- a/src/views/distribution/signfor/distributionSignfortreat.vue +++ b/src/views/distribution/signfor/distributionSignfortreat.vue @@ -1785,18 +1785,46 @@ export default { } }, // 上门照图片上传成功 - ImgSuccessA(response, uploadFile) {}, + ImgSuccessA(response, uploadFile) { + console.log(response, 'response'); + console.log(this.uploadFile, 'uploadFile'); + console.log(this.DoorstepPhoto,'DoorstepPhoto'); + + + }, +isValidImageUrl(url) { + // 检查是否为空字符串 + if (!url || url.trim() === '') { + return false; + } + // 正则表达式匹配模式 + const pattern = /^https?:\/\/.+\.(jpg|jpeg|png|gif|bmp|webp)$/i; + // 检查是否以 'blob:' 开头 + if (url.startsWith('blob:')) { + return false; + } + // 使用正则表达式测试 URL + return pattern.test(url); +}, // 堆门图片上传成功 - ImgSuccessB(response, uploadFile) {}, + ImgSuccessB(response, uploadFile) { + console.log(response, 'response'); + console.log(this.uploadFile, 'uploadFile'); + console.log(this.StackingPhoto,'StackingPhoto'); + + }, // 易碎图片上传成功 ImgSuccessC(response, uploadFile) {}, // 家配图片上传成功 ImgSuccessD(response, uploadFile) { console.log(response, 'response'); console.log(this.HomePhotos, '加配照片'); + }, // 签收图片上传成功 - ImgSuccessE(response, uploadFile) {}, + ImgSuccessE(response, uploadFile) { + + }, //取消 // 上传图片处理开始 @@ -1857,6 +1885,45 @@ export default { }, }); }, + +// 校验图片 +isValidImageUrl(url) { + // 直接检查 URL 是否以 blob: 开头 + return typeof url === 'string' && !url.startsWith('blob:'); +}, + +checkImageUrls(row) { + const invalidImages = []; // 用于存储无效图片的名称 + + // 遍历 row.map 中的每个键 + for (const photoKey in row.map) { + const photoArray = row.map[photoKey]; + + // 遍历每个 photo 数组中的对象 + for (const photoObj of photoArray) { + const url = photoObj.urlRoute; + console.log(url, 'url'); + + const isValid = this.isValidImageUrl(url); + if (!isValid) { + invalidImages.push(photoObj.name); // 如果URL无效,将name加入无效图片数组 + } + } + } + + if (invalidImages.length > 0) { + invalidImages.forEach(item=>{ + ElMessage({ + message: `图片名称为:${item}存在问题,请删除图片重新上传或者刷新页面重试`, + type: 'warning', + }) + }) + console.log(`图片名称为: ${invalidImages.join(', ')}存在问题,请删除图片重新上传,或刷新页面重新尝试`); + return false; + } else { + return true; + } +}, //签收 submitForm() { let row = {}; @@ -1909,6 +1976,20 @@ export default { this.deduplicateByIdAndUpdate(row.map.photo_3); this.deduplicateByIdAndUpdate(row.map.photo_4); this.deduplicateByIdAndUpdate(row.map.photo_5); + // 测试数据 + // row.map.photo_5.push({ + // name: "03add918888d36ce0d566da120510840.png", + // reservationId: "1829120012682530818", + // type: "photo_2", + // urlRoute: "blob:http://192.168.3.13:2888/d236a3be-e565-4122-b573-7fe4c5f07525" + // }) + // 检查 row 对象中的图片地址 + const result = this.checkImageUrls(row); + console.log(`图片校验 ${result}`); + if(!result){ + return + } + console.log(row, '要提交的参数'); // 提交 this.TcFromloading=true @@ -1932,6 +2013,7 @@ export default { }, // 图片放大 EnlargeTheTmageA(uploadFile) { + this.dialogImageUrlA = uploadFile.url; this.dialogVisibleA = true; },