Browse Source

首页增加刷新按钮

ljb 8 months ago
parent
commit
87aff35c3a
1 changed files with 16 additions and 9 deletions
  1. 16 9
      src/views/wel/index.vue

+ 16 - 9
src/views/wel/index.vue

@@ -1,10 +1,13 @@
 <template>
-  <div class="home-contain">
+  <div class="home-contain" v-loading="loading">
     
 
     <div style="position: relative; padding: 16px 0; background-color: #fff;">
       <div style="position: absolute; top: 20px; right: 20px; z-index: 99;">
-        <year-month-select v-model="currYear" :showMonth="false" style="margin: 0;" />
+        <div style="display: flex; align-items: center;">
+          <year-month-select v-model="currYear" :showMonth="false" style="margin: 0;" />
+          <el-button type="primary" size="mini" icon="el-icon-search" style="margin-left: 12px;" @click="handleSearchBtn">查询</el-button>
+        </div>
       </div>
 
       <el-row gutter="20">
@@ -119,6 +122,7 @@ export default {
       monthArr.push((i+1)+"月");
     }
     return {
+      loading: false,
       currYear: "",
       projectTotal: 0,
       costAmount: 0,
@@ -291,14 +295,13 @@ export default {
       this.getCyPersonListFunc();
     }
   },
-  mounted() {
-    // this.initProjectStatusOptions();
-    // this.initRdPersonOptions();
-    // this.initZscqOptions();
-    // this.initYfffChartOptions();
-
-  },
   methods: {
+    handleSearchBtn() {
+      this.getProjectListByYearFunc();
+      this.getCostSummaryListFunc();
+      this.getZlListFunc();
+      this.getCyPersonListFunc();
+    },
     getProjectListByYearFunc() {
       getProjectListByYear({ year: this.currYear }).then(({ data }) => {
         let _projectList = data.data;
@@ -314,7 +317,9 @@ export default {
     },
     // 获取费用统计数据
     getCostSummaryListFunc() {
+      this.loading = true;
       getCostSummaryList({ yearAndMonth: `${this.currYear}12` }).then(({ data }) => {
+        this.loading = false;
         let costList = data.data;
 
         let ryrgfyTotal = new Decimal(0); // 人员人工费用
@@ -403,6 +408,8 @@ export default {
             }
           ]
         }
+      }).catch(err => {
+        this.loading = false;
       })
     },
     // 获取专利数据