用户管理证书

This commit is contained in:
马梓彭 2026-04-27 13:22:42 +08:00
parent ecec637f05
commit bbab43e8fa
5 changed files with 145 additions and 52 deletions

View File

@ -41,7 +41,7 @@ export const eventrecordPageGet = (params) => {
/**
* 获取证书列表
* @param {number} registrationid - 报名记录ID (路径参数)
* @param {Array<number>} registrationIds - 报名记录ID列表
* @returns {Promise<Array<{
* id: number,
* name: string,
@ -50,8 +50,8 @@ export const eventrecordPageGet = (params) => {
* imageUrl: string
* }>>}
*/
export const eventrecordCertificatesGet = (registrationid) => {
return http.get(`/eventrecord/${registrationid}/certificates`);
export const eventrecordCertificatesGet = (registrationIds) => {
return http.get('/eventrecord/certificates', { params: { registrationIds } });
};
/**

View File

@ -56,7 +56,7 @@ const route = useRoute();
const state = reactive({
// 修复:https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
defaultActive: route.meta.isDynamic ? route.meta.isDynamicPath : route.path,
isCollapse: false,
isCollapse: themeConfig.value.isCollapse,
});
// 获取父级菜单数据
@ -93,7 +93,9 @@ onBeforeRouteUpdate((to) => {
watch(
() => themeConfig.value.isCollapse,
(isCollapse) => {
document.body.clientWidth <= 1000 ? (state.isCollapse = false) : (state.isCollapse = isCollapse);
if (document.body.clientWidth > 1000) {
state.isCollapse = isCollapse;
}
},
{
immediate: true,

View File

@ -27,10 +27,35 @@
<!-- 弹窗 -->
<el-dialog title="参赛记录" v-model="isShowDialog" width="80%" @close="onDialogClose">
<ProTable v-if="isShowDialog" ref="table" :request-api="eventrecordPageGet" :columns="columnsUser" :pagination="true" :tool-button="false" :initParam="initParamUser">
<ProTable v-if="isShowDialog" ref="table" :request-api="eventrecordPageGet" :columns="columnsUser" :pagination="true" :tool-button="false" :initParam="initParamUser" preserve-expanded-content>
<!-- 展开列 -->
<el-table-column type="expand">
<template #default="scope">
<div class="expand-content">
<el-table :data="scope.row.items || []" border style="width: 100%; margin-top: 10px;">
<el-table-column label="项目名称" prop="projectName" min-width="150" />
<el-table-column label="项目类型" prop="projectTypeName" width="120" />
<el-table-column label="参赛组别" prop="groupName" width="120" />
<el-table-column label="报名人数" prop="personCount" width="100" align="center" />
<el-table-column label="成绩" prop="score" width="120" />
<el-table-column label="名次" prop="rank" width="100" />
<el-table-column label="操作" width="150" align="center" fixed="right">
<template #default="item">
<el-button size="small" text type="primary" @click="lookBook(scope.row, item.row)">查看证书</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
</el-table-column>
<template #index="scope">
{{ scope.$index + 1 }}
</template>
<template #eventType="scope">
<el-tag :type="scope.row.eventType === 'Online' ? 'primary' : 'success'">
{{ scope.row.eventType === 'Online' ? '线上' : '线下' }}
</el-tag>
</template>
<template #startTime="scope"> {{ scope.row.startTime }} -- {{ scope.row.endTime }} </template>
<template #action="scope">
<el-button v-auth="'user:general:record'" size="small" text type="primary" @click="lookBook(scope.row)"> 查看证书 </el-button>
@ -46,7 +71,19 @@
<!-- 弹窗 -->
<el-dialog title="查看证书" v-model="isShowBook" width="80%">
<div>证书</div>
<div v-if="certificates.length > 0">
<el-table :data="certificates" border>
<el-table-column label="证书名称" prop="name" />
<el-table-column label="获奖等级" prop="awardLevel" />
<el-table-column label="证书类型" prop="certificateType" />
<el-table-column label="查看">
<template #default="scope">
<el-button size="small" text type="primary" @click="openCertificate(scope.row.imageUrl)">查看</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div v-else>暂无证书</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="onCancelB">取消</el-button>
@ -164,21 +201,7 @@ const statusNameList = ['未提交', '未审核', '已通过', '未通过'];
const columnsUser = ref([
{ prop: 'index', label: '序号', align: 'center' },
{ prop: 'eventName', label: '赛事名称', search: { el: 'input' } },
// {
// prop: 'auditStatus',
// label: '赛事类型',
// search: {
// el: 'select',
// },
// enum: [
// { label: '全部', value: '' },
// { label: '未通过', value: 3 },
// { label: '已通过', value: 2 },
// { label: '未审核', value: 1 },
// { label: '未提交', value: 0 },
// ],
// },
{ prop: 'eventType', label: '赛事类型', width: '100' },
{
prop: 'startTime',
label: '起止时间',
@ -198,6 +221,7 @@ const columnsUser = ref([
const isShowDialog = ref(false);
const table = ref();
const certificates = ref([]);
const onOpenMenu = (row) => {
console.log(row);
@ -240,15 +264,31 @@ const onCancelB = () => {
// 查看证书
const isShowBook = ref(false);
const lookBook = async (row) => {
const { succeeded, data } = await eventrecordCertificatesGet(row.id);
const lookBook = async (row, item) => {
console.log('查看证书', row, item);
const registrationIds = row.registrationIds || [];
if (registrationIds.length === 0) {
ElMessage.warning('暂无报名记录');
return;
}
const { succeeded, data } = await eventrecordCertificatesGet(registrationIds);
if (succeeded) {
certificates.value = data || [];
isShowBook.value = true;
} else {
ElMessage.error(data);
}
};
// 打开证书图片
const openCertificate = (url) => {
if (url) {
window.open(url, '_blank');
} else {
ElMessage.warning('证书链接无效');
}
};
// 对话框关闭时清理
const onDialogClose = () => {
// 清理参数,避免下次查询时使用旧参数

View File

@ -32,10 +32,35 @@
<!-- 弹窗 -->
<el-dialog title="参赛记录" v-model="isShowDialog" width="80%" @close="onDialogClose">
<ProTable v-if="isShowDialog" ref="table" :request-api="eventrecordPageGet" :columns="columnsUser" :pagination="true" :tool-button="false" :initParam="initParamUser">
<ProTable v-if="isShowDialog" ref="table" :request-api="eventrecordPageGet" :columns="columnsUser" :pagination="true" :tool-button="false" :initParam="initParamUser" preserve-expanded-content>
<!-- 展开列 -->
<el-table-column type="expand">
<template #default="scope">
<div class="expand-content">
<el-table :data="scope.row.items || []" border style="width: 100%; margin-top: 10px;">
<el-table-column label="项目名称" prop="projectName" min-width="150" />
<el-table-column label="项目类型" prop="projectTypeName" width="120" />
<el-table-column label="参赛组别" prop="groupName" width="120" />
<el-table-column label="报名人数" prop="personCount" width="100" align="center" />
<el-table-column label="成绩" prop="score" width="120" />
<el-table-column label="名次" prop="rank" width="100" />
<el-table-column label="操作" width="150" align="center" fixed="right">
<template #default="item">
<el-button size="small" text type="primary" @click="lookBook(scope.row, item.row)">查看证书</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
</el-table-column>
<template #index="scope">
{{ scope.$index + 1 }}
</template>
<template #eventType="scope">
<el-tag :type="scope.row.eventType === 'Online' ? 'primary' : 'success'">
{{ scope.row.eventType === 'Online' ? '线上' : '线下' }}
</el-tag>
</template>
<template #startTime="scope"> {{ scope.row.startTime }} -- {{ scope.row.endTime }} </template>
<template #action="scope">
<el-button v-auth="'user:general:record'" size="small" text type="primary" @click="lookBook(scope.row)"> 查看证书 </el-button>
@ -51,7 +76,19 @@
<!-- 弹窗 -->
<el-dialog title="查看证书" v-model="isShowBook" width="80%">
<div>证书</div>
<div v-if="certificates.length > 0">
<el-table :data="certificates" border>
<el-table-column label="证书名称" prop="name" />
<el-table-column label="获奖等级" prop="awardLevel" />
<el-table-column label="证书类型" prop="certificateType" />
<el-table-column label="查看">
<template #default="scope">
<el-button size="small" text type="primary" @click="openCertificate(scope.row.imageUrl)">查看</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div v-else>暂无证书</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="onCancelB">取消</el-button>
@ -178,21 +215,7 @@ const handleSelectionChange = (val) => {
const columnsUser = ref([
{ prop: 'index', label: '序号', align: 'center' },
{ prop: 'eventName', label: '赛事名称', search: { el: 'input' } },
// {
// prop: 'auditStatus',
// label: '赛事类型',
// search: {
// el: 'select',
// },
// enum: [
// { label: '全部', value: '' },
// { label: '未通过', value: 3 },
// { label: '已通过', value: 2 },
// { label: '未审核', value: 1 },
// { label: '未提交', value: 0 },
// ],
// },
{ prop: 'eventType', label: '赛事类型', width: '100' },
{
prop: 'startTime',
label: '起止时间',
@ -212,6 +235,7 @@ const columnsUser = ref([
const isShowDialog = ref(false);
const table = ref();
const certificates = ref([]);
const onOpenMenu = (row) => {
console.log(row);
@ -241,15 +265,31 @@ const onCancelB = () => {
// 查看证书
const isShowBook = ref(false);
const lookBook = async (row) => {
const { succeeded, data } = await eventrecordCertificatesGet(row.id);
const lookBook = async (row, item) => {
console.log('查看证书', row, item);
const registrationIds = row.registrationIds || [];
if (registrationIds.length === 0) {
ElMessage.warning('暂无报名记录');
return;
}
const { succeeded, data } = await eventrecordCertificatesGet(registrationIds);
if (succeeded) {
certificates.value = data || [];
isShowBook.value = true;
} else {
ElMessage.error(data);
}
};
// 打开证书图片
const openCertificate = (url) => {
if (url) {
window.open(url, '_blank');
} else {
ElMessage.warning('证书链接无效');
}
};
// 审核弹窗相关
const isShowAuditDialog = ref(false);
const auditForm = reactive({

View File

@ -188,8 +188,8 @@ import { ElMessage, ElForm } from 'element-plus';
import SysMenuApi from '/@/api/SysMenuApi';
import { auths } from '/@/utils/authFunction';
import ProTable from '/@/components/ProTable/index.vue';
import { teamPageGet, teamDetailGet, teamAddPost, teamDeleteDelete, teamUpdatePut } from '/@/api/match/unitUser';
import { appuserAthletePageGet, appuserAthleteAddPost, appuserAthleteUpdatePut, appuserLeaderPageGet, appuserCoachPageGet } from '/@/api/match/appuser';
import { teamPageGet, teamDetailGet, teamAddPost, teamDeleteDelete, teamUpdatePut } from '/@/api/match/unituser';
import { appuserAthletePageGet, appuserAthleteAddPost, appuserAthleteUpdatePut, appuserLeaderPageGet, appuserCoachPageGet, appuserMemberDeletePost } from '/@/api/match/appuser';
import { commonOcrRecognizeIdcardPost, commonOcrRecognizePassportPost, commonSmsSendVerificationCodePost } from '/@/api/match/common';
// 定义表单引用类型
const formRef = ref();
@ -563,14 +563,25 @@ const onOpenMenu = (row) => {
isShowDialog.value = true;
};
//删除菜单
//删除运动员
const onDeleteMenu = async (id) => {
// 保留给其它删除场景(如果需要),目前不改动
const { succeeded, errors } = await SysMenuApi.delete({ id });
if (succeeded) {
ElMessage.success('删除成功');
} else {
ElMessage.error(errors);
try {
const res = await appuserMemberDeletePost(id);
if (res && res.succeeded) {
ElMessage.success('删除成功');
// 刷新运动员表格
try {
await nextTick();
initParam.value.refresh = !initParam.value.refresh;
} catch (e) {
// ignore
}
} else {
ElMessage.error(res.errors || res.msg || '删除失败');
}
} catch (e) {
ElMessage.error('删除失败');
console.error(e);
}
};