Merge branch 'main' of https://github.com/ccnetcore/Yi into main
This commit is contained in:
@@ -66,6 +66,13 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.AddChildrenMenu(Yi.Framework.DTOModel.ChildrenDto{Yi.Framework.Model.Models.menu})">
|
||||||
|
<summary>
|
||||||
|
给一个菜单添加子节点(注意:添加,不是覆盖)
|
||||||
|
</summary>
|
||||||
|
<param name="childrenDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MouldController.UpdateMould(Yi.Framework.Model.Models.mould)">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MouldController.UpdateMould(Yi.Framework.Model.Models.mould)">
|
||||||
<summary>
|
<summary>
|
||||||
更
|
更
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ namespace Yi.Framework.Service
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var menuList = _Db.Set<menu>().Where(u => menuIds.Contains(u.id)&&u.is_delete == (short)Common.Enum.DelFlagEnum.Normal).ToListAsync();
|
var menuList = await _Db.Set<menu>().Where(u => menuIds.Contains(u.id)&&u.is_delete == (short)Common.Enum.DelFlagEnum.Normal).ToListAsync();
|
||||||
|
|
||||||
role_data.menus = (ICollection<menu>)menuList;
|
role_data.menus =menuList;
|
||||||
return await AddAsync(role_data);
|
return await AddAsync(role_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,4 +6,39 @@ export default {
|
|||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
addChildrenMenu(id, data) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Menu/addChildrenMenu',
|
||||||
|
method: 'post',
|
||||||
|
data: { parentId: id, data }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
UpdateMenu(data) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Menu/UpdateMenu',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
DelListMenu(ids) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Menu/DelListMenu',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
},
|
||||||
|
addMenu(data) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Menu/addMenu',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
SetMouldByMenu(menuId, mouldId) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Menu/SetMouldByMenu',
|
||||||
|
method: 'post',
|
||||||
|
data: { id1: menuId, id2: mouldId }
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
10
Yi.Vue/src/api/mouldApi.js
Normal file
10
Yi.Vue/src/api/mouldApi.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import myaxios from '@/util/myaxios'
|
||||||
|
export default {
|
||||||
|
getMould() {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Mould/GetMould',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,5 +5,12 @@ export default {
|
|||||||
url: '/Role/getRole',
|
url: '/Role/getRole',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
setMenuByRole(roleList, menuList) {
|
||||||
|
return myaxios({
|
||||||
|
url: '/Role/setMenuByRole',
|
||||||
|
method: 'post',
|
||||||
|
data: { ids1: roleList, ids2: menuList }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,9 +26,9 @@
|
|||||||
<div class="text-body-1 font-weight-light pt-6 pt-md-0 text-center">
|
<div class="text-body-1 font-weight-light pt-6 pt-md-0 text-center">
|
||||||
© {{ (new Date()).getFullYear() }}, Made by <v-icon>mdi-vuetify</v-icon>
|
© {{ (new Date()).getFullYear() }}, Made by <v-icon>mdi-vuetify</v-icon>
|
||||||
<a
|
<a
|
||||||
href="https://vuetifyjs.com/en/about/meet-the-team/#company"
|
href="https://ccnetcore"
|
||||||
class="text-decoration-none"
|
class="text-decoration-none"
|
||||||
>Vuetify</a>
|
>ccnetcore</a>
|
||||||
</div>
|
</div>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -42,21 +42,17 @@
|
|||||||
data: () => ({
|
data: () => ({
|
||||||
links: [
|
links: [
|
||||||
{
|
{
|
||||||
href: 'https://vuetifyjs.com/',
|
href: '#',
|
||||||
text: 'Vuetify Docs',
|
text: 'YiFramework文档',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: '#',
|
href: '#',
|
||||||
text: 'About Us',
|
text: 'GitHub',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: '#',
|
href: '#',
|
||||||
text: 'Blog',
|
text: '论坛',
|
||||||
},
|
}
|
||||||
{
|
|
||||||
href: '#',
|
|
||||||
text: 'Licenses',
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-dialog v-model="dialog" persistent max-width="600px">
|
<v-dialog v-model="dialog" persistent max-width="600px">
|
||||||
<template v-slot:activator="{ on, attrs }">
|
<template v-slot:activator="{ on, attrs }">
|
||||||
<v-btn color="primary" dark v-bind="attrs" v-on="on">
|
<v-btn class="ma-2" color="primary" dark v-bind="attrs" v-on="on">
|
||||||
{{ headers }}
|
{{ headers }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -74,8 +74,8 @@
|
|||||||
|
|
||||||
<v-btn
|
<v-btn
|
||||||
v-if="axiosUrls.hasOwnProperty('del')"
|
v-if="axiosUrls.hasOwnProperty('del')"
|
||||||
color="red"
|
color="secondary"
|
||||||
dark
|
|
||||||
class="mb-2"
|
class="mb-2"
|
||||||
@click="deleteItem(null)"
|
@click="deleteItem(null)"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,37 +1,198 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-treeview
|
<div>
|
||||||
selectable
|
<app-btn dark class="ma-2" @click="dialog = true"> 添加新项 </app-btn>
|
||||||
:items="items"
|
<app-btn dark class="ma-2" color="secondary" @click="deleteItem(null)">
|
||||||
:selection-type="selectionType"
|
删除所选
|
||||||
v-model="selection"
|
</app-btn>
|
||||||
return-object
|
|
||||||
open-all
|
<v-dialog v-model="dialog" max-width="500px">
|
||||||
hoverable
|
<v-card>
|
||||||
item-text="menu_name"
|
<v-card-title>
|
||||||
>
|
<span class="headline">{{ formTitle }}</span>
|
||||||
<template v-slot:append="{ item }">
|
</v-card-title>
|
||||||
<v-btn>编号:{{ item.id }}</v-btn>
|
|
||||||
<v-btn>图标:{{ item.icon }}</v-btn>
|
<v-card-text>
|
||||||
<v-btn>路由:{{ item.router }}</v-btn>
|
<v-container>
|
||||||
<v-btn>设置接口权限</v-btn>
|
<v-row>
|
||||||
<v-btn>编辑</v-btn>
|
<v-col
|
||||||
<v-btn>删除</v-btn>
|
cols="12"
|
||||||
<v-btn>添加子菜单</v-btn>
|
sm="6"
|
||||||
</template>
|
md="4"
|
||||||
</v-treeview>
|
v-for="(value, key, index) in editedItem"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<v-text-field
|
||||||
|
v-model="editedItem[key]"
|
||||||
|
:label="key"
|
||||||
|
></v-text-field>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-container>
|
||||||
|
</v-card-text>
|
||||||
|
|
||||||
|
<v-card-actions>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-btn color="blue darken-1" text @click="close"> 取消 </v-btn>
|
||||||
|
<v-btn color="blue darken-1" text @click="save"> 保存 </v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
|
||||||
|
<v-treeview
|
||||||
|
selectable
|
||||||
|
:items="desserts"
|
||||||
|
:selection-type="selectionType"
|
||||||
|
v-model="selection"
|
||||||
|
return-object
|
||||||
|
open-all
|
||||||
|
hoverable
|
||||||
|
item-text="menu_name"
|
||||||
|
>
|
||||||
|
<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>
|
||||||
|
<ccCombobox
|
||||||
|
headers="设置接口权限"
|
||||||
|
itemText="mould_name"
|
||||||
|
:items="mouldList"
|
||||||
|
@select="getSelect"
|
||||||
|
>
|
||||||
|
<template v-slot:save>
|
||||||
|
<v-btn @click="setMould(item)" color="blue darken-1" text>
|
||||||
|
保存</v-btn
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</ccCombobox>
|
||||||
|
<app-btn
|
||||||
|
@click="
|
||||||
|
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>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</v-treeview>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import mouldApi from "../api/mouldApi";
|
||||||
|
import menuApi from "../api/menuApi";
|
||||||
export default {
|
export default {
|
||||||
name: "ccTreeview",
|
name: "ccTreeview",
|
||||||
props: {
|
|
||||||
items: {
|
|
||||||
type: Array,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
|
mouldSelect: [],
|
||||||
|
mouldList: [],
|
||||||
|
desserts: [],
|
||||||
selectionType: "leaf",
|
selectionType: "leaf",
|
||||||
selection: [],
|
selection: [],
|
||||||
|
dialog: false,
|
||||||
|
editedItem: {},
|
||||||
|
editedIndex: -1,
|
||||||
|
parentId: 0,
|
||||||
|
defaultItem: {
|
||||||
|
icon: "mdi-start",
|
||||||
|
router: "test",
|
||||||
|
menu_name: "测试",
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
|
computed: {
|
||||||
|
formTitle() {
|
||||||
|
return this.editedIndex === -1 ? "添加数据" : "编辑数据";
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setMould(item) {
|
||||||
|
menuApi.SetMouldByMenu(item.id, this.mouldSelect[0].id).then((resp) => {
|
||||||
|
this.$dialog.notify.info(resp.msg, {
|
||||||
|
position: "top-right",
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
getSelect(data) {
|
||||||
|
this.mouldSelect = data;
|
||||||
|
},
|
||||||
|
async deleteItem(item) {
|
||||||
|
this.editedIndex = this.desserts.indexOf(item);
|
||||||
|
this.editedItem = Object.assign({}, item);
|
||||||
|
var p = await this.$dialog.warning({
|
||||||
|
text: "你确定要删除此条记录吗??",
|
||||||
|
title: "警告",
|
||||||
|
actions: {
|
||||||
|
false: "取消",
|
||||||
|
true: "确定",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (p) {
|
||||||
|
this.deleteItemConfirm();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deleteItemConfirm() {
|
||||||
|
var Ids = [];
|
||||||
|
if (this.editedIndex > -1) {
|
||||||
|
Ids.push(this.editedItem.id);
|
||||||
|
} else {
|
||||||
|
this.selection.forEach(function (item) {
|
||||||
|
Ids.push(item.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
menuApi.DelListMenu(Ids).then(() => this.init());
|
||||||
|
},
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.dialog = false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.editedItem = Object.assign({}, this.defaultItem);
|
||||||
|
this.editedIndex = -1;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
init() {
|
||||||
|
this.parentId = 0;
|
||||||
|
mouldApi.getMould().then((resp) => {
|
||||||
|
this.mouldList = resp.data;
|
||||||
|
});
|
||||||
|
|
||||||
|
menuApi.getMenu().then((resp) => {
|
||||||
|
this.desserts = resp.data;
|
||||||
|
});
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.editedItem = Object.assign({}, this.defaultItem);
|
||||||
|
this.editedIndex = -1;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
editItem(item) {
|
||||||
|
this.editedIndex = this.desserts.indexOf(item);
|
||||||
|
this.editedItem = Object.assign({}, item);
|
||||||
|
this.dialog = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
save() {
|
||||||
|
if (this.editedIndex > -1) {
|
||||||
|
menuApi.UpdateMenu(this.editedItem).then(() => this.init());
|
||||||
|
} else {
|
||||||
|
if (this.parentId == 0) {
|
||||||
|
menuApi.addMenu(this.editedItem).then(() => {
|
||||||
|
this.init();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
menuApi.addChildrenMenu(this.parentId, this.editedItem).then(() => {
|
||||||
|
this.init();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selection: {
|
selection: {
|
||||||
//深度监听,可监听到对象、数组的变化
|
//深度监听,可监听到对象、数组的变化
|
||||||
@@ -40,7 +201,9 @@ export default {
|
|||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
|
dialog(val) {
|
||||||
|
val || this.close();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
export default {
|
export default {
|
||||||
data:()=>({
|
data:()=>({
|
||||||
drawer:true,
|
drawer:true,
|
||||||
name:"测试系统"
|
name:"系统"
|
||||||
}),
|
}),
|
||||||
name: 'DefaultBar',
|
name: 'DefaultBar',
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
mdi-package-up
|
mdi-package-up
|
||||||
</v-icon>
|
</v-icon>
|
||||||
|
|
||||||
Upgrade to Pro
|
退出
|
||||||
</app-btn>
|
</app-btn>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
<v-list-item-content class="pl-2">
|
<v-list-item-content class="pl-2">
|
||||||
<v-list-item-title class="text-h3">
|
<v-list-item-title class="text-h3">
|
||||||
<strong class="mr-1 font-weight-black">VMD</strong>
|
<strong class="mr-1 font-weight-black">Yi</strong>
|
||||||
|
|
||||||
<span class="primary--text">FREE</span>
|
<span class="primary--text">Framework</span>
|
||||||
</v-list-item-title>
|
</v-list-item-title>
|
||||||
</v-list-item-content>
|
</v-list-item-content>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-text-field
|
<v-text-field
|
||||||
placeholder="Search"
|
placeholder="全站搜索"
|
||||||
class="mr-16"
|
class="mr-16"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
hide-details
|
hide-details
|
||||||
style="max-width: 220px"
|
style="max-width: 400px"
|
||||||
>
|
>
|
||||||
<template
|
<template
|
||||||
v-if="$vuetify.breakpoint.mdAndUp"
|
v-if="$vuetify.breakpoint.mdAndUp"
|
||||||
|
|||||||
@@ -1,29 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-card class="mx-auto" width="100%">
|
<v-card class="mx-auto" width="100%">
|
||||||
<v-btn color="primary" dark class="mb-2 mx-2" @click="dialog = true">
|
<ccTreeview></ccTreeview>
|
||||||
添加新项
|
|
||||||
</v-btn>
|
|
||||||
<v-btn color="primary" dark class="mb-2 mx-2" @click="dialog = true">
|
|
||||||
删除所选
|
|
||||||
</v-btn>
|
|
||||||
<ccTreeview :items="Menuitems"></ccTreeview>
|
|
||||||
</v-card>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import menuApi from "../api/MenuApi";
|
|
||||||
export default {
|
export default {
|
||||||
created() {
|
created() {
|
||||||
this.init();
|
|
||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
Menuitems: [],
|
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
|
||||||
menuApi.getMenu().then((resp) => {
|
|
||||||
this.Menuitems = resp.data;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<v-card class="mx-auto" width="100%"><v-btn color="primary">确定分配</v-btn></v-card>
|
<v-card class="mx-auto" width="100%"><app-btn class="ma-2" @click="setMenu">确定分配</app-btn></v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="12" md="4" lg="4">
|
<v-col cols="12" md="4" lg="4">
|
||||||
<v-card class="mx-auto" width="100%">
|
<v-card class="mx-auto" width="100%">
|
||||||
@@ -41,12 +41,28 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import roleApi from "../api/roleApi";
|
import roleApi from "../api/roleApi";
|
||||||
import menuApi from "../api/MenuApi";
|
import menuApi from "../api/menuApi";
|
||||||
export default {
|
export default {
|
||||||
created() {
|
created() {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
setMenu(){
|
||||||
|
var roleIds=[];
|
||||||
|
var menuIds=[];
|
||||||
|
this.selectionRole.forEach((ele)=>{
|
||||||
|
roleIds.push(ele.id)
|
||||||
|
})
|
||||||
|
this.selectionMenu.forEach((ele)=>{
|
||||||
|
menuIds.push(ele.id)
|
||||||
|
})
|
||||||
|
roleApi.setMenuByRole(roleIds,menuIds).then(resp=>{
|
||||||
|
this.$dialog.notify.info(resp.msg, {
|
||||||
|
position: "top-right",
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
init() {
|
init() {
|
||||||
roleApi.getRole().then((resp) => {
|
roleApi.getRole().then((resp) => {
|
||||||
this.RoleItems = resp.data;
|
this.RoleItems = resp.data;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-card class="mx-auto" width="100%">
|
<v-card class="mx-auto" width="100%">
|
||||||
{{ select }}
|
|
||||||
{{ TableSelect }}
|
|
||||||
<ccCombobox
|
<ccCombobox
|
||||||
headers="设置角色"
|
headers="设置角色"
|
||||||
:items="roleItems"
|
:items="roleItems"
|
||||||
|
|||||||
Reference in New Issue
Block a user