scorpio 2 år sedan
förälder
incheckning
786e58f686
1 ändrade filer med 34 tillägg och 24 borttagningar
  1. 34 24
      src/views/home/component/params/params7.vue

+ 34 - 24
src/views/home/component/params/params7.vue

@@ -3,6 +3,12 @@
     <!-- title and btn -->
     <div class="flex flex-center full-width flex-justify-between mt-10 mb-10">
       <span class="full-width text-left bold">{{ info.dictValue }}</span>
+      <el-button
+        v-if="detail.can_update"
+        type="primary"
+        @click="disabled = !disabled"
+        >{{ disabled ? '编 辑' : '保 存' }}
+      </el-button>
     </div>
     <!-- content list -->
     <div style="width: 93%" class="mt-20">
@@ -18,17 +24,19 @@
         <div
           v-for="(item, index) in amount"
           :key="item"
-          class="flex flex-center full-width"
+          class="flex flex-center full-width mb-10 mt-10"
         >
           <div
-            class="flex flex-justify-start flex-align-center full-width flex-child-average mb-20"
+            class="flex flex-justify-start flex-align-center full-width flex-child-average"
           >
             <div class="value flex flex-justify-end">
               {{ item.year }}年度计划投资(万元)
             </div>
-            <div class="ml-20 value-box flex flex-justify-start">
-              {{ item.planSum }}
-            </div>
+            <el-input
+              v-model="item.planSum"
+              type="number"
+              :disabled="disabled"
+            ></el-input>
           </div>
 
           <div
@@ -64,11 +72,11 @@
     </div>
 
     <div style="width: 90%" class="mt-20">
-      <div class="flex flex-justify-start border padding flex-col mb-10">
+      <div class="flex flex-justify-start border padding flex-col mb-10 mt-10">
         <div
           v-for="(item, index) in investment"
           :key="item"
-          class="flex flex-center full-width mb-20"
+          class="flex flex-center full-width mb-10 mt-10"
         >
           <div
             class="flex flex-justify-start flex-align-center full-width flex-child-average"
@@ -76,9 +84,11 @@
             <div class="value flex flex-justify-end">
               {{ item.year }}年度计划纳统投资(万元)
             </div>
-            <div class="ml-20 value-box flex flex-justify-start">
-              {{ item.planSum }}
-            </div>
+            <el-input
+              type="number"
+              v-model="item.planSum"
+              :disabled="disabled"
+            ></el-input>
           </div>
 
           <div
@@ -184,6 +194,13 @@ export default {
           this.investment = val.investment.data
         }
       }
+    },
+    disabled: {
+      handler(val) {
+        if (val) {
+          this.save()
+        }
+      }
     }
   },
   data() {
@@ -241,38 +258,26 @@ export default {
       this.show = !this.show
     },
     save() {
-      if (this.currentMonth.updateType === 1) {
+      if (this.currentMonth && this.currentMonth.updateType === 1) {
         this.form.amount.data[this.currentMonth.updateIndex].monthData =
           this.currentMonth.monthData.map(sub => {
             sub.planData = Number.parseInt(sub.planData)
             sub.actualData = Number.parseInt(sub.actualData)
             return sub
           })
-        this.form.amount.data[this.currentMonth.updateIndex].planSum =
-          this.getSum(
-            this.form.amount.data[this.currentMonth.updateIndex].monthData.map(
-              sub => sub.planData
-            )
-          )
         this.form.amount.data[this.currentMonth.updateIndex].actualSum =
           this.getSum(
             this.form.amount.data[this.currentMonth.updateIndex].monthData.map(
               sub => sub.actualData
             )
           )
-      } else if (this.currentMonth.updateType === 2) {
+      } else if (this.currentMonth && this.currentMonth.updateType === 2) {
         this.form.investment.data[this.currentMonth.updateIndex].monthData =
           this.currentMonth.monthData.map(sub => {
             sub.planData = Number.parseInt(sub.planData)
             sub.actualData = Number.parseInt(sub.actualData)
             return sub
           })
-        this.form.investment.data[this.currentMonth.updateIndex].planSum =
-          this.getSum(
-            this.form.investment.data[
-              this.currentMonth.updateIndex
-            ].monthData.map(sub => sub.planData)
-          )
         this.form.investment.data[this.currentMonth.updateIndex].actualSum =
           this.getSum(
             this.form.investment.data[
@@ -304,11 +309,16 @@ export default {
 .value {
   width: 300px;
 }
+
+:deep(.el-input.is-disabled .el-input__inner) {
+  color: #343434;
+}
 .value-box {
   width: 100%;
   background-color: #f5f7fa;
   border-radius: 4px;
   padding: 10px 10px;
+  border: #e5e7ec solid 1px;
 }
 .month-box {
   width: 90px;