ZaiZai 1 rok temu
rodzic
commit
b73f52e71d

+ 41 - 17
src/views/debit-pay/admin/components/middlepay/addModal.vue

@@ -377,7 +377,9 @@ const treeLoadNode = async ({ item, level }, resolve) => {
 }
 const nodeId = ref('')
 const isLastChild = ref(true)//是否是最底层节点
+const treeItemData = ref({})
 const treeNodeTap = ({ data, keys }) => {
+    treeItemData.value = data
     setStoreValue('middlepay-tree-auto-expand-keys', keys)
     const { notExsitChild } = data
     isLastChild.value = notExsitChild
@@ -630,26 +632,22 @@ const addTableRowStyle = ({ row }) => {
             isCanSave.value = true
             return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
         }
-
     } else {
-            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) {
-                if (isContractOver) {
-                    isCanSave.value = false
-                } else {
-                    isCanSave.value = true
-                    return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
-                }
-            } else {
+        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) {
+            if (isContractOver) {
                 isCanSave.value = false
+            } else {
+                isCanSave.value = true
+                return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
             }
+        } else {
+            isCanSave.value = false
+        }
     }
-
-
-
 }
 
 //删除清单
@@ -769,13 +767,39 @@ const addModalSave = async () => {
     const { code, msg } = res
     if (code === 200) {
         window.$message.success('保存成功')
-        addModalClose()
+        continuousOperation()
         emit('finish')
     } else {
         window.$message.error(msg ?? '保存失败')
     }
 }
 
+//连续新增
+const continuousOperation = () => {
+    //处理数据
+    if (dataId.value ) {
+        addModalClose()
+    } else {
+        //清空数据
+        baseForm.value = { fileList: [], pictureUrl: '' }
+        addTableData.value = []
+        selectId.value = ''
+        isComparedRaVal.value = null
+        setStoreValue('checkRows', [])
+        setBasePeriodForm(period_id.value)
+        //树节点数据
+        const treeData = treeItemData.value
+        const { notExsitChild } = treeData
+        isLastChild.value = notExsitChild
+        nodeId.value = treeData.id
+        baseForm.value.contractUnitId = treeData.id
+        baseForm.value.fileList = []
+        ischangeByGetNode.value = false
+        getNodeDivide(treeData.id)
+        getCurrentNodeAllFormData(treeData.id)
+    }
+}
+
 //关闭弹窗
 const addModalClose = () => {
     isShow.value = false

+ 5 - 3
src/views/debit-pay/admin/middlepay.vue

@@ -69,7 +69,7 @@
 import { nextTick, onActivated, onMounted, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { useRoute, useRouter } from 'vue-router'
-import { getArrValue, getObjValue, getRandom } from 'js-fast-way'
+import { getArrValue, getObjVal, getObjValue, getRandom } from 'js-fast-way'
 import { getStoreValue, setStoreValue } from '~src/utils/storage'
 import { delMessage } from '~uti/tools'
 
@@ -138,10 +138,12 @@ const getKey1Data = async ()=>{
     })
     if (!error && code === 200) {
         let newArr = getArrValue(data), info = getObjValue(newArr[newArr.length - 1])
-        searchForm.value.contractPeriodId = periodId || info.id
-        approveStatus.value = info.approveStatus
         key1Data.value = newArr
         key1Data.value.unshift({ id: -1, periodNumber:'全部' })
+        //处理路由的记录值
+        let periodInfo = getObjVal(newArr.find((item) => item.id === periodId))
+        searchForm.value.contractPeriodId = periodInfo ? periodId : info.id
+        approveStatus.value = periodInfo ? periodInfo.approveStatus : info.approveStatus
     } else {
         key1Data.value = []
     }