<script setup lang="ts">
import { computed, ref, unref } from "vue";
import { PageSearch, usePageSearch } from "/@/components/PageSearch";
import { modalProps } from "./types";
import { ElMessage } from "element-plus";
import { PageContent } from "/@/components/PageContent";
const props = defineProps(modalProps);
const modelTitle = computed(() => props.modalConfig.title);
const searchConfig = computed(() => props.modalConfig.searchConfig);
const contentConfig = computed(() => props.modalConfig.contentConfig);
const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch(
  undefined,
  undefined,
  searchConfig
);
const dialogVisible = ref(false);
function handleConfirmClick() {}
async function show(id) {
  console.log(id);
  // modelFormItems.value.forEach(item => {
  //   if (item.field === "id") {
  //     formData.value[item.field] = id;
  //   } else {
  //     formData.value[item.field] = "";
  //   }
  // });
  dialogVisible.value = true;
}
defineExpose({
  show
});
</script>

<template>
  <el-dialog
    :title="modelTitle"
    v-model="dialogVisible"
    center
    destroy-on-close
    width="1040px"
  >
    <PageSearch
      :form-config="searchConfig"
      @search-btn-click="handleSearchClick"
      @reset-btn-click="handleResetClick"
    />
    <PageContent ref="pageContentRef" :content-config="contentConfig" />
  </el-dialog>
</template>
