<!--
 * @Author: liuJie
 * @Date: 2026-02-28 15:54:00
 * @LastEditors: liuJie
 * @LastEditTime: 2026-04-11 13:33:27
 * @Describe: file describe
-->
<template>
  <div class="safety-platform-container">
    <header class="safety-platform-container__header">
      <BreadcrumbBack />
      <span class="breadcrumb-title">{{ headerTitle }}</span>
    </header>
    <AreaCheckPlanManagementDetail v-if="!isRecordDetail" />
    <AreaCheckPlanRecordDetail v-else />
  </div>
</template>

<script setup lang="ts">
  import { computed } from 'vue';
  import { useRoute } from 'vue-router';
  import BreadcrumbBack from '@/components/BreadcrumbBack.vue';
  import AreaCheckPlanManagementDetail from './components/areaCheckPlanManagementDetail.vue';
  import AreaCheckPlanRecordDetail from './components/areaCheckPlanRecordDetail.vue';

  const route = useRoute();
  const operate = computed(() => (route.query.operate as string) || '');

  const isRecordDetail = computed(() => operate.value === 'area-check-plan-record-view');

  const headerTitle = computed(() => {
    if (isRecordDetail.value) return '查看检查记录';
    switch (operate.value) {
      case 'area-check-plan-create':
        return '新增区域检查';
      case 'area-check-plan-edit':
        return '编辑区域检查';
      case 'area-check-plan-view':
        return '查看区域检查';
      default:
        return '未知操作';
    }
  });
</script>

<style scoped lang="scss">
  @use '@/styles/page-details-layout.scss' as *;
  @use '@/styles/page-main-layout.scss' as *;

  .safety-platform-container__header {
    flex-direction: row !important;
    justify-content: flex-start !important;
    gap: 8px !important;
  }
</style>

