<script setup lang="ts">
import { ref } from "vue";
import searchConfig from "./config/search.config";
import contentConfig from "./config/content.config";
import { usePageSearch, type PageHooks, type PageEvents } from "/@/hooks/page";
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
import { useRouter } from "vue-router"

const PageName = "zixunOrder";
const instance = ref<any>(null);
const hooks: PageHooks = { pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig) };

const router = useRouter()


const events: PageEvents = {
  content: {
    create: () => router.push('/sellOut/zixunOrderDetail'),
    preview: (row) => router.push('/sellOut/zixunOrderDetail?id=' + row.infoNo  + '&type=preview')
  }
}

const handleCopy = (infoNo) => router.push('/sellOut/zixunOrderDetail?id=' + infoNo  + '&type=copy')
</script>

<template>
  <PageAuth :pageName="PageName">
    <PageContainer
      :hooks="hooks"
      :events="events"
      :contentConfig="contentConfig"
      :search-config="searchConfig"
      :get-content-ref="ref => (instance = ref)"
    >
      <template #content_action="{ is_project, status, infoNo }">
        <ElTooltip
          v-if="(is_project == '0' || is_project == '2') && status != '0'" 
          placement="top"
          content="复制" 
        >
          <ElButton 
            link 
            type="primary"
            :icon="useRenderIcon('ppt')"
            @click="() => handleCopy(infoNo)"
          />
        </ElTooltip>
      </template>
    </PageContainer>
  </PageAuth>
</template>
