基本完善前端框架,发现后端bug
This commit is contained in:
@@ -1,47 +1,29 @@
|
||||
<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">
|
||||
添加新项
|
||||
</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>
|
||||
<script>
|
||||
import menuApi from "../api/MenuApi";
|
||||
export default {
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
data: () => ({
|
||||
Menuitems: [
|
||||
{
|
||||
id: 1,
|
||||
menu_name: "用户角色管理",
|
||||
children: [
|
||||
{
|
||||
id: 2,
|
||||
menu_name: "用户管理",
|
||||
children: [
|
||||
{
|
||||
id: 4,
|
||||
menu_name: "添加",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
menu_name: "修改",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
menu_name: "删除",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
menu_name: "查询",
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{ id: 3, menu_name: "角色管理" },
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
Menuitems: [],
|
||||
}),
|
||||
methods: {
|
||||
init() {
|
||||
menuApi.getMenu().then((resp) => {
|
||||
this.Menuitems = resp.data;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -8,20 +8,20 @@
|
||||
export default {
|
||||
data: () => ({
|
||||
axiosUrls:{
|
||||
get:"role/getrole",
|
||||
update:"role/updaterole",
|
||||
del:"role/delListrole",
|
||||
add:"role/addrole"
|
||||
get:"mould/getmould",
|
||||
update:"mould/updatemould",
|
||||
del:"mould/delListmould",
|
||||
add:"mould/addmould"
|
||||
},
|
||||
headers: [
|
||||
{text: "编号",align: "start",value: "id"},
|
||||
{ text: "角色名", value: "role_name", sortable: false },
|
||||
{ text: "简介", value: "introduce", sortable: false },
|
||||
{ text: "接口名", value: "mould_name", sortable: false },
|
||||
{ text: "接口地址", value: "url", sortable: false },
|
||||
{ text: "操作", value: "actions", sortable: false }
|
||||
],
|
||||
defaultItem: {
|
||||
role_name: "test",
|
||||
introduce: "用于测试",
|
||||
mould_name: "test",
|
||||
url: "test/test",
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<template>
|
||||
|
||||
<v-row>
|
||||
<v-col cols="12" md="4" lg="4">
|
||||
<v-card class="mx-auto" width="100%">
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<v-card class="mx-auto" width="100%"><v-btn color="primary">确定分配</v-btn></v-card>
|
||||
</v-col>
|
||||
<v-col cols="12" md="4" lg="4">
|
||||
<v-card class="mx-auto" width="100%">
|
||||
|
||||
<v-treeview
|
||||
selectable
|
||||
:items="RoleItems"
|
||||
@@ -13,11 +16,11 @@
|
||||
item-text="role_name"
|
||||
>
|
||||
</v-treeview>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-card>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" md="8" lg="8">
|
||||
<v-card class="mx-auto" width="100%">
|
||||
<v-col cols="12" md="8" lg="8">
|
||||
<v-card class="mx-auto" width="100%">
|
||||
<v-treeview
|
||||
selectable
|
||||
:items="Menuitems"
|
||||
@@ -29,59 +32,36 @@
|
||||
item-text="menu_name"
|
||||
>
|
||||
<template v-slot:append="{ item }">
|
||||
<v-btn>{{ item.id }}</v-btn>
|
||||
<v-btn>id:{{ item.id }}</v-btn>
|
||||
</template>
|
||||
</v-treeview>
|
||||
</v-card></v-col
|
||||
>
|
||||
|
||||
</v-row>
|
||||
|
||||
</v-card></v-col
|
||||
>
|
||||
</v-row>
|
||||
</template>
|
||||
<script>
|
||||
import roleApi from "../api/roleApi";
|
||||
import menuApi from "../api/MenuApi";
|
||||
export default {
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
roleApi.getRole().then((resp) => {
|
||||
this.RoleItems = resp.data;
|
||||
});
|
||||
|
||||
menuApi.getMenu().then((resp) => {
|
||||
this.Menuitems = resp.data;
|
||||
});
|
||||
},
|
||||
},
|
||||
data: () => ({
|
||||
selectionMenu: [],
|
||||
selectionRole: [],
|
||||
RoleItems: [
|
||||
{ id: 1, role_name: "管理员", sex: "测试" },
|
||||
{ id: 2, role_name: "超级管理员", sex: "测试" },
|
||||
],
|
||||
Menuitems: [
|
||||
{
|
||||
id: 1,
|
||||
menu_name: "用户角色管理",
|
||||
children: [
|
||||
{
|
||||
id: 2,
|
||||
menu_name: "用户管理",
|
||||
children: [
|
||||
{
|
||||
id: 4,
|
||||
menu_name: "添加",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
menu_name: "修改",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
menu_name: "删除",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
menu_name: "查询",
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{ id: 3, menu_name: "角色管理" },
|
||||
],
|
||||
},
|
||||
],
|
||||
RoleItems: [],
|
||||
Menuitems: [],
|
||||
}),
|
||||
};
|
||||
</script>
|
||||
@@ -1,24 +1,84 @@
|
||||
<template>
|
||||
<v-card class="mx-auto" width="100%">
|
||||
{{select}}
|
||||
<ccCombobox headers='设置角色' :items="items" @select="getSelect" itemText="role_name"></ccCombobox>
|
||||
{{ select }}
|
||||
{{ TableSelect }}
|
||||
<ccCombobox
|
||||
headers="设置角色"
|
||||
:items="roleItems"
|
||||
@select="getSelect"
|
||||
itemText="role_name"
|
||||
>
|
||||
<template v-slot:save>
|
||||
<v-btn @click="setRole" color="blue darken-1" text> 保存</v-btn>
|
||||
</template>
|
||||
</ccCombobox>
|
||||
<ccTable
|
||||
:defaultItem="defaultItem"
|
||||
:headers="headers"
|
||||
:axiosUrls="axiosUrls"
|
||||
></ccTable>
|
||||
@selected="getTableSelect"
|
||||
>
|
||||
<template v-slot:action="{ item }">
|
||||
<v-icon small class="mr-2" @click="showItem(item)"> mdi-eye </v-icon>
|
||||
</template>
|
||||
</ccTable>
|
||||
</v-card>
|
||||
</template>
|
||||
<script>
|
||||
import userApi from "../api/userApi";
|
||||
import roleApi from "../api/roleApi";
|
||||
export default {
|
||||
methods:{
|
||||
getSelect(data){
|
||||
this.select=data;
|
||||
}
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
methods: {
|
||||
async showItem(item) {
|
||||
|
||||
var strInfo="";
|
||||
Object.keys(item).forEach(function(key){
|
||||
|
||||
strInfo+=key+":"+ item[key]+"<br>"
|
||||
|
||||
});
|
||||
await this.$dialog.confirm({
|
||||
text: strInfo,
|
||||
title: "信息详情",
|
||||
actions: {
|
||||
true: "关闭",
|
||||
},
|
||||
});
|
||||
},
|
||||
init() {
|
||||
roleApi.getRole().then((resp) => {
|
||||
this.roleItems = resp.data;
|
||||
});
|
||||
},
|
||||
setRole() {
|
||||
var userIds = [];
|
||||
var roleIds = [];
|
||||
this.TableSelect.forEach((item) => {
|
||||
userIds.push(item.id);
|
||||
});
|
||||
this.select.forEach((item) => {
|
||||
roleIds.push(item.id);
|
||||
});
|
||||
userApi.SetRoleByUser(userIds, roleIds).then((resp) => {
|
||||
alert(resp);
|
||||
});
|
||||
},
|
||||
getTableSelect(data) {
|
||||
this.TableSelect = data;
|
||||
},
|
||||
|
||||
getSelect(data) {
|
||||
this.select = data;
|
||||
},
|
||||
},
|
||||
data: () => ({
|
||||
select:[],
|
||||
items: [{id:1,role_name:"管理员"},{id:1,role_name:"超级管理员"}],
|
||||
TableSelect: [],
|
||||
select: [],
|
||||
roleItems: [],
|
||||
axiosUrls: {
|
||||
get: "user/getuser",
|
||||
update: "user/updateuser",
|
||||
|
||||
Reference in New Issue
Block a user