<script setup lang="ts">
import { computed, ref } from "vue";
import { useNav } from "/@/layout/hooks/useNav";
import BasicDescriptions from "/@/components/BasicDescriptions";
import { responseHandle } from "/@/utils/responseHandle";
import { PageDetailProps } from "./types";
const { logout } = useNav();

const props = defineProps(PageDetailProps);
const columns = computed(() => props.contentConfig.columns);
const apis = computed(() => props.contentConfig.apis);
const workDetail = ref({});
const loading = ref(false);
const initData = async row => {
  loading.value = true;
  const { code, data, message } = await apis.value.httpDetail(row);
  responseHandle({
    code,
    message,
    logout,
    handler: () => {
      workDetail.value = data;
      console.log(workDetail.value);
    }
  });
  loading.value = false;
};
defineExpose({
  reload: row => {
    initData(row);
  }
});
</script>

<template>
  <BasicDescriptions
    v-loading="loading"
    :data="workDetail"
    :columns="columns"
  />
</template>
