<script setup lang="ts">
import { shallowRef, ref } from "vue";
import { ElMessage } from "element-plus";

import sourceSearchConfig from "./config/search.config";
import sourceContentConfig from "./config/content.config";

import { usePageSearch, type PageHooks } from "/@/hooks/page";
import { PageContentInstance } from "/@/components/PageContent";

import { useBusinessSearch, useBusinessContent } from "./../../_hooks";
import { createHttpRequset } from "./../../_http/createRequset";

const lockKey = "relaComNo";
const loading = shallowRef(false);
const pageContentRef = ref<PageContentInstance | null>(null);

const { searchConfig } = useBusinessSearch({
  sourceConfig: sourceSearchConfig
});

const { contentConfig } = useBusinessContent({
  sourceConfig: sourceContentConfig,
  apis: { httpList: createHttpRequset("r_reportzixuntotal") },
  insertBusinessField: { index: 1 }
});

const hooks: PageHooks = {
  pageSearchHook: () =>
    usePageSearch(undefined, undefined, searchConfig, false, lockKey)
};
</script>

<template>
  <PageContainer
    :hooks="hooks"
    :getContentRef="ref => (pageContentRef = ref)"
    :content-config="contentConfig"
    :search-config="searchConfig"
    lockKey="relaComNo"
  />
</template>
