心理健康2.0

This commit is contained in:
李旭明 committed 2025-09-16 10:34:38 +08:00
1 parent 067957256d
commit 3b492479b5
63 files changed
+10278 -642

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,350 @@
<template>
<el-dialog
title="年审审批"
v-model="visible"
width="600px"
append-to-body
:before-close="handleClose"
>
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="社团名称:">
<span>{{ auditInfo?.clubName || '加载中...' }}</span>
</el-form-item>
<el-form-item label="年审年度:">
<span>{{ auditInfo?.reviewYear || '加载中...' }}年</span>
</el-form-item>
<el-form-item label="审批节点:">
<span>{{ auditRecord?.nodeName || '加载中...' }}</span>
</el-form-item>
<el-form-item label="审批结果:" prop="approveResult">
<el-radio-group v-model="form.approveResult" @change="handleApproveResultChange">
<el-radio value="通过">通过</el-radio>
<el-radio value="不通过">不通过</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审批意见:" prop="approveOpinion">
<el-input
v-model="form.approveOpinion"
type="textarea"
:rows="4"
placeholder="请填写审批意见"
maxlength="500"
show-word-limit
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleSubmit" :loading="loading">确定</el-button>
</div>
</template>
</el-dialog>
<!-- 审批流程选择对话框 -->
<ApprovalProcessDialog
v-model:visible="showApprovalProcessDialog"
:next-node-name="getNextNodeName()"
@confirm="handleApprovalProcessConfirm"
/>
</template>
<script setup lang="ts">
import { approveAnnualReview, getStglAnnualReviewAudit, getAnnualReviewAuditsByReviewId } from '@/api/stgl/club/annualReviewAudit';
import { getStglClubAnnualReview } from '@/api/stgl/club/annualReview';
import ApprovalProcessDialog from './auditorSelector/ApprovalProcessDialog.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const emit = defineEmits<{
success: [];
}>();
const visible = ref(false);
const loading = ref(false);
const formRef = ref<ElFormInstance>();
const form = ref({
auditId: '',
approveResult: '',
approveOpinion: ''
});
const auditInfo = ref<any>(null);
const auditRecord = ref<any>(null);
const allAuditRecords = ref<any[]>([]);
const showApprovalProcessDialog = ref(false);
const rules = reactive<ElFormRules>({
approveResult: [
{ required: true, message: '请选择审批结果', trigger: 'change' }
],
approveOpinion: [
{ required: true, message: '请填写审批意见', trigger: 'blur' },
{ max: 500, message: '审批意见不能超过500个字符', trigger: 'blur' }
]
});
/** 打开弹窗 */
const open = async (auditId: string | number, annualReviewId: string | number) => {
visible.value = true;
form.value.auditId = auditId.toString();
// 获取年审记录信息用于显示
try {
const res = await getStglClubAnnualReview(annualReviewId);
auditInfo.value = res.data;
} catch (error) {
console.error('获取年审记录信息失败:', error);
}
// 获取审批记录信息用于显示节点名称
try {
const auditRes = await getStglAnnualReviewAudit(auditId);
auditRecord.value = auditRes.data;
} catch (error) {
console.error('获取审批记录信息失败:', error);
}
// 获取当前年审的所有审批记录,用于判断是否是本环节最后一个节点
try {
const allAuditsRes = await getAnnualReviewAuditsByReviewId(annualReviewId);
allAuditRecords.value = allAuditsRes.data || [];
} catch (error) {
console.error('获取所有审批记录失败:', error);
}
// 重置表单
resetForm();
};
/** 重置表单 */
const resetForm = () => {
form.value.approveResult = '';
form.value.approveOpinion = '';
formRef.value?.clearValidate();
};
/** 审批结果变化处理 */
const handleApproveResultChange = (value: string) => {
// 审批结果变化时的处理逻辑(如需要)
};
/** 关闭弹窗 */
const handleClose = () => {
visible.value = false;
resetForm();
auditInfo.value = null;
auditRecord.value = null;
allAuditRecords.value = [];
};
/** 提交审批 */
const handleSubmit = async () => {
if (!formRef.value) return;
const valid = await formRef.value.validate();
if (!valid) return;
// 如果是校团委审批的最后一个节点,直接结束流程,不弹出审批流程选择对话框
if (form.value.approveResult === '通过' && isSchoolCommitteeLastNode()) {
console.log('校团委最后节点,直接结束流程');
await submitApproval();
return;
}
// 如果审批通过,且当前节点是本环节的最后一个节点,弹出审批流程选择对话框
if (form.value.approveResult === '通过' && isLastNodeInCurrentPhase()) {
showApprovalProcessDialog.value = true;
return;
}
// 直接提交审批(审批不通过或不是本环节最后一个节点的情况)
await submitApproval();
};
/** 判断当前节点是否是本环节的最后一个节点 */
const isLastNodeInCurrentPhase = () => {
if (!auditRecord.value || !allAuditRecords.value.length) {
console.log('判断是否是最后节点: 数据不足', {
hasAuditRecord: !!auditRecord.value,
allAuditRecordsLength: allAuditRecords.value.length
});
return false;
}
const currentNodeCode = auditRecord.value.nodeCode;
const currentNodeOrder = Number(auditRecord.value.nodeOrder);
console.log('当前审批记录详情:', {
currentNodeCode,
currentNodeOrder,
currentNodeOrderType: typeof auditRecord.value.nodeOrder,
currentNodeOrderRaw: auditRecord.value.nodeOrder,
auditRecordKeys: Object.keys(auditRecord.value)
});
// 获取同一环节的所有节点
const samePhaseNodes = allAuditRecords.value.filter(record =>
record.nodeCode === currentNodeCode
);
console.log('所有审批记录:', allAuditRecords.value.map(record => ({
id: record.id,
nodeCode: record.nodeCode,
nodeName: record.nodeName,
nodeOrder: record.nodeOrder,
nodeOrderType: typeof record.nodeOrder,
approverName: record.approverName,
nodeStatus: record.nodeStatus
})));
console.log('同环节节点:', samePhaseNodes.map(n => ({
nodeOrder: n.nodeOrder,
nodeOrderType: typeof n.nodeOrder,
approverName: n.approverName,
nodeStatus: n.nodeStatus
})));
if (samePhaseNodes.length === 0) {
console.log('警告: 没有找到同环节的节点');
return false;
}
// 找出同一环节中最大的nodeOrder,使用Number转换确保数值比较
const nodeOrders = samePhaseNodes.map(node => Number(node.nodeOrder));
const maxNodeOrder = Math.max(...nodeOrders);
console.log('判断是否是最后节点:', {
currentNodeCode,
currentNodeOrder,
maxNodeOrder,
nodeOrders,
isLast: currentNodeOrder === maxNodeOrder,
comparison: `${currentNodeOrder} === ${maxNodeOrder}`
});
// 当前节点的nodeOrder等于同环节最大nodeOrder时,表示是最后一个节点
return currentNodeOrder === maxNodeOrder;
};
/** 判断当前是否是校团委审批的最后一个节点 */
const isSchoolCommitteeLastNode = () => {
if (!auditRecord.value) {
return false;
}
const currentNodeName = auditRecord.value.nodeName;
const currentNodeOrder = Number(auditRecord.value.nodeOrder);
// 检查是否是校团委审批节点且node_order是3.X格式
const isSchoolCommitteeNode = currentNodeName === '校团委审批';
const isNodeOrder3X = currentNodeOrder >= 3 && currentNodeOrder < 4;
console.log('校团委最后节点判断:', {
currentNodeName,
currentNodeOrder,
isSchoolCommitteeNode,
isNodeOrder3X,
isLastInPhase: isLastNodeInCurrentPhase()
});
// 校团委审批 + node_order=3.X + 是本环节最后一个节点
return isSchoolCommitteeNode && isNodeOrder3X && isLastNodeInCurrentPhase();
};
/** 获取下一步节点名称 */
const getNextNodeName = () => {
// 根据当前节点确定下一步节点
const currentNodeName = auditRecord.value?.nodeName;
if (currentNodeName === '指导老师审批') {
return '二级学院审批';
} else if (currentNodeName === '二级学院审批') {
return '校团委审批';
} else if (currentNodeName === '校团委审批') {
return '完成审批';
}
// 默认返回二级学院审批
return '二级学院审批';
};
/** 实际提交审批 */
const submitApproval = async (approvalProcessData?: any) => {
loading.value = true;
try {
// 判断是否是校团委最后节点
const isSchoolCommitteeFinalNode = isSchoolCommitteeLastNode();
// 准备审批数据
const approveData = {
auditId: form.value.auditId,
approveResult: form.value.approveResult,
approveOpinion: form.value.approveOpinion,
// 校团委最后节点时不设置下一步审核人,表示流程结束
// 其他情况:只有审批通过且是本环节最后一个节点时,才包含下一步审核人信息
nextAuditors: isSchoolCommitteeFinalNode ? [] :
(form.value.approveResult === '通过' && isLastNodeInCurrentPhase()) ?
(approvalProcessData?.auditors || []).map((auditor: any) => ({
userId: auditor.userId,
userName: auditor.userName,
nickName: auditor.nickName
})) : []
};
console.log('提交审批数据:', {
审批结果: approveData.approveResult,
是否最后节点: isLastNodeInCurrentPhase(),
是否校团委最后节点: isSchoolCommitteeFinalNode,
下一步审核人数量: approveData.nextAuditors.length,
流程状态: isSchoolCommitteeFinalNode ? '流程结束' : '继续流转'
});
await approveAnnualReview(
approveData.auditId,
approveData.approveResult,
approveData.approveOpinion,
approveData.nextAuditors
);
if (isSchoolCommitteeFinalNode) {
proxy?.$modal.msgSuccess('审批成功,年审流程已完成!');
} else {
proxy?.$modal.msgSuccess('审批成功');
}
handleClose();
emit('success');
} catch (error) {
console.error('审批失败:', error);
} finally {
loading.value = false;
}
};
/** 审批流程确认处理 */
const handleApprovalProcessConfirm = async (approvalProcessData: any) => {
console.log('审批流程确认,数据:', approvalProcessData);
await submitApproval(approvalProcessData);
};
defineExpose({
open
});
</script>
<style scoped>
.dialog-footer {
text-align: right;
}
</style>
@@ -0,0 +1,384 @@
<template>
<el-dialog
title="选择审批流程"
v-model="visible"
width="70%"
append-to-body
destroy-on-close
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<div class="approval-dialog-content">
<el-alert
:title="`请选择${props.nextNodeName}审核人`"
description="社团年审审批提交后将按照您选择的审批人员顺序进行审批,请仔细选择审核人员。"
type="info"
:closable="false"
show-icon
style="margin-bottom: 20px"
/>
<!-- 下一步审批节点提示 -->
<div class="next-node-info">
<div class="node-label">
<el-icon><Document /></el-icon>
下一步审批节点:{{ props.nextNodeName }}
</div>
</div>
<!-- 当前已选择的审核人显示 -->
<div class="current-auditors" v-if="currentAuditors.length > 0">
<div class="section-title">
<el-icon><User /></el-icon>
当前已选择的审核人 ({{ currentAuditors.length }} 人)
</div>
<div class="auditor-tags">
<el-tag
v-for="auditor in currentAuditors"
:key="auditor.userId"
type="info"
style="margin: 2px 5px 2px 0;"
>
{{ auditor.nickName }}({{ auditor.userName }})
</el-tag>
</div>
</div>
<!-- 审核人选择区域 -->
<div class="auditor-selection-section">
<div class="custom-process-config">
<el-form-item label="选择审核人" required>
<div class="auditor-selector">
<div class="selector-header">
<el-button type="primary" icon="Plus" @click="openAuditorSelector">添加审核人</el-button>
<el-text v-if="selectedAuditors.length > 0" type="info" size="small">
已选择 {{ selectedAuditors.length }} 个审核人,将按添加顺序进行审批
</el-text>
</div>
<!-- 已选择的审核人列表 -->
<div v-if="selectedAuditors.length > 0" class="selected-auditors">
<div class="auditor-flow">
<div v-for="(auditor, index) in selectedAuditors" :key="auditor.userId" class="auditor-node">
<div class="node-content">
<span class="node-index">{{ index + 1 }}</span>
<div class="auditor-info">
<div class="auditor-name">{{ auditor.nickName || auditor.userName }}</div>
<div class="auditor-dept">{{ auditor.deptName || '未知部门' }}</div>
</div>
<el-button type="danger" icon="Delete" size="small" circle @click="removeAuditor(auditor)" />
</div>
<div v-if="index < selectedAuditors.length - 1" class="flow-arrow">
<el-icon><ArrowRight /></el-icon>
</div>
</div>
</div>
<!-- 流程预览说明 -->
<div class="flow-description">
<el-alert type="info" :closable="false" show-icon>
<template #title>
<span>审批流程预览:{{ props.nextNodeName }}将按上述顺序进行逐级审批,每个节点审批通过后自动流转到下一节点</span>
</template>
</el-alert>
</div>
</div>
<!-- 空状态提示 -->
<div v-else class="empty-state">
<el-empty description="暂未选择审核人">
<el-button type="primary" @click="openAuditorSelector">选择审核人</el-button>
</el-empty>
</div>
</div>
</el-form-item>
</div>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleCancel">取消</el-button>
<el-button
type="primary"
@click="handleConfirm"
:loading="submitting"
:disabled="selectedAuditors.length === 0"
>
<el-icon><Check /></el-icon>
确认提交 ({{ selectedAuditors.length }} 个审核人)
</el-button>
</div>
</template>
</el-dialog>
<!-- 审核人选择器 -->
<AuditorSelector
ref="auditorSelectorRef"
@confirm="handleAuditorsSelected"
/>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue';
import { ElMessage } from 'element-plus';
import { Check, User, UserFilled, Document, Plus, ArrowRight, Delete } from '@element-plus/icons-vue';
import AuditorSelector from './index.vue';
interface Props {
visible: boolean;
currentAuditors?: any[]; // 当前已选择的审核人
nextNodeName?: string; // 下一步审批节点名称
}
interface Emits {
(e: 'update:visible', value: boolean): void;
(e: 'confirm', approvalData: any): void;
}
const props = withDefaults(defineProps<Props>(), {
currentAuditors: () => [],
nextNodeName: '二级学院审批'
});
const emit = defineEmits<Emits>();
const visible = ref(props.visible);
const submitting = ref(false);
const selectedAuditors = ref<any[]>([]);
const currentAuditors = ref<any[]>([]);
const auditorSelectorRef = ref<InstanceType<typeof AuditorSelector>>();
// 监听visible变化
watch(() => props.visible, (newVal) => {
visible.value = newVal;
if (newVal) {
// 初始化当前审核人和选择的审核人
currentAuditors.value = [...(props.currentAuditors || [])];
selectedAuditors.value = [...(props.currentAuditors || [])];
}
});
// 监听内部visible变化
watch(visible, (newVal) => {
emit('update:visible', newVal);
});
// 打开审核人选择器
const openAuditorSelector = () => {
auditorSelectorRef.value?.open(selectedAuditors.value);
};
// 审核人选择确认
const handleAuditorsSelected = (auditors: any[]) => {
selectedAuditors.value = [...auditors];
};
// 移除审核人
const removeAuditor = (auditor: any) => {
const index = selectedAuditors.value.findIndex(item => item.userId === auditor.userId);
if (index > -1) {
selectedAuditors.value.splice(index, 1);
}
};
// 取消操作
const handleCancel = () => {
visible.value = false;
ElMessage.info('已取消提交');
};
// 确认提交
const handleConfirm = async () => {
try {
if (selectedAuditors.value.length === 0) {
ElMessage.warning('请至少选择一个审核人');
return;
}
submitting.value = true;
// 构建审批流程数据
const approvalData = {
auditorIds: selectedAuditors.value.map(auditor => auditor.userId),
processName: '年审审批流程',
auditors: selectedAuditors.value
};
console.log('确认审批流程,数据:', approvalData);
// 触发确认事件
emit('confirm', approvalData);
visible.value = false;
ElMessage.success('审批流程配置成功');
} catch (error) {
console.error('确认审批流程失败:', error);
ElMessage.error('确认审批流程失败');
} finally {
submitting.value = false;
}
};
// 暴露方法供父组件调用
defineExpose({
open: (preSelectedAuditors?: any[]) => {
visible.value = true;
currentAuditors.value = [...(preSelectedAuditors || [])];
selectedAuditors.value = [...(preSelectedAuditors || [])];
}
});
</script>
<style scoped>
.approval-dialog-content {
max-height: 500px;
}
.dialog-footer {
display: flex;
justify-content: space-between;
align-items: center;
}
.next-node-info {
margin-bottom: 20px;
padding: 12px 16px;
background-color: #f0f9ff;
border: 1px solid #d1ecf1;
border-radius: 6px;
}
.node-label {
display: flex;
align-items: center;
gap: 8px;
font-weight: 500;
color: #0c63e4;
font-size: 14px;
}
.current-auditors {
margin-bottom: 20px;
padding: 15px;
border: 1px solid #e4e7ed;
border-radius: 6px;
background-color: #fafafa;
}
.section-title {
display: flex;
align-items: center;
margin-bottom: 10px;
font-weight: 500;
color: #303133;
gap: 8px;
}
.auditor-tags {
display: flex;
flex-wrap: wrap;
gap: 5px;
}
.auditor-selection-section {
margin-bottom: 20px;
}
.custom-process-config {
padding: 24px;
border: 1px solid #e4e7ed;
border-radius: 8px;
background-color: #fafbfc;
}
.auditor-selector {
width: 100%;
}
.selector-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.selected-auditors {
margin-top: 20px;
}
.auditor-flow {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 16px;
margin-bottom: 16px;
}
.auditor-node {
display: flex;
align-items: center;
gap: 12px;
}
.node-content {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
background: white;
border: 1px solid #e4e7ed;
border-radius: 6px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.node-index {
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
background: #409eff;
color: white;
border-radius: 50%;
font-size: 12px;
font-weight: 600;
}
.auditor-info {
flex: 1;
}
.auditor-name {
font-size: 14px;
font-weight: 600;
color: #2c3e50;
margin-bottom: 2px;
}
.auditor-dept {
font-size: 12px;
color: #909399;
}
.flow-arrow {
display: flex;
align-items: center;
color: #409eff;
font-size: 16px;
}
.flow-description {
margin-top: 16px;
}
.empty-state {
text-align: center;
padding: 40px 20px;
}
</style>
@@ -0,0 +1,396 @@
<template>
<div class="auditor-selector">
<el-dialog
v-model="visible"
title="选择审核人"
width="900px"
append-to-body
:before-close="handleClose"
>
<div class="auditor-select-content">
<!-- 搜索区域 -->
<div class="search-section" style="margin-bottom: 20px !important;">
<el-input v-model="searchKeyword" placeholder="搜索审核人姓名或部门" clearable @input="handleSearch" style="width: 300px">
<template #prefix>
<el-icon><Search /></el-icon>
</template>
</el-input>
</div>
<!-- 审核人表格 -->
<el-table
ref="auditorTableRef"
:data="tableData"
@selection-change="handleSelectionChange"
max-height="400"
empty-text="暂无可用审核人"
style="margin-top: 20px !important;"
>
<el-table-column type="selection" width="55" :selectable="isSelectable" header-align="center" align="center" />
<el-table-column label="序号" type="index" width="60" header-align="center" align="center" />
<el-table-column label="姓名" prop="nickName" width="130" header-align="center" align="center" />
<el-table-column label="部门" prop="deptName" header-align="center" align="center" />
<el-table-column label="联系电话" prop="phoneNumber" width="130" header-align="center" />
<el-table-column label="邮箱" prop="email" show-overflow-tooltip header-align="center" />
<el-table-column label="状态" prop="status" width="80" header-align="center" align="center">
<template #default="scope">
<el-tag :type="scope.row.status === '1' ? 'success' : 'danger'" size="small">
{{ scope.row.status === '1' ? '正常' : '停用' }}
</el-tag>
</template>
</el-table-column>
</el-table>
</div>
<template #footer>
<div
class="dialog-footer"
style="display: flex !important; justify-content: space-between !important; align-items: center !important; width: 100% !important; margin: 0 !important;"
>
<span class="selected-count-text" style="color: #909399; font-size: 12px;"> 已选择 {{ selectedUsers.length }} 个审核人 </span>
<div class="footer-buttons" style="display: flex !important; gap: 12px !important;">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleConfirm" :disabled="selectedUsers.length === 0"> 确定添加 </el-button>
</div>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ref, watch, onMounted, nextTick, computed, getCurrentInstance } from 'vue';
import type { ComponentInternalInstance } from 'vue';
import { ElMessage, ElMessageBox, ElTable } from 'element-plus';
import { Search } from '@element-plus/icons-vue';
import { listStglAuditor } from '@/api/stgl/auditor';
import { listDept } from '@/api/system/dept';
import { StglAuditorVO, StglAuditorQuery } from '@/api/stgl/auditor/types';
import { DeptVO } from '@/api/system/dept/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = proxy?.useDict('sys_normal_disable') || {};
const auditorTableRef = ref();
const emit = defineEmits<{
confirm: [users: StglAuditorVO[]];
}>();
// 响应式数据
const visible = ref(false);
const loading = ref(false);
const userList = ref<StglAuditorVO[]>([]);
const filteredUserList = ref<StglAuditorVO[]>([]);
const selectedUsers = ref<StglAuditorVO[]>([]);
const total = ref(0);
const deptOptions = ref<any[]>([]);
const searchKeyword = ref('');
// 计算表格数据
const tableData = computed(() => {
// 确保返回的数组总是有效的
if (searchKeyword.value && filteredUserList.value) {
return filteredUserList.value;
}
return userList.value || [];
});
// 查询参数
const queryParams = ref<StglAuditorQuery>({
pageNum: 1,
pageSize: 500, // 增加页面大小以显示所有审核人
nickName: '',
userName: '',
deptId: undefined,
status: '1' // 只查询正常状态的审核人
});
// 初始查询参数的备份,用于重置
const defaultQuery: StglAuditorQuery = {
pageNum: 1,
pageSize: 500, // 增加页面大小以显示所有审核人
nickName: '',
userName: '',
deptId: undefined,
status: '1'
};
/** 打开选择器 */
const open = (preSelected: StglAuditorVO[] = []) => {
visible.value = true;
selectedUsers.value = [...preSelected];
// 重置搜索状态
searchKeyword.value = '';
filteredUserList.value = [];
getDeptTree();
getList();
};
/** 获取部门树 */
const getDeptTree = async () => {
try {
const response = await listDept();
deptOptions.value = handleTree(response.data, 'id', 'parentId');
} catch (error) {
console.error('获取部门树失败:', error);
}
};
/** 获取审核人列表 */
const getList = async () => {
loading.value = true;
try {
const response = await listStglAuditor(queryParams.value);
userList.value = response.rows;
filteredUserList.value = response.rows;
total.value = response.total;
// 如果有搜索关键词,执行搜索
if (searchKeyword.value) {
handleSearch();
}
// 设置表格选中状态
nextTick(() => {
setTableSelection();
});
} catch (error) {
console.error('获取审核人列表失败:', error);
userList.value = [];
filteredUserList.value = [];
total.value = 0;
} finally {
loading.value = false;
}
};
/** 设置表格选中状态 */
const setTableSelection = () => {
if (!auditorTableRef.value) return;
tableData.value.forEach(user => {
const isSelected = selectedUsers.value.some(selected =>
selected.userId === user.userId
);
auditorTableRef.value.toggleRowSelection(user, isSelected);
});
};
/** 判断行是否可选 */
const isSelectable = (row: StglAuditorVO) => {
return row.status === '1'; // 只有正常状态的审核人可选
};
/** 表格选择变化 */
const handleSelectionChange = (selection: StglAuditorVO[]) => {
// 处理当前显示数据的选择
const currentPageUserIds = tableData.value.map(user => user.userId);
// 移除当前页原有的选择
selectedUsers.value = selectedUsers.value.filter(user =>
!currentPageUserIds.includes(user.userId)
);
// 添加当前页新的选择
selectedUsers.value.push(...selection);
};
/** 移除选中审核人 */
const removeUser = (user: StglAuditorVO) => {
selectedUsers.value = selectedUsers.value.filter(selected =>
selected.userId !== user.userId
);
// 如果当前页包含该用户,需要取消表格选中
if (auditorTableRef.value) {
const currentUser = tableData.value.find(u => u.userId === user.userId);
if (currentUser) {
auditorTableRef.value.toggleRowSelection(currentUser, false);
}
}
};
/** 清空所有选择 */
const clearSelected = () => {
selectedUsers.value = [];
if (auditorTableRef.value) {
auditorTableRef.value.clearSelection();
}
};
/** 搜索处理 */
const handleSearch = () => {
if (!searchKeyword.value) {
filteredUserList.value = userList.value;
return;
}
const keyword = searchKeyword.value.toLowerCase();
filteredUserList.value = userList.value.filter(
(user) =>
(user.nickName && user.nickName.toLowerCase().includes(keyword)) ||
(user.userName && user.userName.toLowerCase().includes(keyword)) ||
(user.deptName && user.deptName.toLowerCase().includes(keyword))
);
};
/** 搜索 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置搜索 */
const resetQuery = () => {
Object.assign(queryParams.value, defaultQuery);
handleQuery();
};
/** 关闭弹窗 */
const handleClose = () => {
visible.value = false;
selectedUsers.value = [];
userList.value = [];
filteredUserList.value = [];
searchKeyword.value = '';
Object.assign(queryParams.value, defaultQuery);
};
/** 确认选择 */
const handleConfirm = () => {
emit('confirm', selectedUsers.value);
visible.value = false;
};
/** 处理树形数据 */
const handleTree = (data: any[], id: string, parentId: string, children = 'children') => {
const config = { id, parentId, children };
const childrenListMap: any = {};
const nodeIds: any = {};
const tree = [];
for (const d of data) {
const parentIdValue = d[config.parentId];
if (childrenListMap[parentIdValue] == null) {
childrenListMap[parentIdValue] = [];
}
nodeIds[d[config.id]] = d;
childrenListMap[parentIdValue].push(d);
}
for (const d of data) {
const parentIdValue = d[config.parentId];
if (nodeIds[parentIdValue] == null) {
tree.push(d);
}
}
for (const t of tree) {
adaptToChildrenArray(t);
}
function adaptToChildrenArray(o: any) {
if (childrenListMap[o[config.id]] !== null) {
o[config.children] = childrenListMap[o[config.id]];
}
if (o[config.children]) {
for (const c of o[config.children]) {
adaptToChildrenArray(c);
}
}
}
return tree.map(item => ({
id: item.id,
label: item.deptName,
children: item.children ? item.children.map((child: any) => convertToTreeNode(child)) : []
}));
};
const convertToTreeNode = (item: any): any => ({
id: item.id,
label: item.deptName,
children: item.children ? item.children.map((child: any) => convertToTreeNode(child)) : []
});
defineExpose({
open
});
</script>
<style scoped>
.auditor-selector {
.auditor-select-content {
max-height: 500px;
}
.search-section {
margin-top: 20px !important;
margin-bottom: 20px !important;
}
:deep(.el-table) {
margin-top: 20px !important;
}
.dialog-footer {
display: flex !important;
justify-content: space-between !important;
align-items: center !important;
width: 100%;
}
.footer-buttons {
display: flex;
gap: 12px;
}
}
/* Element Plus Dialog Footer 样式覆盖 - 使用最高优先级的选择器 */
.auditor-selector :deep(.el-dialog__footer) {
padding: 15px 20px !important;
text-align: left !important;
display: block !important;
}
.auditor-selector :deep(.el-dialog__footer .dialog-footer) {
display: flex !important;
justify-content: space-between !important;
align-items: center !important;
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
box-sizing: border-box !important;
}
/* 确保按钮容器样式正确 */
.auditor-selector .dialog-footer .footer-buttons {
display: flex !important;
gap: 12px !important;
margin-left: auto !important;
flex-shrink: 0 !important;
}
/* 确保文本不会撑开容器 */
.auditor-selector .dialog-footer .selected-count-text {
flex-shrink: 0 !important;
white-space: nowrap !important;
}
/* 确保搜索框和表格间距的全局样式 */
.auditor-selector .auditor-select-content .search-section {
margin-bottom: 20px !important;
}
.auditor-selector .auditor-select-content .el-table {
margin-top: 20px !important;
}
</style>
@@ -124,8 +124,27 @@
<!-- 指导老师意见 -->
<div class="opinion-section">
<div class="opinion-title">指导老师意见</div>
<div class="opinion-content">
{{ annualReview.advisorOpinion || '暂无意见' }}
<div v-if="advisorAudits.length > 0" class="audit-records">
<div v-for="audit in advisorAudits" :key="audit.id" class="audit-record">
<div class="audit-header">
<span class="approver-name">{{ audit.approverName }}</span>
<span class="audit-status" :class="getAuditStatusClass(audit.nodeStatus)">
{{ getAuditStatusText(audit.nodeStatus) }}
</span>
<span v-if="audit.approveTime" class="audit-time">
{{ parseTime(audit.approveTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
</span>
</div>
<div v-if="audit.approveOpinion" class="audit-opinion">
{{ audit.approveOpinion }}
</div>
<div v-else class="audit-opinion pending">
待审批
</div>
</div>
</div>
<div v-else class="opinion-content">
暂无审批记录
</div>
<div class="opinion-signature">签名(公章)</div>
</div>
@@ -133,8 +152,27 @@
<!-- 二级学院意见 -->
<div class="opinion-section">
<div class="opinion-title">二级学院意见</div>
<div class="opinion-content">
{{ annualReview.collegeOpinion || '暂无意见' }}
<div v-if="collegeAudits.length > 0" class="audit-records">
<div v-for="audit in collegeAudits" :key="audit.id" class="audit-record">
<div class="audit-header">
<span class="approver-name">{{ audit.approverName }}</span>
<span class="audit-status" :class="getAuditStatusClass(audit.nodeStatus)">
{{ getAuditStatusText(audit.nodeStatus) }}
</span>
<span v-if="audit.approveTime" class="audit-time">
{{ parseTime(audit.approveTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
</span>
</div>
<div v-if="audit.approveOpinion" class="audit-opinion">
{{ audit.approveOpinion }}
</div>
<div v-else class="audit-opinion pending">
待审批
</div>
</div>
</div>
<div v-else class="opinion-content">
暂无审批记录
</div>
<div class="opinion-signature">签名(公章)</div>
</div>
@@ -142,8 +180,27 @@
<!-- 校团委意见 -->
<div class="opinion-section">
<div class="opinion-title">校团委意见</div>
<div class="opinion-content">
{{ annualReview.youthLeagueOpinion || '暂无意见' }}
<div v-if="youthLeagueAudits.length > 0" class="audit-records">
<div v-for="audit in youthLeagueAudits" :key="audit.id" class="audit-record">
<div class="audit-header">
<span class="approver-name">{{ audit.approverName }}</span>
<span class="audit-status" :class="getAuditStatusClass(audit.nodeStatus)">
{{ getAuditStatusText(audit.nodeStatus) }}
</span>
<span v-if="audit.approveTime" class="audit-time">
{{ parseTime(audit.approveTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
</span>
</div>
<div v-if="audit.approveOpinion" class="audit-opinion">
{{ audit.approveOpinion }}
</div>
<div v-else class="audit-opinion pending">
待审批
</div>
</div>
</div>
<div v-else class="opinion-content">
暂无审批记录
</div>
<div class="opinion-signature">签名(公章)</div>
</div>
@@ -158,7 +215,9 @@
<script setup lang="ts">
import { getStglClubAnnualReview, getAnnualReviewActivities } from '@/api/stgl/club/annualReview';
import { getAnnualReviewAuditsByReviewId } from '@/api/stgl/club/annualReviewAudit';
import { StglClubAnnualReviewVO } from '@/api/stgl/club/annualReview/type';
import { StglAnnualReviewAuditVO } from '@/api/stgl/club/annualReviewAudit/type';
// 扩展的年审VO接口(包含JSON字段)
interface ExtendedAnnualReviewVO extends StglClubAnnualReviewVO {
@@ -180,6 +239,8 @@ const annualReview = ref<ExtendedAnnualReviewVO>();
const memberList = ref<any[]>([]);
// 活动列表
const activityList = ref<any[]>([]);
// 审批记录列表
const auditList = ref<StglAnnualReviewAuditVO[]>([]);
// 年份范围计算
const yearRange = computed(() => {
@@ -208,6 +269,41 @@ const memberCountText = computed(() => {
return `${annualReview.value?.memberCount || 0}人`;
});
// 指导老师审批记录
const advisorAudits = computed(() => {
return auditList.value.filter(audit => audit.nodeCode === 'advisor_approve');
});
// 二级学院审批记录
const collegeAudits = computed(() => {
return auditList.value.filter(audit => audit.nodeCode === 'college_approve');
});
// 校团委审批记录
const youthLeagueAudits = computed(() => {
return auditList.value.filter(audit => audit.nodeCode === 'youth_league_approve');
});
/** 获取审批状态样式类 */
const getAuditStatusClass = (status: string) => {
const statusClasses: { [key: string]: string } = {
'pending': 'status-pending',
'waiting': 'status-waiting',
'approved': 'status-approved'
};
return statusClasses[status] || '';
};
/** 获取审批状态文本 */
const getAuditStatusText = (status: string) => {
const statusTexts: { [key: string]: string } = {
'pending': '待审批',
'waiting': '等待中',
'approved': '已审批'
};
return statusTexts[status] || status;
};
/** 格式化活动时间显示 */
const formatActivityTime = (startTime: string, endTime?: string): string => {
if (!startTime) return '';
@@ -302,6 +398,19 @@ const getDetail = async () => {
memberList.value = [];
}
// 获取审批记录
try {
const auditRes = await getAnnualReviewAuditsByReviewId(props.annualReviewId);
if (auditRes && auditRes.data && Array.isArray(auditRes.data)) {
auditList.value = auditRes.data;
} else {
auditList.value = [];
}
} catch (error) {
console.warn('获取审批记录失败:', error);
auditList.value = [];
}
// 从stgl_club_annual_review_activity表中获取年审记录对应的活动数据
try {
const activitiesRes = await getAnnualReviewActivities(props.annualReviewId);
@@ -524,4 +633,79 @@ watch(
line-height: 1.4;
font-size: 13px;
}
/* 审批记录样式 */
.audit-records {
margin-bottom: 10px;
}
.audit-record {
margin-bottom: 15px;
padding: 12px;
border: 1px solid #e4e7ed;
border-radius: 4px;
background: #fafafa;
}
.audit-record:last-child {
margin-bottom: 0;
}
.audit-header {
display: flex;
align-items: center;
margin-bottom: 8px;
font-size: 14px;
}
.approver-name {
font-weight: bold;
color: #303133;
margin-right: 15px;
}
.audit-status {
padding: 2px 8px;
border-radius: 4px;
font-size: 12px;
margin-right: 15px;
}
.status-pending {
background: #fdf6ec;
color: #e6a23c;
border: 1px solid #f5dab1;
}
.status-waiting {
background: #f4f4f5;
color: #909399;
border: 1px solid #d3d4d6;
}
.status-approved {
background: #f0f9ff;
color: #67c23a;
border: 1px solid #b3d8ff;
}
.audit-time {
color: #909399;
font-size: 12px;
margin-left: auto;
}
.audit-opinion {
line-height: 1.6;
color: #606266;
background: #fff;
padding: 8px;
border-radius: 4px;
border: 1px solid #e4e7ed;
}
.audit-opinion.pending {
color: #909399;
font-style: italic;
}
</style>
@@ -459,9 +459,24 @@ const loadClubInfo = async (clubId: string | number) => {
try {
const advisors = JSON.parse(clubData.advisorsJson);
if (Array.isArray(advisors) && advisors.length > 0) {
const firstAdvisor = advisors[0];
advisorName = firstAdvisor.name || firstAdvisor.teacher?.nickName || '';
advisorDept = firstAdvisor.dept || firstAdvisor.teacher?.deptName || '';
// 处理多个指导老师的情况
const advisorNames = [];
const advisorDepts = [];
advisors.forEach(advisor => {
const name = advisor.name || advisor.teacher?.nickName || '';
const dept = advisor.dept || advisor.teacher?.deptName || '';
if (name) {
advisorNames.push(name);
}
if (dept && !advisorDepts.includes(dept)) {
advisorDepts.push(dept);
}
});
advisorName = advisorNames.join('、');
advisorDept = advisorDepts.join('、');
}
} catch (error) {
console.warn('解析指导老师JSON数据失败:', error);
@@ -57,7 +57,7 @@
</el-row>
</template>
<el-table v-loading="loading" border :data="annualReviewList" @selection-change="handleSelectionChange" @row-dblclick="handleView">
<el-table v-loading="loading" border :data="annualReviewList" :key="tableKey" @selection-change="handleSelectionChange" @row-dblclick="handleView">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="社团名称" align="center" prop="clubName" min-width="150" />
<el-table-column label="成立日期" align="center" prop="establishDate" width="120">
@@ -80,11 +80,11 @@
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" width="100">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status) as any">{{ getStatusText(scope.row.status) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" width="120">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status) as any">{{ getStatusText(scope.row.status) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="年审时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@@ -104,7 +104,10 @@
<el-tooltip content="撤回" placement="top" v-if="scope.row.status === '1'">
<el-button link type="warning" icon="RefreshLeft" @click="handleWithdraw(scope.row)" v-hasPermi="['stgl:clubAnnualReview:withdraw']"></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 === '1' || scope.row.status === '2') && canApprove(scope.row)">
<el-button link type="success" icon="Check" @click="handleApprove(scope.row)" v-hasPermi="['stgl:annualReviewAudit:approve']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top" v-if="scope.row.status === '0' || scope.row.status === '4'">
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['stgl:clubAnnualReview:remove']"></el-button>
</el-tooltip>
</template>
@@ -129,10 +132,15 @@
<el-dialog title="年审记录详情" v-model="detailDialog.visible" width="1000px" append-to-body>
<annual-review-detail :annual-review-id="detailDialog.annualReviewId" />
</el-dialog>
<!-- 审批对话框 -->
<approve-dialog ref="approveDialogRef" @success="handleApproveSuccess" />
</div>
</template>
<script setup name="StglClubAnnualReview" lang="ts">
import { ref, reactive, toRefs, nextTick, onMounted, getCurrentInstance } from 'vue';
import type { ComponentInternalInstance } from 'vue';
import { useRoute } from 'vue-router';
import {
listStglClubAnnualReview,
@@ -143,11 +151,16 @@ import {
exportStglClubAnnualReview
} from '@/api/stgl/club/annualReview';
import { StglClubAnnualReviewVO, StglClubAnnualReviewQuery, ANNUAL_REVIEW_STATUS_OPTIONS } from '@/api/stgl/club/annualReview/type';
import { getPendingAuditsByApproverId } from '@/api/stgl/club/annualReviewAudit';
import { StglAnnualReviewAuditVO } from '@/api/stgl/club/annualReviewAudit/type';
import { useUserStore } from '@/store/modules/user';
import AnnualReviewForm from './form.vue';
import AnnualReviewDetail from './detail.vue';
import ApproveDialog from './approveDialog.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const userStore = useUserStore();
const { stgl_club_type } = toRefs(proxy?.useDict('stgl_club_type') as any);
const annualReviewList = ref<StglClubAnnualReviewVO[]>([]);
@@ -157,9 +170,16 @@ const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const tableKey = ref(0); // 用于强制重新渲染表格
// 审批权限相关状态
const pendingAudits = ref<StglAnnualReviewAuditVO[]>([]);
const pendingAuditsLoading = ref(false);
const pendingAuditsCache = ref<Map<number, boolean>>(new Map());
const queryFormRef = ref<ElFormInstance>();
const annualReviewFormRef = ref<InstanceType<typeof AnnualReviewForm>>();
const approveDialogRef = ref<InstanceType<typeof ApproveDialog>>();
// 状态选项
const statusOptions = ref(ANNUAL_REVIEW_STATUS_OPTIONS);
@@ -214,10 +234,36 @@ const { queryParams, dialog, detailDialog } = toRefs(data);
/** 查询社团年审记录列表 */
const getList = async () => {
loading.value = true;
const res = await listStglClubAnnualReview(queryParams.value);
annualReviewList.value = res.rows;
total.value = res.total;
loading.value = false;
try {
// 并行加载年审记录和待审批记录
const [annualReviewRes] = await Promise.all([
listStglClubAnnualReview(queryParams.value),
loadPendingAudits()
]);
// 确保数据更新
if (annualReviewRes && annualReviewRes.rows) {
annualReviewList.value = annualReviewRes.rows;
total.value = annualReviewRes.total;
} else {
console.warn('获取的年审记录数据格式异常:', annualReviewRes);
annualReviewList.value = [];
total.value = 0;
}
// 强制触发 Vue 的响应式更新
nextTick(() => {
console.log('年审记录列表已更新,记录数:', annualReviewList.value.length);
});
} catch (error) {
console.error('加载数据失败:', error);
proxy?.$modal.msgError('加载数据失败');
// 重置数据
annualReviewList.value = [];
total.value = 0;
} finally {
loading.value = false;
}
};
/** 搜索按钮操作 */
@@ -279,20 +325,51 @@ const handleView = (row: StglClubAnnualReviewVO) => {
const handleSubmit = async (row: StglClubAnnualReviewVO) => {
try {
await proxy?.$modal.confirm(`是否确认提交年审记录"${row.clubName}"?`);
// 调用提交接口
await submitStglClubAnnualReview(row.id);
await getList();
// API调用成功后,立即更新本地状态,避免被getList覆盖
await updateRowStatus(row.id, '1');
proxy?.$modal.msgSuccess('提交成功');
} catch {}
// 延迟重新获取数据,确保状态已经在界面上显示
setTimeout(async () => {
await getList();
}, 100);
} catch (error) {
console.error('提交失败:', error);
// 提交失败时才需要恢复状态,因为我们现在是先调用API再更新状态
}
};
/** 撤回按钮操作 */
const handleWithdraw = async (row: StglClubAnnualReviewVO) => {
try {
await proxy?.$modal.confirm(`是否确认撤回年审记录"${row.clubName}"?`);
// 调用撤回接口
await withdrawStglClubAnnualReview(row.id);
await getList();
// API调用成功后,立即更新本地状态,避免被getList覆盖
await updateRowStatus(row.id, '0');
proxy?.$modal.msgSuccess('撤回成功');
} catch {}
// 延迟重新获取数据,确保状态已经在界面上显示
setTimeout(async () => {
await Promise.all([
getList(),
loadPendingAudits()
]);
}, 100);
} catch (error) {
console.error('撤回失败:', error);
// 撤回失败时才需要恢复状态,因为我们现在是先调用API再更新状态
}
};
/** 删除按钮操作 */
@@ -322,6 +399,30 @@ const handleFormSuccess = () => {
getList();
};
/** 更新行状态的工具函数 */
const updateRowStatus = async (rowId: string | number, newStatus: string) => {
const rowIndex = annualReviewList.value.findIndex(item => item.id === rowId);
if (rowIndex !== -1) {
// 创建新对象确保Vue能检测到变化
const updatedRow = {
...annualReviewList.value[rowIndex],
status: newStatus
};
// 使用splice替换整个对象,触发响应式更新
annualReviewList.value.splice(rowIndex, 1, updatedRow);
// 强制触发DOM更新和表格重新渲染
tableKey.value++;
await nextTick();
console.log(`状态已同步更新: ${updatedRow.status}`);
console.log('当前数组状态:', annualReviewList.value.map(item => ({ id: item.id, status: item.status, clubName: item.clubName })));
return updatedRow;
}
return null;
};
/** 获取状态标签类型 */
const getStatusTagType = (status: string) => {
const tagTypes: { [key: string]: string } = {
@@ -336,8 +437,114 @@ const getStatusTagType = (status: string) => {
/** 获取状态文本 */
const getStatusText = (status: string) => {
// 本地状态映射,确保显示正确
const statusMap: { [key: string]: string } = {
'0': '草稿',
'1': '已提交',
'2': '审核中',
'3': '审核通过',
'4': '审核不通过'
};
// 优先使用本地映射
if (statusMap[status]) {
const result = statusMap[status];
console.log(`getStatusText: 状态=${status}, 返回文本="${result}"`);
return result;
}
// fallback到原来的逻辑
const option = statusOptions.value.find(item => item.value === status);
return option?.label || status;
const result = option?.label || status;
console.log(`getStatusText: 状态=${status}, fallback返回="${result}"`);
return result;
};
/** 获取当前用户的待审批记录 */
const loadPendingAudits = async () => {
if (!userStore.userId || pendingAuditsLoading.value) {
return;
}
try {
pendingAuditsLoading.value = true;
const response = await getPendingAuditsByApproverId(userStore.userId);
// 处理响应数据,确保 data 是数组
// 后端返回的是 R<List<StglAnnualReviewAudit>>,R.data 可能为 null 或 []
let data = [];
if (response && response.data !== undefined) {
// 如果response.data存在但为null,使用空数组
data = response.data || [];
} else if (response && response.rows !== undefined) {
// 有些API返回格式可能是分页格式
data = response.rows || [];
}
pendingAudits.value = data;
// 更新缓存
pendingAuditsCache.value.clear();
if (Array.isArray(data)) {
data.forEach((audit: StglAnnualReviewAuditVO) => {
if (audit.annualReviewId) {
pendingAuditsCache.value.set(Number(audit.annualReviewId), true);
}
});
}
} catch (error) {
console.error('获取待审批记录失败:', error);
// 重置数据
pendingAudits.value = [];
pendingAuditsCache.value.clear();
// 不显示错误提示,避免影响页面正常使用
} finally {
pendingAuditsLoading.value = false;
}
};
/** 判断当前用户是否可以审批该年审记录 */
const canApprove = (row: StglClubAnnualReviewVO) => {
// 检查当前用户是否登录
if (!userStore.userId) {
console.log('canApprove: 用户未登录');
return false;
}
// 检查年审记录状态,支持"已提交"和"审核中"状态
if (row.status !== '1' && row.status !== '2') {
console.log(`canApprove: 状态不符合 ${row.status}`);
return false;
}
// 检查缓存中是否有该年审记录的审批权限
const hasPermission = pendingAuditsCache.value.has(Number(row.id));
console.log(`canApprove: 年审ID=${row.id}, 当前用户=${userStore.userId}, 缓存权限=${hasPermission}, 缓存内容=`, Array.from(pendingAuditsCache.value.keys()));
return hasPermission;
};
/** 审批按钮操作 */
const handleApprove = async (row: StglClubAnnualReviewVO) => {
// 从待审批记录中找到对应的审批ID
const audit = pendingAudits.value.find(audit =>
Number(audit.annualReviewId) === Number(row.id)
);
if (!audit) {
proxy?.$modal.msgError('未找到对应的审批记录');
return;
}
approveDialogRef.value?.open(audit.id, row.id);
};
/** 审批成功回调 */
const handleApproveSuccess = async () => {
// 审批完成后,需要同时刷新年审记录和待审批记录
await Promise.all([
getList(),
loadPendingAudits()
]);
};
onMounted(() => {
+3 -3
View File
@@ -1278,9 +1278,9 @@ watch(
() => form.value.advisors,
(advisors: AdvisorVO[]) => {
// 防止递归更新
if (syncingAdvisors.value) return;
if (syncLock.value) return;
syncingAdvisors.value = true;
syncLock.value = true;
nextTick(() => {
try {
// 为了兼容旧版本,同步第一个指导老师的信息到旧字段
@@ -1297,7 +1297,7 @@ watch(
form.value.advisorEmail = undefined;
}
} finally {
syncingAdvisors.value = false;
syncLock.value = false;
}
});
},