Files
hzdyjs/本地临时文件目录/fix-enrollmentProcess-view.vue
T
2025-07-24 21:03:00 +08:00

163 lines
5.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
修复后的招生流程状态页面片段
作者:Cursor AI
日期:2025-07-21
说明:修复下拉菜单中的操作项,添加v-hasPermi指令
-->
<template>
<!-- 这里只包含需要修改的下拉菜单部分,完整代码请参考原文件 -->
<el-dropdown @command="(command: string) => handleCommand(command, scope.row)">
<el-button link type="primary" icon="More" />
<template #dropdown>
<el-dropdown-menu>
<!-- 添加v-hasPermi指令,确保只有有权限的用户才能看到相应的操作 -->
<el-dropdown-item
v-hasPermi="['zsjy:enrollmentProcess:process']"
command="payment"
:disabled="scope.row.paymentStatus === '1'"
>
<el-icon><CreditCard /></el-icon>
缴费确认
</el-dropdown-item>
<el-dropdown-item
v-hasPermi="['zsjy:enrollmentProcess:complete']"
command="complete"
:disabled="scope.row.isCompleted === 1"
>
<el-icon><CircleCheck /></el-icon>
完成录取
</el-dropdown-item>
<el-dropdown-item
v-hasPermi="['zsjy:enrollmentProcess:reject']"
command="reject"
:disabled="scope.row.currentStatus === '9'"
>
<el-icon><CircleClose /></el-icon>
驳回流程
</el-dropdown-item>
<el-dropdown-item
command="reset"
v-hasPermi="['zsjy:enrollmentProcess:reset']"
>
<el-icon><RefreshRight /></el-icon>
重置流程
</el-dropdown-item>
<el-dropdown-item
command="delete"
v-hasPermi="['zsjy:enrollmentProcess:remove']"
>
<el-icon><Delete /></el-icon>
删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useUserStore } from '@/store/modules/user'
// 获取用户存储
const userStore = useUserStore()
// 判断是否为信息审核员
const isInfoAuditor = computed(() => {
return userStore.roles?.includes('zsjy_info_auditor') || false
})
// 判断是否为录取处理员
const isAdmissionProcessor = computed(() => {
return userStore.roles?.includes('zsjy_admission_processor') || false
})
// 判断是否为管理员
const isAdmin = computed(() => {
return userStore.roles?.includes('admin') || userStore.roles?.includes('superadmin') || false
})
// 修改getList方法,根据用户角色过滤数据
const getList = async () => {
loading.value = true
// 根据角色设置查询参数
if (isInfoAuditor.value) {
// 信息审核员只查询状态为0和1的数据
queryParams.value.currentStatus = ['0', '1']
} else if (isAdmissionProcessor.value) {
// 录取处理员只查询状态为2的数据
queryParams.value.currentStatus = '2'
}
try {
const res = await listEnrollmentProcess(queryParams.value)
processList.value = res.rows || []
total.value = res.total || 0
} catch (error) {
console.error('获取流程列表失败:', error)
// 如果是404错误(接口不存在),使用模拟数据
if (error?.response?.status === 404 || error?.message?.includes('404')) {
console.warn('后端接口不存在,使用模拟数据')
// 创建模拟的流程数据,根据用户角色过滤
let mockData = [
{
id: 1946510098494091300,
enrollmentId: 1001,
studentName: '张三',
idCard: '330101200501010001',
currentStatus: '0',
infoAuditStatus: '0',
admissionStatus: '0',
finalAuditStatus: '0',
isCompleted: 0,
createTime: '2025-07-20 10:28:09'
},
{
id: 1946510098494091301,
enrollmentId: 1946510098494091266,
studentName: '赵四',
idCard: '340403201509091234',
currentStatus: '0',
infoAuditStatus: '0',
admissionStatus: '0',
finalAuditStatus: '0',
isCompleted: 0,
createTime: '2025-07-20 10:28:18'
},
{
id: 1946510098494091302,
enrollmentId: 1003,
studentName: '王五',
idCard: '110101200601010003',
currentStatus: '2',
infoAuditStatus: '1',
admissionStatus: '0',
finalAuditStatus: '0',
isCompleted: 0,
createTime: '2025-07-20 10:28:27'
}
]
// 根据用户角色过滤模拟数据
if (isInfoAuditor.value) {
mockData = mockData.filter(item => ['0', '1'].includes(item.currentStatus))
} else if (isAdmissionProcessor.value) {
mockData = mockData.filter(item => item.currentStatus === '2')
}
processList.value = mockData
total.value = mockData.length
proxy?.$modal.msgWarning('后端接口暂未实现,显示模拟数据')
} else {
// 其他错误,设置空数据并抛出错误
processList.value = []
total.value = 0
throw error
}
} finally {
loading.value = false
}
}
</script>