index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <script setup lang="ts">
  2. import { PageSearch, usePageSearch } from "/@/components/PageSearch";
  3. import { PageContent } from "/@/components/PageContent";
  4. import searchFormConfig from "./config/search.config";
  5. import modalConfig from "./config/modal.config";
  6. import contentConfig from "./config/content.config";
  7. import PagePower from "/@/components/PagePower/PagePower.vue";
  8. import { usePermission } from "/@/hooks";
  9. import { useRouter } from "vue-router";
  10. import dayjs from "dayjs";
  11. defineOptions({
  12. name: "returnTicket"
  13. });
  14. const search = ({ timer }) => {
  15. const [start, end] = timer;
  16. return {
  17. result: {
  18. start: dayjs(start).format("YYYY-MM-DD hh:mm:ss"),
  19. end: dayjs(end).format("YYYY-MM-DD hh:mm:ss")
  20. },
  21. deleteProps: ["timer"]
  22. };
  23. };
  24. const { push } = useRouter();
  25. const { pageContentRef, handleResetClick, handleSearchClick } =
  26. usePageSearch(search);
  27. function toDetail(returnCode) {
  28. push({
  29. path: "/InvoiceSales/returnTicketDetail",
  30. query: {
  31. id: returnCode
  32. }
  33. });
  34. }
  35. const { permission, contentConfigRef } = usePermission({
  36. pageName: "returnTicket",
  37. contentConfig,
  38. callback: powers => (contentConfig.powers = powers)
  39. });
  40. </script>
  41. <template>
  42. <div class="main role">
  43. <PagePower :is-show="permission.list">
  44. <div w-full>
  45. <PageSearch
  46. :form-config="searchFormConfig"
  47. @search-btn-click="handleSearchClick"
  48. @reset-btn-click="handleResetClick"
  49. />
  50. <PageContent
  51. ref="pageContentRef"
  52. :content-config="contentConfigRef"
  53. @preview-btn-click="({ returnCode }) => toDetail(returnCode)"
  54. @create-btn-click="() => push('/InvoiceSales/returnTicketDetail')"
  55. />
  56. </div>
  57. </PagePower>
  58. </div>
  59. </template>
  60. <style scoped lang="scss">
  61. :deep(.el-dropdown-menu__item i) {
  62. margin: 0;
  63. }
  64. </style>