ListModal.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <script setup lang="ts">
  2. import { computed, ref, unref } from "vue";
  3. import { PageSearch, usePageSearch } from "/@/components/PageSearch";
  4. import { modalProps } from "./types";
  5. import { ElMessage } from "element-plus";
  6. import { PageContent } from "/@/components/PageContent";
  7. const props = defineProps(modalProps);
  8. const modelTitle = computed(() => props.modalConfig.title);
  9. const searchConfig = computed(() => props.modalConfig.searchConfig);
  10. const contentConfig = computed(() => props.modalConfig.contentConfig);
  11. const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch(
  12. undefined,
  13. undefined,
  14. searchConfig
  15. );
  16. const dialogVisible = ref(false);
  17. function handleConfirmClick() {}
  18. async function show(id) {
  19. console.log(id);
  20. // modelFormItems.value.forEach(item => {
  21. // if (item.field === "id") {
  22. // formData.value[item.field] = id;
  23. // } else {
  24. // formData.value[item.field] = "";
  25. // }
  26. // });
  27. dialogVisible.value = true;
  28. }
  29. defineExpose({
  30. show
  31. });
  32. </script>
  33. <template>
  34. <el-dialog
  35. :title="modelTitle"
  36. v-model="dialogVisible"
  37. center
  38. destroy-on-close
  39. width="1040px"
  40. >
  41. <PageSearch
  42. :form-config="searchConfig"
  43. @search-btn-click="handleSearchClick"
  44. @reset-btn-click="handleResetClick"
  45. />
  46. <PageContent ref="pageContentRef" :content-config="contentConfig" />
  47. </el-dialog>
  48. </template>