Эх сурвалжийг харах

fix: bug[4458]: 评卷页面回评页面点击连续返回按钮页面无反应

chenhao 2 жил өмнө
parent
commit
bf1e7f431b

+ 111 - 3
src/modules/analysis/personnel-statistics/components/StatisticsGroup.vue

@@ -1,6 +1,15 @@
 <template>
   <div class="p-small radius-base fill-blank">
-    <base-table size="small" :columns="columns" :data="data" :height="useVW(300)" highlight-current-row> </base-table>
+    <base-table
+      ref="tableRef"
+      size="small"
+      :columns="columns"
+      :data="tableData"
+      :height="useVW(300)"
+      highlight-current-row
+      @current-change="onCurrentChange"
+    >
+    </base-table>
   </div>
   <div class="flex justify-between m-t-base">
     <div class="flex-1 p-base radius-base fill-blank m-r-base chart-box">
@@ -14,15 +23,21 @@
 
 <script setup lang="ts" name="StatisticsGroup">
 /** 人员数据统计-按小组 */
+import { watch, computed } from 'vue'
 import BaseTable from '@/components/element/BaseTable.vue'
 import VueECharts from 'vue-echarts'
 import useVW, { usePX } from '@/hooks/useVW'
 import useFetch from '@/hooks/useFetch'
+import useTableCheck from '@/hooks/useTableCheck'
 
-import type { ExtractApiResponse } from 'api-type'
+import type { EChartsOption } from 'echarts'
+import type { ExtractApiResponse, ExtractApiParams } from 'api-type'
 import type { EpTableColumn } from 'global-type'
 
-defineProps<{ data: ExtractApiResponse<'getStatisticsByGroup'> }>()
+const props = defineProps<{
+  data: ExtractApiResponse<'getStatisticsByGroup'>
+  params: ExtractApiParams<'getStatisticsByGroup'> & { expand: boolean }
+}>()
 
 const columns: EpTableColumn<ExtractArrayValue<ExtractApiResponse<'getStatisticsByGroup'>>>[] = [
   {
@@ -62,8 +77,101 @@ const columns: EpTableColumn<ExtractArrayValue<ExtractApiResponse<'getStatistics
   { align: 'center', label: '综合系数', prop: 'integration', width: usePX(64) },
 ]
 
+const data = computed(() => {
+  return props.data || []
+})
+
+const { tableRef, tableData, current, onCurrentChange } = useTableCheck(data)
+
 const { fetch: getStatisticObjectiveByGroup, result: objectiveByGroup } = useFetch('getStatisticObjectiveByGroup')
 const { fetch: getStatisticSubjectiveByGroup, result: subjectiveByGroup } = useFetch('getStatisticSubjectiveByGroup')
+
+watch(
+  [() => props.params, current],
+  () => {
+    const { subjectCode, questionMainNumber, startTime = '', endTime = '' } = props.params || {}
+    if (subjectCode && questionMainNumber && current.value?.markingGroupNumber) {
+      getStatisticObjectiveByGroup({
+        subjectCode,
+        questionMainNumber,
+        markingGroupNumber: current.value.markingGroupNumber,
+        startTime,
+        endTime,
+      })
+      getStatisticSubjectiveByGroup({
+        subjectCode,
+        questionMainNumber,
+        markingGroupNumber: current.value.markingGroupNumber,
+        startTime,
+        endTime,
+      })
+    }
+  },
+  { immediate: true, deep: true }
+)
+
+// 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),
+//       },
+//     ],
+//   }
+// })
 </script>
 
 <style scoped lang="scss">

+ 15 - 6
src/modules/analysis/personnel-statistics/components/StatisticsPersonnel.vue

@@ -25,6 +25,14 @@
       </template>
     </base-table>
   </div>
+  <div class="flex justify-between m-t-base">
+    <div class="flex-1 p-base radius-base fill-blank m-r-base chart-box">
+      <vue-e-charts class="full"></vue-e-charts>
+    </div>
+    <div class="flex-1 p-base radius-base fill-blank chart-box">
+      <vue-e-charts class="full"></vue-e-charts>
+    </div>
+  </div>
   <set-workload v-model="setWorkloadVisible" :data="setWorkloadData" />
 </template>
 
@@ -32,6 +40,7 @@
 /** 人员数据统计-按人员展开 */
 import { reactive, ref, inject } from 'vue'
 import { ElButton, ElPopover, ElMenu, ElMenuItem } from 'element-plus'
+import VueECharts from 'vue-echarts'
 import BaseTable from '@/components/element/BaseTable.vue'
 import SetWorkload from './SetWorkload.vue'
 import useVW, { usePX } from '@/hooks/useVW'
@@ -51,7 +60,7 @@ const columns: EpTableColumn<ExtractArrayValue<ExtractApiResponse<'getStatistics
     prop: 'markingGroupNumber',
     width: usePX(52),
     formatter(row) {
-      return `第${row.markingGroupNumber + 1}组`
+      return `第${row.markingGroupNumber}组`
     },
   },
   { label: '评卷员', prop: 'markerName', minWidth: usePX(84), slotName: 'marker' },
@@ -91,9 +100,6 @@ const setWorkloadData = ref<ExtractArrayValue<ExtractApiResponse<'getStatisticsB
 
 function setPopoverRefs(id: number, popover: PopoverInstance) {
   popovers[`popovers-${id}`] = popover
-  // return (popover: PopoverInstance) => {
-  //   popovers[`popovers-${id}`] = popover
-  // }
 }
 
 /** on popover show */
@@ -114,10 +120,13 @@ function onSetWorkload(data: ExtractArrayValue<ExtractApiResponse<'getStatistics
 /** 发送消息 */
 function onSendMessage(data: ExtractArrayValue<ExtractApiResponse<'getStatisticsByGroup'>>) {
   popovers[`popovers-${data.markerId}`]?.hide()
-  console.log('发送消息', data)
   setReplyUserId?.(data.markerId)
   setMessageVisible?.(true)
 }
 </script>
 
-<style scoped lang="scss"></style>
+<style scoped lang="scss">
+.chart-box {
+  height: 293px;
+}
+</style>

+ 5 - 1
src/modules/analysis/personnel-statistics/index.vue

@@ -9,7 +9,11 @@
       </base-form>
     </div>
     <div class="flex-1 p-small">
-      <component :is="fetchModel.expand ? StatisticsPersonnel : StatisticsGroup" :data="data"></component>
+      <component
+        :is="fetchModel.expand ? StatisticsPersonnel : StatisticsGroup"
+        :data="data"
+        :params="fetchModel"
+      ></component>
     </div>
   </div>
 </template>

+ 1 - 1
src/modules/marking/mark/index.vue

@@ -258,7 +258,7 @@ const onConfirmSubmitProblem = async () => {
 const onBack = () => {
   /** 回评时返回到正评, 否则返回到评卷员主页 */
   if (currentTaskType.value === 'remarking') {
-    currentTask.value = void 0
+    getNextTask()
   } else {
     replace({
       name: 'MarkingNav',