Forráskód Böngészése

研发人员管理模块增加导出功能

ljb 9 hónapja%!(EXTRA string=óta)
szülő
commit
cab5c48dee

+ 11 - 12
src/views/tech-person/cy-person-roster.vue

@@ -82,19 +82,18 @@ export default window.$crudCommon({
       this.getList(this.page);
     }
   },
+  computed: {
+    pageTitle() {
+      let yearAndMonthCN = moment(this.params.yearAndMonth).format("yyyy年");
+      return `${yearAndMonthCN}技术人员花名册统计`
+    }
+  },
   methods: {
     handleExport() {
-      this.$confirm("是否导出吗?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      }).then(() => {
-        NProgress.start();
-        exportBloByPost(`/api/kd-scientific/technician/cyryhmc/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-          downloadXls(res.data, `${this.params.yearAndMonth}参研人员花名册.xlsx`);
-          NProgress.done();
-        })
-      });
+      exportBloByPost(`/api/kd-scientific/technician/cyryhmc-export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+        downloadXls(res.data, `${this.pageTitle}.xlsx`);
+        NProgress.done();
+      })
     },
     /**
      * 打印表格
@@ -102,7 +101,7 @@ export default window.$crudCommon({
      */
     printTable(isLandscape) {
       this.wideTableColumns = this.$refs.crud.columnOption;
-      this.printTitle = `${this.params.yearAndMonth}参研人员花名册`;
+      this.printTitle = `${this.pageTitle}`;
       this.$nextTick(() => {
         this.$refs.printWideTable.printTable(isLandscape);
       })

+ 19 - 13
src/views/tech-person/cy-person-sum-list.vue

@@ -30,7 +30,7 @@
       ref="printWideTable"
       :columns="wideTableColumns"
       :data="data"
-      :print-title="printTitle"
+      :print-title="pageTitle"
       :rows-per-page="30"
       :default-landscape="true"
     />
@@ -64,10 +64,25 @@ export default window.$crudCommon({
   },
   watch: {
     'params.yearAndMonth'(newVal) {
+      if (newVal.length > 4) {
+        // 是否勾选未全年
+        this.isSelAnnual = false;
+      } else {
+        this.isSelAnnual = true;
+      }
       this.page.currentPage = 1;
       this.getList(this.page);
     }
   },
+  computed: {
+    pageTitle() {
+      let yearAndMonthCN = moment(this.params.yearAndMonth).format("yyyy年MM月");
+      if (this.isSelAnnual) {
+        yearAndMonthCN = moment(this.params.yearAndMonth).format("yyyy年");
+      }
+      return `${yearAndMonthCN}项目参研人员汇总表`
+    }
+  },
   methods: {
     spanMethod({ row, column, rowIndex, columnIndex }) {
       let fields = ["xmmc"];
@@ -90,22 +105,13 @@ export default window.$crudCommon({
       }
     },
     handleExport() {
-      this.$confirm("是否导出吗?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      }).then(() => {
-        NProgress.start();
-        exportBloByPost(`/api/kd-scientific/technician/xmcyryhzb/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-          downloadXls(res.data, `${this.params.yearAndMonth}项目参研人员汇总表.xlsx`);
-          NProgress.done();
-        })
-      });
+      exportBloByPost(`/api/kd-scientific/technician/xmcyryhzb-export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+        downloadXls(res.data, `${this.pageTitle}.xlsx`);
+      })
     },
 
     printTable(isLandscape) {
       this.wideTableColumns = this.$refs.crud.columnOption;
-      this.printTitle = `${this.params.yearAndMonth}项目参研人员汇总表`;
       this.$nextTick(() => {
         this.$refs.printWideTable.printTable(isLandscape);
       })

+ 10 - 5
src/views/tech-person/high-tech-person-sum-list.vue

@@ -46,7 +46,7 @@
       ref="printWideTable"
       :columns="wideTableColumns"
       :data="data"
-      :print-title="printTitle"
+      :print-title="pageTitle"
       :rows-per-page="30"
       :default-landscape="true"
     />
@@ -54,7 +54,7 @@
 </template>
 
 <script>
-import {exportBlob} from "@/api/common";
+import {exportBloByPost} from "@/api/common";
 import YearMonthSelect from "@/components/year-month-select";
 import moment from "moment";
 import {getToken} from "@/util/auth";
@@ -81,6 +81,12 @@ export default window.$crudCommon({
       this.getList(this.page);
     }
   },
+  computed: {
+    pageTitle() {
+      let yearAndMonthCN = moment(this.params.yearAndMonth).format("yyyy年");
+      return `${yearAndMonthCN}年度高新科技人员汇总表`;
+    }
+  },
   methods: {
     getSearchParams() {
       let searchParams = { ...this.params, ...this.extraParams };
@@ -93,13 +99,12 @@ export default window.$crudCommon({
       return searchParams;
     },
     handleExport() {
-      exportBlob(`/api/kd-scientific/technician/ndgkjryhzb/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-        downloadXls(res.data, `${this.params.yearAndMonth}年度高新科技人员汇总表.xlsx`);
+      exportBloByPost(`/api/kd-scientific/technician/ndgkjryhzb-export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+        downloadXls(res.data, `${this.pageTitle}.xlsx`);
       });
     },
     printTable(isLandscape) {
       this.wideTableColumns = this.$refs.crud.columnOption;
-      this.printTitle = `${this.params.yearAndMonth}年度高新科技人员汇总表`;
       this.$nextTick(() => {
         this.$refs.printWideTable.printTable(isLandscape);
       });

+ 3 - 10
src/views/tech-person/month-cjcyry.vue

@@ -139,16 +139,9 @@ export default window.$crudCommon({
       });
     },
     handleExport() {
-      this.$confirm("是否导出吗?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      }).then(() => {
-        NProgress.start();
-        exportBloByPost(`/api/kd-scientific/technician/xm/monthly/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-          downloadXls(res.data, `${this.pageTitle}.xlsx`);
-          NProgress.done();
-        })
+      exportBloByPost(`/api/kd-scientific/technician/xm/monthly/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
+        downloadXls(res.data, `${this.pageTitle}.xlsx`);
+        NProgress.done();
       });
     },