diff --git a/src/api/manage/mission.js b/src/api/manage/mission.js index 2a7a95f..8dcf3ec 100644 --- a/src/api/manage/mission.js +++ b/src/api/manage/mission.js @@ -13,6 +13,19 @@ export const getList = (current, size, params) => { }); }; +export const exportList = (current, size, params) => { + return request({ + url: "/api/jobslink-api/missions/mission/manage/export", + method: "get", + params: { + ...params, + current, + size, + }, + responseType: 'blob', + }); +}; + export const getZPView = (current, size, missionNo, params) => { return request({ url: "/api/jobslink-api/missions/mission/apply/manage/list", diff --git a/src/api/workstation/post.js b/src/api/workstation/post.js index bd6c63a..2bdf1ce 100644 --- a/src/api/workstation/post.js +++ b/src/api/workstation/post.js @@ -59,6 +59,18 @@ export const getList = (current, size, params) => { }, }); }; +export const exportList = (current, size, params) => { + return request({ + url: "/api/jobslink-api/jkWorks/jkWorks/export", + method: "get", + params: { + ...params, + current, + size, + }, + responseType: 'blob' + }); +}; export const getZPView = (current, size, missionNo, params) => { return request({ diff --git a/src/views/manage/mission/index.vue b/src/views/manage/mission/index.vue index 1c8bd39..39c16e2 100644 --- a/src/views/manage/mission/index.vue +++ b/src/views/manage/mission/index.vue @@ -152,7 +152,7 @@ > @@ -186,8 +186,10 @@ import { complet, getDetail, download, - Auditing + Auditing, + exportList } from "@/api/manage/mission"; +import {downloadEcxel} from '@/util/util' import { mapGetters } from "vuex"; import missionView from "@/views/util/mission-view"; import zpView from "./zpView"; @@ -211,6 +213,7 @@ export default { recruitStatus, dataSourcesEnum, educationState, + downloadButton: false, view: {}, form: {}, selectionList: [], @@ -601,13 +604,21 @@ export default { }) }, downRecords() { - if (this.query.time) { - this.query.stime = this.query.time[0]; - this.query.etime = this.query.time[1]; - // delete this.query.time; - } - window.open(download(this.query)); - + this.downloadButton = true + exportList( + this.page.currentPage, + this.page.pageSize, + this.query + ).then((response) => { + const blob = window.URL.createObjectURL(new Blob([response.data], { type: response.headers['content-type']})); + let fileName = decodeURI(response.headers['content-disposition'].split(';')[1].split('filename=')[1]) + let a = document.createElement('a') + let event = new MouseEvent('click') + a.download = fileName || Date.now() + '.xlsx' + a.href = blob + a.dispatchEvent(event) + this.downloadButton = false + }) }, }, diff --git a/src/views/manage/works/index.vue b/src/views/manage/works/index.vue index f17a759..66a59ef 100644 --- a/src/views/manage/works/index.vue +++ b/src/views/manage/works/index.vue @@ -126,6 +126,11 @@ v-if="vaildData(permission.manage_mission_zpview, false)" >报名详情 --> + { + const blob = window.URL.createObjectURL(new Blob([response.data], { type: response.headers['content-type']})); + let fileName = decodeURI(response.headers['content-disposition'].split(';')[1].split('filename=')[1]) + let a = document.createElement('a') + let event = new MouseEvent('click') + a.download = fileName || Date.now() + '.xlsx' + a.href = blob + a.dispatchEvent(event) + this.downloadButton = false + }) }, diff --git a/src/views/report/main/innovation.vue b/src/views/report/main/innovation.vue index 05d20d5..bb515b0 100644 --- a/src/views/report/main/innovation.vue +++ b/src/views/report/main/innovation.vue @@ -65,11 +65,7 @@ export default { this.headTitle = res[0].name this.search.serveId = res[0].id this.searchServeId = res[0].id - this.getList().then((records) => { - if(records.length) { - this.headTitle = records[0].name - } - }) + this.getList() } }) }, diff --git a/src/views/report/main/unemployment.vue b/src/views/report/main/unemployment.vue index f8800da..8532335 100644 --- a/src/views/report/main/unemployment.vue +++ b/src/views/report/main/unemployment.vue @@ -66,11 +66,7 @@ export default { this.headTitle = res[0].name this.search.serveId = res[0].id this.searchServeId = res[0].id - this.getList().then((records) => { - if(records.length) { - this.headTitle = records[0].name - } - }) + this.getList() } }) }, diff --git a/src/views/report/main/vocational.vue b/src/views/report/main/vocational.vue index b097e35..2af2c31 100644 --- a/src/views/report/main/vocational.vue +++ b/src/views/report/main/vocational.vue @@ -66,11 +66,7 @@ export default { this.headTitle = res[0].name this.search.serveId = res[0].id this.searchServeId = res[0].id - this.getList().then((records) => { - if(records.length) { - this.headTitle = records[0].name - } - }) + this.getList() } }) }, diff --git a/src/views/report/main/vocationalTraining.vue b/src/views/report/main/vocationalTraining.vue index b22a31c..49929d3 100644 --- a/src/views/report/main/vocationalTraining.vue +++ b/src/views/report/main/vocationalTraining.vue @@ -67,11 +67,7 @@ export default { this.headTitle = res[0].name this.search.serveId = res[0].id this.searchServeId = res[0].id - this.getList().then((records) => { - if(records.length) { - this.headTitle = records[0].name - } - }) + this.getList() } }) },