diff --git a/src/views/permissions/rolePermission.vue b/src/views/permissions/rolePermission.vue index d8f34d0..e4a07b9 100644 --- a/src/views/permissions/rolePermission.vue +++ b/src/views/permissions/rolePermission.vue @@ -9,6 +9,7 @@ import { storeToRefs } from "pinia" const adminStore = useAdminStore(); const { adminData, menuTree } = storeToRefs(adminStore); import { permissionMapping, findMenuById } from "@/utils/menuTreePermission.js" +import { tr } from 'element-plus/es/locales.mjs' // 表单验证ref const Ref = ref(null) @@ -35,7 +36,7 @@ const addRole = ref({ market: '' }) const addRoleMarket = ref([]) - +const channelList = ref(['美股', '港股', 'hc第一频道']) const getRoleList = async function (val) { if (!findMenuById(menuTree.value, permissionMapping.view_role_information)) { ElMessage.error('无此权限') @@ -317,6 +318,7 @@ const handleEditRolePermissionCheck = (checkedNodes, checkedInfo) => { // 判断是否有选中的节点 if (allCheckedNodes.length === 0) { permissionEditRoleObj.value.checkedKeys = [] + ifHasChannel.value = false return } @@ -326,13 +328,22 @@ const handleEditRolePermissionCheck = (checkedNodes, checkedInfo) => { console.log('编辑角色选中的权限ID:', checkedKeys) console.log('选中的节点数量:', allCheckedNodes.length) + if (checkedKeys.includes(124)||checkedKeys.includes(125)||checkedKeys.includes(126)||checkedKeys.includes(127)) { + ifHasChannel.value = true + } else { + ifHasChannel.value = false + } }; + +//用于标记是否勾选频道管理 +const ifHasChannel = ref(false) const handleCheckChange = async (checkedNodes, checkedInfo) => { const { checkedKeys, checkedNodes: allCheckedNodes } = checkedInfo // 判断是否有选中的节点 if (allCheckedNodes.length === 0) { addRole.value.checkedKeys = [] + ifHasChannel.value = false return } @@ -348,6 +359,12 @@ const handleCheckChange = async (checkedNodes, checkedInfo) => { // 将Set转换为数组并更新 addRole.value.checkedKeys = Array.from(allKeys) console.log('新增角色包含所有父级的选中项:', addRole.value.checkedKeys) + if (addRole.value.checkedKeys.includes(124)) { + ifHasChannel.value = true + console.log('勾选了频道'); + } else { + ifHasChannel.value = false + } } const selectParentNodes = (treeData, nodeId, checkedKeys) => { if (!Array.isArray(treeData)) return false @@ -636,9 +653,9 @@ onMounted(async function () {