From 90b39d075df63332a2a8be3c650fcf3193ef826a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com>
Date: Tue, 26 Apr 2022 19:21:37 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8F=9C=E5=8D=95=E6=9F=A5?=
=?UTF-8?q?=E8=AF=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/MenuController.cs | 4 +-
.../yi-sqlsugar-dev.db | Bin 90112 -> 102400 bytes
.../ModelsTemplate/MenuEntity.cs | 2 +-
.../Yi.Framework.Service/MenuService.cs | 2 +-
Yi.Vue2.x/src/api/menuApi.js | 12 +--
Yi.Vue2.x/src/components/ccTreeview.vue | 72 +++++++++---------
6 files changed, 41 insertions(+), 51 deletions(-)
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs
index c7fcf91d..136eccd7 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs
@@ -34,9 +34,9 @@ namespace Yi.Framework.ApiMicroservice.Controllers
///
[HttpGet]
//暂未制作逻辑删除与多租户的过滤
- public async Task> GetMenuTree()
+ public async Task GetMenuTree()
{
- return await _iMenuService.GetMenuTreeAsync();
+ return Result.Success().SetData(await _iMenuService.GetMenuTreeAsync());
}
}
}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db
index 9314907f96aab067eecc2b714eb89f669a8927dc..dc8a76bd2837ca776b57e02d6ac984d19ab27e43 100644
GIT binary patch
delta 790
zcmZoTz}m2YZGyC*4+8^(BoM=Z*hC#;VIKxP>yNBJAx8e+API5)-_r#G7!@{7%H#(L
zi}5rGY!hH)bl_#)$H2w7n}KmR|8>3%6AQ$6*fLnXS>>4bvAkt@JJC^+iLqp}qCf%T
z_Rs)EW+oN}1~z>lUz?4|k!P|ahsI`cu2-z`T(22;*t!|`rt$^xJm*=$EyDhX^Bm_w
zjv@|6wr=*zKn>Y!^-Zqg?Bb%Lj4in(iAg!BzNvYoAS~e=Hu}f-BYDp^43rU$!r-Y>DC8Ajr5aj9W7!;}C?HZ||0rIdW
zFPEme1e>_E=;Vdm5|b5Jx!5J0h1kTy4MBX(c#!Ag^K(+-jSP&83`~s7;tesyIQ7LQ
zH}c6$Udk-IIf6-_kxg5KP264*WWwfa%sPy~Xk^fwtSF!w(#$K!E^cVZ*y;+76ilNq
zML19+3{%1M`T$1t%{8orECRehi&*#r82E4TZ{hFb57?}z;K0vh!!lX6-iAqqdGdsM
zRYs=C+khnF+W;RZcO!y%I1^~@>%0vJF
delta 115
zcmZozz}9epb%L~@Hvz*v7U}e%8?9)FS34
zfo%eej1HVYNfCxn28Ph-Tmg(yT&&uxOw3Q2cQ8dvoTR>ecOWA()8+`K#k>$r0HMwn
A{r~^~
diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs
index d65c6f90..062ff186 100644
--- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs
@@ -32,7 +32,7 @@ namespace Yi.Framework.Model.Models
///
///
///
- [SugarColumn(ColumnName="MenuCode" )]
+ [SugarColumn(ColumnName= "PermissionCode")]
public string PermissionCode { get; set; }
///
///
diff --git a/Yi.Framework.Net6/Yi.Framework.Service/MenuService.cs b/Yi.Framework.Net6/Yi.Framework.Service/MenuService.cs
index dce836fd..e85ef7f2 100644
--- a/Yi.Framework.Net6/Yi.Framework.Service/MenuService.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Service/MenuService.cs
@@ -13,7 +13,7 @@ namespace Yi.Framework.Service
{
//ParentId 0,代表为根目录,只能存在一个
//复杂查询直接使用db代理
- return await _repository._Db.Queryable().ToTreeAsync(it=>it.Children,it=>it.ParentId,0);
+ return await _repository._Db.Queryable().Where(u=>u.IsDeleted==false).ToTreeAsync(it=>it.Children,it=>it.ParentId,0);
}
}
}
diff --git a/Yi.Vue2.x/src/api/menuApi.js b/Yi.Vue2.x/src/api/menuApi.js
index 26abc23a..12c00e16 100644
--- a/Yi.Vue2.x/src/api/menuApi.js
+++ b/Yi.Vue2.x/src/api/menuApi.js
@@ -1,8 +1,8 @@
import myaxios from '@/util/myaxios'
export default {
- GetMenuInMould() {
+ getMenuTree() {
return myaxios({
- url: '/Menu/GetMenuInMould',
+ url: '/Menu/getMenuTree',
method: 'get'
})
},
@@ -34,13 +34,7 @@ export default {
data: data
})
},
- SetMouldByMenu(menuId, mouldId) {
- return myaxios({
- url: '/Menu/SetMouldByMenu',
- method: 'post',
- data: { id1: menuId, id2: mouldId }
- })
- },
+
GetTopMenusByHttpUser() {
return myaxios({
url: '/Menu/GetTopMenusByHttpUser',
diff --git a/Yi.Vue2.x/src/components/ccTreeview.vue b/Yi.Vue2.x/src/components/ccTreeview.vue
index e90c02c2..744eaa01 100644
--- a/Yi.Vue2.x/src/components/ccTreeview.vue
+++ b/Yi.Vue2.x/src/components/ccTreeview.vue
@@ -1,14 +1,11 @@
-
展开全部
-
添加新项
-
+ 展开全部
+ 添加新项
+
删除所选
-
-
-
@@ -53,15 +50,16 @@
return-object
open-all
hoverable
- item-text="menu_name"
+ item-text="menuName"
>
编号:{{ item.id }}
- 图标:{{ item.icon }}
- 路由:{{ item.router }}
- 接口名:{{ item.mould.mould_name }}
- 接口地址:{{ item.mould.url }}
- 权限:{{ item.permissionCode }}
+
+
+
+
+ 添加子菜单
编辑
-
- 删除
-
+
+ 删除
@@ -108,7 +107,7 @@ export default {
icon: "mdi-start",
router: "test",
menu_name: "测试",
- is_show:1
+ is_show: 1,
},
}),
computed: {
@@ -120,20 +119,20 @@ export default {
this.init();
},
methods: {
-showAll(){
- this.$refs.tree.updateAll(true);
-},
-
- setMould(item) {
- menuApi.SetMouldByMenu(item.id, this.mouldSelect[0].id).then((resp) => {
- this.$dialog.notify.info(resp.msg, {
- position: "top-right",
- timeout: 5000,
- });
- this.init();
- });
+ showAll() {
+ this.$refs.tree.updateAll(true);
},
+ // setMould(item) {
+ // menuApi.SetMouldByMenu(item.id, this.mouldSelect[0].id).then((resp) => {
+ // this.$dialog.notify.info(resp.msg, {
+ // position: "top-right",
+ // timeout: 5000,
+ // });
+ // this.init();
+ // });
+ // },
+
getSelect(data) {
this.mouldSelect = data;
},
@@ -173,20 +172,17 @@ showAll(){
},
init() {
this.parentId = 0;
- mouldApi.getMould().then((resp) => {
- this.mouldList = resp.data;
- });
+ // mouldApi.getMould().then((resp) => {
+ // this.mouldList = resp.data;
+ // });
- menuApi.GetMenuInMould().then((resp) => {
- this.desserts =[ resp.data];
+ menuApi.getMenuTree().then((resp) => {
+ this.desserts = resp.data;
});
this.$nextTick(() => {
this.editedItem = Object.assign({}, this.defaultItem);
this.editedIndex = -1;
});
-
-
-
},
editItem(item) {
this.editedIndex = item.id;