Răsfoiți Sursa

中间计量修改

duy 1 an în urmă
părinte
comite
2e18a6e57b
1 a modificat fișierele cu 26 adăugiri și 10 ștergeri
  1. 26 10
      src/views/debit-pay/admin/components/middlepay/addModal.vue

+ 26 - 10
src/views/debit-pay/admin/components/middlepay/addModal.vue

@@ -469,16 +469,29 @@ const containChangeTotalBlur = (row) => {
 const isCanSave = ref(false)
 const addTableRowStyle = ({ row }) => {
 
-    // let allMeterTotal = new BigNumber(row.allMeterTotal) //a 累计计量量
-    // let changeTotal = new BigNumber(row.changeTotal) //b 变更后数量
-    // //a 大于 b = 1,a 等于 b = 0,a 小于 b = -1, a 或 b 的值异常时 = null
-    // const isCompared = allMeterTotal.comparedTo(changeTotal)
-    // if (isCompared === 1 || isCompared === null) {
-    //     isCanSave.value = true
-    //     return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
-    // } else {
-    //     isCanSave.value = false
-    // }
+            //  累计计量金额 > 最高支付金额   变红
+    // 当前行多返回一个字段otherPayMoney 代表其他期计量金额
+    // 累计计量金额 = 其他期计量金额+(本期计量金额*支付比例)
+    // 当前行多返回一个字段upPayMoney 代表最高支付金额
+    console.log(row, 'row')
+    let otherPayMoney = new BigNumber(row.otherPayMoney )//其他期计量金额
+    let currentMeterMoney = new BigNumber(row.currentMeterMoney )//本期计量金额
+    let upPayRatio = new BigNumber(row.upPayRatio ).dividedBy(100)//支付比例
+    let upPayRatioMoney = (otherPayMoney.plus((currentMeterMoney.multipliedBy(upPayRatio)).toNumber()))//累计计量金额
+    let upPayMoney = new BigNumber(row.upPayMoney)//最高支付金额
+    const isComparedmoney = upPayRatioMoney.comparedTo(upPayMoney)
+    //a 大于 b = 1,a 等于 b = 0,a 小于 b = -1, a 或 b 的值异常时 = null
+        if (isComparedmoney === 1 || isComparedmoney === null) {
+            isCanSave.value = true
+            window.$message.warning('累计计量金额超出支付比列,如需计量100%,请完成关联对应的质保资料')
+            return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
+            
+        
+        } else {
+            isCanSave.value = false
+           
+        }
+        console.log(isComparedmoney, 'isComparedmoney')
 
     // 判断施工图数量是否大于合同数据
     //      大于:如果超计= 1并且 划分=1
@@ -518,6 +531,9 @@ const addTableRowStyle = ({ row }) => {
                 isCanSave.value = false
             }
     }
+
+
+
 }
 
 //删除清单