瀏覽代碼

按人员展开、包含组长给分、 作为本地存储配置成员之一,记住效果

刘洋 1 年之前
父節點
當前提交
944ed36ceb

+ 14 - 0
src/modules/analysis/personnel-statistics/hooks/useStatisticsFilter.ts

@@ -8,6 +8,7 @@ import useFetch from '@/hooks/useFetch'
 import useDayList from '@/hooks/useDayList'
 import { getTodayByDay } from '@/utils/common'
 import { useRoute } from 'vue-router'
+import { getUserConfigByType, setUserConfigByType } from '@/utils/common'
 import type { EpFormItem, EpFormRows } from 'global-type'
 import type { ExtractApiParams } from '@/api/api'
 
@@ -94,6 +95,19 @@ const useStatisticsFilter = () => {
       immediate: true,
     }
   )
+  watch(
+    () => model.expand,
+    (val) => {
+      setUserConfigByType('expandByPerson', val?.length ? '1' : '0')
+    }
+  )
+  watch(
+    () => model.hasGroupLeaderScore,
+    (val) => {
+      setUserConfigByType('includeLeaderScore', val?.length == 1 ? '1' : '0')
+    }
+  )
+
   // const fetchModel = computed<ExtractApiParams<'getStatisticsByGroup'> & { expand: boolean }>(() => {
   const fetchModel = computed<any>(() => {
     return Object.assign(omit(model, 'curDay'), {

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

@@ -73,6 +73,7 @@ import { cloneDeep } from 'lodash-es'
 import { useIntervalFn } from '@vueuse/core'
 import { getTodayByDay } from '@/utils/common'
 import { useRoute } from 'vue-router'
+import { getUserConfigByType, setUserConfigByType } from '@/utils/common'
 import type { ExtractApiResponse } from '@/api/api'
 const route = useRoute()
 console.log('route', route)
@@ -138,9 +139,15 @@ watch(groupListWithAll, () => {
 })
 
 onMounted(() => {
-  if (mainStore.myUserInfo && mainStore.myUserInfo.role === 'DEPUTY') {
+  if (
+    (mainStore.myUserInfo && mainStore.myUserInfo.role === 'DEPUTY') ||
+    getUserConfigByType('expandByPerson') == '1'
+  ) {
     model.expand = ['按人员展开']
   }
+  if (getUserConfigByType('includeLeaderScore') == '1') {
+    model.hasGroupLeaderScore = ['true']
+  }
 })
 
 const { fetch, result: allResult, loading } = useFetch('getStatisticsByGroup')

+ 3 - 1
src/utils/common.ts

@@ -308,7 +308,9 @@ export const preloadImg = (url: any) => {
 
 export const initConfigModelData = (): any => {
   return {
-    draft: { other: '' },
+    draft: { other: '' }, //消息草稿信息
+    expandByPerson: '0', //人员数据统计-按人员展开
+    includeLeaderScore: '0', //人员数据统计-是否包含组长给分
   }
 }