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

Merge branch 'release_1.1.1_bugfix' of http://git.qmth.com.cn/marking-cet/marking-cet-web into release_1.1.1

刘洋 1 жил өмнө
parent
commit
b5397bf5e3

+ 47 - 17
src/hooks/useOptions.ts

@@ -54,6 +54,10 @@ const useOptions = (
     return userInfo?.value?.role === 'SECTION_LEADER'
   })
 
+  const isDeputy = computed(() => {
+    return userInfo?.value?.role === 'DEPUTY'
+  })
+
   const dataModel = reactive<DataModel>(unref(initModel) || {})
 
   if (isRef(initModel)) {
@@ -193,27 +197,47 @@ const useOptions = (
     { immediate: true }
   )
 
+  const watchQuestionHandle = () => {
+    isChooseAllOptionMap.question = !dataModel.question
+    if (types.includes('group') && dataModel.subject && dataModel.question) {
+      // resetGroupList()
+      // changeModelValue('group')(void 0)
+      getQuestionGroupList({ subjectCode: dataModel.subject, mainNumber: dataModel.question }).then((res: any) => {
+        // if (!userInfo.value?.markingGroupNumber && res && res[0]) {
+        //   changeModelValue('group')(res[0])
+        // }
+        changeModelValue('group')(
+          multGroup && showAllLabel
+            ? groupList.value?.length && (isAdmin.value || isChief.value || isExpert.value || isLeader.value)
+              ? [void 0]
+              : []
+            : void 0
+        )
+      })
+    }
+  }
   watch(
     // [() => dataModel.question, () => dataModel.question],
     () => dataModel.question,
     () => {
-      isChooseAllOptionMap.question = !dataModel.question
-      if (types.includes('group') && dataModel.subject && dataModel.question) {
-        // resetGroupList()
-        // changeModelValue('group')(void 0)
-        getQuestionGroupList({ subjectCode: dataModel.subject, mainNumber: dataModel.question }).then((res: any) => {
-          // if (!userInfo.value?.markingGroupNumber && res && res[0]) {
-          //   changeModelValue('group')(res[0])
-          // }
-          changeModelValue('group')(
-            multGroup && showAllLabel
-              ? groupList.value?.length && (isAdmin.value || isChief.value || isExpert.value || isLeader.value)
-                ? [void 0]
-                : []
-              : void 0
-          )
-        })
-      }
+      watchQuestionHandle()
+      // isChooseAllOptionMap.question = !dataModel.question
+      // if (types.includes('group') && dataModel.subject && dataModel.question) {
+      //   // resetGroupList()
+      //   // changeModelValue('group')(void 0)
+      //   getQuestionGroupList({ subjectCode: dataModel.subject, mainNumber: dataModel.question }).then((res: any) => {
+      //     // if (!userInfo.value?.markingGroupNumber && res && res[0]) {
+      //     //   changeModelValue('group')(res[0])
+      //     // }
+      //     changeModelValue('group')(
+      //       multGroup && showAllLabel
+      //         ? groupList.value?.length && (isAdmin.value || isChief.value || isExpert.value || isLeader.value)
+      //           ? [void 0]
+      //           : []
+      //         : void 0
+      //     )
+      //   })
+      // }
     },
     { immediate: true }
   )
@@ -245,7 +269,12 @@ const useOptions = (
           !userInfo.value?.mainNumber
         ) {
           if (mainQuestionList.value.length) {
+            const oldQuestionNumber = dataModel.question
             changeModelValue('question')(mainQuestionList.value[0].value)
+            if (oldQuestionNumber == mainQuestionList.value[0].value) {
+              //防止切换科目前的大题号和切换科目后的大题号相同,watch question监听不执行
+              watchQuestionHandle()
+            }
           }
         }
       },
@@ -331,6 +360,7 @@ const useOptions = (
     forceRefresh,
     isExpert,
     isLeader,
+    isDeputy,
   }
 }
 

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

@@ -33,6 +33,7 @@ const useStatisticsFilter = () => {
     onOptionInit,
     isExpert,
     isLeader,
+    isDeputy,
   } = useOptions(['subject', 'question', 'group'], undefined, true, true, true)
 
   const curDayRange = getCurDayRange()
@@ -186,6 +187,7 @@ const useStatisticsFilter = () => {
         options: transGroupOptions.value,
         onChange: customGroupChange,
         multiple: true,
+        disabled: isDeputy.value,
       },
     }),
     OneRowSpan4({