From 818ee9ce0bf6496b0215aac69c2ccdd52bee0b0e Mon Sep 17 00:00:00 2001 From: lihui Date: Fri, 1 Aug 2025 16:58:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(permission):=20=E6=B7=BB=E5=8A=A0=E6=B1=87?= =?UTF-8?q?=E7=8E=87=E4=BF=AE=E6=94=B9=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/menuTreePermission.js | 9 +++++---- src/views/managerecharge/rate.vue | 42 ++++++++++++++++++++++++--------------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/utils/menuTreePermission.js b/src/utils/menuTreePermission.js index 416cc50..356381d 100644 --- a/src/utils/menuTreePermission.js +++ b/src/utils/menuTreePermission.js @@ -28,10 +28,11 @@ export const permissionMapping = { // menu_type 4: 功能操作权限 Workbench_Display: 10, // 工作台展示 - View_Recharge_Audit: 11, // 查看充值审核 - Recharge_Approval: 12, // 充值审批 - View_Refund_Audit: 13, // 查看退款审核 - Refund_Approval: 14, // 退款审批 + View_Recharge_Audit: 11, // 查看充值审核 // 有这个页面权限的就有 + Recharge_Approval: 12, // 充值审批 //细致划分 + View_Refund_Audit: 13, // 查看退款审核 // 有这个页面权限的就有 + Refund_Approval: 14, // 退款审批 //细致划分 + Exchange_Rate_View: 15, // 汇率查看 Exchange_Rate_Modification: 16, // 汇率修改 diff --git a/src/views/managerecharge/rate.vue b/src/views/managerecharge/rate.vue index 9811b8b..96abd59 100644 --- a/src/views/managerecharge/rate.vue +++ b/src/views/managerecharge/rate.vue @@ -2,7 +2,9 @@ import {onMounted, reactive, ref} from 'vue' import {ElMessage, ElMessageBox} from 'element-plus' import request from '@/util/http' - +import {useAdminStore} from "@/store/index.js"; +import {storeToRefs} from "pinia"; +import {findMenuById, permissionMapping} from "@/utils/menuTreePermission.js" /* ====================工具方法========================= */ @@ -189,26 +191,34 @@ const getEditData = async function (row) { console.log('请求失败', error) } } + + +const adminStore = useAdminStore(); +const {menuTree} = storeToRefs(adminStore); // 编辑汇率 const editRate = async function () { - // 提交前验证 汇率是否为数字 - rateEdit.value.num = parseFloat(rateEdit.value.num); - try { - console.log('搜索参数', rateEdit.value) - // 发送POST请求 - const result = await request({ - url: '/rate/update', - data: rateEdit.value - }) - // 将响应结果存储到响应式数据中 - console.log('请求成功', result) - await getAllRate() - } catch (error) { - console.log('请求失败', error) + if (findMenuById(menuTree.value, permissionMapping.Exchange_Rate_Modification)) { + + // 提交前验证 汇率是否为数字 + rateEdit.value.num = parseFloat(rateEdit.value.num); + try { + console.log('搜索参数', rateEdit.value) + // 发送POST请求 + const result = await request({ + url: '/rate/update', + data: rateEdit.value + }) + // 将响应结果存储到响应式数据中 + console.log('请求成功', result) + await getAllRate() + } catch (error) { + console.log('请求失败', error) + } + }else { + ElMessage.error('没有权限') } } - // 添加前验证 const edit = () => { editFormRef.value.validate(async (valid) => {