Browse Source

中间计量修改

duy 1 năm trước cách đây
mục cha
commit
2c1fcf87c1
1 tập tin đã thay đổi với 39 bổ sung12 xóa
  1. 39 12
      src/views/debit-pay/admin/components/middlepay/addModal.vue

+ 39 - 12
src/views/debit-pay/admin/components/middlepay/addModal.vue

@@ -103,7 +103,7 @@
                                 <hc-table-input v-model="row.containChangeTotal" :disabled="isView" @blur="containChangeTotalBlur(row)" />
                             </template>
                             <template #upPayRatio="{ row }">
-                                <hc-table-input v-model="row.upPayRatio" :disabled="isView" />
+                                <hc-table-input v-model="row.upPayRatio" :disabled="isView" @blur="unPayRatioBlur(row)" />
                             </template>
                             <template #currentMeterMoney="{ row }">
                                 <hc-table-input v-model="row.currentMeterMoney" disabled />
@@ -450,6 +450,31 @@ const currentMeterTotalBlur = (row) => {
             meterMoney = (BigNumber(meterMoney).plus(table[i].currentMeterMoney)).toString()
         }
         baseForm.value.meterMoney = meterMoney
+
+
+     
+     //  累计计量金额 > 最高支付金额   变红
+    // 当前行多返回一个字段otherPayMoney 代表其他期计量金额
+    // 累计计量金额 = 其他期计量金额+(本期计量金额*支付比例)
+    // 当前行多返回一个字段upPayMoney 代表最高支付金额
+    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
+           
+        }
     })
 }
 
@@ -464,17 +489,13 @@ const containChangeTotalBlur = (row) => {
         row.containChangeTotal = val
     })
 }
-
-//判断是否红色
-const isCanSave = ref(false)
-const addTableRowStyle = ({ row }) => {
-
-            //  累计计量金额 > 最高支付金额   变红
+const unPayRatioBlur = (row)=>{
+    nextTick(()=>{
+             
+     //  累计计量金额 > 最高支付金额   变红
     // 当前行多返回一个字段otherPayMoney 代表其他期计量金额
     // 累计计量金额 = 其他期计量金额+(本期计量金额*支付比例)
     // 当前行多返回一个字段upPayMoney 代表最高支付金额
-nextTick(()=>{
-    console.log(row, 'row')
     let otherPayMoney = new BigNumber(row.otherPayMoney )//其他期计量金额
     let currentMeterMoney = new BigNumber(row.currentMeterMoney )//本期计量金额
     let upPayRatio = new BigNumber(row.upPayRatio ).dividedBy(100)//支付比例
@@ -484,7 +505,8 @@ nextTick(()=>{
     //a 大于 b = 1,a 等于 b = 0,a 小于 b = -1, a 或 b 的值异常时 = null
         if (isComparedmoney === 1 || isComparedmoney === null) {
             isCanSave.value = true
-            window.$message.warning('累计计量金额超出支付比列,如需计量100%,请完成关联对应的质保资料')
+          
+           window.$message.warning('累计计量金额超出支付比列,如需计量100%,请完成关联对应的质保资料')
             return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
             
         
@@ -492,8 +514,13 @@ nextTick(()=>{
             isCanSave.value = false
            
         }
-        console.log(isComparedmoney, 'isComparedmoney')
-})
+    })
+    
+}
+//判断是否红色
+const isCanSave = ref(false)
+
+const addTableRowStyle = ({ row }) => {
 
     // 判断施工图数量是否大于合同数据
     //      大于:如果超计= 1并且 划分=1