表格导出

This commit is contained in:
xiaofajia 2024-12-02 17:57:49 +08:00
parent 6a882e6bac
commit c81eb9972b
10 changed files with 133 additions and 21 deletions

View File

@ -34,3 +34,13 @@ export function getOtherByName(name){
method: "get"
})
}
// 导出数据
export function exportData(params){
return request({
url: preUrl + "/export",
method: "get",
params,
responseType: 'blob'
})
}

View File

@ -43,9 +43,9 @@ export function getRepairProjectPage(params) {
})
}
// 导出维修项目 Excel
export function exportRepairProjectExcel(params) {
export function exportData(params) {
return request({
url: '/repair/project/export-excel',
url: '/repair/project/export',
method: 'get',
params,
responseType: 'blob'

View File

@ -83,3 +83,13 @@ export function getIfLeader(){
method: "get"
})
}
// 导出数据
export function exportData(params){
return request({
url: '/repair/worker/export',
method: 'get',
params,
responseType: 'blob'
})
}

View File

@ -59,3 +59,13 @@ export function getBaseSupplierList(){
method: 'get'
})
}
// 导出数据
export function exportData(params){
return request({
url: '/supplier/baseSupplier/export',
method: 'get',
params,
responseType: 'blob'
})
}

View File

@ -50,3 +50,13 @@ export function getWaresByName(name){
})
}
// 导出数据
export function exportData(params){
return request({
url: "/repair/wares/export",
method: 'get',
params,
responseType: 'blob'
})
}

View File

@ -17,6 +17,10 @@
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -46,7 +50,7 @@
<script>
import OtherForm from "@/views/repair/other/OtherForm.vue";
import {getOtherPage, deleteOther} from "@/api/repair/other";
import {getOtherPage, deleteOther, exportData} from "@/api/repair/other";
export default {
name: "RepairOther",
@ -60,7 +64,9 @@ export default {
showSearch: true,
total: 0,
list: [],
loading: false
loading: false,
//
exportLoading: false,
}
},
created() {
@ -92,7 +98,22 @@ export default {
this.$modal.msgSuccess("删除成功");
await this.getList()
}catch{}
}
},
/** 导出按钮操作 */
handleExport() {
this.$modal.confirm('是否确认导出当前查询条件所有数据项?').then(() => {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.exportLoading = true;
return exportData(params);
}).then(response => {
this.$download.excel(response, '附加数据.xls');
}).finally(() => {
this.exportLoading = false;
});
},
}
}
</script>

View File

@ -153,15 +153,18 @@ export default {
},
/** 导出按钮操作 */
async handleExport() {
await this.$modal.confirm('是否确认导出所有维修项目数据项?');
try {
this.$modal.confirm('是否确认导出当前查询条件所有数据项?').then(() => {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.exportLoading = true;
const data = await RepairProjectApi.exportRepairProjectExcel(this.queryParams);
this.$download.excel(data, '维修项目.xls');
} catch {
} finally {
return RepairProjectApi.exportData(params)
}).then(response => {
this.$download.excel(response, '维修项目数据.xls');
}).finally(() => {
this.exportLoading = false;
}
});
},
}
};

View File

@ -25,6 +25,10 @@
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="sendMesg()">测试发消息
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -151,15 +155,18 @@ export default {
},
/** 导出按钮操作 */
async handleExport() {
await this.$modal.confirm('是否确认导出所有维修工人数据项?');
try {
this.$modal.confirm('是否确认导出当前查询条件所有数据项?').then(() => {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.exportLoading = true;
const data = await WorkerApi.exportWorkerExcel(this.queryParams);
this.$download.excel(data, '维修工人.xls');
} catch {
} finally {
return WorkerApi.exportData(params);
}).then(response => {
this.$download.excel(response, '维修工人数据.xls');
}).finally(() => {
this.exportLoading = false;
}
});
},
}
};

View File

@ -18,6 +18,10 @@
v-hasPermi="['supplier:base-supplier:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
>导出</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
@ -144,7 +148,21 @@ export default {
} catch {
}
},
/** 导出按钮操作 */
handleExport() {
this.$modal.confirm('是否确认导出当前查询条件所有数据项?').then(() => {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.exportLoading = true;
return BaseSupplierApi.exportData(params);
}).then(response => {
this.$download.excel(response, '供应商数据.xls');
}).finally(() => {
this.exportLoading = false;
});
},
}
};
</script>

View File

@ -26,10 +26,16 @@
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport"
>导入
>导入
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -134,6 +140,8 @@ export default {
remark: null,
createTime: [],
},
//
exportLoading: false,
};
},
created() {
@ -184,6 +192,21 @@ export default {
} catch {
}
},
/** 导出按钮操作 */
handleExport() {
this.$modal.confirm('是否确认导出当前查询条件所有数据项?').then(() => {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.exportLoading = true;
return WaresApi.exportData(params);
}).then(response => {
this.$download.excel(response, '维修配件数据.xls');
}).finally(() => {
this.exportLoading = false;
});
},
}
};
</script>