fix: 前端管理员跳过积分检查
This commit is contained in:
parent
8b2b1a8871
commit
67a2ce7564
@ -12,7 +12,8 @@
|
||||
<span class="tip-icon">
|
||||
<Icon name="info" size="sm" color="#31f08b" />
|
||||
</span>
|
||||
<span>本次任务预估消耗: <strong>{{ estimatedScore }}</strong> 分</span>
|
||||
<span v-if="isAdmin" style="color: #31f08b;">管理员身份,无需积分即可发起任务</span>
|
||||
<span v-else>本次任务预估消耗: <strong>{{ estimatedScore }}</strong> 分</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -418,6 +419,20 @@ const loading = ref(false)
|
||||
// 团队积分余额
|
||||
const teamScore = ref(0)
|
||||
|
||||
// 判断是否是管理员(管理员跳过积分检查)
|
||||
const isAdmin = computed(() => {
|
||||
const userInfo = authStore.userInfo
|
||||
if (!userInfo) return false
|
||||
// 检查 isAdmin 字段
|
||||
if (userInfo.isAdmin === 1 || userInfo.isAdmin === true) return true
|
||||
// 检查角色
|
||||
if (userInfo.roleIds) {
|
||||
const roleIds = userInfo.roleIds.split(',').map((id: string) => id.trim())
|
||||
if (roleIds.includes('1') || roleIds.includes('2')) return true // 1=SUPER_ADMIN, 2=ADMIN
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
// 任务子类型列表
|
||||
const taskSubTypes = ref<TaskSubType[]>([])
|
||||
|
||||
@ -665,7 +680,8 @@ const totalPipelineHours = computed(() => {
|
||||
const calculateScore = () => {
|
||||
// 计算已在computed中完成
|
||||
const score = estimatedScore.value
|
||||
if (score > teamScore.value) {
|
||||
// 管理员跳过积分检查
|
||||
if (!isAdmin.value && score > teamScore.value) {
|
||||
message.warning('团队积分余额不足,无法发起此任务')
|
||||
}
|
||||
}
|
||||
@ -695,8 +711,8 @@ const handleSubmit = async () => {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查积分余额
|
||||
if (estimatedScore.value > teamScore.value) {
|
||||
// 检查积分余额(管理员跳过)
|
||||
if (!isAdmin.value && estimatedScore.value > teamScore.value) {
|
||||
message.error('团队积分余额不足')
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user