Merge branch 'sqlsugar-dev' into sqlsugar
This commit is contained in:
@@ -34,9 +34,9 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
//暂未制作逻辑删除与多租户的过滤
|
//暂未制作逻辑删除与多租户的过滤
|
||||||
public async Task<List<MenuEntity>> GetMenuTree()
|
public async Task<Result> GetMenuTree()
|
||||||
{
|
{
|
||||||
return await _iMenuService.GetMenuTreeAsync();
|
return Result.Success().SetData(await _iMenuService. GetMenuTreeAsync());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -32,7 +32,7 @@ namespace Yi.Framework.Model.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName="MenuCode" )]
|
[SugarColumn(ColumnName= "PermissionCode")]
|
||||||
public string PermissionCode { get; set; }
|
public string PermissionCode { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ namespace Yi.Framework.Repository
|
|||||||
public Task<bool> UpdateIgnoreNullAsync(T entity);
|
public Task<bool> UpdateIgnoreNullAsync(T entity);
|
||||||
public Task<List<S>> UseSqlAsync<S>(string sql);
|
public Task<List<S>> UseSqlAsync<S>(string sql);
|
||||||
public Task<bool> UseSqlAsync(string sql);
|
public Task<bool> UseSqlAsync(string sql);
|
||||||
|
ISugarQueryable<T> QueryConditionHandler(QueryCondition pars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ namespace Yi.Framework.Repository
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ISugarQueryable<T> QueryConditionHandler(QueryCondition pars)
|
public ISugarQueryable<T> QueryConditionHandler(QueryCondition pars)
|
||||||
{
|
{
|
||||||
var sugarParamters = pars.Parameters.Select(it => (IConditionalModel)new ConditionalModel()
|
var sugarParamters = pars.Parameters.Select(it => (IConditionalModel)new ConditionalModel()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Yi.Framework.Service
|
|||||||
{
|
{
|
||||||
//ParentId 0,代表为根目录,只能存在一个
|
//ParentId 0,代表为根目录,只能存在一个
|
||||||
//复杂查询直接使用db代理
|
//复杂查询直接使用db代理
|
||||||
return await _repository._Db.Queryable<MenuEntity>().ToTreeAsync(it=>it.Children,it=>it.ParentId,0);
|
return await _repository._Db.Queryable<MenuEntity>().Where(u=>u.IsDeleted==false).ToTreeAsync(it=>it.Children,it=>it.ParentId,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,46 +1,33 @@
|
|||||||
import myaxios from '@/util/myaxios'
|
import myaxios from '@/util/myaxios'
|
||||||
export default {
|
export default {
|
||||||
GetMenuInMould() {
|
getMenuTree() {
|
||||||
return myaxios({
|
return myaxios({
|
||||||
url: '/Menu/GetMenuInMould',
|
url: '/Menu/getMenuTree',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
addChildrenMenu(id, data) {
|
Update(data) {
|
||||||
return myaxios({
|
return myaxios({
|
||||||
url: '/Menu/addChildrenMenu',
|
url: '/Menu/Update',
|
||||||
method: 'post',
|
|
||||||
data: { parentId: id, data }
|
|
||||||
})
|
|
||||||
},
|
|
||||||
UpdateMenu(data) {
|
|
||||||
return myaxios({
|
|
||||||
url: '/Menu/UpdateMenu',
|
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
DelListMenu(ids) {
|
DeleteList(ids) {
|
||||||
return myaxios({
|
return myaxios({
|
||||||
url: '/Menu/DelListMenu',
|
url: '/Menu/DeleteList',
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
data: ids
|
data: ids
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
AddTopMenu(data) {
|
Add(data) {
|
||||||
return myaxios({
|
return myaxios({
|
||||||
url: '/Menu/AddTopMenu',
|
url: '/Menu/Add',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
SetMouldByMenu(menuId, mouldId) {
|
|
||||||
return myaxios({
|
|
||||||
url: '/Menu/SetMouldByMenu',
|
|
||||||
method: 'post',
|
|
||||||
data: { id1: menuId, id2: mouldId }
|
|
||||||
})
|
|
||||||
},
|
|
||||||
GetTopMenusByHttpUser() {
|
GetTopMenusByHttpUser() {
|
||||||
return myaxios({
|
return myaxios({
|
||||||
url: '/Menu/GetTopMenusByHttpUser',
|
url: '/Menu/GetTopMenusByHttpUser',
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
<app-btn dark class="ma-4" @click="showAll"> 展开全部</app-btn>
|
<app-btn dark class="ma-4" @click="showAll"> 展开全部</app-btn>
|
||||||
<app-btn dark class="my-4 mr-4" @click="dialog = true"> 添加新项 </app-btn>
|
<app-btn dark class="my-4 mr-4" @click="dialog = true"> 添加新项 </app-btn>
|
||||||
<app-btn dark class="my-4" color="secondary" @click="deleteItem(null)">
|
<app-btn dark class="my-4" color="secondary" @click="deleteItem(null)">
|
||||||
删除所选
|
删除所选
|
||||||
</app-btn>
|
</app-btn>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<v-dialog v-model="dialog" max-width="500px">
|
<v-dialog v-model="dialog" max-width="500px">
|
||||||
<v-card>
|
<v-card>
|
||||||
@@ -53,15 +50,16 @@
|
|||||||
return-object
|
return-object
|
||||||
open-all
|
open-all
|
||||||
hoverable
|
hoverable
|
||||||
item-text="menu_name"
|
item-text="menuName"
|
||||||
>
|
>
|
||||||
<template v-slot:append="{ item }">
|
<template v-slot:append="{ item }">
|
||||||
<v-btn class="mr-2">编号:{{ item.id }}</v-btn>
|
<v-btn class="mr-2">编号:{{ item.id }}</v-btn>
|
||||||
<v-btn class="mr-2">图标:{{ item.icon }}</v-btn>
|
<v-btn class="mr-2">权限:{{ item.permissionCode }}</v-btn>
|
||||||
<v-btn class="mr-2">路由:{{ item.router }}</v-btn>
|
<!-- <v-btn class="mr-2">图标:{{ item.icon }}</v-btn> -->
|
||||||
<v-btn v-if="item.mould" class="mr-2">接口名:{{ item.mould.mould_name }}</v-btn>
|
<!-- <v-btn class="mr-2">路由:{{ item.router }}</v-btn> -->
|
||||||
<v-btn v-if="item.mould" class="mr-2" color="secondary">接口地址:{{ item.mould.url }}</v-btn>
|
<!-- <v-btn v-if="item.mould" class="mr-2">接口名:{{ item.mould.mould_name }}</v-btn>
|
||||||
<ccCombobox
|
<v-btn v-if="item.mould" class="mr-2" color="secondary">接口地址:{{ item.mould.url }}</v-btn> -->
|
||||||
|
<!-- <ccCombobox
|
||||||
headers="设置接口权限"
|
headers="设置接口权限"
|
||||||
itemText="url"
|
itemText="url"
|
||||||
:items="mouldList"
|
:items="mouldList"
|
||||||
@@ -72,24 +70,24 @@
|
|||||||
保存</v-btn
|
保存</v-btn
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</ccCombobox>
|
</ccCombobox> -->
|
||||||
<app-btn
|
<app-btn
|
||||||
@click="
|
@click="
|
||||||
parentId = item.id;
|
editedItem.parentId = item.id;
|
||||||
dialog = true;
|
dialog = true;
|
||||||
"
|
"
|
||||||
>添加子菜单</app-btn
|
>添加子菜单</app-btn
|
||||||
>
|
>
|
||||||
<app-btn class="mx-2" @click="editItem(item)">编辑</app-btn>
|
<app-btn class="mx-2" @click="editItem(item)">编辑</app-btn>
|
||||||
|
|
||||||
<app-btn color="secondary" class="mr-2" @click="deleteItem(item)">删除</app-btn>
|
<app-btn color="secondary" class="mr-2" @click="deleteItem(item)"
|
||||||
|
>删除</app-btn
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</v-treeview>
|
</v-treeview>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import mouldApi from "../api/mouldApi";
|
|
||||||
import menuApi from "../api/menuApi";
|
import menuApi from "../api/menuApi";
|
||||||
export default {
|
export default {
|
||||||
name: "ccTreeview",
|
name: "ccTreeview",
|
||||||
@@ -103,12 +101,12 @@ export default {
|
|||||||
dialog: false,
|
dialog: false,
|
||||||
editedItem: {},
|
editedItem: {},
|
||||||
editedIndex: -1,
|
editedIndex: -1,
|
||||||
parentId: 0,
|
|
||||||
defaultItem: {
|
defaultItem: {
|
||||||
icon: "mdi-start",
|
// icon: "mdi-start",
|
||||||
router: "test",
|
permissionCode: "test",
|
||||||
menu_name: "测试",
|
menuName: "管理",
|
||||||
is_show:1
|
parentId: 0,
|
||||||
|
MenuType:0
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
@@ -120,25 +118,25 @@ export default {
|
|||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showAll(){
|
showAll() {
|
||||||
this.$refs.tree.updateAll(true);
|
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();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 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) {
|
getSelect(data) {
|
||||||
this.mouldSelect = data;
|
this.mouldSelect = data;
|
||||||
},
|
},
|
||||||
async deleteItem(item) {
|
async deleteItem(item) {
|
||||||
this.editedIndex = this.desserts.indexOf(item);
|
this.editedIndex = 1;
|
||||||
this.editedItem = Object.assign({}, item);
|
this.editedItem = Object.assign({}, item);
|
||||||
var p = await this.$dialog.warning({
|
var p = await this.$dialog.warning({
|
||||||
text: "你确定要删除此条记录吗??",
|
text: "你确定要删除此条记录吗??",
|
||||||
@@ -161,7 +159,7 @@ showAll(){
|
|||||||
Ids.push(item.id);
|
Ids.push(item.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
menuApi.DelListMenu(Ids).then(() => this.init());
|
menuApi.DeleteList(Ids).then(() => this.init());
|
||||||
},
|
},
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
@@ -173,20 +171,14 @@ showAll(){
|
|||||||
},
|
},
|
||||||
init() {
|
init() {
|
||||||
this.parentId = 0;
|
this.parentId = 0;
|
||||||
mouldApi.getMould().then((resp) => {
|
|
||||||
this.mouldList = resp.data;
|
|
||||||
});
|
|
||||||
|
|
||||||
menuApi.GetMenuInMould().then((resp) => {
|
menuApi.getMenuTree().then((resp) => {
|
||||||
this.desserts =[ resp.data];
|
this.desserts = resp.data;
|
||||||
});
|
});
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.editedItem = Object.assign({}, this.defaultItem);
|
this.editedItem = Object.assign({}, this.defaultItem);
|
||||||
this.editedIndex = -1;
|
this.editedIndex = -1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
editItem(item) {
|
editItem(item) {
|
||||||
this.editedIndex = item.id;
|
this.editedIndex = item.id;
|
||||||
@@ -196,17 +188,11 @@ showAll(){
|
|||||||
|
|
||||||
save() {
|
save() {
|
||||||
if (this.editedIndex > -1) {
|
if (this.editedIndex > -1) {
|
||||||
menuApi.UpdateMenu(this.editedItem).then(() => this.init());
|
menuApi.Update(this.editedItem).then(() => this.init());
|
||||||
} else {
|
} else {
|
||||||
if (this.parentId == 0) {
|
menuApi.Add(this.editedItem).then(() => {
|
||||||
menuApi.AddTopMenu(this.editedItem).then(() => {
|
|
||||||
this.init();
|
this.init();
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
menuApi.addChildrenMenu(this.parentId, this.editedItem).then(() => {
|
|
||||||
this.init();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user