Browse Source

档案中心下载

ljb 8 months ago
parent
commit
4fc76b44d6

+ 9 - 0
src/api/achiveManage/archiveList.js

@@ -10,6 +10,15 @@ export const getList = (params) => {
   })
 }
 
+// 生成任务id
+export const generateTaskId = data => {
+  return request({
+    url: '/api/kd-scientific/archive/generate',
+    method: 'post',
+    data
+  })
+}
+
 export const downAllFile = (params) => {
   return request({
     url: '/api/kd-scientific/archive/center/download',

+ 21 - 20
src/option/achiveManage/archiveList.js

@@ -19,32 +19,33 @@ export default {
   dialogClickModal: false,
   dialogType: "drawer",
   dialogWidth: 520,
+  menu: false,
   column: [
     {
       label: '档案资料',
       prop: 'fileName',
-      width: 600,
+      minWidth: 600,
       span: 24,
       editDisabled: true,
     },
-    {
-      label: '附件',
-      prop: 'fileList',
-      type: "upload",
-      multiple: true,
-      span: 24,
-      minWidth: 300,
-      action: '/api/kd-resource/oss/endpoint/put-file',
-      dataType: "object",
-      propsHttp: {
-        url: "link",
-        name: "originalName",
-        res: "data",
-      },
-      uploadPreview: (file, column, done) => {
-        downloadFileByUrl(file.url, file.name);
-        return;
-      },
-    },
+    // {
+    //   label: '附件',
+    //   prop: 'fileList',
+    //   type: "upload",
+    //   multiple: true,
+    //   span: 24,
+    //   minWidth: 300,
+    //   action: '/api/kd-resource/oss/endpoint/put-file',
+    //   dataType: "object",
+    //   propsHttp: {
+    //     url: "link",
+    //     name: "originalName",
+    //     res: "data",
+    //   },
+    //   uploadPreview: (file, column, done) => {
+    //     downloadFileByUrl(file.url, file.name);
+    //     return;
+    //   },
+    // },
   ],
 };

+ 1 - 1
src/router/axios.js

@@ -23,7 +23,7 @@ import crypto from '@/util/crypto';
 let isErrorShown = false;
 
 //默认超时时间
-axios.defaults.timeout = 100000;
+axios.defaults.timeout = 30 * 1000 * 60; // 设置超时时间为30分钟
 //返回其他状态码
 axios.defaults.validateStatus = function (status) {
   return status >= 200 && status <= 500;

+ 32 - 14
src/views/archive-manage/archive-list.vue

@@ -11,7 +11,7 @@
           type="primary"
           size="small"
           icon="el-icon-download"
-          @click="handleDownAll('/api/kd-scientific/archive/center/download')"
+          @click="handleDownAll('/api/kd-scientific/archive/center/download', 0)"
         >
           一键下载
         </el-button>
@@ -20,7 +20,7 @@
           size="small"
           plain
           icon="el-icon-download"
-          @click="handleDownAll('/api/kd-scientific/archive/center/high-tech/download')"
+          @click="handleDownAll('/api/kd-scientific/archive/center/high-tech/download', 1)"
         >
           一键导出高新备查
         </el-button>
@@ -29,7 +29,7 @@
           size="small"
           plain
           icon="el-icon-download"
-          @click="handleDownAll('/api/kd-scientific/archive/center/deduction/download')"
+          @click="handleDownAll('/api/kd-scientific/archive/center/deduction/download', 2)"
         >
           一键导出加计备查
         </el-button>
@@ -41,9 +41,9 @@
         <year-month-select v-model="params.year" :showMonth="false"></year-month-select>
       </template>
 
-      <template slot="menu" slot-scope="{row}">
+      <!-- <template slot="menu" slot-scope="{row}">
         <el-button type="text" icon="el-icon-download" size="mini" @click="handleRowDown(row)">下载</el-button>
-      </template>
+      </template> -->
 
       <template slot="fileList" slot-scope="{row}">
         <el-link
@@ -68,8 +68,9 @@ import {getToken} from "@/util/auth";
 import {downloadXls, downloadFileByUrl} from "@/util/util";
 import moment from "moment";
 import { getDictValueByKey } from '@/api/system/dict';
-import { downAllFile } from "@/api/achiveManage/archiveList"
+import { generateTaskId, downAllFile } from "@/api/achiveManage/archiveList"
 import { mapGetters } from "vuex";
+import {setStore, getStore, removeStore} from '@/util/store'
 
 
 export default window.$crudCommon({
@@ -239,14 +240,31 @@ export default window.$crudCommon({
     handleDownFile(file) {
       downloadFileByUrl(file.value, file.label);
     },
-    handleDownAll(downUrl) {
-      // let downParams = { year: this.params.year };
-      // exportBlob(`${downUrl}?${this.website.tokenHeader}=${getToken()}`, downParams).then(res => {
-      //   downloadXls(res.data, `${this.pageTitle}.zip`);
-      // });
-      downAllFile({ year: this.params.year }).then(res => {
-        console.log(res)
-      })
+    handleDownAll(downUrl, type) {
+      let fileNameObj = {
+        0: '全部档案资料',
+        1: '高新备查资料',
+        2: '加计扣除备查资料'
+      };
+      if (type) {}
+      let storeName = `taskType${type}`;
+      let taskId = getStore({ name: storeName });
+      if (taskId) {
+        exportBlob(`${downUrl}?${this.website.tokenHeader}=${getToken()}`, { taskId }).then(res => {
+          downloadXls(res.data, `${this.params.year}年${fileNameObj[type]}.zip`);
+        });
+      } else {
+        generateTaskId({ yearAndMonth: this.params.year, type: 0 }).then(res => {
+          if (res.data.code == 200) {
+            let taskId = res.data.data.id;
+            setStore({ name: storeName, content: taskId });
+            exportBlob(`${downUrl}?${this.website.tokenHeader}=${getToken()}`, { taskId }).then(res => {
+              downloadXls(res.data, `${this.params.year}年${fileNameObj[type]}.zip`);
+            });
+          }
+          
+        })
+      }
     },
     handleRowDown() {
       this.$message.warning("功能建设中...");

+ 1 - 1
src/views/project-manage/components/wxzctx-cost.vue

@@ -217,7 +217,7 @@ export default window.$crudCommon({
   res: ({ data }) => {
     data.records = data.records.map(item => {
       item.zcmc = item.zcEntity ? item.zcEntity.zcmc : '';
-      item.zcbm = item.zcEntity ? item.zcEntity.zcbm : '';
+      // item.zcbm = item.zcEntity ? item.zcEntity.zcbm : '';
       item.ytxe = Number(item.zcEntity ? item.zcEntity.yzje : 0).toFixed(2);
 
       let zzscD = new Decimal(item.zzsc || 0); // 工作时长