feat: 完成菜单接入

This commit is contained in:
橙子
2024-09-07 13:43:00 +08:00
parent 978a7fab4c
commit 40b5f33c4e
12 changed files with 41 additions and 18 deletions

View File

@@ -24,5 +24,7 @@ namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Menu
public string? Component { get; set; } public string? Component { get; set; }
public string? Query { get; set; } public string? Query { get; set; }
public int OrderNum { get; set; } public int OrderNum { get; set; }
public MenuSourceEnum MenuSource { get; set; } = MenuSourceEnum.Ruoyi;
public string? RouterName { get; set; }
} }
} }

View File

@@ -1,4 +1,5 @@
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Yi.Framework.Rbac.Domain.Shared.Enums;
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Menu namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Menu
{ {
@@ -7,6 +8,6 @@ namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Menu
public bool? State { get; set; } public bool? State { get; set; }
public string? MenuName { get; set; } public string? MenuName { get; set; }
public MenuSourceEnum MenuSource { get; set; } = MenuSourceEnum.Ruoyi;
} }
} }

View File

@@ -20,7 +20,6 @@ namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Menu
public string? Component { get; set; } public string? Component { get; set; }
public string? Query { get; set; } public string? Query { get; set; }
public int OrderNum { get; set; } public int OrderNum { get; set; }
public string? RouterName { get; set; }
//public List<MenuEntity>? Children { get; set; }
} }
} }

View File

@@ -28,6 +28,7 @@ namespace Yi.Framework.Rbac.Application.Services.System
var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.MenuName), x => x.MenuName.Contains(input.MenuName!)) var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.MenuName), x => x.MenuName.Contains(input.MenuName!))
.WhereIF(input.State is not null, x => x.State == input.State) .WhereIF(input.State is not null, x => x.State == input.State)
.Where(x=>x.MenuSource==input.MenuSource)
.OrderByDescending(x => x.OrderNum) .OrderByDescending(x => x.OrderNum)
.ToListAsync(); .ToListAsync();
//.ToPageListAsync(input.SkipCount, input.MaxResultCount, total); //.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
@@ -45,5 +46,15 @@ namespace Yi.Framework.Rbac.Application.Services.System
return await MapToGetListOutputDtosAsync(entities); return await MapToGetListOutputDtosAsync(entities);
} }
public override Task<MenuGetOutputDto> UpdateAsync(Guid id, MenuUpdateInputVo input)
{
return base.UpdateAsync(id, input);
}
public override Task<MenuGetOutputDto> CreateAsync(MenuCreateInputVo input)
{
return base.CreateAsync(input);
}
} }
} }

View File

@@ -40,7 +40,7 @@ const testRouter = [
frameLoading: null, frameLoading: null,
keepAlive: null, keepAlive: null,
showLink: true showLink: true
}, }
}, },
{ {
path: "/monitor/operation-logs", path: "/monitor/operation-logs",
@@ -50,7 +50,7 @@ const testRouter = [
title: "操作日志", title: "操作日志",
component: "monitor/logs/operation/index", component: "monitor/logs/operation/index",
showLink: true showLink: true
}, }
}, },
{ {
id: "580a7b97-15ab-6d43-d011-3a14dab3cadc", id: "580a7b97-15ab-6d43-d011-3a14dab3cadc",

View File

@@ -28,7 +28,7 @@ const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
// 动态路由 // 动态路由
// getAsyncRoutes // getAsyncRoutes
import { getRoutes,getAsyncRoutes } from "@/api/routes"; import { getRoutes } from "@/api/routes";
function handRank(routeInfo: any) { function handRank(routeInfo: any) {
const { name, path, parentId, meta } = routeInfo; const { name, path, parentId, meta } = routeInfo;

View File

@@ -28,11 +28,13 @@ const props = withDefaults(defineProps<FormProps>(), {
router: "", router: "",
component: "", component: "",
orderNum: 0, orderNum: 0,
icon: "", menuIcon: "",
permissionCode: "", permissionCode: "",
isShow: true, isShow: true,
isLink: false, isLink: false,
state: true state: true,
routerName: "",
menuSource: "Pure"
}) })
}); });
@@ -93,7 +95,7 @@ defineExpose({ getRef });
:sm="24" :sm="24"
> >
<el-form-item label="菜单图标"> <el-form-item label="菜单图标">
<IconSelect v-model="newFormInline.icon" class="w-full" /> <IconSelect v-model="newFormInline.menuIcon" class="w-full" />
</el-form-item> </el-form-item>
</re-col> </re-col>
<re-col :value="12" :xs="24" :sm="24"> <re-col :value="12" :xs="24" :sm="24">

View File

@@ -18,7 +18,8 @@ import { menuTypeOptions } from "@/views/system/menu/utils/enums";
export function useMenu() { export function useMenu() {
const form = reactive({ const form = reactive({
menuName: "" menuName: "",
menuSource: "Pure"
}); });
const formRef = ref(); const formRef = ref();
@@ -44,7 +45,7 @@ export function useMenu() {
cellRenderer: ({ row }) => ( cellRenderer: ({ row }) => (
<> <>
<span class="inline-block mr-1"> <span class="inline-block mr-1">
{h(useRenderIcon(row.icon), { {h(useRenderIcon(row.menuIcon), {
style: { paddingTop: "1px" } style: { paddingTop: "1px" }
})} })}
</span> </span>
@@ -137,7 +138,7 @@ export function useMenu() {
async function openDialog(title = "新增", row?: FormItemProps) { async function openDialog(title = "新增", row?: FormItemProps) {
let data: any = null; let data: any = null;
if (title == "修改") { if (title == "修改") {
data = await getMenu(row.id); data = (await getMenu(row.id)).data;
} }
addDialog({ addDialog({
title: `${title}菜单`, title: `${title}菜单`,
@@ -156,11 +157,13 @@ export function useMenu() {
router: data?.router ?? "", router: data?.router ?? "",
component: data?.component ?? "", component: data?.component ?? "",
orderNum: data?.orderNum ?? 0, orderNum: data?.orderNum ?? 0,
icon: data?.icon ?? "", menuIcon: data?.menuIcon ?? "",
permissionCode: data?.permissionCode ?? "", permissionCode: data?.permissionCode ?? "",
showLink: data?.isShow ?? true, showLink: data?.isShow ?? true,
isLink: data?.isLink ?? false, isLink: data?.isLink ?? false,
state: data?.state ?? true state: data?.state ?? true,
routerName: data?.routerName ?? "",
menuSource: data?.menuSource ?? "Pure"
} }
}, },
width: "45%", width: "45%",

View File

@@ -8,11 +8,13 @@ interface FormItemProps {
router: string; router: string;
component: string; component: string;
orderNum: number; orderNum: number;
icon: string; menuIcon: string;
permissionCode: string; permissionCode: string;
isShow: boolean; isShow: boolean;
isLink: boolean; isLink: boolean;
state: boolean; state: boolean;
routerName: string;
menuSource: string;
} }
interface FormProps { interface FormProps {
formInline: FormItemProps; formInline: FormItemProps;

View File

@@ -48,7 +48,8 @@ export function usePost() {
const columns: TableColumnList = [ const columns: TableColumnList = [
{ {
label: "岗位编号", label: "岗位编号",
prop: "id" prop: "id",
width: 300
}, },
{ {
label: "岗位名称", label: "岗位名称",

View File

@@ -66,7 +66,9 @@ export function useRole(treeRef: Ref) {
const columns: TableColumnList = [ const columns: TableColumnList = [
{ {
label: "角色编号", label: "角色编号",
prop: "id" prop: "id",
width: "300",
fixed: true
}, },
{ {
label: "角色名称", label: "角色名称",

View File

@@ -84,7 +84,7 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
{ {
label: "用户编号", label: "用户编号",
prop: "id", prop: "id",
width: 200 width: 300
}, },
{ {
label: "用户头像", label: "用户头像",