From 6da1e10197c98ae9776b985add40327f5e33805f Mon Sep 17 00:00:00 2001 From: luojiaquan <1583622118@qq.com> Date: Wed, 23 Sep 2026 14:44:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E7=AE=A1=E5=AE=A1=E6=89=B9=E9=A2=9D?= =?UTF-8?q?=E5=BA=A6=E4=B8=8D=E5=8D=A0=E7=94=A8=E9=A2=9D=E5=BA=A6=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CreditQuotaServiceImpl.java | 6 ++++++ .../main/resources/mapper/customer/CreditQuotaMapper.xml | 4 ++-- .../customerinfo/customermoney/index.vue | 9 +++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/service/impl/CreditQuotaServiceImpl.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/service/impl/CreditQuotaServiceImpl.java index d0cbde6a..ad8dd1f6 100644 --- a/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/service/impl/CreditQuotaServiceImpl.java +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/customer/customermoney/service/impl/CreditQuotaServiceImpl.java @@ -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 list = creditQuotaMapper.selectRoleQuotaListByUserId(userId); list.forEach(this::fillAvailable); return list; diff --git a/bms-back/ruoyi-system/src/main/resources/mapper/customer/CreditQuotaMapper.xml b/bms-back/ruoyi-system/src/main/resources/mapper/customer/CreditQuotaMapper.xml index f4b9a3b9..6263d56f 100644 --- a/bms-back/ruoyi-system/src/main/resources/mapper/customer/CreditQuotaMapper.xml +++ b/bms-back/ruoyi-system/src/main/resources/mapper/customer/CreditQuotaMapper.xml @@ -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 diff --git a/bms-front/src/views/customersuppliermanagement/customerinfo/customermoney/index.vue b/bms-front/src/views/customersuppliermanagement/customerinfo/customermoney/index.vue index ace00240..5ffa12d6 100644 --- a/bms-front/src/views/customersuppliermanagement/customerinfo/customermoney/index.vue +++ b/bms-front/src/views/customersuppliermanagement/customerinfo/customermoney/index.vue @@ -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}`)