Browse Source

2023-08-27

wrc 2 years ago
parent
commit
e972404a1f
1 changed files with 57 additions and 9 deletions
  1. 57 9
      src/views/project/componens/info4.vue

+ 57 - 9
src/views/project/componens/info4.vue

@@ -5,11 +5,12 @@
     :edit-btn="true"
     @edit="change"
     @save="save"
-    @on-load="getFundsList(1)"
+    @on-load="getFundsList(this.type)"
   >
     <div
       class="full-width text-right main-color pointer"
       style="margin-top: -10px"
+      :style="styleObject"
       @click="openFundsList"
     >
       更多到位资金>>
@@ -134,28 +135,75 @@ export default {
   },
   data() {
     return {
+      styleObject: {
+        visibility: 'visible'
+      },
+      type: 1,
       disabled: true,
       data: {}
     }
   },
   methods: {
     getFundsList(type) {
+      this.type = type
+      if (type === 2) {
+        this.styleObject.visibility = 'hidden'
+      } else {
+        this.styleObject.visibility = 'visible'
+      }
       this.$api.funds
         .fundsList({ projectId: this.projectId, type: type })
         .then(res => {
           if (res.code === 200) {
-            this.data = res.data
+            if (type === 1) {
+              var t1,
+                t2,
+                t3,
+                t4,
+                t5,
+                t6,
+                t7,
+                t8,
+                t9 = 0
+              res.data().forEach(item => {
+                t1 = t1 + item.total
+                t2 = t2 + item.total
+                t3 = t3 + item.total
+                t4 = t4 + item.total
+                t5 = t5 + item.total
+                t6 = t6 + item.total
+                t6 = t6 + item.total
+                t7 = t7 + item.total
+                t8 = t8 + item.total
+                t9 = t9 + item.total
+              })
+              this.data.t1 = t1
+              this.data.t2 = t2
+              this.data.t3 = t3
+              this.data.t4 = t4
+              this.data.t5 = t5
+              this.data.t6 = t6
+              this.data.t7 = t7
+              this.data.t8 = t8
+              this.data.t9 = t9
+            } else {
+              // this.data = res.data.get(0)
+            }
           }
         })
     },
     save() {
-      this.$api.project.proUpdate(this.form).then(res => {
-        if (res.code === 200) {
-          this.$message.success(res.msg)
-        } else {
-          this.$message.error(res.msg)
-        }
-      })
+      if (this.type == 1) {
+        this.$api.project.proUpdate(this.form).then(res => {
+          if (res.code === 200) {
+            this.$message.success(res.msg)
+          } else {
+            this.$message.error(res.msg)
+          }
+        })
+      } else {
+        this.$message.warning('到位资金合计不可编辑!')
+      }
     },
     change(res) {
       this.disabled = res