新增商品导出

This commit is contained in:
gyq
2026-01-30 16:01:44 +08:00
parent 60ea128a10
commit 3855ed4b75
3 changed files with 29 additions and 2 deletions

View File

@@ -174,7 +174,7 @@ import UserAPI from "@/api/product/index";
import { useRouter } from "vue-router";
import type { IObject, IOperatData } from "@/components/CURD/types";
import usePage from "@/components/CURD/usePage";
import { isSyncStatus } from "@/utils/index";
import { isSyncStatus, downloadFile } from "@/utils/index";
import addModalConfig from "./indexconfig/add";
import contentConfig from "./indexconfig/content";
import MultiImageUpload from "@/components/Upload/MultiImageUpload.vue";
@@ -193,7 +193,7 @@ const {
handleResetClick,
// handleEditClick,
handleSubmitClick,
handleExportClick,
// handleExportClick,
handleSearchClick,
handleFilterChange,
} = usePage();
@@ -302,6 +302,17 @@ function getTongji(params: IObject | undefined) {
});
}
// 导出商品
async function handleExportClick() {
try {
const filterParams = searchRef.value?.getQueryParams();
const file = await UserAPI.exportProducts(filterParams);
downloadFile(file, "商品列表", "xlsx");
} catch (error) {
console.log(error);
}
}
// 新增
async function handleAddClick() {
router.push({ name: "addgoods" });