Browse Source

编辑项目修改

duy 6 tháng trước cách đây
mục cha
commit
4143a545bd

+ 5 - 1
src/renderer/src/views/project/data.vue

@@ -272,7 +272,7 @@ const addAndEditForm = ref({})
 //新增、编辑提交
 const addAndEditSubmit = () => {
     getTableData()
-    addAndEditClose()
+    // addAndEditClose()
 }
 
 //新增、编辑关闭
@@ -280,6 +280,10 @@ const addAndEditClose = () => {
     isAddAndEditShow.value = false
     // addAndEditForm.value = {}
     searchForm.value.type = null
+    getTableData()
+    //     setTimeout(()=>{
+    //     window.location.reload()
+    //    }, 1000)
 }
 
 

+ 72 - 15
src/renderer/src/views/project/data/addAndEdit.vue

@@ -1,5 +1,5 @@
 <template>
-    <hc-drawer v-model="isShow" to-id="add-card-target" is-close>
+    <hc-drawer v-model="isShow" to-id="add-card-target" is-close @close="dialogClose">
         <div class="relative h-95% overflow-y-auto bg-#F2F3F5 p-2">
             <div>
                 <hc-icon class="text-18px text-black font-600" name="add-box" />
@@ -69,7 +69,8 @@
                     </template>
                     <div class="flex p-1 text-sm font-bold">
                         <hc-icon name="arrow-down" class="mr-1 text-lightBlue" /><div>现金流入 </div>
-                        <span class="ml-2 text-blue">共计:xxxx元</span>
+                     
+                        <span class="ml-2 mr-1 text-blue">共计:{{ yearFuns[selectIndex].inflowTotal }}</span><span class="ml-1 text-blue">万元</span>
                     </div>
                     <div class="cash-in-list mt-2 flex justify-between">
                         <div class="cash-in-list-item text-sm">
@@ -100,7 +101,7 @@
                     </div>
                     <div class="mt-2 flex p-1 text-sm font-bold">
                         <hc-icon name="arrow-up" class="mr-1 text-orange" /><div>现金流出</div>
-                        <span class="ml-2 text-blue">共计:xxxx元</span>
+                        <span class="ml-2 mr-1 text-blue">共计:{{ yearFuns[selectIndex].outflowTotal }}</span><span class="ml-1 text-blue">万元</span>
                     </div>
                     <div class="cash-in-list1 mt-2 flex justify-between">
                         <div class="cash-in-list-item text-sm">
@@ -158,7 +159,9 @@
                             <div class="flex items-center font-bold">
                                 <img :src="chengbenPng" class="icon-avatar mr-1">
                                 <div>经营成本</div>
-                                <span class="ml-2 text-blue">共计:xxxx元</span>
+                               
+                               
+                                <span class="ml-2 mr-1 text-blue">共计:{{ yearFuns[selectIndex].costTotal }}</span><span class="ml-1 text-blue">万元</span>
                             </div>
                             <div class="mt-1 w-full flex items-center justify-between">
                                 <span class="text-gray">养护、小修费</span>
@@ -263,13 +266,13 @@
         </div>
         <div class="mt-4 text-center">
             <el-button type="info" style="background-color: white; color: black; border-color: white" @click="dialogClose">退出</el-button>
-            <el-button type="primary" style="background-color: #2550A2; color: white; border-color: #2550A2" :loading="submitLoading" @click="dialogSubmit">保存</el-button>
+            <el-button type="primary" style="background-color: #2550A2; color: white; border-color: #2550A2" :loading="submitLoading" :disabled="data?.isView" @click="dialogSubmit">保存</el-button>
         </div>
     </hc-drawer>
 </template>
 
 <script setup>
-import { nextTick, ref, watch } from 'vue'
+import { computed, nextTick, ref, watch } from 'vue'
 import jianshePng from '~src/assets/view/jianshe.png'
 import sizePng from '~src/assets/view/size.png'
 import jiechangPng from '~src/assets/view/jiechang.png'
@@ -333,6 +336,9 @@ const yearFuns = ref([
             operateOtherOutflow: '',
             operationTaxesOutflow: '',
             otherOutflow: '',
+            inflowTotal:'',
+            outflowTotal:'',
+            costTotal:'',
         },
 ])
 const carList = ref([{
@@ -373,6 +379,7 @@ watch(() => stageYearOptions1.value, (newOptions) => {
 }, { immediate: true })
 
 
+
 const betweenTime = ref(null)
 const betweenTime1 = ref(null)
 //监听
@@ -393,6 +400,9 @@ watch(() => props.data, (data) => {
 
             year: '',
             tollInflow: '',
+            inflowTotal:'',
+            outflowTotal:'',
+            costTotal:'',
             otherInflow: '',
             constructInvestOutflow: '',
             constructProportionOutflow: '',
@@ -450,7 +460,6 @@ watch(isShow, (val) => {
 
 
 
-
 //日期时间被选择
 const betweenTimeUpdate = ({ arr, val, query }) => {
 
@@ -595,6 +604,44 @@ const getProOperationCompany = async () => {
     }
 }
 const selectIndex = ref(0)
+watch(
+    () => [yearFuns.value[selectIndex.value].tollInflow, yearFuns.value[selectIndex.value].otherInflow],
+    ([tollInflow, otherInflow]) => {
+        yearFuns.value[selectIndex.value].inflowTotal = (tollInflow || 0) + (otherInflow || 0)
+    },
+    { immediate: true },
+)
+watch([
+  () => yearFuns.value[selectIndex.value].operateMaintainOutflow,
+  () => yearFuns.value[selectIndex.value].operateOverhaulOutflow,
+  () => yearFuns.value[selectIndex.value].operateCapitalOutflow,
+  () => yearFuns.value[selectIndex.value].operateOperationOutflow,
+  () => yearFuns.value[selectIndex.value].operateOtherOutflow,
+], () => {
+    yearFuns.value[selectIndex.value].costTotal 
+    = Number(yearFuns.value[selectIndex.value].operateMaintainOutflow || 0)
+    + Number(yearFuns.value[selectIndex.value].operateOverhaulOutflow || 0)
+    + Number(yearFuns.value[selectIndex.value].operateCapitalOutflow || 0)
+    + Number(yearFuns.value[selectIndex.value].operateOperationOutflow || 0)
+    + Number(yearFuns.value[selectIndex.value].operateOtherOutflow || 0)
+}, { immediate: true })
+
+watch([
+  () => yearFuns.value[selectIndex.value].constructInvestOutflow,
+  () => yearFuns.value[selectIndex.value].borrowPrincipalOutflow,
+  () => yearFuns.value[selectIndex.value].borrowInterestOutflow,
+  () => yearFuns.value[selectIndex.value].costTotal,
+  () => yearFuns.value[selectIndex.value].operationTaxesOutflow,
+  () => yearFuns.value[selectIndex.value].otherOutflow,
+], () => {
+yearFuns.value[selectIndex.value].outflowTotal 
+  = Number(yearFuns.value[selectIndex.value].constructInvestOutflow || 0)
+  + Number(yearFuns.value[selectIndex.value].borrowPrincipalOutflow || 0)
+  + Number(yearFuns.value[selectIndex.value].borrowInterestOutflow || 0)
+  + Number(yearFuns.value[selectIndex.value].costTotal || 0)
+  + Number(yearFuns.value[selectIndex.value].operationTaxesOutflow || 0)
+  + Number(yearFuns.value[selectIndex.value].otherOutflow || 0)
+}, { immediate: true })
 const stageYearClick = async (val) => {
     if (yearFuns.value[selectIndex]) {
         yearFuns.value[selectIndex].year = val
@@ -610,7 +657,10 @@ const stageYearClick = async (val) => {
         // 如果当前索引位置没有数据,初始化一个空对象
         yearFuns.value[selectIndex.value] = {
             year: val,
+            inflowTotal:'',
             tollInflow: '',
+            outflowTotal:'',
+            costTotal:'',
             otherInflow: '',
             constructInvestOutflow: '',
             constructProportionOutflow: '',
@@ -684,6 +734,9 @@ const dialogSubmit = async () => {
             return {
                 year: stageYearOptions.value[0].value,
                 tollInflow: '',
+                inflowTotal:'',
+                outflowTotal:'',
+                costTotal:'',
                 otherInflow: '',
                 constructInvestOutflow: '',
                 constructProportionOutflow: '',
@@ -710,6 +763,9 @@ for (let i = 0; i < yearFuns.value.length; i++) {
   yearFuns.value[i] = {
                 year: stageYearOptions.value[i].value,
                 tollInflow: '',
+                inflowTotal:'',
+                outflowTotal:'',
+                costTotal:'',
                 otherInflow: '',
                 constructInvestOutflow: '',
                 constructProportionOutflow: '',
@@ -759,16 +815,16 @@ if (!carList.value[i]) {
     if (!error && code === 200) {
         window?.$message?.success(msg)
         //刷新页面
-       setTimeout(()=>{
-        window.location.reload()
-       }, 1000)
+    //    setTimeout(()=>{
+    //     window.location.reload()
+    //    }, 1000)
         // baseForm.value = {}
        
         
     } else {
         window.$message.error(msg ?? '操作失败')
     }
-    dialogClose()
+    // dialogClose()
     emit('finish')
   } else {
     submitLoading.value = true
@@ -778,16 +834,16 @@ if (!carList.value[i]) {
     submitLoading.value = false
     if (!error && code === 200) {
         window?.$message?.success(msg)
-        setTimeout(()=>{
-        window.location.reload()
-       }, 1000)
+    //     setTimeout(()=>{
+    //     window.location.reload()
+    //    }, 1000)
         // baseForm.value = {}
        
         
     } else {
         window.$message.error(msg ?? '操作失败')
     }
-    dialogClose()
+    // dialogClose()
     emit('finish')
   }
 }
@@ -797,6 +853,7 @@ const dialogClose = () => {
     isShow.value = false
     // baseForm.value = {}
     emit('close')
+   
 }
 </script>