表格导出

This commit is contained in:
xiaofajia 2024-12-02 20:38:55 +08:00
parent c81eb9972b
commit c98fd8dd8e
8 changed files with 95 additions and 29 deletions

View File

@ -76,3 +76,13 @@ export function getByNameAndMobile(data){
data
})
}
// 导出数据
export function exportData(params){
return request({
url: '/base/custom/export',
method: 'get',
params,
responseType: 'blob'
})
}

View File

@ -87,3 +87,13 @@ export function exportActiveMainExcel(params) {
responseType: 'blob'
})
}
// 导出数据
export function exportData(params){
return request({
url: '/member/active-main/export',
method: 'get',
params,
responseType: 'blob'
})
}

View File

@ -60,3 +60,12 @@ export function exportCouponExcel(params) {
responseType: 'blob'
})
}
// 导出数据
export function exportData(params){
return request({
url: '/member/coupon/export',
method: 'get',
params,
responseType: 'blob'
})
}

View File

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

View File

@ -25,6 +25,10 @@
v-hasPermi="['base:customer-main: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>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -249,15 +253,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 CustomerMainApi.exportCustomerMainExcel(this.queryParams);
this.$download.excel(data, '客户管理.xls');
} catch {
} finally {
return CustomerMainApi.exportData(params);
}).then(response => {
this.$download.excel(response, '客户数据.xls');
}).finally(() => {
this.exportLoading = false;
}
});
},
}
};

View File

@ -24,6 +24,10 @@
v-hasPermi="['member:active-main: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>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -175,15 +179,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 ActiveMainApi.exportActiveMainExcel(this.queryParams);
this.$download.excel(data, '营销活动.xls');
} catch {
} finally {
return ActiveMainApi.exportData(params);
}).then(response => {
this.$download.excel(response, '营销活动数据.xls');
}).finally(() => {
this.exportLoading = false;
}
});
},
}
};

View File

@ -31,6 +31,10 @@
v-hasPermi="['member:coupon: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>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -184,15 +188,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 CouponApi.exportCouponExcel(this.queryParams);
this.$download.excel(data, '基础卡券.xls');
} catch {
} finally {
return CouponApi.exportData(params);
}).then(response => {
this.$download.excel(response, '基础卡券数据.xls');
}).finally(() => {
this.exportLoading = false;
}
});
},
}
};

View File

@ -17,7 +17,10 @@
v-hasPermi="['member:level: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>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -135,15 +138,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 LevelApi.exportLevelExcel(this.queryParams);
this.$download.excel(data, '会员等级.xls');
} catch {
} finally {
return LevelApi.exportData(params);
}).then(response => {
this.$download.excel(response, '会员等级数据.xls');
}).finally(() => {
this.exportLoading = false;
}
});
},
}
};