scorpioyq 2 gadi atpakaļ
vecāks
revīzija
9ec7686285
1 mainītis faili ar 28 papildinājumiem un 21 dzēšanām
  1. 28 21
      src/views/home/component/params/params3.vue

+ 28 - 21
src/views/home/component/params/params3.vue

@@ -77,13 +77,16 @@
       </el-form>
     </div>
 
-    <el-dialog v-if='current' v-model='show' :title='  current.editType === 1 ?  current.year + "年度投资情况" : current.year + "年度纳统情况"' width='1260px'
-               @close='update(false)'>
+    <el-dialog v-if='current' v-model='show'
+               :title='  current.editType === 1 ?  current.year + "年度投资情况" : current.year + "年度纳统情况"'
+               width='1260px'>
       <div class='flex flex-center flex-align-start'>
         <div>
           <div class='padding-top'></div>
-          <div class='padding-top mt-20 mr-10 bold'>{{current.editType === 1 ? '月计划投资:':'月计划纳统投资:'}}</div>
-          <div class='padding-top mt-10 mr-10 bold'>{{current.editType === 1 ? '月完成投资:':'月完成纳统投资:'}}</div>
+          <div class='padding-top mt-20 mr-10 bold'>{{ current.editType === 1 ? '月计划投资:' : '月计划纳统投资:' }}
+          </div>
+          <div class='padding-top mt-10 mr-10 bold'>{{ current.editType === 1 ? '月完成投资:' : '月完成纳统投资:' }}
+          </div>
         </div>
         <div>
           <div class='mr-5  flex flex-center '>
@@ -109,7 +112,10 @@
           </div>
         </div>
       </div>
-      <div class='mt-20 full-width flex text-left red'>* 请按月份进行填报,单位:万元</div>
+      <div class='mt-20 full-width flex flex-justify-between'>
+        <span class="red">* 请按月份进行填报,单位:万元</span>
+        <base-button class="mr-20" title="保存" @click="update"/>
+      </div>
     </el-dialog>
   </div>
 </template>
@@ -119,7 +125,7 @@ import baseButton from '@/components/base-button.vue'
 
 export default {
   name: 'params3',
-  components: { baseButton },
+  components: {baseButton},
   props: {
     info: {
       type: Object,
@@ -132,7 +138,7 @@ export default {
   },
   watch: {
     detail: {
-      handler (val) {
+      handler(val) {
         if (Object.keys(val).length > 1) {
           this.init(val)
         }
@@ -140,7 +146,7 @@ export default {
       immediate: true
     },
     disabled: {
-      handler (val) {
+      handler(val) {
         if (val) {
           this.update(val !== true)
         }
@@ -148,7 +154,7 @@ export default {
       immediate: false
     }
   },
-  data () {
+  data() {
     return {
       show: false,
       disabled: true,
@@ -165,7 +171,7 @@ export default {
      *
      * @param type 1计划投资  2 纳统投资
      */
-    addYear (type) {
+    addYear(type) {
       this.disabled = false
       if (type === 1) {
         if (this.form.month_complete_amount.length === 0) {
@@ -190,18 +196,18 @@ export default {
       }
       console.log(this.form)
     },
-    nextYear (year) {
+    nextYear(year) {
       const tmp2 = {}
       tmp2.year = (year + 1).toString()
       tmp2.sum = ''
       tmp2.monthlyData = []
       for (let i = 1; i <= 12; i++) {
-        const item2 = { year: tmp2.year, data: '', month: i.toString() }
+        const item2 = {year: tmp2.year, data: '', month: i.toString()}
         tmp2.monthlyData.push(item2)
       }
       return tmp2
     },
-    init (res) {
+    init(res) {
       if (!Object.keys(res).includes('month_plan_investment')) {
         res.month_plan_investment = []
       }
@@ -263,11 +269,11 @@ export default {
       }
       this.form = res
     },
-    change (item) {
+    change(item) {
       this.form[item.code] = item.value
       this.form[item.code2] = item.value2
     },
-    update (show = Boolean) {
+    update(show = Boolean) {
       this.$nextTick(() => {
         this.form.projectId = this.form.id
         if (this.form.month_plan_complete_amount.length > 0) {
@@ -287,6 +293,7 @@ export default {
           if (res.code === 200) {
             if (show) {
               this.$message.success(res.msg)
+              this.show = false
             }
           } else {
             this.$message.error(res.msg)
@@ -300,9 +307,9 @@ export default {
      * @param type 1 年度投资 2 纳统投资
      * @param index 索引
      */
-    showMonth (year, type, index) {
+    showMonth(year, type, index) {
       this.$nextTick(() => {
-        const item = { editType: type, year, index }
+        const item = {editType: type, year, index}
         if (type === 1) {
           item.planMonths = this.form.month_plan_complete_amount.find(sub => sub.year === year).monthlyData
           item.months = this.form.month_complete_amount.find(sub => sub.year === year).monthlyData
@@ -314,12 +321,12 @@ export default {
         for (let i = 1; i <= 11; i++) {
           const index = this.current.months.findIndex(sub => sub.month === i.toString())
           if (index === -1 && this.current.months.length < 11) {
-            const ele = { month: i.toString(), data: '', year: '' }
+            const ele = {month: i.toString(), data: '', year: ''}
             this.current.months.push(ele)
           }
           const planIndex = this.current.planMonths.findIndex(sub => sub.month === i.toString())
           if (planIndex === -1 && this.current.planMonths.length < 11) {
-            const sub = { month: i.toString(), data: '', year: '' }
+            const sub = {month: i.toString(), data: '', year: ''}
             this.current.planMonths.push(sub)
           }
         }
@@ -332,7 +339,7 @@ export default {
      * @param type 1 计划 2 累计
      * current 1 年度投资 2 纳统投资
      */
-    changeMonth (res, type, index) {
+    changeMonth(res, type, index) {
       setTimeout(() => {
         if (this.current.editType === 1) {
           if (type === 1) {
@@ -349,7 +356,7 @@ export default {
         }
       }, 1000)
     },
-    getSum (list) {
+    getSum(list) {
       let sum = 0
       list.forEach(sub => {
         if (sub.data.length > 0) {