基本完善前端框架,发现后端bug

This commit is contained in:
橙子
2021-10-15 20:33:08 +08:00
parent 141987893e
commit cbfb19ade8
24 changed files with 352 additions and 318 deletions

View File

@@ -0,0 +1,9 @@
import myaxios from '@/util/myaxios'
export default {
getMenu() {
return myaxios({
url: '/Menu/GetMenu',
method: 'get'
})
},
}

View File

@@ -16,12 +16,6 @@ export default {
method: 'post',
})
},
logged() {
return myaxios({
url: '/Account/logged',
method: 'post',
})
},
register(username, password, email, code) {
return myaxios({
url: `/Account/register?code=${code}`,

View File

@@ -1,30 +0,0 @@
import myaxios from '@/util/myaxios'
export default {
getActions() {
return myaxios({
url: '/Action/getActions',
method: 'get'
})
},
addAction(action) {
return myaxios({
url: '/action/addAction',
method: 'post',
data: action
})
},
updateAction(action) {
return myaxios({
url: '/action/UpdateAction',
method: 'post',
data: action
})
},
delActionList(Ids) {
return myaxios({
url: '/action/DelAllAction',
method: 'post',
data: Ids
})
},
}

View File

@@ -1,50 +1,9 @@
import myaxios from '@/util/myaxios'
export default {
getRoles() {
getRole() {
return myaxios({
url: '/Role/getRoles',
method: 'get'
})
},
AddRole(role) {
return myaxios({
url: '/Role/AddRole',
method: 'post',
data: role
})
},
delRole(roleId) {
return myaxios({
url: `/Role/DelRole?roleId=${roleId}`,
method: 'get'
})
},
updateRole(role) {
return myaxios({
url: '/role/updateRole',
method: 'post',
data: role
})
},
delRoleList(Ids) {
return myaxios({
url: '/role/delAllRole',
method: 'post',
data: Ids
})
},
setAction(Id, Ids) {
return myaxios({
url: '/role/setAction',
method: 'post',
data: { "Id": Id, "Ids": Ids }
})
},
GetActionByRoleId(roleId) {
return myaxios({
url: `/role/GetActionByRoleId?roleId=${roleId}`,
url: '/Role/getRole',
method: 'get'
})
}
}

View File

@@ -1,101 +1,10 @@
import myaxios from '@/util/myaxios'
export default {
getAllUser() {
SetRoleByUser(userIds, roleIds) {
return myaxios({
url: '/User/getAllUser',
method: 'get'
})
},
getUserByUserId(userId) {
if (userId == undefined) {
userId = 0;
}
return myaxios({
url: `/User/getUserByUserId?userId=${userId}`,
method: 'get'
})
},
addUser(user) {
return myaxios({
url: '/User/addUser',
url: '/User/SetRoleByUser',
method: 'post',
data: user
data: { "ids1": userIds, "ids2": roleIds }
})
},
delUser(userId) {
return myaxios({
url: `/User/delUser?userId=${userId}`,
method: 'get'
})
},
updateUser(user) {
return myaxios({
url: '/User/updateUser',
method: 'post',
data: user
})
},
tryUpdateUser(form) {
return myaxios({
url: '/User/tryUpdateUser',
method: 'post',
data: form
})
},
delUserList(Ids) {
return myaxios({
url: '/User/delAllUser',
method: 'post',
data: Ids
})
},
setRole(Id, Ids) {
return myaxios({
url: '/User/setRole',
method: 'post',
data: { "Id": Id, "Ids": Ids }
})
},
setRoleList(userIds, roleIds) {
return myaxios({
url: '/User/setRoleList',
method: 'post',
data: { "userIds": userIds, "roleIds": roleIds }
})
},
getRoleByuserId(userId) {
if (userId == undefined) {
userId = 0;
}
return myaxios({
url: `/User/getRoleByuserId?userId=${userId}`,
method: 'get'
})
},
getSpecialAction(userId) {
return myaxios({
url: `/User/getSpecialAction?userId=${userId}`,
method: 'get'
})
},
setSpecialAction(Id, Ids) {
return myaxios({
url: '/User/setSpecialAction',
method: 'post',
data: { "Id": Id, "Ids": Ids }
})
},
getActionByUserId(userId) {
if (userId == undefined) {
userId = 0;
}
return myaxios({
url: `/User/getActionByUserId?userId=${userId}`,
method: 'get'
})
}
}

View File

@@ -14,7 +14,6 @@
<v-row>
<v-col cols="12">
<v-combobox
v-model="select"
:items="items"
label="请点击选择"
@@ -30,7 +29,7 @@
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="dialog = false"> 关闭 </v-btn>
<v-btn color="blue darken-1" text @click="dialog = false"> 保存 </v-btn>
<div @click="dialog = false"> <slot name="save" ></slot> </div>
</v-card-actions>
</v-card>
</v-dialog>

View File

@@ -86,6 +86,9 @@
<!-- 表格中的删除和修改 -->
<template v-slot:item.actions="{ item }">
<slot name="action" :item="item"></slot>
<v-icon
v-if="axiosUrls.hasOwnProperty('update')"
small
@@ -101,6 +104,8 @@
>
mdi-delete
</v-icon>
</template>
<!-- 初始化 -->
@@ -113,6 +118,7 @@
<script>
import itemApi from "./TableApi.js";
export default {
name: "ccTable",
props: {
defaultItem: {
@@ -125,7 +131,6 @@ export default {
type: Object,
},
},
data: () => ({
page: 1,
selected: [],
@@ -143,6 +148,12 @@ export default {
},
watch: {
selected:{
handler(val, oldVal){
this.$emit("selected",val);
},
deep:true
},
dialog(val) {
val || this.close();
}
@@ -200,7 +211,6 @@ export default {
itemApi
.delItemList(this.axiosUrls.del, Ids)
.then(() => this.initialize());
this.closeDelete();
},
close() {
this.dialog = false;

View File

@@ -7,13 +7,17 @@
return-object
open-all
hoverable
item-text="menu_name"
item-text="menu_name"
>
<template v-slot:append="{ item }">
<v-btn>{{ item.id }}</v-btn>
<v-btn>设置接口权限</v-btn>
</template>
<template v-slot:append="{ item }">
<v-btn>编号:{{ item.id }}</v-btn>
<v-btn>图标:{{ item.icon }}</v-btn>
<v-btn>路由:{{ item.router }}</v-btn>
<v-btn>设置接口权限</v-btn>
<v-btn>编辑</v-btn>
<v-btn>删除</v-btn>
<v-btn>添加子菜单</v-btn>
</template>
</v-treeview>
</template>
<script>
@@ -28,16 +32,15 @@ export default {
selectionType: "leaf",
selection: [],
}),
watch:{
selection:{//深度监听,可监听到对象、数组的变化
handler(val, oldVal){
this.$emit("selection",val);
},
deep:true
}
watch: {
selection: {
//深度监听,可监听到对象、数组的变化
handler(val, oldVal) {
this.$emit("selection", val);
},
deep: true,
},
},
methods:{
}
methods: {},
};
</script>

View File

@@ -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>

View File

@@ -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",
},
}),
};

View File

@@ -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>

View File

@@ -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",