Quellcode durchsuchen

解决舌面象结果异常值未正确标注
ps. 疑似深拷贝数据时,数组自定义属性丢失

cc12458 vor 3 Monaten
Ursprung
Commit
d29eec4534
2 geänderte Dateien mit 7 neuen und 4 gelöschten Zeilen
  1. 2 2
      src/components/AnalysisComponent.vue
  2. 5 2
      src/request/model/analysis.model.ts

+ 2 - 2
src/components/AnalysisComponent.vue

@@ -38,13 +38,13 @@ const {
               <tbody>
               <tr
                 v-for="item in table?.data"
-                :key="item[0]"
+                :key="item.columns[0]"
                 :data-exception="item.exception"
                 :data-invalid="item.invalid"
               >
                 <td
                     class="py-4 px-2 border border-primary text-center text-grey"
-                    v-for="(value, i) in item"
+                    v-for="(value, i) in item.columns"
                     :key="i"
                     v-html="value"
                 ></td>

+ 5 - 2
src/request/model/analysis.model.ts

@@ -22,7 +22,7 @@ export function fromAnalysisModel(mode: 'tongue' | 'face', data: Record<string,
 export interface AnalysisModel {
   table: {
     columns: string[];
-    data: (string[] & { exception: boolean; invalid?: boolean })[];
+    data: { exception: boolean; invalid?: boolean; columns: string[] }[];
   };
   exception: AnalysisException[];
   exceptionGroup: {
@@ -128,6 +128,9 @@ function fromAnalysisException(exception: AnalysisException[], $title = (label:
         }
         return title;
       }) ?? [];
-    return Object.assign([label, values.join('<br>'), data?.standardValue ?? ''], { exception: is, invalid });
+    return {
+      exception: is, invalid,
+      columns: [label, values.join('<br>'), data?.standardValue ?? '']
+    }
   };
 }