|
@@ -1,5 +1,6 @@
|
|
|
import {injectLocal, provideLocal} from "@vueuse/core";
|
|
import {injectLocal, provideLocal} from "@vueuse/core";
|
|
|
import {
|
|
import {
|
|
|
|
|
+ getPaperBatches,
|
|
|
getPaperExamTypes,
|
|
getPaperExamTypes,
|
|
|
getPaperKnowledges,
|
|
getPaperKnowledges,
|
|
|
getPaperMajors,
|
|
getPaperMajors,
|
|
@@ -11,6 +12,9 @@ import {
|
|
|
const key = Symbol('PaperExactCondition')
|
|
const key = Symbol('PaperExactCondition')
|
|
|
|
|
|
|
|
export const useProvidePaperExactCondition = function () {
|
|
export const useProvidePaperExactCondition = function () {
|
|
|
|
|
+ const batchId = ref('')
|
|
|
|
|
+ const batchList = ref([])
|
|
|
|
|
+
|
|
|
const location = ref('')
|
|
const location = ref('')
|
|
|
const provinces = ref([])
|
|
const provinces = ref([])
|
|
|
const examType = ref('')
|
|
const examType = ref('')
|
|
@@ -23,13 +27,15 @@ export const useProvidePaperExactCondition = function () {
|
|
|
const subjects = ref([])
|
|
const subjects = ref([])
|
|
|
const subjectId = ref('')
|
|
const subjectId = ref('')
|
|
|
const knowledges = ref([])
|
|
const knowledges = ref([])
|
|
|
- const knowledgeId = ref('') // 单选
|
|
|
|
|
|
|
+ const knowledgeNode = ref(null) // 单选节点
|
|
|
const knowledgeCheckNodes = ref([]) // 多选的节点
|
|
const knowledgeCheckNodes = ref([]) // 多选的节点
|
|
|
const knowledgeIds = computed(() => knowledgeCheckNodes.value.map(k => k.id))
|
|
const knowledgeIds = computed(() => knowledgeCheckNodes.value.map(k => k.id))
|
|
|
|
|
+ const knowledgeId = computed(() => knowledgeNode.value?.id || '') // 单选
|
|
|
|
|
|
|
|
const payload = {
|
|
const payload = {
|
|
|
- location, provinces, examType, examTypes, universityId, universities, majorPlanId, majors,
|
|
|
|
|
- subjects, subjectId, knowledges, knowledgeId, knowledgeCheckNodes, knowledgeIds
|
|
|
|
|
|
|
+ location, provinces, examType, examTypes, universityId, universities,
|
|
|
|
|
+ batchId, batchList, majorPlanId, majors, subjects, subjectId,
|
|
|
|
|
+ knowledges, knowledgeNode, knowledgeId, knowledgeCheckNodes, knowledgeIds
|
|
|
}
|
|
}
|
|
|
provideLocal(key, payload)
|
|
provideLocal(key, payload)
|
|
|
|
|
|
|
@@ -38,27 +44,35 @@ export const useProvidePaperExactCondition = function () {
|
|
|
const res = await getPaperProvinces()
|
|
const res = await getPaperProvinces()
|
|
|
provinces.value = res.data
|
|
provinces.value = res.data
|
|
|
})
|
|
})
|
|
|
- watch(location, async () => {
|
|
|
|
|
|
|
+ onMounted(async () => {
|
|
|
|
|
+ const res = await getPaperBatches()
|
|
|
|
|
+ batchList.value = res.data
|
|
|
|
|
+ })
|
|
|
|
|
+ watch(location, async (location) => {
|
|
|
// clean
|
|
// clean
|
|
|
examType.value = ''
|
|
examType.value = ''
|
|
|
examTypes.value = []
|
|
examTypes.value = []
|
|
|
- universityId.value = ''
|
|
|
|
|
- universities.value = []
|
|
|
|
|
|
|
|
|
|
- if (!location.value) return
|
|
|
|
|
- const resT = await getPaperExamTypes({location: toValue(location)})
|
|
|
|
|
|
|
+ if (!location) return
|
|
|
|
|
+ const resT = await getPaperExamTypes({location})
|
|
|
examTypes.value = resT.data
|
|
examTypes.value = resT.data
|
|
|
|
|
+ })
|
|
|
|
|
+ watch([location, batchId], async ([location, batchId]) => {
|
|
|
|
|
+ // clean
|
|
|
|
|
+ universityId.value = ''
|
|
|
|
|
+ universities.value = []
|
|
|
|
|
|
|
|
- const resU = await getPaperUniversities({location: toValue(location)})
|
|
|
|
|
|
|
+ if (!location || !batchId) return
|
|
|
|
|
+ const resU = await getPaperUniversities({location, batchId})
|
|
|
universities.value = resU.data
|
|
universities.value = resU.data
|
|
|
})
|
|
})
|
|
|
- watch([examType, universityId], async ([examType, universityId]) => {
|
|
|
|
|
|
|
+ watch([location, examType, batchId, universityId], async ([location, examType, batchId, universityId]) => {
|
|
|
// clean
|
|
// clean
|
|
|
majorPlanId.value = ''
|
|
majorPlanId.value = ''
|
|
|
majors.value = []
|
|
majors.value = []
|
|
|
|
|
|
|
|
- if (!examType || !universityId) return
|
|
|
|
|
- const res = await getPaperMajors({location: toValue(location), examType, universityId})
|
|
|
|
|
|
|
+ if (!location || !examType || !batchId || !universityId) return
|
|
|
|
|
+ const res = await getPaperMajors({location, examType, batchId, universityId})
|
|
|
majors.value = res.data
|
|
majors.value = res.data
|
|
|
if (res.data.length) majorPlanId.value = res.data[0].id
|
|
if (res.data.length) majorPlanId.value = res.data[0].id
|
|
|
})
|
|
})
|
|
@@ -75,7 +89,7 @@ export const useProvidePaperExactCondition = function () {
|
|
|
watch([majorPlanId, subjectId], async ([majorPlanId, subjectId]) => {
|
|
watch([majorPlanId, subjectId], async ([majorPlanId, subjectId]) => {
|
|
|
// clean
|
|
// clean
|
|
|
knowledges.value = []
|
|
knowledges.value = []
|
|
|
- knowledgeId.value = '' // 单选的情况
|
|
|
|
|
|
|
+ knowledgeNode.value = null // 单选的情况
|
|
|
knowledgeCheckNodes.value = [] // 多选的情况
|
|
knowledgeCheckNodes.value = [] // 多选的情况
|
|
|
|
|
|
|
|
if (!subjectId || !majorPlanId) return
|
|
if (!subjectId || !majorPlanId) return
|