123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <script setup lang="ts">
- import { reactive, ref } from "vue";
- import { useRouter } from "vue-router";
- import { usePageSearch, type PageHooks, type PageEvents } from "/@/hooks/page";
- import NotOrderImportModal from "./components/NotOrderImportModal/index.vue"
- import OrderImportModal from "./components/OrderImportModal/index.vue"
- import { notOrderTemplate } from "./components/NotOrderImportModal/columns-config"
- import { orderTemplate } from "./components/OrderImportModal/columns-config"
- import { useRenderIcon } from "/@/components/ReIcon/src/hooks"
- import contentConfig from "./config/content.config";
- import searchConfig from "./config/search.config";
- import { utils, writeFile } from "xlsx";
- const PageName = "inOutManager";
- const router = useRouter();
- const state = reactive({ orderImportVisible: false, notOrderImportVisible: false })
- const hooks: PageHooks = { pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig) };
- const pageContentRef = ref(null)
- const events: PageEvents = {
- content: {
- create: () => router.push('/invoiceInOut/productManagerDetail'),
- preview: ({ id }) => router.push("/invoiceInOut/inOutManagerDetail?id=" + id)
- }
- };
- function onDownload(type = 'notOrder'){
- const data = type === 'notOrder' ? notOrderTemplate : orderTemplate
- const title = type === 'notOrder' ? '非订单商品模板.xlsx' : '订单商品模板.xlsx'
- const workBook = utils.book_new();
- const workSheet = utils.json_to_sheet(data);
- utils.book_append_sheet(workBook, workSheet, "sheet");
- writeFile(workBook, title, { bookType: "xlsx" });
- }
- </script>
- <template>
- <PageAuth :pageName="PageName">
- <PageContainer
- :hooks="hooks"
- :events="events"
- :searchConfig="searchConfig"
- :contentConfig="contentConfig"
- :get-content-ref="ref => pageContentRef = ref"
- >
- <template #content_header>
- <ElDropdown>
- <ElButton
- size="small"
- type="primary"
- style="margin-right: 10px;margin-top:1px"
- :icon="useRenderIcon('arrow-up-line')"
- >商品导入
- </ElButton>
-
- <template #dropdown>
- <ElDropdownMenu>
- <ElDropdownItem @click="state.orderImportVisible = true">订单商品</ElDropdownItem>
- <ElDropdownItem @click="state.notOrderImportVisible = true">非订单商品</ElDropdownItem>
- </ElDropdownMenu>
- </template>
- </ElDropdown>
- <ElDropdown>
- <ElButton
- size="small"
- style="margin-right: 10px;margin-top:1px"
- :icon="useRenderIcon('arrow-down-line')"
- >商品导入模板下载</ElButton>
-
- <template #dropdown>
- <ElDropdownMenu>
- <ElDropdownItem @click="onDownload('order')">订单商品</ElDropdownItem>
- <ElDropdownItem @click="onDownload('notOrder')">非订单商品</ElDropdownItem>
- </ElDropdownMenu>
- </template>
- </ElDropdown>
- </template>
- <template #content_action>
- <ElTooltip content="取消操作" placement="top">
- <ElButton
- :icon="useRenderIcon('delete')"
- type="danger"
- link
- />
- </ElTooltip>
- </template>
- </PageContainer>
- <OrderImportModal
- v-model:visible="state.orderImportVisible"
- @refresh="pageContentRef?.onSearch()"
- />
- <NotOrderImportModal
- v-model:visible="state.notOrderImportVisible"
- @refresh="pageContentRef?.onSearch()"
- />
- </PageAuth>
- </template>
|