Forráskód Böngészése

feat: 雷同卷确认后刷新列表

chenhao 2 éve
szülő
commit
3da70bb72b

+ 64 - 74
src/modules/analysis/personnel-statistics/components/StatisticsGroup.vue

@@ -112,81 +112,71 @@ watch(
 
 type StatisticObjectiveByGroup = ExtractApiResponse<'getStatisticObjectiveByGroup'>
 
-// const getXAxisData = <K extends keyof StatisticObjectiveByGroup>(field: K, data?: StatisticObjectiveByGroup[K]) => {
-//   if (!data) {
-//     return []
-//   }
-//   const getValue = <T extends keyof ExtractArrayValue<StatisticObjectiveByGroup[K]>>(
-//     key: T,
-//     item: ExtractArrayValue<StatisticObjectiveByGroup[K]>
-//   ) => {
-//     return item[key]
-//   }
-//   return data?.map((v) => getValue(field, v))
-// }
+type StatisticObjectiveByGroupValues = StatisticObjectiveByGroup['segmentsByAll']
 
-// const groupChartsOption = computed<EChartsOption>(() => {
-//   return {
-//     legend: {
-//       right: 0,
-//       itemWidth: 14,
-//       data: ['小组主观分布', '题组主观分布'],
-//     },
-//     xAxis: {
-//       axisLine: { show: false },
-//       axisTick: { show: false },
-//       splitLine: { show: false },
-//       axisLabel: {
-//         align: 'right',
-//       },
-//       data: getXAxisData('markingGroupNumber', groupProgressResult?.value),
-//     },
-//     yAxis: [
-//       {
-//         type: 'value',
-//       },
-//       {
-//         type: 'value',
-//         axisLabel: {
-//           formatter: `{value}%`,
-//         },
-//         splitLine: { show: false },
-//       },
-//     ],
-//     series: [
-//       {
-//         name: '完成总量',
-//         type: 'bar',
-//         barWidth: 20,
-//         itemStyle: {
-//           color: '#3AD500',
-//         },
-//         data: getXAxisData('finishCount', groupProgressResult?.value),
-//       },
-//       {
-//         name: '当日已完成',
-//         type: 'bar',
-//         barWidth: 20,
-//         itemStyle: {
-//           color: '#0064FF',
-//         },
-//         data: getXAxisData('dayFinishCount', groupProgressResult?.value),
-//       },
-//       {
-//         name: '完成比',
-//         type: 'bar',
-//         barWidth: 80,
-//         showBackground: true,
-//         barGap: '-200%',
-//         yAxisIndex: 1,
-//         itemStyle: {
-//           color: 'rgba(0, 186, 151,0.3)',
-//         },
-//         data: getXAxisData('finishRate', groupProgressResult?.value),
-//       },
-//     ],
-//   }
-// })
+const getXAxisData = <K extends keyof ExtractArrayValue<StatisticObjectiveByGroupValues>>(
+  field: K,
+  data?: StatisticObjectiveByGroupValues
+) => {
+  if (!data) {
+    return []
+  }
+  const getValue = (key: K, item: ExtractArrayValue<StatisticObjectiveByGroupValues>) => {
+    return item[key]
+  }
+  return data?.map((v) => getValue(field, v))
+}
+
+const groupChartsOption = computed<EChartsOption>(() => {
+  return {
+    legend: {
+      right: 0,
+      itemWidth: 14,
+      data: ['小组主观分布', '题组主观分布'],
+    },
+    xAxis: {
+      axisLine: { show: false },
+      axisTick: { show: false },
+      splitLine: { show: false },
+      axisLabel: {
+        align: 'right',
+      },
+      data: getXAxisData('count', subjectiveByGroup?.value?.segmentsByGroup),
+    },
+    yAxis: [
+      {
+        type: 'value',
+      },
+      {
+        type: 'value',
+        axisLabel: {
+          formatter: `{value}%`,
+        },
+        splitLine: { show: false },
+      },
+    ],
+    series: [
+      {
+        name: '小组主观分布',
+        type: 'bar',
+        barWidth: 20,
+        itemStyle: {
+          color: '#3AD500',
+        },
+        data: getXAxisData('rate', subjectiveByGroup?.value?.segmentsByGroup),
+      },
+      {
+        name: '题组主观分布',
+        type: 'bar',
+        barWidth: 20,
+        itemStyle: {
+          color: '#0064FF',
+        },
+        data: getXAxisData('rate', subjectiveByGroup?.value?.segmentsByAll),
+      },
+    ],
+  }
+})
 </script>
 
 <style scoped lang="scss">

+ 10 - 4
src/modules/marking/similar/index.vue

@@ -42,7 +42,7 @@
 <script setup lang="ts" name="MarkingSimilar">
 /** 雷同卷查看 */
 import { reactive, ref, computed, watch, nextTick } from 'vue'
-import { ElButton } from 'element-plus'
+import { ElButton, ElMessage } from 'element-plus'
 import { useSetImgBg } from '@/hooks/useSetImgBg'
 import useFetch from '@/hooks/useFetch'
 import useVW from '@/hooks/useVW'
@@ -157,9 +157,15 @@ const onSearch = async () => {
 /** 是否雷同 */
 const { fetch: confirmIsSimilar } = useFetch('confirmIsSimilar')
 
-const onConfirmSame = (same: boolean) => {
-  if (currentSamePaper.value) {
-    confirmIsSimilar({ id: currentSamePaper.value.id, same })
+const onConfirmSame = async (same: boolean) => {
+  try {
+    if (currentSamePaper.value) {
+      await confirmIsSimilar({ id: currentSamePaper.value.id, same })
+      ElMessage.success('操作成功')
+      onSearch()
+    }
+  } catch (error) {
+    console.error(error)
   }
 }