Commit 7b4f8b79 by 姜雷

添加导出

parent 10b1d039
...@@ -45,7 +45,7 @@ service.interceptors.response.use(response => { ...@@ -45,7 +45,7 @@ service.interceptors.response.use(response => {
if (res.code !== 1000) { if (res.code !== 1000) {
if ( if (
response.headers && response.headers &&
response.headers['content-type'] === 'application/octet-stream' /application\/octet-stream/.test(response.headers['content-type'])
) { ) {
return response; return response;
} }
......
import fetch from '@/api/fetch'; import fetch from '@/api/fetch';
import downloadUrl from '@/utils/download';
export const fetchApplyList = entity => export const fetchApplyList = entity =>
fetch({ fetch({
...@@ -13,3 +14,15 @@ export const dealApply = entity => ...@@ -13,3 +14,15 @@ export const dealApply = entity =>
method: 'post', method: 'post',
data: entity, 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 fetch from '@/api/fetch';
import downloadUrl from '@/utils/download';
export const fetchApplyList = entity => export const fetchApplyList = entity =>
fetch({ fetch({
...@@ -13,3 +14,16 @@ export const dealApply = entity => ...@@ -13,3 +14,16 @@ export const dealApply = entity =>
method: 'post', method: 'post',
data: entity, 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 @@ ...@@ -22,6 +22,7 @@
</el-date-picker> </el-date-picker>
</div> </div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button> <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> </el-form>
<div class="tabel-wrap"> <div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%"> <el-table border v-loading="loading" :data="list" style="width: 100%">
...@@ -161,7 +162,7 @@ ...@@ -161,7 +162,7 @@
import listMixin from '@/mixin/listPage.js'; import listMixin from '@/mixin/listPage.js';
import { mapGetters, mapActions } from 'vuex'; import { mapGetters, mapActions } from 'vuex';
import store from './store.js'; 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'; // import printJS from 'print-js';
export default { export default {
...@@ -227,6 +228,10 @@ export default { ...@@ -227,6 +228,10 @@ export default {
let item = list.find(item => item.checked); let item = list.find(item => item.checked);
return item ? item.name : ''; return item ? item.name : '';
}, },
exportList() {
const filters = this.getFilters();
exportApplyList(filters);
},
showEditDialog(type, data) { showEditDialog(type, data) {
this.editType = type; this.editType = type;
if (this.carPlateOptions.length == 0) { if (this.carPlateOptions.length == 0) {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
</el-date-picker> </el-date-picker>
</div> </div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button> <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> </el-form>
<div class="tabel-wrap"> <div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%"> <el-table border v-loading="loading" :data="list" style="width: 100%">
...@@ -106,7 +107,7 @@ ...@@ -106,7 +107,7 @@
import listMixin from '@/mixin/listPage.js'; import listMixin from '@/mixin/listPage.js';
import { mapGetters, mapActions } from 'vuex'; import { mapGetters, mapActions } from 'vuex';
import store from './store.js'; import store from './store.js';
import { dealApply } from '@/api/management/repair.js'; import { dealApply, exportApplyList } from '@/api/management/repair.js';
export default { export default {
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
...@@ -171,6 +172,10 @@ export default { ...@@ -171,6 +172,10 @@ export default {
let item = this.dealStateOptions.find(item => item.value == val); let item = this.dealStateOptions.find(item => item.value == val);
return item ? item.label : val; return item ? item.label : val;
}, },
exportList() {
const filters = this.getFilters();
exportApplyList(filters);
},
showEditDialog(type, data) { showEditDialog(type, data) {
this.editType = type; this.editType = type;
this.selected = { 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