DepartmentSelectionCard.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <section class="business-card">
  3. <h2>推荐科室</h2>
  4. <article v-for="dept in departments" :key="dept.departmentId" class="option">
  5. <h3>{{ dept.name }}</h3>
  6. <p>{{ dept.reason }}</p>
  7. <button @click="$emit('action', 'select_department')">选择{{ dept.name }}</button>
  8. </article>
  9. </section>
  10. </template>
  11. <script setup lang="ts">
  12. import { computed } from 'vue';
  13. import type { CardInstance } from '../api/types';
  14. const props = defineProps<{ card: CardInstance }>();
  15. defineEmits<{ action: [actionName: string] }>();
  16. interface DepartmentOption {
  17. departmentId: string;
  18. name: string;
  19. reason: string;
  20. }
  21. const departments = computed(() => (props.card.cardData.departments as DepartmentOption[]) ?? []);
  22. </script>
  23. <style scoped>
  24. .business-card {
  25. min-height: 0;
  26. overflow: auto;
  27. padding: 16px;
  28. border: 1px solid var(--border);
  29. border-radius: var(--radius-panel);
  30. background: var(--surface);
  31. }
  32. h2 {
  33. margin: 0 0 12px;
  34. font-size: 18px;
  35. }
  36. .option {
  37. padding: 12px;
  38. border: 1px solid var(--border);
  39. border-radius: var(--radius-card);
  40. margin-bottom: 10px;
  41. background: var(--soft-tint);
  42. }
  43. h3 {
  44. margin: 0;
  45. color: var(--brand-primary);
  46. }
  47. p {
  48. color: var(--text-secondary);
  49. font-size: 12px;
  50. line-height: 1.6;
  51. }
  52. button {
  53. width: 100%;
  54. border: 0;
  55. border-radius: 999px;
  56. padding: 9px 12px;
  57. background: var(--brand-primary);
  58. color: #ffffff;
  59. font-weight: 900;
  60. cursor: pointer;
  61. }
  62. </style>