Browse Source

年份切换问题

ljb 6 months ago
parent
commit
2417651a5d

+ 3 - 2
src/components/year-month-select/index.vue

@@ -70,10 +70,11 @@ export default {
     },
     year(newVal) {
       this.$emit("input", this.formatYearMonth(newVal, this.month));
+      this.$store.commit("SET_PAGEYEAR", newVal.substr(0, 4));
     },
   },
   computed: {
-    ...mapGetters(['vipYearList']),
+    ...mapGetters(['vipYearList', 'pageYear']),
     datePickerOptions() {
       return {
         disabledDate: time => {
@@ -124,7 +125,7 @@ export default {
       } else {
         targetYear = target.minGreaterThanTarget || target.maxLessThanTarget;
       }
-      this.year = targetYear.toString();
+      this.year = this.pageYear || targetYear.toString();
       this.month = currMonthStr;
 
       this.$emit("input", this.formatYearMonth(this.year, this.month));

+ 5 - 1
src/mixins/crud.js

@@ -20,7 +20,7 @@ export default (app, option = {}) => {
       }
     },
     computed: {
-      ...mapGetters(['userInfo', 'permission', 'roles']),
+      ...mapGetters(['userInfo', 'permission', 'roles', 'pageYear']),
       ids() {
         const ids = [];
         this.selectionList.forEach(ele => {
@@ -61,6 +61,10 @@ export default (app, option = {}) => {
           this.$refs.crud.doLayout();
         });
       }
+      console.log(this.params.yearAndMonth)
+      if (this.params.yearAndMonth != this.pageYear) {
+        this.params.yearAndMonth = this.pageYear + this.params.yearAndMonth.substring(4, 6);
+      }
     },
     methods: {
       getList() {

+ 2 - 1
src/store/getters.js

@@ -25,6 +25,7 @@ const getters = {
   logsLen: state => state.logs.logsList.length || 0,
   logsFlag: (state, getters) => getters.logsLen === 0,
   flowRoutes: state => state.dict.flowRoutes,
-  vipYearList: state => state.user.vipYearList
+  vipYearList: state => state.user.vipYearList,
+  pageYear: state => state.common.pageYear,
 }
 export default getters

+ 4 - 0
src/store/modules/common.js

@@ -28,8 +28,12 @@ const common = {
     themeName: getStore({name: 'themeName'}) || 'theme-bule',
     lockPasswd: getStore({name: 'lockPasswd'}) || '',
     website: website,
+    pageYear: '',
   },
   mutations: {
+    SET_PAGEYEAR: (state, year) => {
+      state.pageYear = year;
+    },
     SET_LANGUAGE: (state, language) => {
       state.language = language
       setStore({

+ 7 - 7
src/views/archive-manage/archive-list.vue

@@ -40,7 +40,7 @@
       
       <template slot="body">
         <h3 class="page-title">{{ pageTitle }}</h3>
-        <year-month-select v-model="params.year" :showMonth="false"></year-month-select>
+        <year-month-select v-model="params.yearAndMonth" :showMonth="false"></year-month-select>
       </template>
       
     </avue-crud>
@@ -76,7 +76,7 @@ export default window.$crudCommon({
   data() {
     return {
       params: {
-        year: "",
+        yearAndMonth: "",
       },
       isSelAnnual: false,
 
@@ -148,14 +148,14 @@ export default window.$crudCommon({
     };
   },
   watch: {
-    'params.year'() {
+    'params.yearAndMonth'() {
       this.getList();
     },
   },
   computed: {
     ...mapGetters(['tag', 'userInfo']),
     pageTitle() {
-      let yearCN = this.params.year ? moment(this.params.year).format('yyyy年') : ''
+      let yearCN = this.params.yearAndMonth ? moment(this.params.yearAndMonth).format('yyyy年') : ''
       return `${yearCN}${this.tag.label}`
     }
   },
@@ -169,10 +169,10 @@ export default window.$crudCommon({
         1: '高新备查资料',
         2: '加计扣除备查资料'
       };
-      let storeName = `taskType${type}_${this.params.year}_${this.userInfo.tenant_id}`;
+      let storeName = `taskType${type}_${this.params.yearAndMonth}_${this.userInfo.tenant_id}`;
       let taskId = getStore({ name: storeName }) || undefined;
       this.confirmLoading = true;
-      generateTaskId({ yearAndMonth: this.params.year, type, id: taskId }).then(taskRes => {
+      generateTaskId({ yearAndMonth: this.params.yearAndMonth, type, id: taskId }).then(taskRes => {
         if (taskRes.data.code == 200) {
           const { id, status, fileSize } = taskRes.data.data;
           let taskId = id;
@@ -184,7 +184,7 @@ export default window.$crudCommon({
               const progress = Math.round((progressEvent.loaded * 100) / fileSize);
               this.downPercent = progress;
             }).then(res => {
-              downloadXls(res.data, `${this.params.year}年${fileNameObj[type]}.zip`);
+              downloadXls(res.data, `${this.params.yearAndMonth}年${fileNameObj[type]}.zip`);
 
                 this.$message.success("下载成功");
                 this.confirmLoading = false;

+ 9 - 12
src/views/archive-manage/file-supplement.vue

@@ -28,7 +28,7 @@
 
       <template slot="body">
         <h3 class="page-title">{{ pageTitle }}</h3>
-        <year-month-select v-model="params.year" :showMonth="false"></year-month-select>
+        <year-month-select v-model="params.yearAndMonth" :showMonth="false"></year-month-select>
       </template>
 
       <!-- <template slot="menu" slot-scope="{row}">
@@ -75,7 +75,7 @@ export default window.$crudCommon({
   data() {
     return {
       params: {
-        year: "",
+        yearAndMonth: "",
       },
       isSelAnnual: false,
 
@@ -86,14 +86,14 @@ export default window.$crudCommon({
     };
   },
   watch: {
-    'params.year'() {
+    'params.yearAndMonth'() {
       this.getList();
     },
   },
   computed: {
     ...mapGetters(['tag']),
     pageTitle() {
-      let yearCN = this.params.year ? moment(this.params.year).format('yyyy年') : ''
+      let yearCN = this.params.yearAndMonth ? moment(this.params.yearAndMonth).format('yyyy年') : ''
       return `${yearCN}${this.tag.label}`
     }
   },
@@ -113,7 +113,9 @@ export default window.$crudCommon({
   methods: {
     loadData() {
       this.loading = true;
-      this.api.getList(this.getSearchParams()).then(({ data }) => {
+      const params = { ...this.getSearchParams(), year: this.params.yearAndMonth };
+      delete params.yearAndMonth;
+      this.api.getList(params).then(({ data }) => {
         
         if (data.code == 200) {
           let list = [{
@@ -193,16 +195,11 @@ export default window.$crudCommon({
       this.currIndex = this.form.$index + 1;
       done();
     },
-    // handleExport() {
-    //   exportBlob(`/api/kd-scientific/fjbczl/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-    //     downloadXls(res.data, `${this.params.year}附件补充.xlsx`);
-    //   });
-    // },
     handleDownFile(file) {
       downloadFileByUrl(file.value, file.label);
     },
     handleDownAll() {
-      let downParams = { year: this.params.year };
+      let downParams = { year: this.params.yearAndMonth };
       const loading = this.$loading({
         lock: true,
         text: '文件正在下载中,请耐心等待...',
@@ -233,7 +230,7 @@ export default window.$crudCommon({
       
     },
     getFormData() {
-      return { id: this.form.id, yearAndMonth: this.params.year, [`${this.form.rowIndex}`]: JSON.stringify(this.form.fileList) }
+      return { id: this.form.id, yearAndMonth: this.params.yearAndMonth, [`${this.form.rowIndex}`]: JSON.stringify(this.form.fileList) }
     },
     handleDownTemp(templateKey) {
       getDictValueByKey('fjbczl-template', templateKey).then(({ data }) => {

+ 8 - 6
src/views/external-reports/external-manage/107-1.vue

@@ -11,7 +11,7 @@
         <h3 class="page-title">{{ pageTitle }}</h3>
         <div style="display: flex; align-items: center;">
           <year-month-select
-            v-model="params.year"
+            v-model="params.yearAndMonth"
             :showMonth="false"
             style="margin-right: 16px;"
           ></year-month-select>
@@ -54,19 +54,19 @@ export default window.$crudCommon({
   data() {
     return {
       params: {
-        year: "",
+        yearAndMonth: "",
       },
     };
   },
   computed: {
     ...mapGetters(['tag']),
     pageTitle() {
-      let yearCN = this.params.year ? moment(this.params.year).format('yyyy年') : '';
+      let yearCN = this.params.yearAndMonth ? moment(this.params.yearAndMonth).format('yyyy年') : '';
       return `${yearCN}${this.tag.label}`
     }
   },
   watch: {
-    "params.year"(nweVal) {
+    "params.yearAndMonth"(nweVal) {
       this.getList();
     }
   },
@@ -76,7 +76,9 @@ export default window.$crudCommon({
     },
     loadData() {
         this.loading = true;
-        this.api.getList(this.getSearchParams()).then(res => {
+        const params = { ...this.getSearchParams(), year: this.params.yearAndMonth };
+        delete params.yearAndMonth;
+        this.api.getList(params).then(res => {
           this.loading = false;
           if (res.data.code == 200) {
             this.data = res.data.data.map((item, idx) => {
@@ -89,7 +91,7 @@ export default window.$crudCommon({
         })
       },
     getFormData() {
-      return { yearAndMonth: this.params.year, xmId: this.form.xmId, id: this.form.id, xmStage: this.form.xmStageField, govBonus: this.form.govBonusField };
+      return { yearAndMonth: this.params.yearAndMonth, xmId: this.form.xmId, id: this.form.id, xmStage: this.form.xmStageField, govBonus: this.form.govBonusField };
     },
     handleExport() {
       exportBlob(

+ 6 - 1
src/views/external-reports/external-manage/107-2.vue

@@ -506,7 +506,7 @@ export default {
     };
   },
   computed: {
-    ...mapGetters(['tag']),
+    ...mapGetters(['tag', 'pageYear']),
     pageTitle() {
       let yearCN = this.year ? moment(this.year).format('yyyy年') : '';
       return `${yearCN}${this.tag.label}`
@@ -517,6 +517,11 @@ export default {
       this.getData();
     }
   },
+  activated() {
+    if (this.year != this.pageYear) {
+      this.year = this.pageYear
+    }
+  },
   methods: {
     getData() {
       this.loading = true;

+ 6 - 1
src/views/external-reports/external-manage/high-comp-annual-report.vue

@@ -372,7 +372,7 @@ export default {
     };
   },
   computed: {
-    ...mapGetters(['tag']),
+    ...mapGetters(['tag', 'pageYear']),
     pageTitle() {
       let yearCN = this.year ? moment(this.year).format('yyyy年') : '';
       return `${yearCN}${this.tag.label}`
@@ -383,6 +383,11 @@ export default {
       this.getData();
     }
   },
+  activated() {
+    if (this.year != this.pageYear) {
+      this.year = this.pageYear
+    }
+  },
   methods: {
     handleReady() {
       this.getData();

+ 6 - 1
src/views/external-reports/external-manage/high-comp-discount-details.vue

@@ -329,7 +329,7 @@ export default {
     };
   },
   computed: {
-    ...mapGetters(['tag']),
+    ...mapGetters(['tag', 'pageYear']),
     pageTitle() {
       let yearCN = this.year ? moment(this.year).format('yyyy年') : '';
       return `${yearCN}${this.tag.label}`
@@ -340,6 +340,11 @@ export default {
       this.getData();
     }
   },
+  activated() {
+    if (this.year != this.pageYear) {
+      this.year = this.pageYear
+    }
+  },
   methods: {
     handleReady() {
       this.getData();

+ 6 - 1
src/views/external-reports/external-manage/jjkc-discount-details.vue

@@ -334,7 +334,7 @@ export default {
     };
   },
   computed: {
-    ...mapGetters(['tag']),
+    ...mapGetters(['tag', 'pageYear']),
     pageTitle() {
       let yearCN = this.year ? moment(this.year).format('yyyy年') : '';
       return `${yearCN}${this.tag.label}`
@@ -345,6 +345,11 @@ export default {
       this.getData();
     }
   },
+  activated() {
+    if (this.year != this.pageYear) {
+      this.year = this.pageYear
+    }
+  },
   methods: {
     getData() {
       this.loading = true;

+ 6 - 1
src/views/external-reports/external-manage/torch-develop-annual-report.vue

@@ -651,12 +651,17 @@ export default {
     },
   },
   computed: {
-    ...mapGetters(['tag']),
+    ...mapGetters(['tag', 'pageYear']),
     pageTitle() {
       let yearCN = this.yearAndMonth ? moment(this.yearAndMonth).format('yyyy年') : '';
       return `${yearCN}${this.tag.label}`
     }
   },
+  activated() {
+    if (this.yearAndMonth != this.pageYear) {
+      this.yearAndMonth = this.pageYear
+    }
+  },
   methods: {
     getAttachmentListFunc(year) {
       getAttachmentList(year).then(({ data }) => {

+ 6 - 1
src/views/external-reports/high-tech/gx-auxiliary-details.vue

@@ -79,12 +79,17 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['tag']),
+    ...mapGetters(['tag', 'pageYear']),
     pageTitle() {
       let yearAndMonthCN = this.yearAndMonth ? moment(this.yearAndMonth).format('yyyy年MM月') : '';
       return `${yearAndMonthCN}${this.tag.label}`;
     }
   },
+  activated() {
+    if (this.yearAndMonth != this.pageYear) {
+      this.yearAndMonth = this.pageYear + this.yearAndMonth.substring(4, 6);
+    }
+  },
   methods: {
     loadData() {
       let params = { ...this.params };

+ 6 - 1
src/views/external-reports/jjkc-standards/jjkc-auxiliary-details.vue

@@ -103,12 +103,17 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['tag']),
+    ...mapGetters(['tag', 'pageYear']),
     pageTitle() {
       let yearAndMonthCN = this.yearAndMonth ? moment(this.yearAndMonth).format('yyyy年MM月') : '';
       return `${yearAndMonthCN}${this.tag.label}`;
     },
   },
+  activated() {
+    if (this.yearAndMonth != this.pageYear) {
+      this.yearAndMonth = this.pageYear + this.yearAndMonth.substring(4, 6);
+    }
+  },
   methods: {
     loadData() {
       let params = { ...this.params, type: this.costType };

+ 6 - 1
src/views/external-reports/kj-standards/kj-auxiliary-details.vue

@@ -85,13 +85,18 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['tag']),
+    ...mapGetters(['tag', 'pageYear']),
     pageTitle() {
       let yearAndMonthCN = this.yearAndMonth ? moment(this.yearAndMonth).format("yyyy年MM月") : '';
 
       return `${yearAndMonthCN}${this.tag.label}`;
     }
   },
+  activated() {
+    if (this.yearAndMonth != this.pageYear) {
+      this.yearAndMonth = this.pageYear + this.yearAndMonth.substring(4, 6);
+    }
+  },
   methods: {
     loadData() {
       let params = { ...this.params };

+ 6 - 1
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/cl-cost/components/common-page.vue

@@ -124,12 +124,17 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['tag']),
+    ...mapGetters(['tag', 'pageYear']),
     pageTitle() {
       let yearAndMonthCN = this.yearAndMonth ? moment(this.yearAndMonth).format('yyyy年MM月') : '';
       return `${yearAndMonthCN}${this.tag.label}`.replace(/每月/g, '');
     }
   },
+  activated() {
+    if (this.yearAndMonth != this.pageYear) {
+      this.yearAndMonth = this.pageYear + this.yearAndMonth.substring(4, 6);
+    }
+  },
   methods: {
     loadData() {
       let params = { ...this.params };

+ 6 - 1
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/dev-cost/yf-lease-allocation-list.vue

@@ -119,12 +119,17 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['tag']),
+    ...mapGetters(['tag', 'pageYear']),
     pageTitle() {
       let yearAndMonthCN = moment(this.params.yearAndMonth).format('yyyy年MM月');
       return `${yearAndMonthCN}${this.tag.label}`.replace(/每月/g, '');
     }
   },
+  activated() {
+    if (this.yearAndMonth != this.pageYear) {
+      this.yearAndMonth = this.pageYear + this.yearAndMonth.substring(4, 6);
+    }
+  },
   methods: {
     loadData() {
       let params = { ...this.params };