wuzhen 招生完成
This commit is contained in:
1 parent
6fb55c7723
commit
b215f7b9b3
23 files changed
+125633
-998
No files matched your search
@@ -149,6 +149,16 @@ export interface EnrollmentInfoVO {
|
||||
*/
|
||||
qrCodeSource: string;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
collegeName: string;
|
||||
|
||||
/**
|
||||
* 学院代码
|
||||
*/
|
||||
collegeId: string;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@@ -320,6 +330,16 @@ export interface EnrollmentInfoForm extends BaseEntity {
|
||||
* 二维码来源标识
|
||||
*/
|
||||
qrCodeSource?: string;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
collegeName?: string;
|
||||
|
||||
/**
|
||||
* 学院代码
|
||||
*/
|
||||
collegeId?: string;
|
||||
}
|
||||
|
||||
export interface EnrollmentInfoQuery extends PageQuery {
|
||||
@@ -368,8 +388,18 @@ export interface EnrollmentInfoQuery extends PageQuery {
|
||||
*/
|
||||
examRegion?: string;
|
||||
|
||||
/**
|
||||
* 学院代码
|
||||
*/
|
||||
collegeId?: string;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
collegeName?: string;
|
||||
|
||||
/**
|
||||
* 报名时间范围
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
}
|
||||
@@ -151,6 +151,76 @@ export interface EnrollmentProcessVO {
|
||||
* 更新时间
|
||||
*/
|
||||
updateTime: string
|
||||
|
||||
/**
|
||||
* 性别(M-男 F-女)
|
||||
*/
|
||||
gender?: string
|
||||
|
||||
/**
|
||||
* 地区/省份
|
||||
*/
|
||||
province?: string
|
||||
|
||||
/**
|
||||
* 学院名称(驼峰命名)
|
||||
*/
|
||||
collegeName?: string
|
||||
|
||||
/**
|
||||
* 学院代码(驼峰命名)
|
||||
*/
|
||||
collegeId?: string
|
||||
|
||||
/**
|
||||
* 学院名称(下划线命名)
|
||||
*/
|
||||
college_name?: string
|
||||
|
||||
/**
|
||||
* 学院代码(下划线命名)
|
||||
*/
|
||||
college_id?: string
|
||||
|
||||
/**
|
||||
* 学院名称(拼写变体 - collage)
|
||||
*/
|
||||
collage_name?: string
|
||||
|
||||
/**
|
||||
* 学院代码(拼写变体 - collage)
|
||||
*/
|
||||
collage_id?: string
|
||||
|
||||
/**
|
||||
* 专业名称(驼峰命名)
|
||||
*/
|
||||
majorName?: string
|
||||
|
||||
/**
|
||||
* 专业代码(驼峰命名)
|
||||
*/
|
||||
majorCode?: string
|
||||
|
||||
/**
|
||||
* 专业名称(下划线命名)
|
||||
*/
|
||||
major_name?: string
|
||||
|
||||
/**
|
||||
* 专业代码(下划线命名)
|
||||
*/
|
||||
major_code?: string
|
||||
|
||||
/**
|
||||
* 报考专业(来自报名信息表)
|
||||
*/
|
||||
appliedMajor?: string
|
||||
|
||||
/**
|
||||
* 关联的报名信息对象
|
||||
*/
|
||||
enrollmentInfo?: any
|
||||
}
|
||||
|
||||
export interface EnrollmentProcessForm extends BaseEntity {
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
import request from '@/utils/request';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
/**
|
||||
* 获取统计概览数据
|
||||
*/
|
||||
export function getStatisticsOverview() {
|
||||
return request({
|
||||
url: '/dev-api/zsjy/statistics/overview',
|
||||
method: 'get'
|
||||
url: '/zsjy/statistics/overview',
|
||||
method: 'get',
|
||||
headers: {
|
||||
'isToken': true
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取统计概览数据失败:', error);
|
||||
ElMessage.error('获取统计数据失败,请联系管理员');
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,8 +23,15 @@ export function getStatisticsOverview() {
|
||||
*/
|
||||
export function getMajorDistribution() {
|
||||
return request({
|
||||
url: '/dev-api/zsjy/statistics/major',
|
||||
method: 'get'
|
||||
url: '/zsjy/statistics/major',
|
||||
method: 'get',
|
||||
headers: {
|
||||
'isToken': true
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取专业分布数据失败:', error);
|
||||
ElMessage.error('获取专业分布数据失败,请联系管理员');
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,8 +40,15 @@ export function getMajorDistribution() {
|
||||
*/
|
||||
export function getRegionDistribution() {
|
||||
return request({
|
||||
url: '/dev-api/zsjy/statistics/region',
|
||||
method: 'get'
|
||||
url: '/zsjy/statistics/region',
|
||||
method: 'get',
|
||||
headers: {
|
||||
'isToken': true
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取地区分布数据失败:', error);
|
||||
ElMessage.error('获取地区分布数据失败,请联系管理员');
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -35,8 +57,15 @@ export function getRegionDistribution() {
|
||||
*/
|
||||
export function getGenderRatio() {
|
||||
return request({
|
||||
url: '/dev-api/zsjy/statistics/gender',
|
||||
method: 'get'
|
||||
url: '/zsjy/statistics/gender',
|
||||
method: 'get',
|
||||
headers: {
|
||||
'isToken': true
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取性别比例数据失败:', error);
|
||||
ElMessage.error('获取性别比例数据失败,请联系管理员');
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,9 +75,16 @@ export function getGenderRatio() {
|
||||
*/
|
||||
export function getEnrollmentTrend(days?: number) {
|
||||
return request({
|
||||
url: '/dev-api/zsjy/statistics/trend',
|
||||
url: '/zsjy/statistics/trend',
|
||||
method: 'get',
|
||||
params: { days }
|
||||
params: { days },
|
||||
headers: {
|
||||
'isToken': true
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取报名趋势数据失败:', error);
|
||||
ElMessage.error('获取报名趋势数据失败,请联系管理员');
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,8 +93,15 @@ export function getEnrollmentTrend(days?: number) {
|
||||
*/
|
||||
export function getStatusDistribution() {
|
||||
return request({
|
||||
url: '/dev-api/zsjy/statistics/status',
|
||||
method: 'get'
|
||||
url: '/zsjy/statistics/status',
|
||||
method: 'get',
|
||||
headers: {
|
||||
'isToken': true
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取状态分布数据失败:', error);
|
||||
ElMessage.error('获取状态分布数据失败,请联系管理员');
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="性别" prop="gender" required>
|
||||
<el-select v-model="applyForm.gender" placeholder="请选择性别" style="width: 100%">
|
||||
<el-select v-model="applyForm.gender" placeholder="请选择性别" style="width: 100%; font-size: 14px; font-weight: bold;" :key="applyForm.gender">
|
||||
<el-option v-for="dict in zsjy_gender" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -269,7 +269,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="EnrollmentApply" lang="ts">
|
||||
import { reactive, ref, toRefs, getCurrentInstance, ComponentInternalInstance, onMounted } from 'vue';
|
||||
import { reactive, ref, toRefs, getCurrentInstance, ComponentInternalInstance, onMounted, nextTick } from 'vue';
|
||||
import { ElForm } from 'element-plus';
|
||||
import { submitEnrollmentApplication, queryMyEnrollmentStatus } from '@/api/zsjy/enrollment';
|
||||
import { EnrollmentInfoForm } from '@/api/zsjy/enrollment/types';
|
||||
@@ -358,15 +358,31 @@ const rules = {
|
||||
const onIdCardChange = () => {
|
||||
const idCard = applyForm.idCard;
|
||||
if (idCard && idCard.length === 18) {
|
||||
// 提取出生日期
|
||||
const year = idCard.substring(6, 10);
|
||||
const month = idCard.substring(10, 12);
|
||||
const day = idCard.substring(12, 14);
|
||||
applyForm.birthDate = `${year}-${month}-${day}`;
|
||||
|
||||
// 提取性别(奇数为男M,偶数为女F)
|
||||
const genderCode = parseInt(idCard.substring(16, 17));
|
||||
applyForm.gender = genderCode % 2 === 1 ? 'M' : 'F';
|
||||
try {
|
||||
// 提取出生日期
|
||||
const year = idCard.substring(6, 10);
|
||||
const month = idCard.substring(10, 12);
|
||||
const day = idCard.substring(12, 14);
|
||||
applyForm.birthDate = `${year}-${month}-${day}`;
|
||||
|
||||
// 提取性别(奇数为男,偶数为女)
|
||||
const genderCode = parseInt(idCard.substring(16, 17));
|
||||
|
||||
// 根据奇偶性设置性别为'M'或'F'
|
||||
applyForm.gender = genderCode % 2 === 1 ? 'M' : 'F';
|
||||
|
||||
// 性别设置完成后,强制重新渲染一下
|
||||
nextTick(() => {
|
||||
// 通过临时设置为空再重新设置回来,强制UI更新
|
||||
const currentGender = applyForm.gender;
|
||||
applyForm.gender = '';
|
||||
setTimeout(() => {
|
||||
applyForm.gender = currentGender;
|
||||
}, 10);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('解析身份证信息时出错:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -426,6 +442,14 @@ const submitApplication = () => {
|
||||
if (valid) {
|
||||
try {
|
||||
submitLoading.value = true;
|
||||
|
||||
// 处理是否住宿字段,将"Y"/"N"转换为1/0
|
||||
if (applyForm.isBoarding === 'Y') {
|
||||
applyForm.isBoarding = 1;
|
||||
} else if (applyForm.isBoarding === 'N') {
|
||||
applyForm.isBoarding = 0;
|
||||
}
|
||||
|
||||
await submitEnrollmentApplication(applyForm);
|
||||
proxy?.$modal.msgSuccess('报名申请提交成功!');
|
||||
resetForm();
|
||||
@@ -452,14 +476,14 @@ const queryStatus = async () => {
|
||||
proxy?.$modal.msgWarning('请输入身份证号或准考证号');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
queryLoading.value = true;
|
||||
const response = await queryMyEnrollmentStatus({
|
||||
idCard: queryForm.idCard,
|
||||
examNumber: queryForm.examNumber
|
||||
});
|
||||
|
||||
|
||||
if (response.data) {
|
||||
statusInfo.value = response.data;
|
||||
statusDialog.visible = true;
|
||||
@@ -571,4 +595,4 @@ onMounted(() => {
|
||||
.status-tips p {
|
||||
margin: 5px 0;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -28,7 +28,8 @@
|
||||
<span class="detail-value">{{ processData.currentHandlerName || '-' }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="完成状态">
|
||||
<dict-tag :options="sys_yes_no" :value="processData.isCompleted" />
|
||||
<el-tag type="success" v-if="processData.isCompleted === 1 || processData.isCompleted === '1'">已完成</el-tag>
|
||||
<el-tag type="info" v-else>未完成</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
<span class="detail-value">{{ parseTime(processData.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
@@ -111,7 +112,9 @@
|
||||
</template>
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="缴费状态">
|
||||
<dict-tag :options="zsjy_payment_status" :value="processData.paymentStatus" />
|
||||
<el-tag :type="processData.paymentStatus == 1 ? 'success' : 'info'">
|
||||
{{ processData.paymentStatus == 1 ? '已缴费' : '未缴费' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="缴费确认时间">
|
||||
<span class="detail-value">{{ parseTime(processData.paymentConfirmTime, '{y}-{m}-{d} {h}:{i}:{s}') || '-' }}</span>
|
||||
@@ -191,6 +194,15 @@ const dialogVisible = computed({
|
||||
const handleClose = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
const isCompletedTag = computed(() => {
|
||||
return String(processData.value.isCompleted) === '1' ? 'success' : 'info'
|
||||
})
|
||||
|
||||
const isCompletedText = computed(() => {
|
||||
return String(processData.value.isCompleted) === '1' ? '已完成' : '未完成'
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -395,4 +407,4 @@ const handleClose = () => {
|
||||
background: #fff !important;
|
||||
color: #303133 !important;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="page-container">
|
||||
<!-- 搜索区域 -->
|
||||
<el-card class="search-card">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="80px">
|
||||
<el-form ref="queryFormRef" :model="queryParams" label-width="80px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="学生姓名" prop="studentName">
|
||||
@@ -27,50 +27,18 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="当前状态" prop="currentStatus">
|
||||
<el-select
|
||||
v-model="queryParams.currentStatus"
|
||||
placeholder="请选择当前状态"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in zsjy_enrollment_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="完成状态" prop="isCompleted">
|
||||
<el-select
|
||||
v-model="queryParams.isCompleted"
|
||||
placeholder="请选择完成状态"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in sys_yes_no"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="search-btn-container">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 统计卡片 -->
|
||||
<el-row :gutter="16" class="stat-cards">
|
||||
<el-col :span="6">
|
||||
<el-col :span="8">
|
||||
<el-card class="stat-card stat-card-primary" shadow="hover">
|
||||
<div class="stat-content">
|
||||
<div class="stat-icon">
|
||||
@@ -78,46 +46,33 @@
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<div class="stat-value">{{ statistics.total || 0 }}</div>
|
||||
<div class="stat-label">总流程数</div>
|
||||
<div class="stat-label">待处理录取数</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-card class="stat-card stat-card-warning" shadow="hover">
|
||||
<div class="stat-content">
|
||||
<div class="stat-icon">
|
||||
<el-icon><Clock /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<div class="stat-value">{{ statistics.pending || 0 }}</div>
|
||||
<div class="stat-label">待处理</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :span="8">
|
||||
<el-card class="stat-card stat-card-info" shadow="hover">
|
||||
<div class="stat-content">
|
||||
<div class="stat-icon">
|
||||
<el-icon><Clock /></el-icon>
|
||||
<el-icon><CreditCard /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<div class="stat-value">{{ statistics.processing || 0 }}</div>
|
||||
<div class="stat-label">处理中</div>
|
||||
<div class="stat-value">{{ statistics.paymentConfirmed || 0 }}</div>
|
||||
<div class="stat-label">已缴费人数</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :span="8">
|
||||
<el-card class="stat-card stat-card-success" shadow="hover">
|
||||
<div class="stat-content">
|
||||
<div class="stat-icon">
|
||||
<el-icon><Select /></el-icon>
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<div class="stat-value">{{ statistics.completed || 0 }}</div>
|
||||
<div class="stat-label">已完成</div>
|
||||
<div class="stat-value">{{ statistics.admissionProcessed || 0 }}</div>
|
||||
<div class="stat-label">已处理人数</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
@@ -128,7 +83,7 @@
|
||||
<el-card class="button-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="toolbar-title">录取流程管理</span>
|
||||
<span class="toolbar-title">录取处理管理</span>
|
||||
<div class="toolbar-actions">
|
||||
<el-button
|
||||
v-hasPermi="['zsjy:enrollmentProcess:export']"
|
||||
@@ -162,9 +117,11 @@
|
||||
row-key="id"
|
||||
class="scroll-table"
|
||||
@selection-change="handleSelectionChange"
|
||||
fit
|
||||
border
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="学生信息" align="center" width="200">
|
||||
<el-table-column label="学生信息" align="center" min-width="180">
|
||||
<template #default="scope">
|
||||
<div style="text-align: left;">
|
||||
<div style="font-weight: 600; color: #303133;">{{ scope.row.studentName }}</div>
|
||||
@@ -172,36 +129,36 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态" align="center" width="120">
|
||||
<el-table-column label="当前状态" align="center" min-width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="zsjy_enrollment_status" :value="scope.row.currentStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前处理人" align="center" width="120" prop="currentHandlerName" />
|
||||
<el-table-column label="缴费状态" align="center" width="100">
|
||||
<el-table-column label="当前处理人" align="center" min-width="100" prop="currentHandlerName" />
|
||||
<el-table-column label="缴费状态" align="center" min-width="90">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.payment_status === '1' || scope.row.paymentStatus === '1'" type="success">已缴费</el-tag>
|
||||
<el-tag v-else-if="scope.row.payment_status === '0' || scope.row.paymentStatus === '0'" type="warning">未缴费</el-tag>
|
||||
<el-tag v-else type="info">未知</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="录取通知书" align="center" width="150" show-overflow-tooltip>
|
||||
<el-table-column label="录取通知书" align="center" min-width="120" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.noticeNumber || scope.row.notice_number || '未生成' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="完成状态" align="center" width="100">
|
||||
<el-table-column label="完成状态" align="center" min-width="90">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.is_completed === 1 || scope.row.is_completed === '1' || scope.row.is_completed === 'Y'" type="success">是</el-tag>
|
||||
<el-tag v-else type="info">否</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" width="180">
|
||||
<el-table-column label="创建时间" align="center" min-width="160">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="280" fixed="right">
|
||||
<el-table-column label="操作" align="center" min-width="250" fixed="right">
|
||||
<template #default="scope">
|
||||
<div class="action-buttons">
|
||||
<el-tooltip content="查看详情" placement="top">
|
||||
@@ -224,7 +181,7 @@
|
||||
/>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="(scope.row.payment_status !== '1' && scope.row.paymentStatus !== '1') ?
|
||||
'请先完成缴费确认' : '录取处理'" placement="top">
|
||||
'请先完成缴费确认' : '录取处理'" placement="top">
|
||||
<el-button
|
||||
v-hasPermi="['zsjy:enrollmentProcess:process']"
|
||||
link
|
||||
@@ -241,9 +198,9 @@
|
||||
type="info"
|
||||
icon="CircleCheck"
|
||||
:disabled="(scope.row.payment_status !== '1' && scope.row.paymentStatus !== '1') ||
|
||||
(scope.row.admissionStatus !== '1' && scope.row.admission_status !== '1') ||
|
||||
scope.row.is_completed === 1 ||
|
||||
scope.row.is_completed === 'Y'"
|
||||
(scope.row.admissionStatus !== '1' && scope.row.admission_status !== '1') ||
|
||||
scope.row.is_completed === 1 ||
|
||||
scope.row.is_completed === 'Y'"
|
||||
@click="handleComplete(scope.row)"
|
||||
/>
|
||||
</el-tooltip>
|
||||
@@ -372,9 +329,8 @@ const handleSelectionChange = (selection: EnrollmentProcessVO[]) => {
|
||||
// 统计数据
|
||||
const statistics = ref({
|
||||
total: 0,
|
||||
pending: 0,
|
||||
processing: 0,
|
||||
completed: 0
|
||||
paymentConfirmed: 0,
|
||||
admissionProcessed: 0
|
||||
})
|
||||
|
||||
// 对话框状态
|
||||
@@ -389,65 +345,93 @@ const currentProcess = ref<Partial<EnrollmentProcessVO>>({})
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
// 设置查询参数,只查询录取处理中且未完成的数据
|
||||
queryParams.value.currentStatus = '2' // 只查询录取处理中的数据
|
||||
queryParams.value.isCompleted = 0 // 只查询未完成的数据
|
||||
|
||||
const res = await listEnrollmentProcess(queryParams.value)
|
||||
|
||||
// 对返回的数据进行处理,确保字段名一致
|
||||
const processedList = (res.rows || []).map(item => {
|
||||
// 添加日志用于调试(首行数据)
|
||||
if (item === res.rows[0]) {
|
||||
console.log('首行数据字段:', Object.keys(item))
|
||||
console.log('首行数据内容:', JSON.stringify(item))
|
||||
}
|
||||
const processedList = (res.rows || [])
|
||||
// 过滤掉已完成录取的数据
|
||||
.filter(item => {
|
||||
const isCompleted = item.isCompleted || item.is_completed || 0;
|
||||
// 只保留未完成录取的数据
|
||||
return isCompleted === 0 || isCompleted === '0';
|
||||
})
|
||||
.map(item => {
|
||||
// 添加日志用于调试(首行数据)
|
||||
if (item === res.rows[0]) {
|
||||
console.log('首行数据字段:', Object.keys(item))
|
||||
console.log('首行数据内容:', JSON.stringify(item))
|
||||
}
|
||||
|
||||
// 字段名映射处理
|
||||
return {
|
||||
...item,
|
||||
// 确保同时有驼峰式和下划线式的字段
|
||||
paymentStatus: item.paymentStatus || item.payment_status,
|
||||
payment_status: item.payment_status || item.paymentStatus,
|
||||
isCompleted: item.isCompleted || item.is_completed,
|
||||
is_completed: item.is_completed || item.isCompleted,
|
||||
noticeNumber: item.noticeNumber || item.notice_number,
|
||||
notice_number: item.notice_number || item.noticeNumber
|
||||
}
|
||||
})
|
||||
// 字段名映射处理
|
||||
return {
|
||||
...item,
|
||||
// 确保同时有驼峰式和下划线式的字段
|
||||
paymentStatus: item.paymentStatus || item.payment_status,
|
||||
payment_status: item.payment_status || item.paymentStatus,
|
||||
isCompleted: item.isCompleted || item.is_completed,
|
||||
is_completed: item.is_completed || item.isCompleted,
|
||||
noticeNumber: item.noticeNumber || item.notice_number,
|
||||
notice_number: item.notice_number || item.noticeNumber,
|
||||
admissionStatus: item.admissionStatus || item.admission_status,
|
||||
admission_status: item.admission_status || item.admissionStatus
|
||||
}
|
||||
})
|
||||
|
||||
processList.value = processedList
|
||||
total.value = res.total || 0
|
||||
total.value = processedList.length // 更新总数为过滤后的数量
|
||||
} catch (error) {
|
||||
console.error('获取流程列表失败:', error)
|
||||
|
||||
// 如果是404错误(接口不存在),使用模拟数据
|
||||
if (error?.response?.status === 404 || error?.message?.includes('404')) {
|
||||
console.warn('后端接口不存在,使用模拟数据')
|
||||
// 创建模拟的流程数据
|
||||
// 创建模拟的流程数据,只包含未完成录取的数据
|
||||
processList.value = [
|
||||
{
|
||||
id: 1946510098494091300,
|
||||
enrollmentId: 1001,
|
||||
studentName: '张三',
|
||||
idCard: '330101200501010001',
|
||||
currentStatus: '0',
|
||||
infoAuditStatus: '0',
|
||||
admissionStatus: '0',
|
||||
id: 1946510098494091302,
|
||||
enrollmentId: 1003,
|
||||
studentName: '王五',
|
||||
idCard: '110101200601010003',
|
||||
currentStatus: '2', // 录取处理中
|
||||
infoAuditStatus: '1',
|
||||
admissionStatus: '0', // 未处理录取
|
||||
paymentStatus: '0', // 未缴费
|
||||
finalAuditStatus: '0',
|
||||
isCompleted: 0,
|
||||
createTime: '2025-07-20 10:28:09'
|
||||
isCompleted: 0, // 未完成
|
||||
createTime: '2025-07-20 10:28:27'
|
||||
},
|
||||
{
|
||||
id: 1946510098494091301,
|
||||
enrollmentId: 1946510098494091266,
|
||||
studentName: '赵四',
|
||||
idCard: '340403201509091234',
|
||||
currentStatus: '0',
|
||||
infoAuditStatus: '0',
|
||||
admissionStatus: '0',
|
||||
id: 1946510098494091303,
|
||||
enrollmentId: 1004,
|
||||
studentName: '李六',
|
||||
idCard: '440106200701010004',
|
||||
currentStatus: '2', // 录取处理中
|
||||
infoAuditStatus: '1',
|
||||
admissionStatus: '0', // 未处理录取
|
||||
paymentStatus: '1', // 已缴费
|
||||
finalAuditStatus: '0',
|
||||
isCompleted: 0,
|
||||
createTime: '2025-07-20 10:28:18'
|
||||
isCompleted: 0, // 未完成
|
||||
createTime: '2025-07-20 10:28:36'
|
||||
},
|
||||
{
|
||||
id: 1946510098494091304,
|
||||
enrollmentId: 1005,
|
||||
studentName: '赵七',
|
||||
idCard: '330106200801010005',
|
||||
currentStatus: '2', // 录取处理中
|
||||
infoAuditStatus: '1',
|
||||
admissionStatus: '1', // 已处理录取
|
||||
paymentStatus: '1', // 已缴费
|
||||
finalAuditStatus: '0',
|
||||
isCompleted: 0, // 未完成
|
||||
createTime: '2025-07-20 10:28:45'
|
||||
}
|
||||
]
|
||||
total.value = 2
|
||||
total.value = 3
|
||||
proxy?.$modal.msgWarning('后端接口暂未实现,显示模拟数据')
|
||||
} else {
|
||||
// 其他错误,设置空数据并抛出错误
|
||||
@@ -467,28 +451,38 @@ const getStatistics = async () => {
|
||||
// const res = await getProcessStatistics()
|
||||
// const stats = res.data || []
|
||||
|
||||
// 基于当前流程列表计算统计数据
|
||||
// 基于当前流程列表计算统计数据(只包含录取处理中的数据)
|
||||
const stats = processList.value || []
|
||||
const statusCounts = stats.reduce((acc: any, item: any) => {
|
||||
const status = item.currentStatus
|
||||
acc[status] = (acc[status] || 0) + 1
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
// 计算已缴费人数和已处理人数
|
||||
let paymentConfirmed = 0
|
||||
let admissionProcessed = 0
|
||||
|
||||
stats.forEach(item => {
|
||||
// 计算已缴费人数
|
||||
if (item.paymentStatus === '1' || item.payment_status === '1') {
|
||||
paymentConfirmed++
|
||||
}
|
||||
|
||||
// 计算已处理人数(录取状态为已处理)
|
||||
if (item.admissionStatus === '1' || item.admission_status === '1') {
|
||||
admissionProcessed++
|
||||
}
|
||||
})
|
||||
|
||||
// 更新统计数据
|
||||
statistics.value = {
|
||||
total: stats.length,
|
||||
pending: (statusCounts['0'] || 0) + (statusCounts['1'] || 0), // 待审核 + 信息审核中
|
||||
processing: (statusCounts['2'] || 0) + (statusCounts['3'] || 0), // 录取处理中 + 待最终确认
|
||||
completed: statusCounts['4'] || 0 // 录取完成
|
||||
paymentConfirmed,
|
||||
admissionProcessed
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取统计数据失败:', error)
|
||||
// 设置默认值
|
||||
statistics.value = {
|
||||
total: 0,
|
||||
pending: 0,
|
||||
processing: 0,
|
||||
completed: 0
|
||||
paymentConfirmed: 0,
|
||||
admissionProcessed: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -713,9 +707,28 @@ const getCompleteButtonTooltip = (row: any): string => {
|
||||
return '完成录取';
|
||||
}
|
||||
|
||||
/** 判断是否已缴费 */
|
||||
const isPaymentConfirmed = (row: any): boolean => {
|
||||
return row.payment_status === '1' || row.paymentStatus === '1';
|
||||
}
|
||||
|
||||
/** 判断是否已处理录取 */
|
||||
const isAdmissionProcessed = (row: any): boolean => {
|
||||
return row.admissionStatus === '1' || row.admission_status === '1';
|
||||
}
|
||||
|
||||
/** 判断是否已完成 */
|
||||
const isCompleted = (row: any): boolean => {
|
||||
return row.is_completed === 1 || row.is_completed === '1' || row.is_completed === 'Y';
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
try {
|
||||
// 设置默认查询参数
|
||||
queryParams.value.currentStatus = '2' // 录取处理中
|
||||
queryParams.value.isCompleted = 0 // 未完成
|
||||
|
||||
// 处理路由参数
|
||||
const route = useRoute();
|
||||
if (route && route.query) {
|
||||
@@ -747,6 +760,8 @@ onMounted(async () => {
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
padding: 8px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 搜索卡片样式 */
|
||||
@@ -886,21 +901,28 @@ onMounted(async () => {
|
||||
border-radius: 12px;
|
||||
border: 1px solid #e4e7ed;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
padding: 20px !important;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 表格容器 - 支持横向滚动 */
|
||||
.table-container {
|
||||
width: 100%;
|
||||
margin-bottom: 0;
|
||||
overflow-x: auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 横向滚动表格样式 */
|
||||
.scroll-table {
|
||||
width: 100%;
|
||||
table-layout: auto;
|
||||
}
|
||||
|
||||
/* 表格横向滚动条样式优化 */
|
||||
@@ -909,8 +931,12 @@ onMounted(async () => {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.scroll-table :deep(.el-table__header-wrapper) {
|
||||
overflow-x: hidden;
|
||||
/* 强制表格自适应容器宽度 */
|
||||
.scroll-table :deep(.el-table__header),
|
||||
.scroll-table :deep(.el-table__body) {
|
||||
width: 100% !important;
|
||||
min-width: 100% !important;
|
||||
table-layout: auto !important;
|
||||
}
|
||||
|
||||
/* 强制显示表格横向滚动条 - 适用于所有浏览器 */
|
||||
@@ -975,9 +1001,31 @@ onMounted(async () => {
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
padding: 16px 0 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 确保整个表格区域适应容器 */
|
||||
.el-card.table-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.el-card.table-card :deep(.el-card__body) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
padding: 20px !important;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
/* 操作按钮样式 */
|
||||
|
||||
@@ -186,9 +186,10 @@ const loadStatisticsData = async () => {
|
||||
}
|
||||
|
||||
statisticsData.value = res.data;
|
||||
console.log('已设置统计数据:', statisticsData.value);
|
||||
|
||||
// 加载所有图表
|
||||
loadAllCharts();
|
||||
await loadAllCharts();
|
||||
} catch (error) {
|
||||
console.error('获取统计概览数据失败', error);
|
||||
ElMessage.error('获取统计数据失败,请联系管理员');
|
||||
@@ -198,12 +199,29 @@ const loadStatisticsData = async () => {
|
||||
};
|
||||
|
||||
// 加载所有图表
|
||||
const loadAllCharts = () => {
|
||||
loadTrendChart();
|
||||
loadGenderChart();
|
||||
loadMajorChart();
|
||||
loadRegionChart();
|
||||
loadStatusChart();
|
||||
const loadAllCharts = async () => {
|
||||
try {
|
||||
console.log('开始加载所有图表...');
|
||||
|
||||
// 确保等待DOM元素完全加载
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
// 依次加载各个图表(改为串行以避免资源竞争)
|
||||
await loadTrendChart();
|
||||
await loadGenderChart();
|
||||
await loadMajorChart();
|
||||
await loadRegionChart();
|
||||
await loadStatusChart();
|
||||
|
||||
console.log('所有图表加载完成');
|
||||
|
||||
// 最后再次调整所有图表大小
|
||||
nextTick(() => {
|
||||
handleResize();
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('加载图表失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// 加载趋势图
|
||||
@@ -220,18 +238,25 @@ const loadTrendChart = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const trendData = res.data;
|
||||
// 确保DOM元素已经加载
|
||||
await nextTick();
|
||||
|
||||
// 初始化趋势图
|
||||
if (!trendChartInstance) {
|
||||
const chartDom = document.getElementById('trendChart');
|
||||
if (!chartDom) {
|
||||
console.error('找不到趋势图DOM元素!');
|
||||
return;
|
||||
}
|
||||
trendChartInstance = echarts.init(chartDom);
|
||||
// 检查DOM元素
|
||||
const chartDom = document.getElementById('trendChart');
|
||||
if (!chartDom) {
|
||||
console.error('找不到趋势图DOM元素! 请检查HTML结构');
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化图表,如果已存在则销毁重建
|
||||
if (trendChartInstance) {
|
||||
trendChartInstance.dispose();
|
||||
}
|
||||
|
||||
trendChartInstance = echarts.init(chartDom);
|
||||
console.log('趋势图实例已创建');
|
||||
|
||||
const trendData = res.data.data || res.data;
|
||||
const dates: string[] = [];
|
||||
const counts: number[] = [];
|
||||
|
||||
@@ -240,6 +265,7 @@ const loadTrendChart = async () => {
|
||||
dates.push(item.date as string);
|
||||
counts.push(item.count as number);
|
||||
});
|
||||
console.log('趋势数据已处理:', { dates, counts });
|
||||
} else {
|
||||
console.error('趋势数据不是数组格式:', trendData);
|
||||
return;
|
||||
@@ -294,10 +320,15 @@ const loadTrendChart = async () => {
|
||||
]
|
||||
};
|
||||
|
||||
// 设置选项并绘制图表
|
||||
trendChartInstance.setOption(option);
|
||||
console.log('趋势图已渲染完成');
|
||||
|
||||
// 强制更新布局
|
||||
trendChartInstance.resize();
|
||||
} catch (error) {
|
||||
console.error('获取报名趋势数据失败', error);
|
||||
ElMessage.warning('获取报名趋势数据失败');
|
||||
ElMessage.warning('获取报名趋势数据失败,请检查网络连接');
|
||||
} finally {
|
||||
trendLoading.value = false;
|
||||
}
|
||||
@@ -317,18 +348,27 @@ const loadGenderChart = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const genderData = res.data;
|
||||
// 确保DOM元素已经加载
|
||||
await nextTick();
|
||||
|
||||
// 初始化性别比例图
|
||||
if (!genderChartInstance) {
|
||||
const chartDom = document.getElementById('genderChart');
|
||||
if (!chartDom) {
|
||||
console.error('找不到性别比例图DOM元素!');
|
||||
return;
|
||||
}
|
||||
genderChartInstance = echarts.init(chartDom);
|
||||
// 检查DOM元素
|
||||
const chartDom = document.getElementById('genderChart');
|
||||
if (!chartDom) {
|
||||
console.error('找不到性别比例图DOM元素! 请检查HTML结构');
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化图表,如果已存在则销毁重建
|
||||
if (genderChartInstance) {
|
||||
genderChartInstance.dispose();
|
||||
}
|
||||
|
||||
genderChartInstance = echarts.init(chartDom);
|
||||
console.log('性别比例图实例已创建');
|
||||
|
||||
const genderData = res.data.data || res.data;
|
||||
console.log('原始性别数据:', genderData);
|
||||
|
||||
const pieData = [];
|
||||
let total = 0;
|
||||
|
||||
@@ -349,6 +389,8 @@ const loadGenderChart = async () => {
|
||||
});
|
||||
});
|
||||
|
||||
console.log('处理后的性别数据:', pieData);
|
||||
|
||||
const option = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
@@ -389,10 +431,15 @@ const loadGenderChart = async () => {
|
||||
]
|
||||
};
|
||||
|
||||
// 设置选项并绘制图表
|
||||
genderChartInstance.setOption(option);
|
||||
console.log('性别比例图已渲染完成');
|
||||
|
||||
// 强制更新布局
|
||||
genderChartInstance.resize();
|
||||
} catch (error) {
|
||||
console.error('获取性别比例数据失败', error);
|
||||
ElMessage.warning('获取性别比例数据失败');
|
||||
ElMessage.warning('获取性别比例数据失败,请检查网络连接');
|
||||
} finally {
|
||||
genderLoading.value = false;
|
||||
}
|
||||
@@ -412,88 +459,88 @@ const loadMajorChart = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const majorData = res.data;
|
||||
// 确保DOM元素已经加载
|
||||
await nextTick();
|
||||
|
||||
// 初始化专业分布图
|
||||
if (!majorChartInstance) {
|
||||
const chartDom = document.getElementById('majorChart');
|
||||
if (!chartDom) {
|
||||
console.error('找不到专业分布图DOM元素!');
|
||||
return;
|
||||
}
|
||||
majorChartInstance = echarts.init(chartDom);
|
||||
}
|
||||
|
||||
const majorNames: string[] = [];
|
||||
const majorCounts: number[] = [];
|
||||
|
||||
if (Array.isArray(majorData)) {
|
||||
majorData.forEach(item => {
|
||||
majorNames.push(item.name as string);
|
||||
majorCounts.push(item.value as number);
|
||||
});
|
||||
} else {
|
||||
console.error('专业分布数据不是数组格式:', majorData);
|
||||
// 检查DOM元素
|
||||
const chartDom = document.getElementById('majorChart');
|
||||
if (!chartDom) {
|
||||
console.error('找不到专业分布图DOM元素! 请检查HTML结构');
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化图表,如果已存在则销毁重建
|
||||
if (majorChartInstance) {
|
||||
majorChartInstance.dispose();
|
||||
}
|
||||
|
||||
majorChartInstance = echarts.init(chartDom);
|
||||
console.log('专业分布图实例已创建');
|
||||
|
||||
// 获取数据
|
||||
const majorData = res.data.data || res.data;
|
||||
console.log('专业分布原始数据:', majorData);
|
||||
|
||||
if (!Array.isArray(majorData)) {
|
||||
console.error('专业分布数据格式错误,应为数组:', majorData);
|
||||
return;
|
||||
}
|
||||
|
||||
// 限制显示的专业数量,避免图表过于拥挤
|
||||
const displayLimit = 10;
|
||||
const sortedData = [...majorData].sort((a, b) => b.value - a.value);
|
||||
const displayData = sortedData.slice(0, displayLimit);
|
||||
|
||||
// 如果数据超过限制,添加"其他"类别
|
||||
if (sortedData.length > displayLimit) {
|
||||
const otherSum = sortedData.slice(displayLimit).reduce((sum, item) => sum + item.value, 0);
|
||||
displayData.push({
|
||||
name: '其他',
|
||||
value: otherSum
|
||||
});
|
||||
}
|
||||
|
||||
console.log('处理后的专业分布数据:', displayData);
|
||||
|
||||
const option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
trigger: 'item',
|
||||
formatter: '{b}: {c} ({d}%)'
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: majorNames,
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
rotate: majorNames.length > 5 ? 45 : 0,
|
||||
textStyle: {
|
||||
fontSize: 12
|
||||
}
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
name: '报名人数',
|
||||
minInterval: 1
|
||||
legend: {
|
||||
type: 'scroll',
|
||||
orient: 'vertical',
|
||||
right: 10,
|
||||
top: 20,
|
||||
bottom: 20,
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '报名人数',
|
||||
type: 'bar',
|
||||
data: majorCounts,
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: '#5d87ff' },
|
||||
{ offset: 1, color: '#83bff6' }
|
||||
])
|
||||
},
|
||||
name: '专业分布',
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
center: ['40%', '50%'],
|
||||
data: displayData,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: '#2378f7' },
|
||||
{ offset: 0.7, color: '#2378f7' },
|
||||
{ offset: 1, color: '#83bff6' }
|
||||
])
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 设置选项并绘制图表
|
||||
majorChartInstance.setOption(option);
|
||||
console.log('专业分布图已渲染完成');
|
||||
|
||||
// 强制更新布局
|
||||
majorChartInstance.resize();
|
||||
} catch (error) {
|
||||
console.error('获取专业分布数据失败', error);
|
||||
ElMessage.warning('获取专业分布数据失败');
|
||||
ElMessage.warning('获取专业分布数据失败,请检查网络连接');
|
||||
} finally {
|
||||
majorLoading.value = false;
|
||||
}
|
||||
@@ -513,66 +560,110 @@ const loadRegionChart = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const regionData = res.data;
|
||||
// 确保DOM元素已经加载
|
||||
await nextTick();
|
||||
|
||||
// 初始化地区分布图
|
||||
if (!regionChartInstance) {
|
||||
const chartDom = document.getElementById('regionChart');
|
||||
if (!chartDom) {
|
||||
console.error('找不到地区分布图DOM元素!');
|
||||
return;
|
||||
}
|
||||
regionChartInstance = echarts.init(chartDom);
|
||||
}
|
||||
|
||||
const pieData: { name: string; value: number }[] = [];
|
||||
|
||||
if (Array.isArray(regionData)) {
|
||||
regionData.forEach(item => {
|
||||
pieData.push({
|
||||
name: item.name as string,
|
||||
value: item.value as number
|
||||
});
|
||||
});
|
||||
} else {
|
||||
console.error('地区分布数据不是数组格式:', regionData);
|
||||
// 检查DOM元素
|
||||
const chartDom = document.getElementById('regionChart');
|
||||
if (!chartDom) {
|
||||
console.error('找不到地区分布图DOM元素! 请检查HTML结构');
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化图表,如果已存在则销毁重建
|
||||
if (regionChartInstance) {
|
||||
regionChartInstance.dispose();
|
||||
}
|
||||
|
||||
regionChartInstance = echarts.init(chartDom);
|
||||
console.log('地区分布图实例已创建');
|
||||
|
||||
// 获取数据
|
||||
const regionData = res.data.data || res.data;
|
||||
console.log('地区分布原始数据:', regionData);
|
||||
|
||||
if (!Array.isArray(regionData)) {
|
||||
console.error('地区分布数据格式错误,应为数组:', regionData);
|
||||
return;
|
||||
}
|
||||
|
||||
// 限制显示的地区数量,避免图表过于拥挤
|
||||
const displayLimit = 6;
|
||||
const sortedData = [...regionData].sort((a, b) => b.value - a.value);
|
||||
const displayData = sortedData.slice(0, displayLimit);
|
||||
|
||||
// 如果数据超过限制,添加"其他"类别
|
||||
if (sortedData.length > displayLimit) {
|
||||
const otherSum = sortedData.slice(displayLimit).reduce((sum, item) => sum + item.value, 0);
|
||||
displayData.push({
|
||||
name: '其他',
|
||||
value: otherSum
|
||||
});
|
||||
}
|
||||
|
||||
const regions = displayData.map(item => item.name);
|
||||
const values = displayData.map(item => item.value);
|
||||
|
||||
console.log('处理后的地区分布数据:', { regions, values });
|
||||
|
||||
const option = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b}: {c} ({d}%)'
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
type: 'scroll',
|
||||
orient: 'vertical',
|
||||
right: 10,
|
||||
top: 20,
|
||||
bottom: 20
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
data: regions,
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
rotate: 0
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '地区分布',
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
center: ['40%', '50%'],
|
||||
data: pieData,
|
||||
name: '报名人数',
|
||||
type: 'bar',
|
||||
data: values,
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
|
||||
{ offset: 0, color: '#83bff6' },
|
||||
{ offset: 0.5, color: '#188df0' },
|
||||
{ offset: 1, color: '#188df0' }
|
||||
])
|
||||
},
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
|
||||
{ offset: 0, color: '#2378f7' },
|
||||
{ offset: 0.7, color: '#2378f7' },
|
||||
{ offset: 1, color: '#83bff6' }
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 设置选项并绘制图表
|
||||
regionChartInstance.setOption(option);
|
||||
console.log('地区分布图已渲染完成');
|
||||
|
||||
// 强制更新布局
|
||||
regionChartInstance.resize();
|
||||
} catch (error) {
|
||||
console.error('获取地区分布数据失败', error);
|
||||
ElMessage.warning('获取地区分布数据失败');
|
||||
ElMessage.warning('获取地区分布数据失败,请检查网络连接');
|
||||
} finally {
|
||||
regionLoading.value = false;
|
||||
}
|
||||
@@ -592,18 +683,28 @@ const loadStatusChart = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const statusData = res.data;
|
||||
// 确保DOM元素已经加载
|
||||
await nextTick();
|
||||
|
||||
// 初始化状态分布图
|
||||
if (!statusChartInstance) {
|
||||
const chartDom = document.getElementById('statusChart');
|
||||
if (!chartDom) {
|
||||
console.error('找不到状态分布图DOM元素!');
|
||||
return;
|
||||
}
|
||||
statusChartInstance = echarts.init(chartDom);
|
||||
// 检查DOM元素
|
||||
const chartDom = document.getElementById('statusChart');
|
||||
if (!chartDom) {
|
||||
console.error('找不到状态分布图DOM元素! 请检查HTML结构');
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化图表,如果已存在则销毁重建
|
||||
if (statusChartInstance) {
|
||||
statusChartInstance.dispose();
|
||||
}
|
||||
|
||||
statusChartInstance = echarts.init(chartDom);
|
||||
console.log('状态分布图实例已创建');
|
||||
|
||||
// 获取数据
|
||||
const statusData = res.data.data || res.data;
|
||||
console.log('状态分布原始数据:', statusData);
|
||||
|
||||
const statusMap: Record<string, string> = {
|
||||
'0': '未开始',
|
||||
'1': '信息审核中',
|
||||
@@ -637,6 +738,8 @@ const loadStatusChart = async () => {
|
||||
});
|
||||
}
|
||||
|
||||
console.log('处理后的状态分布数据:', chartData);
|
||||
|
||||
const option = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
@@ -677,10 +780,15 @@ const loadStatusChart = async () => {
|
||||
]
|
||||
};
|
||||
|
||||
// 设置选项并绘制图表
|
||||
statusChartInstance.setOption(option);
|
||||
console.log('状态分布图已渲染完成');
|
||||
|
||||
// 强制更新布局
|
||||
statusChartInstance.resize();
|
||||
} catch (error) {
|
||||
console.error('获取状态分布数据失败', error);
|
||||
ElMessage.warning('获取状态分布数据失败');
|
||||
ElMessage.warning('获取状态分布数据失败,请检查网络连接');
|
||||
} finally {
|
||||
statusLoading.value = false;
|
||||
}
|
||||
@@ -700,16 +808,23 @@ const handleResize = () => {
|
||||
statusChartInstance?.resize();
|
||||
};
|
||||
|
||||
// 页面初始化
|
||||
onMounted(() => {
|
||||
console.log('统计页面已挂载');
|
||||
try {
|
||||
// 加载后台真实数据
|
||||
loadStatisticsData();
|
||||
window.addEventListener('resize', handleResize);
|
||||
console.log('添加窗口resize事件监听');
|
||||
} catch (e) {
|
||||
console.error('页面初始化错误:', e);
|
||||
}
|
||||
// 延迟执行,确保DOM完全加载
|
||||
setTimeout(() => {
|
||||
console.log('开始页面初始化流程...');
|
||||
try {
|
||||
// 加载后台真实数据
|
||||
loadStatisticsData();
|
||||
|
||||
// 添加窗口resize事件监听
|
||||
window.addEventListener('resize', handleResize);
|
||||
console.log('添加窗口resize事件监听');
|
||||
} catch (e) {
|
||||
console.error('页面初始化错误:', e);
|
||||
}
|
||||
}, 300); // 添加300ms延迟,确保DOM完全加载
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
Reference in new issue
Block a user