Commit 7b4f8b79 by 姜雷

添加导出

parent 10b1d039
......@@ -45,7 +45,7 @@ service.interceptors.response.use(response => {
if (res.code !== 1000) {
if (
response.headers &&
response.headers['content-type'] === 'application/octet-stream'
/application\/octet-stream/.test(response.headers['content-type'])
) {
return response;
}
......
import fetch from '@/api/fetch';
import downloadUrl from '@/utils/download';
export const fetchApplyList = entity =>
fetch({
......@@ -13,3 +14,15 @@ export const dealApply = entity =>
method: 'post',
data: entity,
});
export const exportApplyList = entity =>
fetch({
url: '/publicCar/export/manager/teacherAppoCar',
method: 'post',
data: entity,
responseType: 'blob',
timeout: 120000,
}).then(res => {
let blob = new Blob([res.data], { type: res.headers });
let fileName = res.headers['content-disposition'].split('=')[1];
downloadUrl(blob, fileName);
});
import fetch from '@/api/fetch';
import downloadUrl from '@/utils/download';
export const fetchApplyList = entity =>
fetch({
......@@ -13,3 +14,16 @@ export const dealApply = entity =>
method: 'post',
data: entity,
});
export const exportApplyList = entity =>
fetch({
url: '/repair/export/manager/userRepair',
method: 'post',
data: entity,
responseType: 'blob',
timeout: 120000,
}).then(res => {
let blob = new Blob([res.data], { type: res.headers });
let fileName = res.headers['content-disposition'].split('=')[1];
downloadUrl(blob, fileName);
});
......@@ -22,6 +22,7 @@
</el-date-picker>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
<el-button type="primary" icon="el-icon-download" @click="exportList">导出</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
......@@ -161,7 +162,7 @@
import listMixin from '@/mixin/listPage.js';
import { mapGetters, mapActions } from 'vuex';
import store from './store.js';
import { dealApply } from '@/api/management/publicCar.js';
import { dealApply, exportApplyList } from '@/api/management/publicCar.js';
// import printJS from 'print-js';
export default {
......@@ -227,6 +228,10 @@ export default {
let item = list.find(item => item.checked);
return item ? item.name : '';
},
exportList() {
const filters = this.getFilters();
exportApplyList(filters);
},
showEditDialog(type, data) {
this.editType = type;
if (this.carPlateOptions.length == 0) {
......
......@@ -31,6 +31,7 @@
</el-date-picker>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
<el-button type="primary" icon="el-icon-download" @click="exportList">导出</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
......@@ -106,7 +107,7 @@
import listMixin from '@/mixin/listPage.js';
import { mapGetters, mapActions } from 'vuex';
import store from './store.js';
import { dealApply } from '@/api/management/repair.js';
import { dealApply, exportApplyList } from '@/api/management/repair.js';
export default {
beforeRouteEnter(to, from, next) {
......@@ -171,6 +172,10 @@ export default {
let item = this.dealStateOptions.find(item => item.value == val);
return item ? item.label : val;
},
exportList() {
const filters = this.getFilters();
exportApplyList(filters);
},
showEditDialog(type, data) {
this.editType = type;
this.selected = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment