all.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <script setup lang="ts">
  2. import { ref } from "vue";
  3. import searchConfig from "./config/search.config";
  4. import contentConfig from "./config/content.config";
  5. import { PageContentInstance } from "/@/components/PageContent";
  6. import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
  7. import { usePageSearch, type PageHooks } from "/@/hooks/page";
  8. import { isBeyondTime } from "/@/views/time/_utils";
  9. import { frontEndExport } from "/@/utils/export";
  10. import { usePermission } from "/@/hooks/core";
  11. const pageName = "receivableManager";
  12. const { hasPermissionWithCode } = usePermission(pageName);
  13. const pageContentRef = ref<PageContentInstance | null>(null);
  14. const hooks: PageHooks = {
  15. pageSearchHook: () => {
  16. return usePageSearch(
  17. (params) => ({ result: { ...params}}),
  18. (params) => ({ result: { ...params}}),
  19. searchConfig);
  20. }
  21. };
  22. async function handleExportAllReport() {
  23. const params = pageContentRef.value.getBasicParams() || {};
  24. const { start, end } = params;
  25. const beyondTime = isBeyondTime({ start, end, len: 30 });
  26. if (beyondTime) return;
  27. const data = pageContentRef.value.getData();
  28. frontEndExport({ columns: contentConfig.columns, name: "项目经理日报.xlsx", data });
  29. }
  30. </script>
  31. <template>
  32. <page-auth :page-name="pageName">
  33. <page-container
  34. :hooks="hooks"
  35. :page-name="pageName"
  36. :get-content-ref="ref => (pageContentRef = ref)"
  37. :content-config="contentConfig"
  38. :search-config="searchConfig"
  39. >
  40. <template #content_header>
  41. <el-button
  42. v-if="hasPermissionWithCode('9')"
  43. @click="handleExportAllReport"
  44. size="small"
  45. :icon="useRenderIcon('arrow-up-line')"
  46. type="primary"
  47. >导出</el-button
  48. >
  49. </template>
  50. </page-container>
  51. </page-auth>
  52. </template>