| 方法 | 路径 | 说明 |
|---|---|---|
| POST | /basic/customer-follow/export |
导出洽谈进度 |
请求参数(Query String 或 Form Data):
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| customerName | String | 否 | 客户名称(模糊搜索) |
| customerType | String | 否 | 客户分类 |
响应: 文件流(Excel 下载),响应头 Content-Disposition: attachment; filename=洽谈进度.xlsx
| 列名 | 字段 | 说明 |
|---|---|---|
| 客户名称 | customerName | |
| 客户分类 | customerType | |
| 客户等级 | customerLevel | |
| 联系人 | contactPerson | |
| 联系电话 | contactPhone | |
| 维护人 | maintainer | |
| 跟进方式 | followUpMethod | |
| 跟进程度 | followUpLevel | |
| 跟进时间 | followUpTime | 格式 yyyy-MM-dd HH:mm:ss |
| 跟进人 | followerUserName | |
| 跟进内容 | content |
每行一条跟进记录(客户有多条跟进时展开多行)。
<el-button type="warning" icon="el-icon-download" @click="exportFollowUp">导出洽谈进度</el-button>
// 导出洽谈进度
exportFollowUp() {
this.$confirm('确认导出所有客户的洽谈进度数据吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'info'
}).then(() => {
this.downloadFollowUpExcel();
}).catch(() => {});
},
// 执行导出
downloadFollowUpExcel() {
const params = new URLSearchParams();
if (this.queryParams.customerName) {
params.append('customerName', this.queryParams.customerName);
}
if (this.queryParams.customerType) {
params.append('customerType', this.queryParams.customerType);
}
// POST 方式下载文件
fetch('/basic/customer-follow/export', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: params.toString(),
responseType: 'blob'
}).then(response => {
if (!response.ok) throw new Error('导出失败');
return response.blob();
}).then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = '洽谈进度.xlsx';
a.click();
window.URL.revokeObjectURL(url);
}).catch(err => {
this.$message.error('导出失败:' + err.message);
});
}
注:如果项目中有封装好的文件下载工具函数(如
downloadBlob),建议直接复用。