<script setup lang="ts">
import { PageContent } from "/@/components/PageContent";
import { PageSearch, usePageSearch } from "/@/components/PageSearch";
import { useRouter } from "vue-router";
import contentConfig from "./config/content.config";
import searchFormConfig from "./config/search.config";

defineOptions({
  name: "purchPay"
});

const { pageContentRef, handleSearchClick, handleResetClick } = usePageSearch();

const { push } = useRouter();

function handleCreate() {
  push("/purchase/purchPayDetail");
}

function handlePreview(item) {
  push({
    path: "/purchase/purchPayDetail",
    query: {
      id: item.dzNo
    }
  });
}
</script>

<template>
  <div class="main role">
    <PageSearch
      ref="pageContentRef"
      :form-config="searchFormConfig"
      @search-btn-click="handleSearchClick"
      @reset-btn-click="handleResetClick"
    />
    <PageContent
      ref="pageContentRef"
      :content-config="contentConfig"
      @preview-btn-click="handlePreview"
    >
      <template #create>
        <el-button type="primary" @click="handleCreate">新建</el-button>
      </template>
    </PageContent>
  </div>
</template>
