zhangjie 6 сар өмнө
parent
commit
55426a9a01

+ 33 - 1
src/views/base/track-export/useDraw.ts

@@ -1006,7 +1006,39 @@ export default function useDraw(drawConfig: DrawConfig) {
   // objective answer tag ----- end->
 
   // mode4 data
+  function getMode4MarkerName(q: Question): string {
+    let markerName = '';
+    if (q.headerTrack && q.headerTrack.length) {
+      markerName = q.headerTrack[0].userName;
+    } else if (q.trackList && q.trackList.length) {
+      markerName = q.trackList[0].userName;
+    } else if (q.markerList && q.markerList.length) {
+      let markers = q.markerList.filter((marker) => marker.header);
+      if (!markers.length) {
+        markers = q.markerList.filter((marker) => !marker.header);
+      }
+      if (markers.length) markerName = markers[0].userName;
+    }
+    return markerName;
+  }
+
   function parseMode4Data(img: ImageItem): DrawTrackItem[] {
+    const isDoubleMark = (rawTask.questionList || []).some((question) => {
+      let userIds = question.trackList.map((track) => track.userId);
+      if (
+        !userIds.length &&
+        question.markerList &&
+        question.markerList.length
+      ) {
+        userIds = question.markerList
+          .filter((marker) => !marker.header)
+          .map((marker) => marker.userId);
+      }
+      const uids = new Set(userIds);
+      return uids.size === 2;
+    });
+    if (isDoubleMark) return [];
+
     const dataList: DrawTrackItem[] = [];
     const sources: string[][] = [['主观题号', '分数', '评卷员']];
 
@@ -1014,7 +1046,7 @@ export default function useDraw(drawConfig: DrawConfig) {
       sources.push([
         `${q.mainNumber}-${q.subNumber}`,
         `${q.score}`,
-        q.trackList[0]?.userName,
+        getMode4MarkerName(q),
       ]);
     });