Просмотр исходного кода

finStlBillsVoucherItemsList 结算申请没有字段的时候 需要加上判断不进行校验

Qukatie 6 дней назад
Родитель
Сommit
f7daa08b42
1 измененных файлов с 42 добавлено и 40 удалено
  1. 42 40
      src/views/iosBasicData/ComputationCenter/settlementDetails.vue

+ 42 - 40
src/views/iosBasicData/ComputationCenter/settlementDetails.vue

@@ -1694,7 +1694,7 @@ export default {
         }
         }
       });
       });
     },
     },
-        // 借方/贷方 本币的计算
+    // 借方/贷方 本币的计算
     offAmountBlur(row, name) {
     offAmountBlur(row, name) {
       if (name === "D") {
       if (name === "D") {
         this.$set(row, "amountCrOffCurrent", 0);
         this.$set(row, "amountCrOffCurrent", 0);
@@ -2160,50 +2160,52 @@ export default {
         let amountDrSum = 0;
         let amountDrSum = 0;
         let amountCrSum = 0;
         let amountCrSum = 0;
         let index = 0;
         let index = 0;
-        for (let item of this.form.finStlBillsVoucherItemsList) {
-          // console.log(item);
-          index++;
-          let amtDr = this.forceNumber(item.amountDr);
-          let amtCr = this.forceNumber(item.amountCr);
-          amountDrSum += amtDr;
-          amountCrSum += amtCr;
-          let descr = item.descr ? item.descr.trim() : "";
-          if (!descr) {
-            msgs.push(`第 ${index} 行分录请填写摘要!`);
-          } else {
-            item.descr = descr;
-          }
-          if (!item.accountId) {
-            msgs.push(`第 ${index} 行分录缺少科目代码!`);
-          } else {
-            if (item.isCorp === 1 && !item.corpId) {
-              msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算客户,请选择客户名称!`);
-            }
-            if (item.isDept === 1 && !item.deptId) {
-              msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算部门,请选择部门名称!`);
-            }
-            if (item.isEmpl === 1 && !item.emplId) {
-              msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算职员,请选择职员名称!`);
+        if (this.form.finStlBillsVoucherItemsList && this.form.finStlBillsVoucherItemsList.length) {
+          for (let item of this.form.finStlBillsVoucherItemsList) {
+            index++;
+            let amtDr = this.forceNumber(item.amountDr);
+            let amtCr = this.forceNumber(item.amountCr);
+            amountDrSum += amtDr;
+            amountCrSum += amtCr;
+            let descr = item.descr ? item.descr.trim() : "";
+            if (!descr) {
+              msgs.push(`第 ${index} 行分录请填写摘要!`);
+            } else {
+              item.descr = descr;
             }
             }
-            // if (item.isItem === 1 && !item.itemId) {
-            //   msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算项目,请选择项目名称!`);
-            // }
-            if (amtDr.toFixed(2) === "0.00" && amtCr.toFixed(2) === "0.00") {
-              msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 请填写金额!`);
+            if (!item.accountId) {
+              msgs.push(`第 ${index} 行分录缺少科目代码!`);
+            } else {
+              if (item.isCorp === 1 && !item.corpId) {
+                msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算客户,请选择客户名称!`);
+              }
+              if (item.isDept === 1 && !item.deptId) {
+                msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算部门,请选择部门名称!`);
+              }
+              if (item.isEmpl === 1 && !item.emplId) {
+                msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算职员,请选择职员名称!`);
+              }
+              // if (item.isItem === 1 && !item.itemId) {
+              //   msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算项目,请选择项目名称!`);
+              // }
+              if (amtDr.toFixed(2) === "0.00" && amtCr.toFixed(2) === "0.00") {
+                msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 请填写金额!`);
+              }
             }
             }
           }
           }
-        }
-        if (amountDrSum !== amountCrSum) {
-          msgs.push(`凭证借贷金额不平衡!`);
-        }
+          if (amountDrSum !== amountCrSum) {
+            msgs.push(`凭证借贷金额不平衡!`);
+          }
 
 
-        if (msgs.length > 0) {
-          return this.$message({
-            dangerouslyUseHTMLString: true,
-            message: msgs.join("<br /><br />"),
-            type: "warning"
-          });
+          if (msgs.length > 0) {
+            return this.$message({
+              dangerouslyUseHTMLString: true,
+              message: msgs.join("<br /><br />"),
+              type: "warning"
+            });
+          }
         }
         }
+
         // this.form.finStlBillsVoucherItemsList = this.form.finStlBillsVoucherItemsList.concat(this.removedFinvouchersitems);
         // this.form.finStlBillsVoucherItemsList = this.form.finStlBillsVoucherItemsList.concat(this.removedFinvouchersitems);
         this.saveLoading = true; // 打开按钮动画
         this.saveLoading = true; // 打开按钮动画
         if (this.form.estimatedTime) {
         if (this.form.estimatedTime) {