优化若干功能
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
import { ref, watch, computed } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { getRoleById } from "@/api/role";
|
||||
import { getAllMenus } from "@/api/menu";
|
||||
import { getAssignableMenus } from "@/api/menu";
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean;
|
||||
@@ -151,10 +151,10 @@ const loadRoleDetail = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 加载菜单树:租户端只展示租户端菜单(cid=2)
|
||||
// 加载菜单树:服务端已按 cid=2(租户端)+ 已启用 + 已显示 过滤
|
||||
const loadMenus = async () => {
|
||||
try {
|
||||
const res = await getAllMenus({ cid: 2 });
|
||||
const res = await getAssignableMenus({ cid: 2 });
|
||||
if (res.code === 200) {
|
||||
allMenus.value = res.data || [];
|
||||
}
|
||||
|
||||
@@ -21,9 +21,6 @@
|
||||
<el-tag :type="form.is_custom ? 'warning' : 'primary'" size="small">
|
||||
{{ form.is_custom ? "自定义角色" : "系统预置租户角色" }}
|
||||
</el-tag>
|
||||
<div class="form-tip">
|
||||
当前为租户端,仅可维护本租户的自定义角色:权限范围限定在租户端菜单,数据按租户隔离,平台端不可见。
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="权限设置" prop="rights">
|
||||
@@ -53,7 +50,7 @@
|
||||
import { ref, watch, nextTick } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { createRole, updateRole } from "@/api/role";
|
||||
import { getAllMenus } from "@/api/menu";
|
||||
import { getAssignableMenus } from "@/api/menu";
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean;
|
||||
@@ -155,10 +152,10 @@ const toggleSelectAll = () => {
|
||||
|
||||
// --- 数据加载与监听 ---
|
||||
|
||||
// 加载菜单树数据:租户端只展示租户端菜单(cid=2),平台菜单不在此分配
|
||||
// 加载菜单树数据:服务端已按 cid=2(租户端)+ 已启用 + 已显示 过滤
|
||||
const loadMenus = async () => {
|
||||
try {
|
||||
const res = await getAllMenus({ cid: 2 });
|
||||
const res = await getAssignableMenus({ cid: 2 });
|
||||
if (res.code === 200) {
|
||||
menuTree.value = res.data || [];
|
||||
}
|
||||
@@ -246,9 +243,9 @@ const handleSubmit = async () => {
|
||||
await formRef.value.validate();
|
||||
|
||||
// 只获取完全选中的节点(不包含半选父节点)
|
||||
const checkedKeys = treeRef.value.getCheckedKeys();
|
||||
const checkedKeys: number[] = treeRef.value.getCheckedKeys();
|
||||
|
||||
// 租户端只提交基础字段,cid/tenant_id/is_custom 由服务端按当前租户写入
|
||||
// 租户端只提交基础字段;cid/tenant_id/is_custom 与权限合法性由服务端校验收敛
|
||||
const submitData: any = {
|
||||
name: form.value.name,
|
||||
status: form.value.status,
|
||||
@@ -285,11 +282,4 @@ const handleSubmit = async () => {
|
||||
:deep(.el-tree) {
|
||||
background-color: var(--el-bg-color);
|
||||
}
|
||||
|
||||
.form-tip {
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
line-height: 1.4;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user