|
@@ -3,9 +3,12 @@ import { usePageSearch, type PageHooks, type PageEvents } from "/@/hooks/page";
|
|
|
import contentConfig from "./config/content.config";
|
|
|
import searchConfig from "./config/search.config";
|
|
|
import { useRouter } from "vue-router";
|
|
|
-
|
|
|
import BatchCreateModal from "./components/BatchCreateModal/index.vue"
|
|
|
import { ref } from "vue";
|
|
|
+import { batchCreateTemplate } from "./components/BatchCreateModal/columns-config";
|
|
|
+import { utils, writeFile } from 'xlsx';
|
|
|
+
|
|
|
+
|
|
|
|
|
|
const PageName = "productManager";
|
|
|
const router = useRouter();
|
|
@@ -23,6 +26,15 @@ const events: PageEvents = {
|
|
|
create: () => router.push('/invoiceInOut/inventoryCheckDetail')
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+async function onDownload(){
|
|
|
+ const workBook = utils.book_new();
|
|
|
+ const workSheet = utils.json_to_sheet(batchCreateTemplate);
|
|
|
+ utils.book_append_sheet(workBook, workSheet, "sheet");
|
|
|
+ //导出模板
|
|
|
+ writeFile(workBook, `盘点模板.xlsx`, { bookType: "xlsx" });
|
|
|
+ // const result = await utils.book_new()
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -34,15 +46,13 @@ const events: PageEvents = {
|
|
|
:contentConfig="contentConfig"
|
|
|
>
|
|
|
<template #content_header>
|
|
|
- <ElButton
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- @click="visible = true"
|
|
|
- >批量创建</ElButton>
|
|
|
-
|
|
|
- <ElButton
|
|
|
- size="small"
|
|
|
- >批量导出当前结存数</ElButton>
|
|
|
+ <ElButton type="primary" size="small" @click="visible = true" >
|
|
|
+ 批量创建
|
|
|
+ </ElButton>
|
|
|
+
|
|
|
+ <ElButton size="small" @click="onDownload">
|
|
|
+ 下载模板
|
|
|
+ </ElButton>
|
|
|
</template>
|
|
|
</PageContainer>
|
|
|
|