|
|
@@ -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,
|