ly 1 год назад
Родитель
Сommit
91d81e68e6
1 измененных файлов с 13 добавлено и 36 удалено
  1. 13 36
      src/views/business/financial/contract/form.vue

+ 13 - 36
src/views/business/financial/contract/form.vue

@@ -453,19 +453,11 @@
       }
       for (let i = 0; i < form.value.details.length; i++) {
         let item = form.value.details[i];
-        let countAmount = 0;
-        for (let j = 0; j < res.data.length; j++) {
-            let match = res.data[j];
-            if (item.taskTypeId == match.taskTypeId) {
-                countAmount += match.arriveAmount;
-            }
-        }
-        if (item.amount < countAmount) {
-            proxy.$modal.msgError("当前的" + item.taskTypeName + "收款申请总金额超过当前服务金额,不可提交,请联系财务人员。");
-            return false;
-        }
-    }
-
+         if (item.arriveAmount != null && item.amount < item.arriveAmount) {
+        proxy.$modal.msgError("当前的" + item.taskTypeName + "收款申请总金额超过当前服务金额,不可提交,请联系财务人员。");
+        return false;
+      }
+      }
     } else {
       const countAmount = res.data.map((item) => item.arriveAmount).reduce((total, number) => {
         return total + number;
@@ -475,35 +467,20 @@
         proxy.$modal.msgError("当前的合同提过的收款申请总金额超过当前合同金额,不可提交,请联系财务人员。");
         return false;
       }
-
-      // form.value.details.forEach(item => {
-      //   let countAmount = 0;
-      //   res.data.forEach(match => {
-      //     if (item.taskTypeId == match.taskTypeId) {
-      //       countAmount += match.arriveAmount;
-      //     }
-      //   })
-      //   if (item.amount < match.add(item.arriveAmount,countAmount)) {
-      //     proxy.$modal.msgError("当前的" + item.taskTypeName + "收款申请总金额超过当前服务金额,不可提交,请联系财务人员。");
-      //     console.log(2323);
-      //     return false;
-      //   }
-      // });
       for (let i = 0; i < form.value.details.length; i++) {
         let item = form.value.details[i];
         let countAmount = 0;
         for (let j = 0; j < res.data.length; j++) {
-            let match = res.data[j];
-            if (item.taskTypeId == match.taskTypeId) {
-                countAmount += match.arriveAmount;
-            }
+          let match = res.data[j];
+          if (item.taskTypeId == match.taskTypeId) {
+            countAmount += match.arriveAmount;
+          }
         }
-        if (item.amount < match.add(item.arriveAmount,countAmount)) {
-            proxy.$modal.msgError("当前的" + item.taskTypeName + "收款申请总金额超过当前服务金额,不可提交,请联系财务人员。");
-            console.log(2323);
-            return false;
+        if (item.amount < match.add(item.arriveAmount, countAmount)) {
+          proxy.$modal.msgError("当前的" + item.taskTypeName + "收款申请总金额超过当前服务金额,不可提交,请联系财务人员。");
+          return false;
         }
-    }
+      }
     }
 
     if (form.value.arriveAmount > form.value.contractAmount) {