Przeglądaj źródła

fix(qualityControl): 修正部门类型判断条件

refactor(dutyOrganization): 重构出勤统计图表逻辑

- 在qualityControl组件中修正部门类型判断条件,将isBrigadeType改为isDepartmentType
- 在dutyOrganization组件中:
  - 删除查询参数中的deptId
  - 新增非站长视角的出勤统计图表配置
  - 根据用户类型区分显示不同的出勤统计图表
huoyi 4 dni temu
rodzic
commit
ad97992a5c

+ 100 - 2
src/views/assistant/components/dutyOrganization.vue

@@ -315,7 +315,7 @@ const fetchDutyOrganizationData = async (queryParams) => {
315 315
     const processedParams = processQueryParams(queryParams)
316 316
     const selectedDept = props.selectedDeptObject
317 317
     const { deptType = "", id } = selectedDept ? selectedDept : { deptType: "", id: "" }
318
-
318
+    delete processedParams.deptId
319 319
     let calculateParams = {
320 320
       ...(['TEAMS', 'DEPARTMENT', 'BRIGADE'].includes(deptType) ? { deptId: id } : {}),
321 321
       ...(deptType == 'USER' ? { userId: id } : {})
@@ -665,6 +665,76 @@ const attendanceBarOptions = {
665 665
     }
666 666
   ]
667 667
 }
668
+// 出勤人次柱状图配置
669
+const attendanceBarOtherOptions = {
670
+  tooltip: {
671
+    trigger: 'axis',
672
+    axisPointer: {
673
+      type: 'shadow'
674
+    },
675
+    formatter: function (params) {
676
+      let result = `${params[0].axisValue}<br/>`
677
+      params.forEach(param => {
678
+        result += ` <span style="color:${param.color};font-weight:bold">${param.data}</span>人<br/>`
679
+      })
680
+      return result
681
+    }
682
+  },
683
+  legend: {
684
+    top: 0,
685
+    show: true,
686
+  },
687
+  grid: {
688
+    left: '3%',
689
+    right: '4%',
690
+    bottom: '0%',
691
+    top: '80',
692
+    containLabel: true
693
+  },
694
+  xAxis: {
695
+    type: 'category',
696
+    data: [],
697
+    axisLine: {
698
+      lineStyle: {
699
+        color: '#999'
700
+      }
701
+    },
702
+    axisLabel: {
703
+      fontSize: 12
704
+    }
705
+  },
706
+  yAxis: {
707
+    type: 'value',
708
+    name: '人数',
709
+    axisLine: {
710
+      lineStyle: {
711
+        color: '#999'
712
+      }
713
+    },
714
+    splitLine: {
715
+      lineStyle: {
716
+        color: '#f0f0f0'
717
+      }
718
+    }
719
+  },
720
+  series: [
721
+    {
722
+      name: '',
723
+      type: 'bar',
724
+      barWidth: '10%',
725
+      itemStyle: {
726
+        color: '#5470C6'
727
+      },
728
+      label: {
729
+        show: true,
730
+        position: 'top',
731
+        formatter: '{c}人'
732
+      },
733
+      data: []
734
+    },
735
+  ]
736
+}
737
+
668 738
 
669 739
 // 初始化图表
670 740
 onMounted(() => {
@@ -793,6 +863,29 @@ const updateTrendBarChart = () => {
793 863
     setBarOption(trendBarOptions)
794 864
   }
795 865
 }
866
+//非站长走这个逻辑
867
+const updateAttendanceBarOtherChart = () => {
868
+  if (trendData.value && Array.isArray(trendData.value)) {
869
+    const trendList = trendData.value
870
+    
871
+    // 提取横坐标数据(timeLabel字段)
872
+    const xAxisData = trendList.map(item => item.timeLabel || '未知时间')
873
+    // 提取各科室数据
874
+    const allData = trendList.map(item => item.overall || 0)
875
+    // 更新图表配置
876
+    attendanceBarOtherOptions.xAxis.data = xAxisData
877
+    attendanceBarOtherOptions.series[0].data = allData
878
+    attendanceBarOtherOptions.legend.show = !!isStationType.value
879
+    // 重新设置图表选项
880
+    setAttendanceOption(attendanceBarOtherOptions)
881
+  } else {
882
+    // 无数据时清空图表
883
+    attendanceBarOtherOptions.xAxis.data = []
884
+    attendanceBarOtherOptions.series[0].data = []
885
+    attendanceBarOtherOptions.legend.show = !!isStationType.value
886
+    setAttendanceOption(attendanceBarOtherOptions)
887
+  }
888
+}
796 889
 
797 890
 const updateAttendanceBarChart = () => {
798 891
   if (trendData.value && Array.isArray(trendData.value)) {
@@ -836,7 +929,12 @@ const updateAttendanceBarChart = () => {
836 929
 // 根据API数据更新图表和统计信息
837 930
 const updateChartsWithData = () => {
838 931
   // 更新出勤人次柱状图
839
-  updateAttendanceBarChart()
932
+  if (isStationType.value) {
933
+    updateAttendanceBarChart()
934
+  } {
935
+    updateAttendanceBarOtherChart()
936
+  }
937
+
840 938
   // 更新资质等级分布饼图
841 939
   updateQualificationPieChart()
842 940
   // 更新资质趋势柱状图

+ 1 - 1
src/views/assistant/components/qualityControl.vue

@@ -8,7 +8,7 @@
8 8
     <!-- 四个横向均分的内容区域 -->
9 9
     <div class="four-panel-layout">
10 10
       <!-- 第一个:任务计划安排统计 -->
11
-      <div class="panel-item" v-show="!isTeamType && !isUserType && !isBrigadeType">
11
+      <div class="panel-item" v-show="!isTeamType && !isUserType && !isDepartmentType">
12 12
         <div class="panel-header">
13 13
           <h3>任务计划安排统计</h3>
14 14
         </div>