新增商品导出

This commit is contained in:
weipengfei 2024-03-12 14:30:16 +08:00
parent 3af8eea20c
commit 374c2c7fac
2 changed files with 42 additions and 0 deletions

View File

@ -111,6 +111,13 @@ export function transferBill(data) {
return request.get(`financial/bill`, data)
}
/**
* @description 商品列表 -- 导出
*/
export function transferCommodity(data) {
return request.get(`store/product/excel`, data)
}
/**
* @description 资金记录 -- 导出
*/

View File

@ -189,6 +189,12 @@
@click="batchRecommend"
>批量设置推荐</el-button
>
<el-button
size="mini"
type="primary"
@click="exports"
>批量导出</el-button
>
</div>
<el-table
v-loading="listLoading"
@ -600,6 +606,8 @@ import {
batchesRecommendApi,
batchesOnOffApi
} from '@/api/product'
import { transferCommodity } from '@/api/accounts'
import createWorkBook from '@/utils/newToExcel.js';
import { roterPre } from '@/settings'
import infoFrom from './info'
import ueditorFrom from '@/components/ueditorFrom'
@ -917,6 +925,33 @@ export default {
})
},
/**订单列表 */
downData(excelData) {
return new Promise((resolve, reject) => {
transferCommodity(excelData).then((res) => {
return resolve(res.data)
})
})
},
//
async exports() {
let excelData = JSON.parse(JSON.stringify(this.tableFrom)), data = []
excelData.page = 1
let pageCount = 1
let lebData = {};
for (let i = 0; i < pageCount; i++) {
lebData = await this.downData(excelData)
pageCount = Math.ceil(lebData.count / excelData.limit)
if (lebData.export.length) {
data = data.concat(lebData.export)
excelData.page++
}
}
createWorkBook(lebData.header, lebData.title, data, lebData.foot, lebData.filename);
return;
},
//
toOff (id) {
this.$prompt('强制下架', {