This commit is contained in:
wuweihua
2026-09-23 15:08:26 +08:00
3 changed files with 15 additions and 4 deletions
@@ -53,6 +53,12 @@ public class CreditQuotaServiceImpl implements ICreditQuotaService
{
throw new ServiceException("无法获取当前登录用户");
}
// 超管审批不占用任何角色额度池:直接返回空列表,前端不弹选池框(否则 LEFT JOIN 会带出
// 超管角色未配置的 0 额度池,导致前端强制选池并被"额度池剩余不足"拦截)
if (SecurityUtils.isAdmin(userId))
{
return java.util.Collections.emptyList();
}
List<RoleCreditQuotaVo> list = creditQuotaMapper.selectRoleQuotaListByUserId(userId);
list.forEach(this::fillAvailable);
return list;
@@ -28,14 +28,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
r.role_name as roleName,
r.role_key as roleKey,
r.status as status,
coalesce(q.total_quota, 0) as totalQuota,
q.total_quota as totalQuota,
(select coalesce(sum(g.remaining), 0)
from customer_credit_grant g
where g.role_id = r.role_id and g.status = '0' and g.del_flag = '0') as usedQuota,
q.remark as remark
from sys_user_role ur
inner join sys_role r on r.role_id = ur.role_id and r.del_flag = '0' and r.status = '0'
left join sys_role_credit_quota q on q.role_id = r.role_id
inner join sys_role_credit_quota q on q.role_id = r.role_id
where ur.user_id = #{userId}
order by r.role_sort, r.role_id
</select>
@@ -994,11 +994,15 @@ import { AR_BALANCE_WRITEOFF_STATUS, AR_BALANCE_WRITEOFF_STATUS_OPTIONS, AR_BALA
import { useRoute } from 'vue-router'
import { nextTick } from 'vue'
import useUserStore from '@/store/modules/user'
const route = useRoute()
const router = useRouter()
const { proxy } = getCurrentInstance()
const baseUrl = import.meta.env.VITE_APP_BASE_API
const userStore = useUserStore()
/** 超管(admin 角色)审批额度不占用角色额度池,不受池余额限制 */
const isSuperAdmin = computed(() => (userStore.roles || []).includes('admin'))
const activeTab = ref('receipt')
const customer = ref({})
@@ -1685,7 +1689,8 @@ function handleApproveApply(row) {
const netDelta = isApplyNetIncrease(row)
listMyCreditPools().then(res => {
const pools = res.data || []
if (netDelta > 0 && pools.length > 0) {
// 超管审批不占用角色额度池,直接通过(后端 myPools 对超管返回空列表,此处双保险)
if (!isSuperAdmin.value && netDelta > 0 && pools.length > 0) {
// 非超管且名下有角色额度池:净增审批必须选池占用
approveDialog.apply = row
approveDialog.pools = pools
@@ -1694,7 +1699,7 @@ function handleApproveApply(row) {
approveDialog.visible = true
return
}
const poolTip = (netDelta > 0 && pools.length === 0)
const poolTip = (!isSuperAdmin.value && netDelta > 0 && pools.length === 0)
? '(提示:净增额度需占用角色额度池,您名下未配置额度池,提交后将由后端校验拦截)'
: ''
proxy.$modal.confirm(`确认通过额度调整申请「${row.applyNo}」?通过后将立即调整客户额度并写入额度流水。${poolTip}`)