index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <script setup lang="ts">
  2. import { ref , watch} 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 { useUserStore } from "/@/store/modules/user";
  9. import { isBeyondTime } from "/@/views/time/_utils";
  10. import { frontEndExport } from "/@/utils/export";
  11. import { usePermission } from "/@/hooks/core";
  12. import dayjs from "dayjs"
  13. const pageName = "receivableMain";
  14. const { hasPermissionWithCode } = usePermission(pageName);
  15. const pageContentRef = ref<PageContentInstance | null>(null);
  16. const userStore = useUserStore();
  17. const hooks: PageHooks = {
  18. pageSearchHook: () => usePageSearch((params) => {
  19. const { date, ...rest } = params;
  20. const start = dayjs(date).format('YYYY-MM-DD');
  21. const daysInMonth = dayjs(date).daysInMonth();
  22. const end = dayjs(start).subtract(-(daysInMonth - 1), 'days').format('YYYY-MM-DD');
  23. return {
  24. result: {
  25. start: start + " 00:00:00",
  26. end: end + " 23:59:59",
  27. plat_type: "1",
  28. dz_type:"2",
  29. ...rest
  30. },
  31. deleteProps:['date']
  32. }
  33. },
  34. (params) => {
  35. const { date , depart_id} = params;
  36. const start = dayjs(date).format('YYYY-MM-DD');
  37. const daysInMonth = dayjs(date).daysInMonth();
  38. const end = dayjs(start).subtract(-(daysInMonth - 1), 'days').format('YYYY-MM-DD');
  39. return {
  40. result: {
  41. start: start + " 00:00:00",
  42. end: end + " 23:59:59",
  43. plat_type: "1",
  44. dz_type: "2",
  45. depart_id,
  46. },
  47. deleteProps:['date']
  48. }
  49. }, searchConfig)
  50. };
  51. const searchConfigRef = ref(searchConfig);
  52. watch(
  53. () => userStore.level,
  54. level => {
  55. const { formItems } = searchConfigRef.value;
  56. const index = formItems.findIndex(({ field }) => field === "depart_id");
  57. const { itemid = "" } = userStore.info || {};
  58. if (Number(level) === 2) {
  59. searchConfigRef.value.formItems[index].disabled = Number(level) === 2;
  60. searchConfigRef.value.formItems[index].defaultValue = itemid;
  61. }
  62. },
  63. {
  64. immediate: true
  65. }
  66. );
  67. </script>
  68. <template>
  69. <page-auth :page-name="pageName">
  70. <page-container
  71. :hooks="hooks"
  72. :page-name="pageName"
  73. :get-content-ref="ref => (pageContentRef = ref)"
  74. :content-config="contentConfig"
  75. />
  76. </page-auth>
  77. </template>