专业批次筛选
This commit is contained in:
parent
5d9bc3ba5a
commit
da16f9fdca
|
|
@ -4,7 +4,7 @@ import { onMounted, ref, watch } from 'vue'
|
||||||
import { getUserMajorList, type MajorItem } from '~/service/api/major'
|
import { getUserMajorList, type MajorItem } from '~/service/api/major'
|
||||||
|
|
||||||
// --- 类型定义 ---
|
// --- 类型定义 ---
|
||||||
type TabKey = 'all' | 'hard' | 'risky' | 'safe' | 'stable' | '本科' | '专科'
|
type TabKey = 'all' | 'hard' | 'risky' | 'safe' | 'stable' | '本科' | '专科' | '985/211/双一流' | '公办本科' | '民办本科'
|
||||||
type PanelType = 'market' | 'my-volunteers'
|
type PanelType = 'market' | 'my-volunteers'
|
||||||
|
|
||||||
interface VolunteerTab {
|
interface VolunteerTab {
|
||||||
|
|
@ -90,14 +90,40 @@ const myVolunteers = ref<VolunteerSchool[]>([
|
||||||
{ id: '2025121427', name: '志愿2025121427', code: "1001", tags: ['手动'], probability: "80.5%", statusLabel: '保', calcScore: 450, diffScore: 250, majorName: '计算机科学与技术', requirements: '物化生', tuition: '', majorCode:'2003', planCount: 10, history: { '2025': {count: 10,minScore: 1,diff: 4,method: 'q'} } }
|
{ id: '2025121427', name: '志愿2025121427', code: "1001", tags: ['手动'], probability: "80.5%", statusLabel: '保', calcScore: 450, diffScore: 250, majorName: '计算机科学与技术', requirements: '物化生', tuition: '', majorCode:'2003', planCount: 10, history: { '2025': {count: 10,minScore: 1,diff: 4,method: 'q'} } }
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
// 志愿Tab
|
||||||
const volunteerCurrentTab = ref<TabKey>('本科')
|
const volunteerCurrentTab = ref<TabKey>('本科')
|
||||||
const volunteerTabs = [
|
const volunteerTabs = [
|
||||||
{ key: '本科', label: '本科', count: 1, max: 64 },
|
{ key: '本科', label: '本科', count: 1, max: 64 },
|
||||||
{ key: '专科', label: '专科', count: 2, max: 64 },
|
{ key: '专科', label: '专科', count: 2, max: 64 },
|
||||||
] as VolunteerTab[]
|
] as VolunteerTab[]
|
||||||
|
|
||||||
const currentTab = ref<TabKey>('stable')
|
|
||||||
const tabs = [
|
//============= Panel A 数据
|
||||||
|
|
||||||
|
// 批次Tab
|
||||||
|
const currentBatchTab = ref<TabKey>('本科')
|
||||||
|
const batchTabs = [
|
||||||
|
{ key: '本科提前', label: '本科提前批', count: 0 },
|
||||||
|
{ key: '本科', label: '本科批', count: 0 },
|
||||||
|
{ key: '高职高专', label: '高职批', count: 0 },
|
||||||
|
] as VolunteerTab[]
|
||||||
|
|
||||||
|
// 二级批次Tab
|
||||||
|
const currentBatch2Tab = ref<TabKey>('公办本科')
|
||||||
|
const batch2Tabs = [
|
||||||
|
{ key: '双一流', label: '985/211/双一流', count: 0 },
|
||||||
|
{ key: '公办本科', label: '公办本科', count: 0 },
|
||||||
|
{ key: '民办本科', label: '民办本科', count: 0 },
|
||||||
|
] as VolunteerTab[]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 概率Tab
|
||||||
|
const currentProbTab = ref<TabKey>('all')
|
||||||
|
const probTabs = [
|
||||||
|
{ key: 'all', label: '全部', count: 0 },
|
||||||
{ key: 'safe', label: '可保底', count: 1 },
|
{ key: 'safe', label: '可保底', count: 1 },
|
||||||
{ key: 'stable', label: '较稳妥', count: 11 },
|
{ key: 'stable', label: '较稳妥', count: 11 },
|
||||||
{ key: 'risky', label: '可冲击', count: 11 },
|
{ key: 'risky', label: '可冲击', count: 11 },
|
||||||
|
|
@ -106,7 +132,6 @@ const tabs = [
|
||||||
|
|
||||||
const oldYears = ref(['2025','2024','2023'])
|
const oldYears = ref(['2025','2024','2023'])
|
||||||
|
|
||||||
// Panel A 列表数据
|
|
||||||
const schools = ref<MajorItem[]>([])
|
const schools = ref<MajorItem[]>([])
|
||||||
const page = ref(1)
|
const page = ref(1)
|
||||||
const size = ref(10)
|
const size = ref(10)
|
||||||
|
|
@ -126,6 +151,8 @@ const selectedMajorCodes = ref<string[]>([]) // 存储已选的专业Code,数
|
||||||
const showSaveConfirm = ref(false) // 控制气泡确认框显示
|
const showSaveConfirm = ref(false) // 控制气泡确认框显示
|
||||||
const isSaving = ref(false) // 保存接口Loading状态
|
const isSaving = ref(false) // 保存接口Loading状态
|
||||||
|
|
||||||
|
|
||||||
|
//============= Panel A 数据
|
||||||
// --- 辅助函数 ---
|
// --- 辅助函数 ---
|
||||||
function getProbabilityLabel(prob: number): string {
|
function getProbabilityLabel(prob: number): string {
|
||||||
if (prob >= 93) return '保'
|
if (prob >= 93) return '保'
|
||||||
|
|
@ -162,15 +189,17 @@ async function loadMore(reset = false) {
|
||||||
try {
|
try {
|
||||||
// 映射 Tab 到 API 参数
|
// 映射 Tab 到 API 参数
|
||||||
let probability: string | undefined
|
let probability: string | undefined
|
||||||
if (currentTab.value === 'hard') probability = '难录取'
|
if (currentProbTab.value === 'hard') probability = '难录取'
|
||||||
if (currentTab.value === 'risky') probability = '可冲击'
|
if (currentProbTab.value === 'risky') probability = '可冲击'
|
||||||
if (currentTab.value === 'stable') probability = '较稳妥'
|
if (currentProbTab.value === 'stable') probability = '较稳妥'
|
||||||
if (currentTab.value === 'safe') probability = '可保底'
|
if (currentProbTab.value === 'safe') probability = '可保底'
|
||||||
|
|
||||||
const res = await getUserMajorList({
|
const res = await getUserMajorList({
|
||||||
page: page.value,
|
page: page.value,
|
||||||
size: size.value,
|
size: size.value,
|
||||||
probability
|
probability,
|
||||||
|
batch: currentBatchTab.value,
|
||||||
|
batch2: currentBatch2Tab.value,
|
||||||
})
|
})
|
||||||
console.warn(res)
|
console.warn(res)
|
||||||
if (res && res.list && res.list.items) {
|
if (res && res.list && res.list.items) {
|
||||||
|
|
@ -179,8 +208,10 @@ async function loadMore(reset = false) {
|
||||||
|
|
||||||
// 更新 Tabs 计数
|
// 更新 Tabs 计数
|
||||||
if (res.list.probCount) {
|
if (res.list.probCount) {
|
||||||
tabs.forEach(tab => {
|
probTabs.forEach(tab => {
|
||||||
if (tab.key && res.list.probCount[tab.key] !== undefined) {
|
if (tab.key && tab.key == 'all'){
|
||||||
|
tab.count = total.value
|
||||||
|
}else if (tab.key && res.list.probCount[tab.key] !== undefined) {
|
||||||
tab.count = res.list.probCount[tab.key]
|
tab.count = res.list.probCount[tab.key]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -203,10 +234,20 @@ async function loadMore(reset = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听 Tab 切换,重新加载
|
// 监听 Tab 切换,重新加载
|
||||||
watch(currentTab, () => {
|
watch(currentBatchTab, () => {
|
||||||
loadMore(true)
|
loadMore(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(currentBatch2Tab, () => {
|
||||||
|
loadMore(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(currentProbTab, () => {
|
||||||
|
loadMore(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function handleScroll() {
|
function handleScroll() {
|
||||||
if (!scrollContainer.value)
|
if (!scrollContainer.value)
|
||||||
return
|
return
|
||||||
|
|
@ -525,7 +566,7 @@ function deletePlan(planId: string) {
|
||||||
========================================================== -->
|
========================================================== -->
|
||||||
<div v-show="activePanel === 'market'" class="h-full flex flex-col">
|
<div v-show="activePanel === 'market'" class="h-full flex flex-col">
|
||||||
<!-- 顶部筛选栏 (保持不变) -->
|
<!-- 顶部筛选栏 (保持不变) -->
|
||||||
<div class="mb-8 mt-8 rounded-lg bg-white p-6 shadow">
|
<div class="mt-8 rounded-t-lg bg-white p-6 border-b border-slate-200">
|
||||||
<div class="grid grid-cols-1 select-none gap-6 lg:grid-cols-6">
|
<div class="grid grid-cols-1 select-none gap-6 lg:grid-cols-6">
|
||||||
<!-- Top Toolbar -->
|
<!-- Top Toolbar -->
|
||||||
<div class="lg:col-span-4">
|
<div class="lg:col-span-4">
|
||||||
|
|
@ -533,20 +574,52 @@ function deletePlan(planId: string) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-shrink-0 space-x-2 justify-between mb-8">
|
||||||
<div class="flex flex-shrink-0 space-x-2">
|
<div class="flex flex-shrink-0 space-x-2">
|
||||||
<button
|
<button
|
||||||
v-for="tab in tabs" :key="tab.key"
|
v-for="tab in batchTabs" :key="tab.key"
|
||||||
class="border-x border-t border-transparent rounded-t-md px-6 py-2 text-sm font-medium transition-colors duration-200"
|
class="border-x border-t border-transparent rounded-b-md px-6 py-2 text-sm font-medium transition-colors duration-200"
|
||||||
:class="[
|
:class="[
|
||||||
currentTab === tab.key
|
currentBatchTab === tab.key
|
||||||
? 'bg-blue-500 text-white border-blue-500'
|
? 'bg-blue-500 text-white border-blue-500'
|
||||||
: 'bg-white text-slate-600 hover:text-blue-500 border-slate-200',
|
: 'bg-white text-slate-600 hover:text-blue-500 border-slate-200',
|
||||||
]" @click="currentTab = tab.key"
|
]" @click="currentBatchTab = tab.key"
|
||||||
|
>
|
||||||
|
{{ tab.label }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-shrink-0 space-x-2" v-show="currentBatchTab == '本科'">
|
||||||
|
<button
|
||||||
|
v-for="tab in batch2Tabs" :key="tab.key"
|
||||||
|
class="border-x border-t border-transparent rounded-b-md px-6 py-2 text-sm font-medium transition-colors duration-200"
|
||||||
|
:class="[
|
||||||
|
currentBatch2Tab === tab.key
|
||||||
|
? 'bg-blue-500 text-white border-blue-500'
|
||||||
|
: 'bg-white text-slate-600 hover:text-blue-500 border-slate-200',
|
||||||
|
]" @click="currentBatch2Tab = tab.key"
|
||||||
|
>
|
||||||
|
{{ tab.label }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="flex flex-shrink-0 space-x-2">
|
||||||
|
<button
|
||||||
|
v-for="tab in probTabs" :key="tab.key"
|
||||||
|
class="border-x border-t border-transparent rounded-t-md px-6 py-2 text-sm font-medium transition-colors duration-200"
|
||||||
|
:class="[
|
||||||
|
currentProbTab === tab.key
|
||||||
|
? 'bg-blue-500 text-white border-blue-500'
|
||||||
|
: 'bg-white text-slate-600 hover:text-blue-500 border-slate-200',
|
||||||
|
]" @click="currentProbTab = tab.key"
|
||||||
>
|
>
|
||||||
{{ tab.label }} <span class="ml-1 opacity-90">{{ tab.count }}</span>
|
{{ tab.label }} <span class="ml-1 opacity-90">{{ tab.count }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- 表格容器:限制高度 + 滚动监听 -->
|
<!-- 表格容器:限制高度 + 滚动监听 -->
|
||||||
<!-- 关键点:h-[calc(100vh-150px)] 用于限制高度,overflow-auto 用于滚动 -->
|
<!-- 关键点:h-[calc(100vh-150px)] 用于限制高度,overflow-auto 用于滚动 -->
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ export interface UserMajorListRequest {
|
||||||
page?: number
|
page?: number
|
||||||
size?: number
|
size?: number
|
||||||
batch?: string
|
batch?: string
|
||||||
|
batch2?: string
|
||||||
probability?: string
|
probability?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue