Browse Source

页面增加缓存,对外报表增加读取数据功能

ljb 8 months ago
parent
commit
6fca918e60

+ 3 - 0
src/option/externalReports/107-1.js

@@ -8,6 +8,9 @@ export default {
   index: false,
   addBtn: false,
   delBtn: false,
+  refreshBtn: false,
+  gridBtn: false,
+  columnBtn: false,
   selection: false,
   searchLabelWidth: 140,
   labelWidth: 200,

+ 2 - 2
src/page/index/index.vue

@@ -18,9 +18,9 @@
         <!-- 主体视图层 -->
         <div style="height:100%;overflow-y:auto;overflow-x:hidden;" id="avue-view" v-show="!isSearch">
           <keep-alive>
-            <router-view class="avue-view" v-if="$route.meta.keepAlive"/>
+            <router-view />
           </keep-alive>
-          <router-view class="avue-view" v-if="!$route.meta.keepAlive"/>
+          <!-- <router-view class="avue-view" v-if="!$route.meta.keepAlive"/> -->
         </div>
       </div>
     </div>

+ 3 - 2
src/page/index/layout.vue

@@ -1,8 +1,9 @@
 <template>
   <div>
     <keep-alive>
-      <router-view class="avue-view" v-if="$route.meta.keepAlive" />
+      <!-- <router-view class="avue-view" v-if="$route.meta.keepAlive" /> -->
+      <router-view />
     </keep-alive>
-    <router-view class="avue-view" v-if="!$route.meta.keepAlive" />
+    <!-- <router-view class="avue-view" v-if="!$route.meta.keepAlive" /> -->
   </div>
 </template>

+ 34 - 21
src/views/external-reports/external-manage/107-1.vue

@@ -5,24 +5,34 @@
       v-on="onEvent"
       v-model="form"
       :page.sync="page"
+      class="crud1071"
     >
-      <template slot="menuLeft">
-        <el-button
-          type="warning"
-          size="small"
-          plain
-          icon="el-icon-download"
-          @click="handleExport"
-        >
-          导出
-        </el-button>
-      </template>
       <template slot="body">
         <h3 class="page-title">{{ pageTitle }}</h3>
-        <year-month-select
-          v-model="params.year"
-          :showMonth="false"
-        ></year-month-select>
+        <div style="display: flex; align-items: center;">
+          <year-month-select
+            v-model="params.year"
+            :showMonth="false"
+            style="margin-right: 16px;"
+          ></year-month-select>
+          <el-button
+            type="primary"
+            size="small"
+            @click="handleReady"
+          >
+            读取数据
+          </el-button>
+          <el-button
+            type="warning"
+            size="small"
+            plain
+            icon="el-icon-download"
+            @click="handleExport"
+          >
+            导出
+          </el-button>
+        </div>
+        
       </template>
     </avue-crud>
 
@@ -48,12 +58,6 @@ export default window.$crudCommon({
       },
     };
   },
-  watch: {
-    "params.year"() {
-      this.page.currentPage = 1;
-      this.getList(this.page);
-    },
-  },
   computed: {
     ...mapGetters(['tag']),
     pageTitle() {
@@ -62,6 +66,9 @@ export default window.$crudCommon({
     }
   },
   methods: {
+    handleReady() {
+      this.getList();
+    },
     loadData() {
         this.loading = true;
         this.api.getList(this.getSearchParams()).then(res => {
@@ -99,3 +106,9 @@ export default window.$crudCommon({
   name: "externalReports/107-1",
 });
 </script>
+
+<style lang="scss">
+.crud1071 .avue-crud__header {
+  min-height: 0;
+}
+</style>

+ 24 - 8
src/views/external-reports/external-manage/107-2.vue

@@ -1,12 +1,19 @@
 <template>
   <basic-container v-loading="loading">
     <div class="btn-wrap">
-      <el-button type="primary" icon="el-icon-edit" @click="handleSaveBtn">保存</el-button>
+      <el-button type="primary" icon="el-icon-edit" :loading="confirmLoading" @click="handleSaveBtn">保存</el-button>
     </div>
     <div class="doc-page">
       <h3 class="page-title" style="margin: 24px 0 16px">{{ pageTitle }}</h3>
-      <div style="display: flex; justify-content: space-between; margin: 12px 0;">
-        <year-month-select v-model="year" :showMonth="false" style="margin: 0;"></year-month-select>
+      <div style="display: flex;  margin: 12px 0;">
+        <year-month-select v-model="year" :showMonth="false" style="margin: 0 15px 0 0;"></year-month-select>
+        <el-button
+          type="primary"
+          size="small"
+          @click="handleReady"
+        >
+          读取数据
+        </el-button>
         <el-button
           type="warning"
           size="small"
@@ -490,16 +497,13 @@ export default {
   },
   data() {
     return {
+      isLoad: false, // 页面数据是否加载完成
       loading: false,
+      confirmLoading: false,
       year: "",
       formData: {},
     };
   },
-  watch: {
-    "year"() {
-      this.getData();
-    },
-  },
   computed: {
     ...mapGetters(['tag']),
     pageTitle() {
@@ -513,13 +517,22 @@ export default {
       getList({ year: this.year }).then(({ data }) => {
         this.loading = false;
         if (data.code == 200) {
+          this.isLoad = true;
           this.formData = data.data;
         }
       }).catch(() => {
         this.loading = false;
       });
     },
+    handleReady() {
+      this.getData();
+    },
     handleSaveBtn() {
+      if (!this.isLoad) {
+        this.$message.error("请读取页面数据,再保存!");
+        return;
+      }
+      this.confirmLoading = true;
       let params = {
         yearAndMonth: this.year,
         "d2": this.formData.d2,
@@ -544,10 +557,13 @@ export default {
         "d50": this.formData.d50,
       };
       update(params).then(({ data }) => {
+        this.confirmLoading = false;
         if (data.code == 200) {
           this.$message.success('保存成功!');
           this.getData();
         }
+      }).catch(err => {
+        this.confirmLoading = false;
       });
     },
     handleExport() {      

+ 23 - 7
src/views/external-reports/external-manage/high-comp-annual-report.vue

@@ -5,8 +5,15 @@
     </div>
     <div class="doc-page">
       <h3 class="page-title" style="margin: 24px 0 16px">{{ pageTitle }}</h3>
-      <div style="display: flex; justify-content: space-between; margin: 12px 0;">
-        <year-month-select v-model="year" :showMonth="false" style="margin: 0;"></year-month-select>
+      <div style="display: flex; margin: 12px 0;">
+        <year-month-select v-model="year" :showMonth="false" style="margin: 0 15px 0 0;"></year-month-select>
+        <el-button
+          type="primary"
+          size="small"
+          @click="handleReady"
+        >
+          读取数据
+        </el-button>
         <el-button
           type="warning"
           size="small"
@@ -181,15 +188,12 @@ export default {
   data() {
     return {
       loading: false,
+      isLoad: false,
+      confirmLoading: false,
       year: "",
       formData: {},
     };
   },
-  watch: {
-    "year"() {
-      this.getData();
-    },
-  },
   computed: {
     ...mapGetters(['tag']),
     pageTitle() {
@@ -198,11 +202,15 @@ export default {
     }
   },
   methods: {
+    handleReady() {
+      this.getData();
+    },
     getData() {
       this.loading = true;
       getList({ year: this.year }).then(({ data }) => {
         this.loading = false;
         if (data.code == 200) {
+          this.isLoad = true;
           this.formData = data.data;
         }
       }).catch(() => {
@@ -210,6 +218,11 @@ export default {
       });
     },
     handleSaveBtn() {
+      if (!this.isLoad) {
+        this.$message.error("请读取页面数据,再保存!");
+        return;
+      }
+      this.confirmLoading = true;
       let params = {
         yearAndMonth: this.year,
         d13: this.formData.d13,
@@ -217,10 +230,13 @@ export default {
         d16: this.formData.d16,
       };
       update(params).then(({ data }) => {
+        this.confirmLoading = false;
         if (data.code == 200) {
           this.$message.success('保存成功!');
           this.getData();
         }
+      }).catch(err => {
+        this.confirmLoading = false;
       });
     },
     handleExport() {

+ 23 - 7
src/views/external-reports/external-manage/high-comp-discount-details.vue

@@ -5,8 +5,15 @@
     </div>
     <div class="doc-page">
       <h3 class="page-title" style="margin: 24px 0 16px">{{ pageTitle }}</h3>
-      <div style="display: flex; justify-content: space-between; margin: 12px 0;">
-        <year-month-select v-model="year" :showMonth="false" style="margin: 0;"></year-month-select>
+      <div style="display: flex; margin: 12px 0;">
+        <year-month-select v-model="year" :showMonth="false" style="margin: 0 15px 0 0;"></year-month-select>
+        <el-button
+          type="primary"
+          size="small"
+          @click="handleReady"
+        >
+          读取数据
+        </el-button>
         <el-button
           type="warning"
           size="small"
@@ -314,16 +321,13 @@ export default {
   },
   data() {
     return {
+      isLoad: false,
       loading: false,
+      confirmLoading: false,
       year: "",
       formData: {}
     };
   },
-  watch: {
-    "year"() {
-      this.getData();
-    },
-  },
   computed: {
     ...mapGetters(['tag']),
     pageTitle() {
@@ -332,6 +336,9 @@ export default {
     }
   },
   methods: {
+    handleReady() {
+      this.getData();
+    },
     // 转译高新领域
     formatHighTechField(id) {
       return this.findLabelById(HIGH_TECH_FIELDS, id);
@@ -361,6 +368,7 @@ export default {
       getList({ year: this.year }).then(({ data }) => {
         this.loading = false;
         if (data.code == 200) {
+          this.isLoad = true;
           this.formData = data.data;
         }
       }).catch(() => {
@@ -368,6 +376,11 @@ export default {
       });
     },
     handleSaveBtn() {
+      if (!this.isLoad) {
+        this.$message.error("请读取页面数据,再保存!");
+        return;
+      }
+      this.confirmLoading = true;
       let params = {
         yearAndMonth: this.year,
         d5: this.formData.d5,
@@ -382,10 +395,13 @@ export default {
         d32: this.formData.d32,
       };
       update(params).then(({ data }) => {
+        this.confirmLoading = false;
         if (data.code == 200) {
           this.$message.success('保存成功!');
           this.getData();
         }
+      }).catch(err => {
+        this.confirmLoading = false;
       });
     },
     handleExport() {      

+ 24 - 8
src/views/external-reports/external-manage/jjkc-discount-details.vue

@@ -1,12 +1,19 @@
 <template>
   <basic-container v-loading="loading">
     <div class="btn-wrap">
-      <el-button type="primary" icon="el-icon-edit" @click="handleSaveBtn">保存</el-button>
+      <el-button type="primary" icon="el-icon-edit" :loading="confirmLoading" @click="handleSaveBtn">保存</el-button>
     </div>
     <div class="doc-page">
       <h3 class="page-title" style="margin: 24px 0 16px">{{ pageTitle }}</h3>
-      <div style="display: flex; justify-content: space-between; margin: 12px 0;">
-        <year-month-select v-model="year" :showMonth="false" style="margin: 0;"></year-month-select>
+      <div style="display: flex; margin: 12px 0;">
+        <year-month-select v-model="year" :showMonth="false" style="margin: 0 15px 0 0;"></year-month-select>
+        <el-button
+          type="primary"
+          size="small"
+          @click="handleReady"
+        >
+          读取数据
+        </el-button>
         <el-button
           type="warning"
           size="small"
@@ -319,16 +326,13 @@ export default {
   },
   data() {
     return {
+      isLoad: false,
       loading: false,
+      confirmLoading: false,
       year: "",
       formData: {}
     };
   },
-  watch: {
-    "year"() {
-      this.getData();
-    },
-  },
   computed: {
     ...mapGetters(['tag']),
     pageTitle() {
@@ -342,13 +346,22 @@ export default {
       getList({ year: this.year }).then(({ data }) => {
         this.loading = false;
         if (data.code == 200) {
+          this.isLoad = true;
           this.formData = data.data;
         }
       }).catch(() => {
         this.loading = false;
       });
     },
+    handleReady() {
+      this.getData();
+    },
     handleSaveBtn() {
+      if (!this.isLoad) {
+        this.$message.error("请读取页面数据,再保存!");
+        return;
+      }
+      this.confirmLoading = true;
       let params = {
         yearAndMonth: this.year,
         d43: this.formData.d43,
@@ -358,10 +371,13 @@ export default {
         d49: this.formData.d49,
       };
       update(params).then(({ data }) => {
+        this.confirmLoading = false;
         if (data.code == 200) {
           this.$message.success('保存成功!');
           this.getData();
         }
+      }).catch(err => {
+        this.confirmLoading = false;
       });
     },
     handleExport() {      

+ 1 - 1
src/views/project-manage/apply.vue

@@ -13,7 +13,7 @@ export default {
   },
   methods: {
     handleApplySucc() {
-      this.$router.push({ path: '/project-manage/project-list' });
+      this.$router.push({ path: '/project-manage/project-list?refresh=1' });
     }
   }
 }

+ 41 - 1
src/views/project-manage/components/apply-form.vue

@@ -69,6 +69,7 @@
             </td>
             <td colspan="3">
               <second-unit-cascader
+                ref="secondUnitCascader"
                 v-model="formData.xmsqdwid"
                 :yearAndMonth="yearAndMonth"
                 style="width: 100%;"
@@ -222,7 +223,22 @@ export default {
   data() {
     return {
       loading: false,
-      formData: {},
+      formData: {
+        xmmc: '',
+        xmbh: '',
+        xmkssj: '',
+        xmjssj: '',
+        xmsqdwid: [],
+        xmfzr: '',
+        yjlx: '',
+        xmly: '',
+        xmkzxs: '',
+        yqcgxs: [],
+        xmjsjjmb: [],
+        lxpw: [],
+        lxbg: [],
+        qtzl: []
+      },
 
       yearList: [],
       // 预算是否超出
@@ -520,6 +536,29 @@ export default {
 
       return errorText;
     },
+    handleResetBtn() {
+      this.yearList.forEach(year => {
+        this.formData[year] = '';
+      });
+      this.formData = {
+        xmmc: '',
+        xmbh: '',
+        xmkssj: '',
+        xmjssj: '',
+        xmsqdwid: [],
+        xmfzr: '',
+        yjlx: '',
+        xmly: '',
+        xmkzxs: '',
+        yqcgxs: [],
+        xmjsjjmb: [],
+        lxpw: [],
+        lxbg: [],
+        qtzl: []
+      };
+      this.yearList = [];
+      this.$refs.secondUnitCascader.cascaderVal = [];
+    },
     handleSaveBtn() {
       if (!this.operateType || this.operateType === 'add') {
         let errorText = this.validForm();
@@ -563,6 +602,7 @@ export default {
       func(params).then(({ data }) => {
         this.loading = false;
         if (data.code == 200) {
+          this.handleResetBtn();
           this.$emit('success', data.data);
           this.$message.success(this.operateType === 'edit' ? '修改成功!' : '保存成功!');
         }

+ 7 - 0
src/views/project-manage/project-list.vue

@@ -153,6 +153,13 @@ export default window.$crudCommon({
       return `${yearAndMonthCN}${this.tag.label}`
     },
   },
+  activated() {
+    const queryParams = this.$route.query;
+    if (queryParams.refresh) {
+      this.page.currentPage = 1;
+      this.loadData(this.page);
+    }
+  },
   methods: {
     handleCreateClick() {
       this.operateType = 'add',