index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <script setup lang="ts">
  2. import { ref } from "vue";
  3. import { PageSearch, usePageSearch } from "/@/components/PageSearch";
  4. import { PageContent } from "/@/components/PageContent";
  5. import contentConfig from "./config/content.config";
  6. import { usePermission } from "/@/hooks/usePermission";
  7. import searchConfig from "./config/search.config";
  8. import EditModel from "./components/edit-dialog.vue";
  9. const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch(
  10. undefined,
  11. undefined,
  12. searchConfig
  13. );
  14. const modelRef = ref<InstanceType<typeof EditModel>>(null);
  15. const pageName = "updates";
  16. const { hasPermissionWithCode, permissions } = usePermission(pageName);
  17. function handleAddChangeCheck(item: any, id: string, type: string) {
  18. modelRef.value.show(item, id, type);
  19. }
  20. </script>
  21. <template>
  22. <PageAuth :pageName="pageName">
  23. <PageSearch
  24. :form-config="searchConfig"
  25. @search-btn-click="handleSearchClick"
  26. @reset-btn-click="handleResetClick"
  27. >
  28. <template #action>
  29. <el-button
  30. type="primary"
  31. @click="handleAddChangeCheck({}, '', 'create')"
  32. v-if="hasPermissionWithCode('002')"
  33. >
  34. 新增
  35. </el-button>
  36. </template>
  37. </PageSearch>
  38. <PageContent
  39. ref="pageContentRef"
  40. :content-config="contentConfig"
  41. :powers="permissions"
  42. @preview-btn-click="row => handleAddChangeCheck(row, row.id, 'view')"
  43. @update-btn-click="row => handleAddChangeCheck(row, row.id, 'edit')"
  44. />
  45. <EditModel ref="modelRef" @reload="pageContentRef.onSearch()" />
  46. </PageAuth>
  47. </template>