فهرست منبع

bug-16 个人 / 系统 标签添加颜色区分

cc12458 10 ماه پیش
والد
کامیت
90e3d7610f
3فایلهای تغییر یافته به همراه4 افزوده شده و 6 حذف شده
  1. 1 1
      src/components/PatientHealthRecordPreview.vue
  2. 1 5
      src/components/PatientTagEdit.vue
  3. 2 0
      src/model/patient.model.ts

+ 1 - 1
src/components/PatientHealthRecordPreview.vue

@@ -226,7 +226,7 @@ function openIndicatorRecordsPreview() {
         <label>标签:</label>
         <a-spin v-if="loadPatientTagsPending"></a-spin>
         <template v-else>
-          <a-tag v-for="tag in patientTags" :key="tag.id">{{ tag.name }}</a-tag>
+          <a-tag v-for="tag in patientTags" :key="tag.id" :color="tag.color">{{ tag.name }}</a-tag>
           <a-button type="link" @click="openPatientTagEdit($event)">
             <template #icon>
               <EditOutlined />

+ 1 - 5
src/components/PatientTagEdit.vue

@@ -109,16 +109,12 @@ function appendTag(id: PatientTagVO['id']) {
 function remove(tag: PatientTagVO, index: number) {
   form.value.tags.splice(index, 1);
 }
-
-const getTagColor = (tag: PatientTagVO) => {
-  return { 1: 'pink', 2: 'blue' }[tag.category];
-};
 </script>
 
 <template>
   <a-spin :spinning="loading">
     <div class="flex flex-wrap mt--2">
-      <a-tag class="mt-2" v-for="(item, index) in form.tags" :key="item.id" :color="getTagColor(item)" :closable="!submitting" @close="remove(item, index)">
+      <a-tag class="mt-2" v-for="(item, index) in form.tags" :key="item.id" :color="item.color" :closable="!submitting" @close="remove(item, index)">
         {{ item.name }}
       </a-tag>
     </div>

+ 2 - 0
src/model/patient.model.ts

@@ -60,6 +60,7 @@ export interface PatientTagVO {
   category: '1' | '2';
 
   disabled?: boolean;
+  color: string;
 }
 
 export function fromPatientTag(data: PatientTagDTO): PatientTagVO {
@@ -68,5 +69,6 @@ export function fromPatientTag(data: PatientTagDTO): PatientTagVO {
     name: data.name,
     category: data.type,
     disabled: data.status === '1',
+    color: { 1: 'pink', 2: 'blue' }[data.type],
   }
 }