<script lang="ts" setup>
/**
 * 病历门店词条-按字段拆分页（从路由 path 末段解析 field_code）
 */
import { computed } from 'vue';
import { useRoute } from 'vue-router';

import EntryListPage from '#/views/doctor/medical-record/components/EntryListPage.vue';
import { MEDICAL_RECORD_FIELD_OPTIONS } from '#/views/doctor/medical-record/config/constants';

defineOptions({ name: 'MedicalRecordEntryStoreField' });

const route = useRoute();

const fieldCode = computed(() => {
  const seg = (route.path.split('/').filter(Boolean).pop() || '').trim();
  return seg.replace(/-/g, '_');
});

const fieldLabel = computed(() => {
  const hit = MEDICAL_RECORD_FIELD_OPTIONS.find((o) => o.value === fieldCode.value);
  return hit?.label || fieldCode.value;
});

const pageTitle = computed(() => `门店词条·${fieldLabel.value}`);
</script>
<template>
  <EntryListPage
    :key="fieldCode"
    scope="store"
    :fixed-field-code="fieldCode"
    :page-title="pageTitle"
    :page-name="String(route.name || 'MedicalRecordEntryStoreField')"
  />
</template>
