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

feat: 小组信息部分选项增加全部

chenhao 2 жил өмнө
parent
commit
7e5b733436

+ 5 - 3
src/hooks/useOptions.ts

@@ -1,6 +1,5 @@
 import { reactive, computed, watch, ref, unref, isRef, nextTick } from 'vue'
 import useFetch from '@/hooks/useFetch'
-import { numberToChinese } from '@/utils/common'
 import { ExtractApiResponse } from 'api-type'
 import type { Ref } from 'vue'
 
@@ -74,7 +73,7 @@ const useOptions = (types: (keyof DataModel)[], initModel?: DataModel | Ref<Data
   })
 
   const groupList = computed<Group[]>(() => {
-    const groupList = mainQuestionInfo.value?.groupNumber
+    return mainQuestionInfo.value?.groupNumber
       ? Array.from({ length: mainQuestionInfo.value.groupNumber }).map((_, i) => {
           return {
             value: i + 1,
@@ -82,8 +81,10 @@ const useOptions = (types: (keyof DataModel)[], initModel?: DataModel | Ref<Data
           }
         })
       : []
+  })
 
-    return groupList?.length ? groupList.concat({ label: '全部', value: void 0 } as unknown as Group) : []
+  const groupListWithAll = computed(() => {
+    return groupList.value?.length ? [{ label: '全部', value: void 0 } as unknown as Group].concat(groupList.value) : []
   })
 
   watch(
@@ -172,6 +173,7 @@ const useOptions = (types: (keyof DataModel)[], initModel?: DataModel | Ref<Data
     subjectList,
     mainQuestionList,
     groupList,
+    groupListWithAll,
     dataModel,
     initFinish,
     onOptionInit,

+ 2 - 2
src/modules/analysis/group-monitoring/hooks/useFormFilter.ts

@@ -26,7 +26,7 @@ const useFormFilter = () => {
     }
   })
 
-  const { subjectList, mainQuestionList, groupList, changeModelValue, dataModel, onOptionInit } = useOptions([
+  const { subjectList, mainQuestionList, groupListWithAll, changeModelValue, dataModel, onOptionInit } = useOptions([
     'subject',
     'question',
     'group',
@@ -65,7 +65,7 @@ const useFormFilter = () => {
       label: '小组',
       slotType: 'select',
       slot: {
-        options: groupList.value,
+        options: groupListWithAll.value,
         onChange: changeModelValue('group'),
       },
     }),

+ 2 - 2
src/modules/analysis/marking-progress/components/GroupProgress.vue

@@ -60,7 +60,7 @@ const onExport = () => {
   exportStatistics(model)
 }
 
-const { groupList, onOptionInit } = useOptions(['group'], initModel)
+const { groupListWithAll, onOptionInit } = useOptions(['group'], initModel)
 
 onOptionInit(onSearch)
 
@@ -69,7 +69,7 @@ const { defineColumn, _ } = useForm()
 const OneRow = defineColumn(_, 'row-1', { span: 5 })
 
 const items = computed<EpFormItem[]>(() => [
-  OneRow({ label: '小组', slotType: 'select', prop: 'markingGroupNumbers', slot: { options: groupList.value } }),
+  OneRow({ label: '小组', slotType: 'select', prop: 'markingGroupNumbers', slot: { options: groupListWithAll.value } }),
   OneRow({ slotName: 'operation' }),
 ])
 

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

@@ -40,7 +40,7 @@ const useStatisticsFilter = () => {
 
   const { formRef, elFormRef, defineColumn, _ } = useForm()
 
-  const { subjectList, mainQuestionList, groupList, changeModelValue, dataModel, onOptionInit } = useOptions([
+  const { subjectList, mainQuestionList, groupListWithAll, changeModelValue, dataModel, onOptionInit } = useOptions([
     'subject',
     'question',
     'group',
@@ -86,7 +86,7 @@ const useStatisticsFilter = () => {
       label: '小组',
       slotType: 'select',
       slot: {
-        options: groupList.value,
+        options: groupListWithAll.value,
         onChange: changeModelValue('group'),
       },
     }),

+ 2 - 2
src/modules/analysis/statistics/index.vue

@@ -75,7 +75,7 @@ const fetchModel = computed<ExtractApiParams<'getStatistics'>>(() => {
 
 const { defineColumn, _ } = useForm()
 
-const { subjectList, mainQuestionList, groupList, dataModel, changeModelValue, onOptionInit } = useOptions([
+const { subjectList, mainQuestionList, groupListWithAll, dataModel, changeModelValue, onOptionInit } = useOptions([
   'subject',
   'question',
   'group',
@@ -115,7 +115,7 @@ const formItems = computed<EpFormItem[]>(() => [
     slotType: 'select',
     prop: 'markingGroupNumbers',
     slot: {
-      options: groupList.value,
+      options: groupListWithAll.value,
       onChange: changeModelValue('group'),
     },
   }),

+ 2 - 2
src/modules/marking/inquiry/index.vue

@@ -66,7 +66,7 @@ const model = reactive<FormModel>({
   // timeStart: void 0,
 })
 
-const { subjectList, mainQuestionList, groupList, dataModel, changeModelValue } = useOptions(
+const { subjectList, mainQuestionList, groupListWithAll, dataModel, changeModelValue } = useOptions(
   ['subject', 'question', 'group'],
   {},
   false
@@ -136,7 +136,7 @@ const items = computed<EpFormItem[]>(() => [
     slotType: 'select',
     slot: {
       placeholder: '评卷小组',
-      options: groupList.value,
+      options: groupListWithAll.value,
       onChange: changeModelValue('group'),
     },
   }),

+ 2 - 2
src/modules/monitor/training-monitoring/hooks/useFormFilter.ts

@@ -48,7 +48,7 @@ const useFormFilter = () => {
     { deep: true }
   )
 
-  const { subjectList, mainQuestionList, groupList, dataModel, onOptionInit, changeModelValue } = useOptions([
+  const { subjectList, mainQuestionList, groupListWithAll, dataModel, onOptionInit, changeModelValue } = useOptions([
     'subject',
     'question',
     'group',
@@ -93,7 +93,7 @@ const useFormFilter = () => {
         label: '小组',
         slotType: 'select',
         slot: {
-          options: groupList.value,
+          options: groupListWithAll.value,
           onChange: changeModelValue('group'),
         },
       }),

+ 7 - 4
src/modules/quality/ending-check/components/EndCheck.vue

@@ -89,9 +89,12 @@ const { fetch: getUnMarkPaperList, result: unMarkPaperList } = useFetch('unMarkP
 const { fetch: getUnProcessProblemList, result: unProcessProblemList } = useFetch('unProcessProblemList')
 const { fetch: getUnProcessSimilarList, result: unProcessSimilarList } = useFetch('unProcessSimilarList')
 
-const { mainQuestionList, groupList, onOptionInit, dataModel, changeModelValue } = useOptions(['question', 'group'], {
-  subject: mainStore.myUserInfo?.subjectCode,
-})
+const { mainQuestionList, groupListWithAll, onOptionInit, dataModel, changeModelValue } = useOptions(
+  ['question', 'group'],
+  {
+    subject: mainStore.myUserInfo?.subjectCode,
+  }
+)
 
 watch(dataModel, () => {
   model.subjectCode = dataModel.subject || ''
@@ -118,7 +121,7 @@ const items = computed<EpFormItem[]>(() => [
     prop: 'markingGroupNumber',
     slotType: 'select',
     slot: {
-      options: groupList.value,
+      options: groupListWithAll.value,
       onChange: changeModelValue('group'),
     },
   }),

+ 2 - 2
src/modules/quality/self-check/index.vue

@@ -61,7 +61,7 @@ const model = reactive<FormModel & { time: string }>({
   markingGroupNumber: void 0,
 })
 
-const { subjectList, mainQuestionList, groupList, dataModel, onOptionInit, changeModelValue } = useOptions([
+const { subjectList, mainQuestionList, groupListWithAll, dataModel, onOptionInit, changeModelValue } = useOptions([
   'subject',
   'question',
   'group',
@@ -96,7 +96,7 @@ const items = computed<EpFormItem[]>(() => {
       label: '小组',
       slotType: 'select',
       prop: 'markingGroupNumber',
-      slot: { options: groupList.value, onChange: changeModelValue('group') },
+      slot: { options: groupListWithAll.value, onChange: changeModelValue('group') },
     }),
     OneRowSpan6({
       label: '时间',