Browse Source

fix export projectYear

scorpio 2 years ago
parent
commit
2ba2d950a1
2 changed files with 14 additions and 5 deletions
  1. 7 3
      src/views/home/component/dash.vue
  2. 7 2
      src/views/home/component/form_dialog.vue

+ 7 - 3
src/views/home/component/dash.vue

@@ -311,6 +311,7 @@
       @close="formDialogClose"
       @export="exportExcel"
       :ids="selectList"
+      :year="owerQuery.projectYear"
     />
     <summary-dialog
       :dialogType="diaType"
@@ -596,7 +597,6 @@ export default {
     })
     this.getTypeList()
     this.getNumList()
-    console.log(this.permissions.vaildPermission('projectApprovalBtn'))
   },
   unmounted() {
     sessionStorage.removeItem('selectList')
@@ -610,8 +610,13 @@ export default {
     },
     onLoad(query = {}) {
       this.loading = true
+      if (!Object.hasOwn(this.owerQuery, 'projectYear')) {
+        this.owerQuery.projectYear = new Date().getFullYear()
+      }
+      console.log(this.owerQuery)
       const data = { ...this.owerQuery, parentId: this.parentId }
       this.queryData = data
+      console.log(this.queryData)
       this.$api.project
         .projectList(this.page.currentPage, this.page.pageSize, this.queryData)
         .then(res => {
@@ -878,14 +883,13 @@ export default {
       this.diaType = -1
     },
     exportExcel(res, year) {
-      console.log(year)
       const data = Object.assign(
         { ...this.queryData },
         {
           columnName: res,
           projectIds: this.selectList.join(','),
           previewType: 1,
-          year
+          projectYear: year
         }
       )
       this.$router.push({ query: data, path: '/home/excel' })

+ 7 - 2
src/views/home/component/form_dialog.vue

@@ -244,6 +244,7 @@
           icon="el-icon-download"
           @click="exportExcel"
         />
+        {{ year }}
       </div>
     </el-dialog>
   </div>
@@ -266,6 +267,12 @@ export default {
     dialogType: {
       type: Number,
       default: -1
+    },
+    year: {
+      type: Number,
+      default: () => {
+        return new Date().getFullYear()
+      }
     }
   },
   watch: {
@@ -314,7 +321,6 @@ export default {
         size: 10
       },
       years: [],
-      year: '',
       months: [
         {
           name: '1-2月',
@@ -370,7 +376,6 @@ export default {
   methods: {
     init() {
       const tmp = new Date().getFullYear()
-      this.year = tmp
       for (let i = 0; i < tmp - 2017; i++) {
         const res = Number.parseInt(tmp) - i
         this.years.push(res)