wuzhen更新社团管理新需求
This commit is contained in:
1 parent
52d892337e
commit
0745d287f5
32 files changed
+1638
-76
No files matched your search
@@ -461,6 +461,11 @@ export interface StglActivityForm {
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
|
||||
/**
|
||||
* 邀请成员ID列表(前端专用,提交时传给后端)
|
||||
*/
|
||||
invitedMemberIds?: (string | number)[];
|
||||
}
|
||||
|
||||
export interface StglActivityQuery extends PageQuery {
|
||||
|
||||
@@ -79,6 +79,21 @@ export interface StglClubVO {
|
||||
*/
|
||||
presidentPhone: string;
|
||||
|
||||
/**
|
||||
* 社长用户ID(关联学生用户)
|
||||
*/
|
||||
presidentUserId?: string | number;
|
||||
|
||||
/**
|
||||
* 物资保管员用户ID
|
||||
*/
|
||||
materialKeeperUserId?: string | number;
|
||||
|
||||
/**
|
||||
* 物资保管员姓名
|
||||
*/
|
||||
materialKeeperName?: string;
|
||||
|
||||
/**
|
||||
* 副社长列表
|
||||
*/
|
||||
@@ -148,10 +163,7 @@ export interface StglClubVO {
|
||||
* 指导老师列表JSON格式存储
|
||||
*/
|
||||
advisorsJson?: string;
|
||||
|
||||
/**
|
||||
* 成员规模上限
|
||||
*/
|
||||
affiliation?: string;
|
||||
memberLimit: number;
|
||||
|
||||
/**
|
||||
@@ -286,6 +298,36 @@ export interface StglClubForm {
|
||||
*/
|
||||
presidentPhone?: string;
|
||||
|
||||
/**
|
||||
* 社长用户ID(关联学生用户)
|
||||
*/
|
||||
presidentUserId?: string | number;
|
||||
|
||||
/**
|
||||
* 物资保管员用户ID
|
||||
*/
|
||||
materialKeeperUserId?: string | number;
|
||||
|
||||
/**
|
||||
* 物资保管员姓名
|
||||
*/
|
||||
materialKeeperName?: string;
|
||||
|
||||
/**
|
||||
* 物资保管员学生对象(前端选择器用)
|
||||
*/
|
||||
materialKeeperStudent?: StudentVO | null;
|
||||
|
||||
/**
|
||||
* 物资保管员学号(前端显示用)
|
||||
*/
|
||||
materialKeeperStudentNo?: string;
|
||||
|
||||
/**
|
||||
* 物资保管员联系方式(前端显示用)
|
||||
*/
|
||||
materialKeeperPhone?: string;
|
||||
|
||||
/**
|
||||
* 副社长列表
|
||||
*/
|
||||
@@ -350,6 +392,7 @@ export interface StglClubForm {
|
||||
* 成员规模上限
|
||||
*/
|
||||
memberLimit?: number;
|
||||
affiliation?: string;
|
||||
|
||||
/**
|
||||
* 组织架构
|
||||
|
||||
@@ -98,9 +98,41 @@ export const approveMember = (id: string | number, approved: boolean) => {
|
||||
return request({
|
||||
url: `/stgl/member/approve/${id}`,
|
||||
method: 'put',
|
||||
params: { approved },
|
||||
headers: {
|
||||
isEncrypt: 'true'
|
||||
}
|
||||
params: { approved }
|
||||
});
|
||||
};
|
||||
|
||||
export const presidentApprove = (memberId: number, approved: boolean, opinion?: string) => {
|
||||
return request({
|
||||
url: '/stgl/member/presidentApprove',
|
||||
method: 'put',
|
||||
data: { memberId, approved, opinion },
|
||||
headers: { isEncrypt: 'true' }
|
||||
});
|
||||
};
|
||||
|
||||
export const advisorApprove = (memberId: number, approved: boolean, opinion?: string) => {
|
||||
return request({
|
||||
url: '/stgl/member/advisorApprove',
|
||||
method: 'put',
|
||||
data: { memberId, approved, opinion },
|
||||
headers: { isEncrypt: 'true' }
|
||||
});
|
||||
};
|
||||
|
||||
export const getApprovalFlow = (memberId: number) => {
|
||||
return request({
|
||||
url: `/stgl/member/approvalFlow/${memberId}`,
|
||||
method: 'get',
|
||||
headers: { isEncrypt: 'true' }
|
||||
});
|
||||
};
|
||||
|
||||
export const getPendingApprovals = (clubId?: number) => {
|
||||
return request({
|
||||
url: '/stgl/member/pendingApprovals',
|
||||
method: 'get',
|
||||
params: clubId ? { clubId } : {},
|
||||
headers: { isEncrypt: 'true' }
|
||||
});
|
||||
};
|
||||
@@ -62,3 +62,11 @@ export function exportStglClass(query: StglClassQuery) {
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
export function getCurrentActivities(query: StglClassQuery) {
|
||||
return request({
|
||||
url: '/stgl/stclass/current-activities',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
}
|
||||
@@ -290,28 +290,24 @@ export interface ActivityDetailVO {
|
||||
* 班级详情对象
|
||||
*/
|
||||
export interface StglClassDetailVO {
|
||||
/**
|
||||
* 班级ID
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 班级名称
|
||||
*/
|
||||
className: string;
|
||||
|
||||
/**
|
||||
* 学院名称
|
||||
*/
|
||||
collegeName: string;
|
||||
|
||||
/**
|
||||
* 专业名称
|
||||
*/
|
||||
majorName: string;
|
||||
|
||||
/**
|
||||
* 年级
|
||||
*/
|
||||
grade: string;
|
||||
}
|
||||
|
||||
export interface CurrentActivityVO {
|
||||
id: string | number;
|
||||
studentNo: string;
|
||||
studentName: string;
|
||||
gender: string;
|
||||
phone: string;
|
||||
className: string;
|
||||
activityId: string | number;
|
||||
activityName: string;
|
||||
startTime: string;
|
||||
endTime: string;
|
||||
location: string;
|
||||
organizationName: string;
|
||||
}
|
||||
@@ -118,6 +118,7 @@ watch(
|
||||
(newValue) => {
|
||||
if (updateLock.value) return;
|
||||
updateLock.value = true;
|
||||
emit('update:modelValue', newValue);
|
||||
emit('change', newValue);
|
||||
nextTick(() => {
|
||||
updateLock.value = false;
|
||||
|
||||
@@ -610,6 +610,34 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-divider content-position="left">邀请成员</el-divider>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="邀请成员">
|
||||
<div style="width: 100%">
|
||||
<div style="margin-bottom: 10px; display: flex; align-items: center; gap: 12px;">
|
||||
<el-checkbox v-model="inviteCheckAll" :indeterminate="inviteIndeterminate" @change="handleInviteCheckAll">全选</el-checkbox>
|
||||
<el-input v-model="inviteSearchText" placeholder="搜索姓名/学号" clearable style="width: 200px" size="small" />
|
||||
<span style="color: #909399; font-size: 12px;">已选 {{ form.invitedMemberIds?.length || 0 }} / {{ inviteMemberList.length }} 人</span>
|
||||
<span v-if="!form.relatedClubId" style="color: #E6A23C; font-size: 12px;">请先选择关联社团</span>
|
||||
</div>
|
||||
<el-checkbox-group v-model="form.invitedMemberIds" @change="handleInviteChange">
|
||||
<div style="max-height: 200px; overflow-y: auto; border: 1px solid #dcdfe6; border-radius: 4px; padding: 8px;">
|
||||
<div v-if="inviteMemberList.length === 0" style="color: #909399; text-align: center; padding: 20px;">暂无可邀请的成员</div>
|
||||
<el-checkbox
|
||||
v-for="member in filteredInviteMembers"
|
||||
:key="member.userId"
|
||||
:label="member.userId"
|
||||
style="width: 200px; margin: 4px 0;"
|
||||
>
|
||||
{{ member.studentName }}({{ member.studentNo }})
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-form>
|
||||
@@ -690,7 +718,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="StglActivity" lang="ts">
|
||||
import { nextTick, watch } from 'vue';
|
||||
import { nextTick, watch, computed } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { ElNotification } from 'element-plus';
|
||||
import {
|
||||
@@ -719,6 +747,7 @@ import { AdvisorVO } from '@/components/AdvisorManager/index.vue';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { checkClubActivityPermission, type ClubActivityPermissionResult } from '@/api/stgl/clubPermission';
|
||||
import { getPendingActivityAudits } from '@/api/stgl/activity/audit';
|
||||
import { listStglMember } from '@/api/stgl/member';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const route = useRoute();
|
||||
@@ -741,6 +770,37 @@ const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
|
||||
// 邀请成员相关
|
||||
interface InviteMember { userId: string; studentName: string; studentNo: string; }
|
||||
const inviteMemberList = ref<InviteMember[]>([]);
|
||||
const inviteCheckAll = ref(false);
|
||||
const inviteIndeterminate = ref(false);
|
||||
const inviteSearchText = ref('');
|
||||
const filteredInviteMembers = computed(() => {
|
||||
if (!inviteSearchText.value) return inviteMemberList.value;
|
||||
const kw = inviteSearchText.value.toLowerCase();
|
||||
return inviteMemberList.value.filter(m => m.studentName.toLowerCase().includes(kw) || m.studentNo.includes(kw));
|
||||
});
|
||||
const handleInviteCheckAll = (val: boolean) => {
|
||||
form.value.invitedMemberIds = val ? filteredInviteMembers.value.map(m => m.userId) : [];
|
||||
inviteIndeterminate.value = false;
|
||||
};
|
||||
const handleInviteChange = (val: (string | number)[]) => {
|
||||
const total = filteredInviteMembers.value.length;
|
||||
inviteCheckAll.value = val.length === total;
|
||||
inviteIndeterminate.value = val.length > 0 && val.length < total;
|
||||
};
|
||||
const loadInviteMembers = async (clubId: string | number) => {
|
||||
try {
|
||||
const res = await listStglMember({ memberType: 1, relationId: clubId, status: '2', pageNum: 1, pageSize: 9999 } as any);
|
||||
const rows = (res as any)?.rows || [];
|
||||
inviteMemberList.value = rows.map((m: any) => ({ userId: String(m.userId), studentName: m.studentName, studentNo: m.studentNo }));
|
||||
} catch (e) {
|
||||
console.error('加载社团成员失败:', e);
|
||||
inviteMemberList.value = [];
|
||||
}
|
||||
};
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const activeTab = ref('basic');
|
||||
@@ -836,7 +896,8 @@ const initFormData: StglActivityForm = {
|
||||
summaryAttachments: undefined,
|
||||
achievementsAttachments: undefined,
|
||||
importSource: undefined,
|
||||
remark: undefined
|
||||
remark: undefined,
|
||||
invitedMemberIds: []
|
||||
};
|
||||
|
||||
const data = reactive<PageData<StglActivityForm, StglActivityQuery & { relatedClub?: ClubOption | null; relatedDept?: DeptOption | null }>>({
|
||||
@@ -2113,6 +2174,20 @@ watch(
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
() => form.value.relatedClub,
|
||||
(newClub) => {
|
||||
if (newClub?.relatedClubId && newClub.relatedType === 1) {
|
||||
loadInviteMembers(newClub.relatedClubId);
|
||||
} else {
|
||||
inviteMemberList.value = [];
|
||||
form.value.invitedMemberIds = [];
|
||||
inviteCheckAll.value = false;
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -59,6 +59,14 @@
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审批阶段" align="center" width="120">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status === 0" type="warning">等待社长审批</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 1" type="info">等待指导老师审批</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 3" type="danger">已驳回</el-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="学号" align="center" prop="studentNo" width="120" />
|
||||
<el-table-column label="姓名" align="center" prop="studentName" width="80" />
|
||||
<el-table-column label="性别" align="center" prop="gender" width="60">
|
||||
@@ -105,6 +113,7 @@
|
||||
style="font-size: 16px; margin-right: 8px"
|
||||
@click="handleApprove(scope.row)"
|
||||
v-hasPermi="['stgl:clubmember:approve']"
|
||||
v-if="scope.row.status === '0' || scope.row.status === '1'"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
@@ -188,6 +197,7 @@ import { Check, Close } from '@element-plus/icons-vue';
|
||||
import { listStglMember, getStglMember, approveMember } from '@/api/stgl/member';
|
||||
import { StglMemberVO, StglMemberQuery } from '@/api/stgl/member/types';
|
||||
import { parseTime } from '@/utils/ruoyi';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
|
||||
interface Props {
|
||||
clubId: string | number;
|
||||
@@ -277,12 +287,16 @@ const getList = async () => {
|
||||
|
||||
console.log('PendingMembersTab: getList 开始查询,参数:', queryData);
|
||||
|
||||
// 待审核页面:查询待审核(status=0)和已驳回(status=3)的成员
|
||||
// 字典配置:0-待审核,1-审核中,2-已加入,3-已驳回,4-已退出
|
||||
// 根据角色动态设置查询状态
|
||||
// 社长:看到 status=0(待审核)+ status=3(已驳回)
|
||||
// 指导老师:看到 status=1(审核中,社长已通过)+ status=3(已驳回)
|
||||
const userRoles = useUserStore().roles;
|
||||
const isInstructor = userRoles.includes('stgl_instructor');
|
||||
|
||||
if (!queryData.status) {
|
||||
// 使用params传递多状态查询
|
||||
queryData.params = { ...queryData.params, statusList: ['0', '3'] } as any;
|
||||
delete queryData.status; // 删除单个status字段
|
||||
const statusList = isInstructor ? ['1', '3'] : ['0', '3'];
|
||||
queryData.params = { ...queryData.params, statusList } as any;
|
||||
delete queryData.status;
|
||||
}
|
||||
|
||||
// 确保phone参数正确传递到params中
|
||||
@@ -439,7 +453,8 @@ const submitApproval = () => {
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('审核失败:', error);
|
||||
proxy.$modal.msgError('审核失败,请检查数据完整性');
|
||||
const msg = error?.msg || error?.message || '审核失败';
|
||||
proxy.$modal.msgError(msg);
|
||||
});
|
||||
} else {
|
||||
// 批量审核 - 再次验证数据完整性
|
||||
@@ -461,7 +476,8 @@ const submitApproval = () => {
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('批量审核失败:', error);
|
||||
proxy.$modal.msgError('批量审核失败,请检查数据完整性');
|
||||
const msg = error?.msg || error?.message || '批量审核失败';
|
||||
proxy.$modal.msgError(msg);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,6 +241,13 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="归属" prop="affiliation">
|
||||
<el-select v-model="form.affiliation" placeholder="请选择归属" style="width: 100%" :disabled="!hasInstructorPermission">
|
||||
<el-option v-for="item in affiliationOptions" :key="item.deptId" :label="item.deptName" :value="item.deptId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
@@ -333,6 +340,17 @@
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<!-- 副社长信息 -->
|
||||
<div class="personnel-section">
|
||||
<h4 class="section-title">副社长信息</h4>
|
||||
<VicePresidentManager
|
||||
v-model="form.vicePresidents"
|
||||
title=""
|
||||
add-button-text="添加副社长"
|
||||
empty-tip="暂未添加副社长"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 指导老师信息 -->
|
||||
<div class="personnel-section">
|
||||
<h4 class="section-title">指导老师信息</h4>
|
||||
@@ -343,6 +361,33 @@
|
||||
:disabled="!hasInstructorPermission"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 物资保管员 -->
|
||||
<div class="personnel-section">
|
||||
<h4 class="section-title">物资保管员</h4>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="选择学生" prop="materialKeeperStudent">
|
||||
<StudentSelector
|
||||
v-model="form.materialKeeperStudent"
|
||||
placeholder="请选择物资保管员"
|
||||
:showStudentNo="false"
|
||||
@change="handleMaterialKeeperChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="学号">
|
||||
<el-input v-model="form.materialKeeperStudentNo" placeholder="学号" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="联系方式">
|
||||
<el-input v-model="form.materialKeeperPhone" placeholder="联系方式" readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="组织架构" name="organization">
|
||||
@@ -422,6 +467,7 @@
|
||||
<el-descriptions-item label="社团类型">
|
||||
<dict-tag :options="stgl_club_type" :value="viewForm.clubType" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="归属">{{ affiliationOptions.find(o => o.deptId === String(viewForm.affiliation))?.deptName || '暂未设置' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="成立日期">{{ viewForm.establishDate || '暂无' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="成员规模上限">{{ viewForm.memberLimit || '不限' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="邮箱">{{ viewForm.email || '暂无' }}</el-descriptions-item>
|
||||
@@ -468,6 +514,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 物资保管员信息 -->
|
||||
<div class="position-group">
|
||||
<div class="position-title">物资保管员:</div>
|
||||
<div class="position-content">
|
||||
<template v-if="viewForm.materialKeeperName">
|
||||
<span class="info-item"><strong>姓名:</strong>{{ viewForm.materialKeeperName }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span class="no-data">暂无物资保管员信息</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 指导老师信息 -->
|
||||
<div class="position-group">
|
||||
<div class="position-title">指导老师:</div>
|
||||
@@ -682,11 +741,14 @@ import {
|
||||
import { StglClubVO, StglClubQuery, StglClubForm } from '@/api/stgl/club/types';
|
||||
import StudentSelector from '@/components/StudentSelector/index.vue';
|
||||
import AdvisorManager from '@/components/AdvisorManager/index.vue';
|
||||
import VicePresidentManager from '@/components/VicePresidentManager/index.vue';
|
||||
import MemberManagementDialog from './components/MemberManagementDialog.vue';
|
||||
import AdvisorHistoryDialog from '@/components/AdvisorHistoryDialog/index.vue';
|
||||
import { StudentVO } from '@/api/xg/student/types';
|
||||
import { AdvisorVO } from '@/components/AdvisorManager/index.vue';
|
||||
import { VicePresidentVO } from '@/components/VicePresidentManager/index.vue';
|
||||
import { Document } from '@element-plus/icons-vue';
|
||||
import { listCollege } from '@/api/xg/xsjcxx/collegemsg';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const router = useRouter();
|
||||
@@ -699,6 +761,22 @@ const hasInstructorPermission = computed(() => {
|
||||
return proxy?.$auth.hasRoleOr(['stgl_instructor', 'stgl_stgl_admin', 'superadmin']);
|
||||
});
|
||||
|
||||
// 归属选项:二级学院 + 学生处
|
||||
interface DeptOption { deptId: string; deptName: string; }
|
||||
const affiliationOptions = ref<DeptOption[]>([]);
|
||||
const loadAffiliationOptions = async () => {
|
||||
try {
|
||||
const res = await listCollege();
|
||||
const colleges = (res as any)?.rows || (res as any)?.data || [];
|
||||
const options: DeptOption[] = colleges.map((c: any) => ({ deptId: String(c.deptId), deptName: c.deptName }));
|
||||
options.push({ deptId: '202512231307170009', deptName: '学生处' });
|
||||
affiliationOptions.value = options;
|
||||
} catch (e) {
|
||||
console.error('加载归属选项失败:', e);
|
||||
}
|
||||
};
|
||||
loadAffiliationOptions();
|
||||
|
||||
// 社长权限控制 - 检查用户是否为各社团的社长(无论是否为创建者)
|
||||
// 用于控制转让按钮显示和社长相关操作权限
|
||||
const presidentRoles = ref<Record<string | number, boolean>>({});
|
||||
@@ -811,6 +889,12 @@ const viewForm = reactive<StglClubForm>({
|
||||
presidentMajor: undefined,
|
||||
presidentClass: undefined,
|
||||
presidentPhone: undefined,
|
||||
presidentUserId: undefined,
|
||||
materialKeeperUserId: undefined,
|
||||
materialKeeperName: undefined,
|
||||
materialKeeperStudent: null,
|
||||
materialKeeperStudentNo: undefined,
|
||||
materialKeeperPhone: undefined,
|
||||
vicePresidentName: undefined,
|
||||
vicePresidentStudentNo: undefined,
|
||||
advisorName: undefined,
|
||||
@@ -843,11 +927,19 @@ const initFormData: StglClubForm = {
|
||||
presidentMajor: undefined,
|
||||
presidentClass: undefined,
|
||||
presidentPhone: undefined,
|
||||
presidentUserId: undefined,
|
||||
materialKeeperUserId: undefined,
|
||||
materialKeeperName: undefined,
|
||||
materialKeeperStudent: null,
|
||||
materialKeeperStudentNo: undefined,
|
||||
materialKeeperPhone: undefined,
|
||||
|
||||
vicePresidents: [],
|
||||
advisors: [],
|
||||
advisorName: undefined,
|
||||
advisorDept: undefined,
|
||||
memberLimit: undefined,
|
||||
affiliation: undefined,
|
||||
departments: undefined,
|
||||
recruitCycle: undefined,
|
||||
recruitTime: undefined,
|
||||
@@ -983,6 +1075,9 @@ const handleUpdate = async (row?: StglClubVO) => {
|
||||
if (res.data.sighOpen !== undefined && res.data.sighOpen !== null) {
|
||||
(res.data as any).sighOpen = String(res.data.sighOpen);
|
||||
}
|
||||
if (res.data.affiliation !== undefined && res.data.affiliation !== null) {
|
||||
(res.data as any).affiliation = String(res.data.affiliation);
|
||||
}
|
||||
|
||||
// 处理社长信息:将简单字段转换为复杂对象结构
|
||||
if (res.data.presidentName) {
|
||||
@@ -998,7 +1093,54 @@ const handleUpdate = async (row?: StglClubVO) => {
|
||||
(res.data as any).presidentStudent = null;
|
||||
}
|
||||
|
||||
// 处理物资保管员信息:如果有userId则构建选择器对象
|
||||
if (res.data.materialKeeperUserId) {
|
||||
(res.data as any).materialKeeperStudent = {
|
||||
name: res.data.materialKeeperName,
|
||||
phone: ''
|
||||
};
|
||||
} else {
|
||||
(res.data as any).materialKeeperStudent = null;
|
||||
}
|
||||
|
||||
// 处理副社长信息:优先从JSON字段读取,如果没有则使用单一字段
|
||||
let vicePresidentsData: VicePresidentVO[] = [];
|
||||
if (res.data.vicePresidentsJson) {
|
||||
try {
|
||||
const parsed = JSON.parse(res.data.vicePresidentsJson);
|
||||
vicePresidentsData = parsed.map((vp: any) => ({
|
||||
student: {
|
||||
id: vp.studentId || vp.studentNo || '',
|
||||
name: vp.name || '',
|
||||
studentNo: vp.studentNo || '',
|
||||
phone: vp.phone || '',
|
||||
collegeName: vp.dept || '',
|
||||
majorName: vp.major || '',
|
||||
className: vp.class || ''
|
||||
} as StudentVO,
|
||||
name: vp.name || '',
|
||||
dept: vp.dept || '',
|
||||
major: vp.major || '',
|
||||
class: vp.class || '',
|
||||
phone: vp.phone || ''
|
||||
}));
|
||||
} catch (error) {
|
||||
console.warn('解析副社长JSON数据失败:', error);
|
||||
vicePresidentsData = [];
|
||||
}
|
||||
} else if (res.data.vicePresidentName) {
|
||||
vicePresidentsData = [{
|
||||
student: {
|
||||
name: res.data.vicePresidentName,
|
||||
studentNo: res.data.vicePresidentStudentNo || ''
|
||||
} as StudentVO,
|
||||
name: res.data.vicePresidentName,
|
||||
dept: res.data.vicePresidentDept || '',
|
||||
major: res.data.vicePresidentMajor || '',
|
||||
class: res.data.vicePresidentClass || '',
|
||||
phone: res.data.vicePresidentPhone || ''
|
||||
}];
|
||||
}
|
||||
|
||||
// 处理指导老师信息:优先从JSON字段读取,如果没有则使用单一字段
|
||||
let advisorsData = [];
|
||||
@@ -1036,6 +1178,7 @@ const handleUpdate = async (row?: StglClubVO) => {
|
||||
// 然后单独设置指导老师数据,避免触发 watch 时的冲突
|
||||
nextTick(() => {
|
||||
form.value.advisors = advisorsData;
|
||||
form.value.vicePresidents = vicePresidentsData;
|
||||
});
|
||||
|
||||
dialog.visible = true;
|
||||
@@ -1071,6 +1214,26 @@ const submitForm = () => {
|
||||
// 🔥 新增:同时保存JSON字段和兼容性字段
|
||||
submitData.advisorsJson = JSON.stringify(submitData.advisors || []);
|
||||
|
||||
// 处理副社长数据:序列化为JSON
|
||||
if (submitData.vicePresidents && Array.isArray(submitData.vicePresidents)) {
|
||||
submitData.vicePresidentsJson = JSON.stringify(submitData.vicePresidents);
|
||||
// 兼容旧字段:取第一个副社长
|
||||
if (submitData.vicePresidents.length > 0) {
|
||||
const firstVp = submitData.vicePresidents[0];
|
||||
submitData.vicePresidentName = firstVp.name;
|
||||
submitData.vicePresidentStudentNo = firstVp.student?.studentNo || '';
|
||||
} else {
|
||||
submitData.vicePresidentName = '';
|
||||
submitData.vicePresidentStudentNo = '';
|
||||
}
|
||||
}
|
||||
|
||||
// 清理前端专用字段,不发送到后端
|
||||
delete submitData.materialKeeperStudent;
|
||||
delete submitData.materialKeeperStudentNo;
|
||||
delete submitData.materialKeeperPhone;
|
||||
delete submitData.presidentStudent;
|
||||
|
||||
if (form.value.id) {
|
||||
await updateStglClub(submitData).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
@@ -1255,6 +1418,7 @@ const handlePresidentChange = (student: StudentVO | null) => {
|
||||
form.value.presidentMajor = student.majorName;
|
||||
form.value.presidentClass = student.className;
|
||||
form.value.presidentPhone = student.phone;
|
||||
form.value.presidentUserId = student.id;
|
||||
} else {
|
||||
form.value.presidentName = undefined;
|
||||
form.value.presidentStudentNo = undefined;
|
||||
@@ -1262,14 +1426,29 @@ const handlePresidentChange = (student: StudentVO | null) => {
|
||||
form.value.presidentMajor = undefined;
|
||||
form.value.presidentClass = undefined;
|
||||
form.value.presidentPhone = undefined;
|
||||
form.value.presidentUserId = undefined;
|
||||
}
|
||||
|
||||
// 手动触发相关字段的验证,确保表单验证状态正确更新
|
||||
nextTick(() => {
|
||||
clubFormRef.value?.validateField(['presidentName', 'presidentStudentNo']);
|
||||
});
|
||||
};
|
||||
|
||||
/** 物资保管员选择变化处理 */
|
||||
const handleMaterialKeeperChange = (student: StudentVO | null) => {
|
||||
if (student) {
|
||||
form.value.materialKeeperName = student.name;
|
||||
form.value.materialKeeperStudentNo = student.studentNo;
|
||||
form.value.materialKeeperPhone = student.phone;
|
||||
form.value.materialKeeperUserId = student.id;
|
||||
} else {
|
||||
form.value.materialKeeperName = undefined;
|
||||
form.value.materialKeeperStudentNo = undefined;
|
||||
form.value.materialKeeperPhone = undefined;
|
||||
form.value.materialKeeperUserId = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
// 防止递归更新的锁
|
||||
const syncLock = ref(false);
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
v-hasPermi="['stgl:clubmember:edit']"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="审核" placement="top" v-if="scope.row.status === 0">
|
||||
<el-tooltip content="审核" placement="top" v-if="scope.row.status === 0 || scope.row.status === 1">
|
||||
<el-button
|
||||
link
|
||||
type="success"
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
<template>
|
||||
<div class="p-2 page-container">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="班级" prop="classId">
|
||||
<el-select v-model="queryParams.classId" placeholder="请选择班级" clearable style="width: 100%" @change="handleClassChange">
|
||||
<el-option v-for="item in classList" :key="item.id" :label="item.className" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="学生姓名" prop="studentName">
|
||||
<el-input v-model="queryParams.studentName" placeholder="请输入学生姓名" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="学号" prop="studentNo">
|
||||
<el-input v-model="queryParams.studentNo" placeholder="请输入学号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24" class="search-btn-container">
|
||||
<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>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never" class="button-card table-card">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="RefreshRight" @click="handleQuery">刷新</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<!-- 统计信息 -->
|
||||
<div v-if="queryParams.classId" class="statistics-bar">
|
||||
<el-tag type="success" size="large" effect="plain">
|
||||
当前共有 <span class="statistics-count">{{ total }}</span> 名学生正在参加活动
|
||||
</el-tag>
|
||||
</div>
|
||||
|
||||
<!-- 未选择班级提示 -->
|
||||
<div v-if="!queryParams.classId" class="no-data-container">
|
||||
<el-empty description="请先选择班级" />
|
||||
</div>
|
||||
|
||||
<!-- 活动列表表格 -->
|
||||
<el-table v-else v-loading="loading" border :data="activityList" row-key="id">
|
||||
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||
<el-table-column label="学生姓名" align="center" prop="studentName" min-width="40" />
|
||||
<el-table-column label="学号" align="center" prop="studentNo" min-width="45" />
|
||||
<el-table-column label="性别" align="center" prop="gender" width="70">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_user_sex" :value="scope.row.gender" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活动名称" align="center" min-width="60">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.activityName" class="activity-name">{{ scope.row.activityName }}</span>
|
||||
<span v-else class="no-data">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所属社团/队伍" align="center" prop="organizationName" min-width="50">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.organizationName">{{ scope.row.organizationName }}</span>
|
||||
<span v-else class="no-data">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活动开始时间" align="center" width="160">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.startTime">{{ formatTime(scope.row.startTime) }}</span>
|
||||
<span v-else class="no-data">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活动结束时间" align="center" width="160">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.endTime">{{ formatTime(scope.row.endTime) }}</span>
|
||||
<span v-else class="no-data">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活动地址" align="center" prop="location" min-width="50">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.location">{{ scope.row.location }}</span>
|
||||
<span v-else class="no-data">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div v-if="queryParams.classId" class="pagination-container">
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="StglClassCurrentActivity" lang="ts">
|
||||
import { getTeacherClasses, getCurrentActivities } from '@/api/stgl/stclass';
|
||||
import { StglClassQuery, CurrentActivityVO, StglClassDetailVO } from '@/api/stgl/stclass/types';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex'));
|
||||
|
||||
const loading = ref(false);
|
||||
const showSearch = ref(true);
|
||||
const total = ref(0);
|
||||
const activityList = ref<CurrentActivityVO[]>([]);
|
||||
const classList = ref<StglClassDetailVO[]>([]);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
|
||||
const queryParams = ref<StglClassQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
classId: undefined,
|
||||
studentName: undefined,
|
||||
studentNo: undefined
|
||||
});
|
||||
|
||||
/** 格式化时间 yyyy-MM-dd HH:mm */
|
||||
const formatTime = (time: string) => {
|
||||
return dayjs(time).format('YYYY-MM-DD HH:mm');
|
||||
};
|
||||
|
||||
/** 查询班主任的班级列表 */
|
||||
const getTeacherClassList = async () => {
|
||||
try {
|
||||
const res = await getTeacherClasses();
|
||||
if ((res.code === 200 || res.code === 0) && res.data) {
|
||||
classList.value = res.data;
|
||||
if (classList.value.length > 0) {
|
||||
queryParams.value.classId = classList.value[0].id;
|
||||
await getList();
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取班级列表失败:', error);
|
||||
proxy?.$modal.msgError('获取班级列表失败');
|
||||
}
|
||||
};
|
||||
|
||||
/** 查询当前活动列表 */
|
||||
const getList = async () => {
|
||||
if (!queryParams.value.classId) return;
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await getCurrentActivities(queryParams.value);
|
||||
if (res.code === 200 || res.code === 0) {
|
||||
activityList.value = res.rows;
|
||||
total.value = res.total;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('查询当前活动列表失败:', error);
|
||||
proxy?.$modal.msgError('查询当前活动列表失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 班级切换处理 */
|
||||
const handleClassChange = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getTeacherClassList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器样式 */
|
||||
.page-container {
|
||||
padding: 8px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
/* 表格卡片布局 */
|
||||
.table-card {
|
||||
margin-top: 0;
|
||||
border-radius: 12px;
|
||||
border: 1px solid #e4e7ed;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.table-card :deep(.el-card__body) {
|
||||
padding: 0px 20px 20px 20px !important;
|
||||
}
|
||||
|
||||
/* 移除按钮栏底部边框 */
|
||||
.button-card :deep(.el-card__header) {
|
||||
border-bottom: none !important;
|
||||
background: linear-gradient(135deg, #fafbff 0%, #f8fafc 100%);
|
||||
padding: 16px 20px;
|
||||
}
|
||||
|
||||
/* 搜索按钮容器样式 */
|
||||
.search-btn-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 10px;
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* 统计信息栏 */
|
||||
.statistics-bar {
|
||||
padding: 12px 0 16px 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.statistics-count {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
/* 活动名称样式 */
|
||||
.activity-name {
|
||||
color: #303133;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 分页容器样式 */
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px 20px 0 0 !important;
|
||||
background-color: #fff;
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
/* 无数据样式 */
|
||||
.no-data {
|
||||
color: #909399;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.no-data-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 300px;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user