Merge branch 'sqlsugar-dev' into sqlsugar
This commit is contained in:
@@ -34,9 +34,9 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
/// <returns></returns>
|
||||
[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>
|
||||
[SugarColumn(ColumnName="MenuCode" )]
|
||||
[SugarColumn(ColumnName= "PermissionCode")]
|
||||
public string PermissionCode { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
|
||||
@@ -23,6 +23,6 @@ namespace Yi.Framework.Repository
|
||||
public Task<bool> UpdateIgnoreNullAsync(T entity);
|
||||
public Task<List<S>> UseSqlAsync<S>(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()
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Yi.Framework.Service
|
||||
{
|
||||
//ParentId 0,代表为根目录,只能存在一个
|
||||
//复杂查询直接使用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'
|
||||
export default {
|
||||
GetMenuInMould() {
|
||||
getMenuTree() {
|
||||
return myaxios({
|
||||
url: '/Menu/GetMenuInMould',
|
||||
url: '/Menu/getMenuTree',
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
addChildrenMenu(id, data) {
|
||||
Update(data) {
|
||||
return myaxios({
|
||||
url: '/Menu/addChildrenMenu',
|
||||
method: 'post',
|
||||
data: { parentId: id, data }
|
||||
})
|
||||
},
|
||||
UpdateMenu(data) {
|
||||
return myaxios({
|
||||
url: '/Menu/UpdateMenu',
|
||||
url: '/Menu/Update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
},
|
||||
DelListMenu(ids) {
|
||||
DeleteList(ids) {
|
||||
return myaxios({
|
||||
url: '/Menu/DelListMenu',
|
||||
url: '/Menu/DeleteList',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
},
|
||||
AddTopMenu(data) {
|
||||
Add(data) {
|
||||
return myaxios({
|
||||
url: '/Menu/AddTopMenu',
|
||||
url: '/Menu/Add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
},
|
||||
SetMouldByMenu(menuId, mouldId) {
|
||||
return myaxios({
|
||||
url: '/Menu/SetMouldByMenu',
|
||||
method: 'post',
|
||||
data: { id1: menuId, id2: mouldId }
|
||||
})
|
||||
},
|
||||
|
||||
GetTopMenusByHttpUser() {
|
||||
return myaxios({
|
||||
url: '/Menu/GetTopMenusByHttpUser',
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-divider></v-divider>
|
||||
<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" color="secondary" @click="deleteItem(null)">
|
||||
<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" color="secondary" @click="deleteItem(null)">
|
||||
删除所选
|
||||
</app-btn>
|
||||
|
||||
|
||||
|
||||
|
||||
<v-dialog v-model="dialog" max-width="500px">
|
||||
<v-card>
|
||||
@@ -53,15 +50,16 @@
|
||||
return-object
|
||||
open-all
|
||||
hoverable
|
||||
item-text="menu_name"
|
||||
item-text="menuName"
|
||||
>
|
||||
<template v-slot:append="{ item }">
|
||||
<v-btn class="mr-2">编号:{{ item.id }}</v-btn>
|
||||
<v-btn class="mr-2">图标:{{ item.icon }}</v-btn>
|
||||
<v-btn class="mr-2">路由:{{ item.router }}</v-btn>
|
||||
<v-btn v-if="item.mould" class="mr-2">接口名:{{ item.mould.mould_name }}</v-btn>
|
||||
<v-btn v-if="item.mould" class="mr-2" color="secondary">接口地址:{{ item.mould.url }}</v-btn>
|
||||
<ccCombobox
|
||||
<v-btn class="mr-2">权限:{{ item.permissionCode }}</v-btn>
|
||||
<!-- <v-btn class="mr-2">图标:{{ item.icon }}</v-btn> -->
|
||||
<!-- <v-btn class="mr-2">路由:{{ item.router }}</v-btn> -->
|
||||
<!-- <v-btn v-if="item.mould" class="mr-2">接口名:{{ item.mould.mould_name }}</v-btn>
|
||||
<v-btn v-if="item.mould" class="mr-2" color="secondary">接口地址:{{ item.mould.url }}</v-btn> -->
|
||||
<!-- <ccCombobox
|
||||
headers="设置接口权限"
|
||||
itemText="url"
|
||||
:items="mouldList"
|
||||
@@ -72,24 +70,24 @@
|
||||
保存</v-btn
|
||||
>
|
||||
</template>
|
||||
</ccCombobox>
|
||||
<app-btn
|
||||
</ccCombobox> -->
|
||||
<app-btn
|
||||
@click="
|
||||
parentId = item.id;
|
||||
editedItem.parentId = item.id;
|
||||
dialog = true;
|
||||
"
|
||||
>添加子菜单</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>
|
||||
</v-treeview>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import mouldApi from "../api/mouldApi";
|
||||
import menuApi from "../api/menuApi";
|
||||
export default {
|
||||
name: "ccTreeview",
|
||||
@@ -103,12 +101,12 @@ export default {
|
||||
dialog: false,
|
||||
editedItem: {},
|
||||
editedIndex: -1,
|
||||
parentId: 0,
|
||||
defaultItem: {
|
||||
icon: "mdi-start",
|
||||
router: "test",
|
||||
menu_name: "测试",
|
||||
is_show:1
|
||||
// icon: "mdi-start",
|
||||
permissionCode: "test",
|
||||
menuName: "管理",
|
||||
parentId: 0,
|
||||
MenuType:0
|
||||
},
|
||||
}),
|
||||
computed: {
|
||||
@@ -120,25 +118,25 @@ 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;
|
||||
},
|
||||
async deleteItem(item) {
|
||||
this.editedIndex = this.desserts.indexOf(item);
|
||||
this.editedIndex = 1;
|
||||
this.editedItem = Object.assign({}, item);
|
||||
var p = await this.$dialog.warning({
|
||||
text: "你确定要删除此条记录吗??",
|
||||
@@ -161,7 +159,7 @@ showAll(){
|
||||
Ids.push(item.id);
|
||||
});
|
||||
}
|
||||
menuApi.DelListMenu(Ids).then(() => this.init());
|
||||
menuApi.DeleteList(Ids).then(() => this.init());
|
||||
},
|
||||
|
||||
close() {
|
||||
@@ -173,20 +171,14 @@ showAll(){
|
||||
},
|
||||
init() {
|
||||
this.parentId = 0;
|
||||
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;
|
||||
@@ -196,17 +188,11 @@ showAll(){
|
||||
|
||||
save() {
|
||||
if (this.editedIndex > -1) {
|
||||
menuApi.UpdateMenu(this.editedItem).then(() => this.init());
|
||||
menuApi.Update(this.editedItem).then(() => this.init());
|
||||
} else {
|
||||
if (this.parentId == 0) {
|
||||
menuApi.AddTopMenu(this.editedItem).then(() => {
|
||||
menuApi.Add(this.editedItem).then(() => {
|
||||
this.init();
|
||||
});
|
||||
} else {
|
||||
menuApi.addChildrenMenu(this.parentId, this.editedItem).then(() => {
|
||||
this.init();
|
||||
});
|
||||
}
|
||||
}
|
||||
this.close();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user