Browse Source

中间计量修改

duy 1 year ago
parent
commit
5be2b71edd
1 changed files with 21 additions and 18 deletions
  1. 21 18
      src/views/debit-pay/admin/components/middlepay/addModal.vue

+ 21 - 18
src/views/debit-pay/admin/components/middlepay/addModal.vue

@@ -272,31 +272,31 @@ const baseFormRules = {
         message: '请选择业务日期',
     },
 }
-const isRelationData = ref(false)//是否管理质检资料
+
 const tableKey = ref(getRandom())
 //监听
 watch(() => baseForm.value.fileList, (list) => {
     console.log(list, 'list')
     tableKey.value = getRandom()
     // 验证数组中的对象是否包含名为 'selectId' 的字段
-const fieldName = 'selectId'
-
-const containsField = list.some(obj => obj.hasOwnProperty(fieldName))
-
-if (containsField) {
-  isRelationData.value = true//关联质检资料后最大支付比例变为100
-  addTableData.value.forEach((ele)=>{
-    ele.upPayRatio = 100
-  })
-} else {
-  isRelationData.value = false
-  addTableData.value.forEach((ele)=>{
-    if (!ischangeByGetNode.value) {
-        ele.upPayRatio = ele.oldupPayRatio || '0.00'
+
+    if (list.length > 0) {
+        const fieldName = 'selectId'//是否关联质检资料,已关联变为100
+        const containsField = list.some(obj => obj.hasOwnProperty(fieldName))
+        if (containsField) {
+            addTableData.value.forEach((ele)=>{
+                ele.upPayRatio = 100
+            })
+            } else {
+                addTableData.value.forEach((ele)=>{
+                    if (!ischangeByGetNode.value) {
+                        ele.upPayRatio = ele.oldupPayRatio || '0.00'
+                    }
+                        
+            })
+        }
     }
-   
-  })
-}
+
 nextTick(()=>{
     console.log(isComparedRaVal.value, 'isComparedRaVal.value ')
     if (isComparedRaVal.value === 1 ) {
@@ -372,6 +372,9 @@ const getNodeDivide = async (nodeId) => {
  const getCurrentNodeAllFormData = async (nodeId) => {
     const { data } = await mainApi.getCurrentNodeAllForm({ contractId:  cid.value, contractPeriodId:baseForm.value.contractPeriodId, contractUnitId:nodeId })
  addTableData.value = getArrValue(data)
+ addTableData.value.forEach((ele)=>{
+        ele.oldupPayRatio = ele.upPayRatio
+    })
 
 }