From e488e515900f1218f9f8a9082a328f5b5aa6fe2e Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Thu, 12 Feb 2026 11:56:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A0=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../payment-fail/addAndEditForm.vue | 88 ++++++++----------- 1 file changed, 35 insertions(+), 53 deletions(-) diff --git a/src/views/synthesize-query/payment-fail/addAndEditForm.vue b/src/views/synthesize-query/payment-fail/addAndEditForm.vue index cb102f6..784ba05 100644 --- a/src/views/synthesize-query/payment-fail/addAndEditForm.vue +++ b/src/views/synthesize-query/payment-fail/addAndEditForm.vue @@ -265,9 +265,9 @@ export default { return } // 校验格式:最多两位小数点的数字 - const pattern = /^\d+(\.\d{1,2})?$/ + const pattern = /^\d+(\.\d{1,3})?$/ if (!pattern.test(value)) { - callback(new Error('请输入正确的金额格式,最多两位小数点')) + callback(new Error('请输入正确的金额格式,最多三位小数点')) return } // 转换为数字进行范围校验 @@ -277,8 +277,8 @@ export default { return } // 校验范围:0-99999999.99 - if (numValue < 0 || numValue > 99999999.99) { - callback(new Error('金额范围应在0-99999999.99元之间')) + if (numValue < 0 || numValue > 99999999.999) { + callback(new Error('金额范围应在0-99999999.999元之间')) return } callback() @@ -364,57 +364,40 @@ export default { } try { + let dataUpdateId=''; + let dataDelFileId=''; + debugger + // 如果是修改,添加id + // 如果是修改,添加id和删除文件ID + if (this.formType === 2 && this.editId) { + dataUpdateId = this.editId + // 找出被删除的文件id集合(判空处理) + if (Array.isArray(this.allFileList) && this.allFileList.length > 0) { + const delFileList = this.allFileList.filter( + (item) => !this.paymentFailForm.fileList.some((file) => file.id === item.id) + ) + dataDelFileId = delFileList.length > 0 ? delFileList.map((item) => item.id).join(',') : '' + } + } + // 组装FormData const formData = new FormData() - - // 添加表单字段(同步config.js中的字段名) - formData.append( - 'userName', - this.paymentFailForm.userName, - ) - formData.append('idCard', this.paymentFailForm.idCard) - formData.append('proName', this.paymentFailForm.proName) - formData.append('subName', this.paymentFailForm.subName) - formData.append( - 'failMonth', - this.paymentFailForm.failMonth, - ) - formData.append('money', this.paymentFailForm.money) - formData.append( - 'failReason', - this.paymentFailForm.failReason, - ) - formData.append( - 'failStatus', - this.paymentFailForm.failStatus, - ) - formData.append( - 'remark', - this.paymentFailForm.remark || '', - ) - - // 如果是修改,添加id - if (this.formType === 2 && this.editId) { - formData.append('id', this.editId) - - // 找出被删除的文件id集合 - const delFileList = this.allFileList.filter( - (item) => { - return !this.paymentFailForm.fileList.some( - (file) => file.id === item.id, - ) - }, - ) - if (delFileList.length > 0) { - formData.append( - 'delFileId', - delFileList - .map((item) => item.id) - .join(','), - ) - } + const params = { + userName:this.paymentFailForm.userName, + idCard: this.paymentFailForm.idCard, + proName:this.paymentFailForm.proName, + subName:this.paymentFailForm.subName, + failMonth:this.paymentFailForm.failMonth, + money:this.paymentFailForm.money, + failStatus:this.paymentFailForm.failStatus, + failReason: this.paymentFailForm.failReason, + remark: this.paymentFailForm.remark || '', + id:dataUpdateId, + delFileId:dataDelFileId } - + console.log(params) + //参数封装 + formData.append('params', JSON.stringify(params)) // 添加文件 if ( this.paymentFailForm.fileList && @@ -426,7 +409,6 @@ export default { } }) } - // 调用API const API = this.formType === 1