index.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <script setup lang="ts">
  2. import { reactive, ref } from "vue";
  3. import { useRouter } from "vue-router";
  4. import { usePageSearch, type PageHooks, type PageEvents } from "/@/hooks/page";
  5. import OrderImportModal from "./components/OrderImportModal/index.vue"
  6. import { orderTemplate } from "./components/OrderImportModal/columns-config"
  7. import { useRenderIcon } from "/@/components/ReIcon/src/hooks"
  8. import contentConfig from "./config/content.config";
  9. import searchConfig from "./config/search.config";
  10. import { utils, writeFile } from "xlsx";
  11. import { ElButton } from "element-plus";
  12. const PageName = "inOutManager";
  13. const router = useRouter();
  14. const state = reactive({ orderImportVisible: false, notOrderImportVisible: false })
  15. const hooks: PageHooks = { pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig) };
  16. const pageContentRef = ref(null)
  17. const events: PageEvents = {
  18. content: {
  19. create: () => router.push('/invoiceInOut/clinetCDetail'),
  20. preview: ({ id }) => router.push("/invoiceInOut/clinetCDetail?id=" + id)
  21. }
  22. };
  23. function handleDownloadTemplate(){
  24. const workBook = utils.book_new()
  25. const workSheet = utils.json_to_sheet(orderTemplate)
  26. utils.book_append_sheet(workBook, workSheet, 'sheet');
  27. writeFile(workBook, 'C端无发票订单出库模板.xlsx', { bookType: 'xlsx' })
  28. }
  29. </script>
  30. <template>
  31. <PageAuth :pageName="PageName">
  32. <PageContainer :hooks="hooks" :events="events" :searchConfig="searchConfig" :contentConfig="contentConfig"
  33. :get-content-ref="ref => pageContentRef = ref">
  34. <template #content_header>
  35. <ElButton
  36. size="small"
  37. type="primary"
  38. style="margin-right: 10px;margin-top:1px"
  39. :icon="useRenderIcon('arrow-up-line')"
  40. @click="state.orderImportVisible = true"
  41. >C端无发票订单出库导入
  42. </ElButton>
  43. <ElButton
  44. size="small"
  45. style="margin-right: 10px;margin-top:1px"
  46. @click="handleDownloadTemplate"
  47. :icon="useRenderIcon('arrow-down-line')"
  48. >C端无发票订单出库模板
  49. </ElButton>
  50. <ElButton
  51. size="small"
  52. type="primary"
  53. @click="router.push('/invoiceInOut/clinetCDetail')"
  54. >批量审核
  55. </ElButton>
  56. </template>
  57. <!-- <template #content_action="{ row }">
  58. <ElButton type="danger" :icon="useRenderIcon('delete')" />
  59. </template> -->
  60. </PageContainer>
  61. <OrderImportModal v-model:visible="state.orderImportVisible" @refresh="pageContentRef?.onSearch()" />
  62. </PageAuth>
  63. </template>