瀏覽代碼

new condition for exact-hand

abpcoder 2 周之前
父節點
當前提交
25aae56444

+ 11 - 8
back-ui/src/views/dz/papers/components/paper-exact-hand.vue

@@ -7,6 +7,11 @@
                         <el-option v-for="b in batchList" :label="b.name" :value="b.batchId"/>
                     </el-select>
                 </el-form-item>
+                <el-form-item label="考生类型">
+                    <el-select v-model="examType" clearable style="width: 227px">
+                        <el-option v-for="e in examTypes" :label="e.dictLabel" :value="e.dictValue"/>
+                    </el-select>
+                </el-form-item>
                 <el-form-item label="院校">
                     <el-select v-model="universityId" clearable style="width: 227px">
                         <el-option v-for="u in universities" :label="u.name" :value="u.id"/>
@@ -54,14 +59,11 @@ import router from "@/router/index.js";
 
 const type = consts.enums.buildType.ExactHand
 const {
-    batchId,
-    batchList,
-    universityId,
-    universities,
-    majorGroup,
-    majorGroups,
-    majors,
-    majorPlanId,
+    batchId, batchList,
+    examType, examTypes,
+    universityId, universities,
+    majorGroup, majorGroups,
+    majors, majorPlanId,
     onConditionReady
 } = useProvidePaperExactCondition(type)
 const {selectedClasses, classList, loadClassStatistic} = useProvidePaperClassStatisticCondition()
@@ -70,6 +72,7 @@ const {knowledgeNode, knowledgeCheckNodes, loadKnowledge} = useProvidePaperKnowl
 const handleSubmit = async (questions) => {
     // validation
     if (!batchId.value) return ElMessage.error('请选择批次')
+    if (!examType.value) return ElMessage.error('请选择考生类型')
     if (!universityId.value) return ElMessage.error('请选择院校')
     if (majorGroups.value.length && !majorGroup.value) return ElMessage.error('请选择专业组')
     if (majors.value.length && !majorPlanId.value) return ElMessage.error('请选择专业')

+ 1 - 1
back-ui/src/views/dz/papers/components/plugs/class-detail.vue

@@ -12,7 +12,7 @@
     <Table :data="list" :columns="columns" :actions="actions" @action="handleAction">
         <template #rate="{row}">
             <el-text v-if="[undefined, null].includes(row.rate)">-</el-text>
-            <el-text :type="row.rate>90?'success':row.rate>75?'primary':'danger'">{{row.rate}}%</el-text>
+            <el-text :type="row.rate>90?'success':row.rate>70?'primary':'danger'">{{row.rate}}%</el-text>
         </template>
     </Table>
     <el-dialog v-model="dialog" title="做题情况" show-close>

+ 26 - 9
back-ui/src/views/dz/papers/hooks/usePaperExactCondition.js

@@ -1,11 +1,14 @@
 import {useProvidePaperBatchCondition} from "@/views/dz/papers/hooks/usePaperBatchCondition.js";
-import {getPaperMajors, getPaperUniversities} from "@/api/dz/papers.js";
+import {getPaperExamTypes, getPaperMajors, getPaperUniversities} from "@/api/dz/papers.js";
 import {createEventHook, injectLocal, provideLocal} from "@vueuse/core";
 
 const key = Symbol('PaperExactCondition')
 export const useProvidePaperExactCondition = function (type) {
     const {buildType, batchId, batchList} = useProvidePaperBatchCondition(type)
 
+    const examType = ref('')
+    const examTypes = ref([])
+
     const universityId = ref('')
     const universities = ref([])
 
@@ -29,11 +32,14 @@ export const useProvidePaperExactCondition = function (type) {
 
     const conditionArgs = computed(() => ({
         buildType: toValue(buildType),
+        batchId: toValue(batchId),
+        examType: toValue(examType),
         universityId: toValue(universityId),
         majorGroup: toValue(majorGroup),
         majorPlanId: toValue(majorPlanId)
     }))
     const conditionData = computed(() => ({
+        examTypes: toValue(examTypes),
         universities: toValue(universities),
         majorGroups: toValue(majorGroups),
         majors: toValue(majors)
@@ -44,31 +50,40 @@ export const useProvidePaperExactCondition = function (type) {
     }
 
     watch(batchId, async (batchId) => {
+        examType.value = ''
+        examTypes.value = []
+
+        if (!batchId) return
+        const res = await getPaperExamTypes({buildType, batchId})
+        examTypes.value = res.data
+    })
+
+    watch([batchId, examType], async ([batchId, examType]) => {
         universityId.value = ''
         universities.value = []
 
         if (!batchId) return
-        const res = await getPaperUniversities({buildType, batchId})
+        const res = await getPaperUniversities({buildType, batchId, examType})
         universities.value = res.data
     })
 
-    watch([batchId, universityId], async ([batchId, universityId]) => {
+    watch([batchId, examType, universityId], async ([batchId, examType, universityId]) => {
         majorGroup.value = ''
 
-        if (!batchId || !universityId) return
-        const res = await getPaperMajors({buildType, batchId, universityId})
+        if (!batchId || !examType || !universityId) return
+        const res = await getPaperMajors({buildType, batchId, examType, universityId})
         _allMajors.value = res.data
 
         // 没有数据时,说明已经满足了条件
-        if (!majorGroups.value.length) await triggerExactEvent({buildType, batchId, universityId})
+        if (!majorGroups.value.length) await triggerExactEvent({buildType, batchId, examType, universityId})
         else if (majorGroups.value.length == 1) majorGroup.value = majorGroups.value[0]
     })
 
-    watch([batchId, universityId, majorGroup], async ([batchId, universityId, majorGroup]) => {
+    watch([batchId, examType, universityId, majorGroup], async ([batchId, examType, universityId, majorGroup]) => {
         majorPlanId.value = ''
 
-        if (!batchId || !universityId || !majorGroup) return
-        if (!majors.value.length) await triggerExactEvent({buildType, batchId, universityId, majorGroup})
+        if (!batchId || !examType || !universityId || !majorGroup) return
+        if (!majors.value.length) await triggerExactEvent({buildType, batchId, examType, universityId, majorGroup})
         else if (majors.value.length == 1) majorPlanId.value = majors.value[0].id
     })
 
@@ -79,6 +94,7 @@ export const useProvidePaperExactCondition = function (type) {
         const args = {
             buildType,
             batchId: toValue(batchId),
+            examType: toValue(examType),
             universityId: toValue(universityId),
             majorGroup: toValue(majorGroup),
             majorPlanId
@@ -87,6 +103,7 @@ export const useProvidePaperExactCondition = function (type) {
     })
 
     const payload = {buildType, batchId, batchList,
+        examType, examTypes,
         universityId, universities,
         majorGroup, majorGroups,
         majorPlanId, majors,

+ 9 - 2
back-ui/src/views/dz/papers/hooks/usePaperKnowledgeCondition.js

@@ -1,5 +1,6 @@
 import {createEventHook, injectLocal, provideLocal} from "@vueuse/core";
 import {getPaperKnowledges} from "@/api/dz/papers.js";
+import {useInjectGlobalLoading} from "@/views/hooks/useGlobalLoading.js";
 
 const key = Symbol('PaperKnowledgeCondition')
 export const useProvidePaperKnowledgeCondition = function () {
@@ -9,6 +10,7 @@ export const useProvidePaperKnowledgeCondition = function () {
     const knowledgeIds = computed(() => knowledgeCheckNodes.value.map(k => k.id))
     const knowledgeId = computed(() => knowledgeNode.value?.id || '')
     const knowledgeRemoveEvent = createEventHook()
+    const {loading} = useInjectGlobalLoading()
     const removeKnowledge = async (k) => {
         const nodes = knowledgeCheckNodes.value
         const idx = nodes.indexOf(k)
@@ -19,8 +21,13 @@ export const useProvidePaperKnowledgeCondition = function () {
     }
 
     const loadKnowledge = async function(payload) {
-        const res = await getPaperKnowledges(payload)
-        knowledges.value = res.data
+        loading.value = true
+        try {
+            const res = await getPaperKnowledges(payload)
+            knowledges.value = res.data
+        } finally {
+            loading.value = false
+        }
     }
 
     const payload = {