浏览代码

fix:修改结算单新增计算单暂存、提交传参方式

lazy 3 天之前
父节点
当前提交
7dfe26042f
共有 1 个文件被更改,包括 63 次插入31 次删除
  1. 63 31
      src/views/myTrade/settlementDocumentManagement/add.vue

+ 63 - 31
src/views/myTrade/settlementDocumentManagement/add.vue

@@ -588,58 +588,90 @@ export default {
       });
 
       // this.isLoading = true
-      let data = new FormData()
+      // modify by lx at 2024-11-21 这里将新增结算单更新结算单改为json传参,取消以前的formdata传参
+      // let data = new FormData()
+      let data = {
+        supplierId: this.businessInfo.supplierId,
+        businessNumber: this.ruleForm.businessNumber,
+        businessName: this.businessInfo.projectName,
+        enterpriseCustomerInfoId: this.businessInfo.coreEnterpriseId,
+        tradingPlatformId: this.businessInfo.platformId,
+        settlementDate: this.ruleForm.settlementDate,
+        settlementAmount: this.ruleForm.settlementAmount,
+        operatorSupplier: this.ruleForm.operatorSupplier,
+        additionalRemarks: this.ruleForm.additionalRemarks,
+        operatorEnterprise: this.ruleForm.operatorEnterprise,
+        settlementStartDate: this.ruleForm.settlementStartDate,
+        settlementEndDate: this.ruleForm.settlementEndDate,
+        submit: flag == 2 ? true : false,
+        Loading: true
+      }
       if(this.$route.query.key) {
-        data.append('businessKey', this.$route.query.key)
-        data.append('id', this.$route.query.key)
+        // data.append('businessKey', this.$route.query.key)
+        // data.append('id', this.$route.query.key)
+        data.businessKey = this.$route.query.key
+        data.id = this.$route.query.key
       }
       if(this.$route.query.taskId) {
-        data.append('taskId', this.$route.query.taskId)
+        // data.append('taskId', this.$route.query.taskId)
+        data.taskId = this.$route.query.taskId
       }
-      data.append('supplierId', this.businessInfo.supplierId)
-      data.append('businessNumber', this.ruleForm.businessNumber)
-      data.append('businessName', this.businessInfo.projectName)
-      data.append('enterpriseCustomerInfoId', this.businessInfo.coreEnterpriseId)
-      data.append('tradingPlatformId', this.businessInfo.platformId)
-      data.append('settlementDate', this.ruleForm.settlementDate);
-      data.append('settlementAmount', this.ruleForm.settlementAmount);
-      data.append('operatorSupplier', this.ruleForm.operatorSupplier);
-      data.append('additionalRemarks', this.ruleForm.additionalRemarks)
+      // data.append('supplierId', this.businessInfo.supplierId)
+      // data.append('businessNumber', this.ruleForm.businessNumber)
+      // data.append('businessName', this.businessInfo.projectName)
+      // data.append('enterpriseCustomerInfoId', this.businessInfo.coreEnterpriseId)
+      // data.append('tradingPlatformId', this.businessInfo.platformId)
+      // data.append('settlementDate', this.ruleForm.settlementDate);
+      // data.append('settlementAmount', this.ruleForm.settlementAmount);
+      // data.append('operatorSupplier', this.ruleForm.operatorSupplier);
+      // data.append('additionalRemarks', this.ruleForm.additionalRemarks)
       // if(this.ruleForm.operatorEnterprise.length) {
-      data.append('operatorEnterprise', this.ruleForm.operatorEnterprise)
-      data.append('Loading', true)
+      // data.append('operatorEnterprise', this.ruleForm.operatorEnterprise)
+      // data.append('Loading', true)
       // }
       if(this.ruleForm.goodsList.length) {
+        data.settlementGoodsInfos = []
         this.ruleForm.goodsList.forEach((item, index) => {
+          data.settlementGoodsInfos[index] = {
+            acceptanceGoodsInfoId: item.id
+          }
           Object.keys(item).forEach(key => {
             if((item[key] || item[key] === 0) && key !== 'id' && key !== 'gmtCreate' && key !== 'gmtModified') {
-              data.append(`settlementGoodsInfos[${index}].${key}`, item[key])
+              // data.append(`settlementGoodsInfos[${index}].${key}`, item[key])
+              data.settlementGoodsInfos[index][key] = item[key]
             }
           })
-          data.append(`settlementGoodsInfos[${index}].acceptanceGoodsInfoId`, item.id)
+          // data.append(`settlementGoodsInfos[${index}].acceptanceGoodsInfoId`, item.id)
         })
       }
-      data.append('settlementStartDate', this.ruleForm.settlementStartDate)
-      data.append('settlementEndDate', this.ruleForm.settlementEndDate)
+      // data.append('settlementStartDate', this.ruleForm.settlementStartDate)
+      // data.append('settlementEndDate', this.ruleForm.settlementEndDate)
       if(this.ruleForm.repayList.length) {
+        data.settlementRepaymentPlans = []
         this.ruleForm.repayList.forEach((item, index) => {
-          data.append(`settlementRepaymentPlans[${index}].repaymentDate`, item.repaymentDate)
-          data.append(`settlementRepaymentPlans[${index}].repaymentAmount`, item.repaymentAmount)
+          data.settlementRepaymentPlans[index] = {}
+          // data.append(`settlementRepaymentPlans[${index}].repaymentDate`, item.repaymentDate)
+          // data.append(`settlementRepaymentPlans[${index}].repaymentAmount`, item.repaymentAmount)
+          data.settlementRepaymentPlans[index].repaymentDate = item.repaymentDate
+          data.settlementRepaymentPlans[index].repaymentAmount = item.repaymentAmount
         })
       }
       let arr1 = [...this.ruleForm.fileIds, ...this.$refs.fileStorage1.fileLists];
       let arr2 = [...this.ruleForm.netPriceFileIds, ...this.$refs.fileStorage2.fileLists];
       let arr3 = [...this.ruleForm.additionalFileIds, ...this.$refs.fileStorage3.fileLists];
-      arr1.forEach((item, index) => {
-        data.append(`fileIds[${index}]`, item.response?.data?.id || item.id)
-      });
-      arr2.forEach((item, index) => {
-        data.append(`netPriceFileIds[${index}]`, item.response?.data?.id || item.id)
-      });
-      arr3.forEach((item, index) => {
-        data.append(`additionalFileIds[${index}]`, item.response?.data?.id || item.id)
-      });
-      data.append('submit', flag == 2)
+      data.fileIds = arr1.map(item => item.response?.data?.id || item.id)
+      data.netPriceFileIds = arr2.map(item => item.response?.data?.id || item.id)
+      data.additionalFileIds = arr3.map(item => item.response?.data?.id || item.id)
+      // arr1.forEach((item, index) => {
+      //   data.append(`fileIds[${index}]`, item.response?.data?.id || item.id)
+      // });
+      // arr2.forEach((item, index) => {
+      //   data.append(`netPriceFileIds[${index}]`, item.response?.data?.id || item.id)
+      // });
+      // arr3.forEach((item, index) => {
+      //   data.append(`additionalFileIds[${index}]`, item.response?.data?.id || item.id)
+      // });
+      // data.append('submit', flag == 2)
       request({
         url: this.$route.query.key ? '/bill/updateBill' : '/bill/addBillBasicInformation',
         method: 'post',