Browse Source

feat(permission): 添加汇率修改权限控制

zhangrenyuan/feature-20250728113353-金币前端三期
lihui 2 weeks ago
parent
commit
818ee9ce0b
  1. 9
      src/utils/menuTreePermission.js
  2. 14
      src/views/managerecharge/rate.vue

9
src/utils/menuTreePermission.js

@ -28,10 +28,11 @@ export const permissionMapping = {
// menu_type 4: 功能操作权限 // menu_type 4: 功能操作权限
Workbench_Display: 10, // 工作台展示 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_View: 15, // 汇率查看
Exchange_Rate_Modification: 16, // 汇率修改 Exchange_Rate_Modification: 16, // 汇率修改

14
src/views/managerecharge/rate.vue

@ -2,7 +2,9 @@
import {onMounted, reactive, ref} from 'vue' import {onMounted, reactive, ref} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus' import {ElMessage, ElMessageBox} from 'element-plus'
import request from '@/util/http' import request from '@/util/http'
import {useAdminStore} from "@/store/index.js";
import {storeToRefs} from "pinia";
import {findMenuById, permissionMapping} from "@/utils/menuTreePermission.js"
/* /*
====================工具方法========================= ====================工具方法=========================
*/ */
@ -189,8 +191,14 @@ const getEditData = async function (row) {
console.log('请求失败', error) console.log('请求失败', error)
} }
} }
const adminStore = useAdminStore();
const {menuTree} = storeToRefs(adminStore);
// //
const editRate = async function () { const editRate = async function () {
if (findMenuById(menuTree.value, permissionMapping.Exchange_Rate_Modification)) {
// //
rateEdit.value.num = parseFloat(rateEdit.value.num); rateEdit.value.num = parseFloat(rateEdit.value.num);
try { try {
@ -206,9 +214,11 @@ const editRate = async function () {
} catch (error) { } catch (error) {
console.log('请求失败', error) console.log('请求失败', error)
} }
}else {
ElMessage.error('没有权限')
}
} }
// //
const edit = () => { const edit = () => {
editFormRef.value.validate(async (valid) => { editFormRef.value.validate(async (valid) => {

Loading…
Cancel
Save