Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梁国权
gin-vue-admin
提交
a7cc8c32
G
gin-vue-admin
项目概览
梁国权
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a7cc8c32
编写于
9月 28, 2019
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
API增删改查忘词嗯
上级
1bc10958
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
267 addition
and
40 deletion
+267
-40
QMPlusServer/controller/api/api.go
QMPlusServer/controller/api/api.go
+50
-6
QMPlusServer/controller/servers/paging.go
QMPlusServer/controller/servers/paging.go
+1
-1
QMPlusServer/model/dbModel/api.go
QMPlusServer/model/dbModel/api.go
+8
-3
QMPlusServer/model/dbModel/api_authority.go
QMPlusServer/model/dbModel/api_authority.go
+3
-4
QMPlusServer/model/dbModel/authority.go
QMPlusServer/model/dbModel/authority.go
+1
-1
QMPlusServer/router/api.go
QMPlusServer/router/api.go
+6
-4
QMPlusVuePage/src/api/api.js
QMPlusVuePage/src/api/api.js
+69
-0
QMPlusVuePage/src/api/menu.js
QMPlusVuePage/src/api/menu.js
+17
-0
QMPlusVuePage/src/view/superAdmin/api/api.vue
QMPlusVuePage/src/view/superAdmin/api/api.vue
+92
-10
QMPlusVuePage/src/view/superAdmin/authority/authority.vue
QMPlusVuePage/src/view/superAdmin/authority/authority.vue
+3
-1
QMPlusVuePage/src/view/superAdmin/menu/menu.vue
QMPlusVuePage/src/view/superAdmin/menu/menu.vue
+17
-10
未找到文件。
QMPlusServer/controller/api/api.go
浏览文件 @
a7cc8c32
...
@@ -67,11 +67,11 @@ type AuthAndPathIn struct {
...
@@ -67,11 +67,11 @@ type AuthAndPathIn struct {
// @Produce application/json
// @Produce application/json
// @Param data body api.AuthAndPathIn true "创建api和角色关系"
// @Param data body api.AuthAndPathIn true "创建api和角色关系"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/setAuthAnd
Path
[post]
// @Router /api/setAuthAnd
Api
[post]
func
SetAuthAnd
Path
(
c
*
gin
.
Context
)
{
func
SetAuthAnd
Api
(
c
*
gin
.
Context
)
{
var
authAndPathIn
AuthAndPathIn
var
authAndPathIn
AuthAndPathIn
_
=
c
.
BindJSON
(
&
authAndPathIn
)
_
=
c
.
BindJSON
(
&
authAndPathIn
)
err
:=
new
(
dbModel
.
ApiAuthority
)
.
SetAuthAnd
Path
(
authAndPathIn
.
AuthorityId
,
authAndPathIn
.
Apis
)
err
:=
new
(
dbModel
.
ApiAuthority
)
.
SetAuthAnd
Api
(
authAndPathIn
.
AuthorityId
,
authAndPathIn
.
Apis
)
if
err
!=
nil
{
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"添加失败:%v"
,
err
),
gin
.
H
{})
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"添加失败:%v"
,
err
),
gin
.
H
{})
}
else
{
}
else
{
...
@@ -80,11 +80,11 @@ func SetAuthAndPath(c *gin.Context) {
...
@@ -80,11 +80,11 @@ func SetAuthAndPath(c *gin.Context) {
}
}
// @Tags Api
// @Tags Api
// @Summary 分页获取
角色
列表
// @Summary 分页获取
API
列表
// @Security ApiKeyAuth
// @Security ApiKeyAuth
// @accept application/json
// @accept application/json
// @Produce application/json
// @Produce application/json
// @Param data body modelInterface.PageInfo true "分页获取
用户
列表"
// @Param data body modelInterface.PageInfo true "分页获取
API
列表"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/getApiList [post]
// @Router /api/getApiList [post]
func
GetApiList
(
c
*
gin
.
Context
)
{
func
GetApiList
(
c
*
gin
.
Context
)
{
...
@@ -103,3 +103,47 @@ func GetApiList(c *gin.Context) {
...
@@ -103,3 +103,47 @@ func GetApiList(c *gin.Context) {
}
}
}
}
// @Tags Api
// @Summary 根据id获取api
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body modelInterface.PageInfo true "分页获取用户列表"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/getApiById [post]
func
GetApiById
(
c
*
gin
.
Context
)
{
var
idInfo
GetById
_
=
c
.
BindJSON
(
&
idInfo
)
err
,
api
:=
new
(
dbModel
.
Api
)
.
GetApiById
(
idInfo
.
Id
)
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"获取数据失败,%v"
,
err
),
gin
.
H
{})
}
else
{
servers
.
ReportFormat
(
c
,
true
,
"获取数据成功"
,
gin
.
H
{
"api"
:
api
,
})
}
}
// @Tags Api
// @Summary 创建基础api
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.CreateApiParams true "创建api"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/updataApi [post]
func
UpdataApi
(
c
*
gin
.
Context
)
{
var
api
dbModel
.
Api
_
=
c
.
BindJSON
(
&
api
)
err
:=
api
.
UpdataApi
()
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"修改数据失败,%v"
,
err
),
gin
.
H
{})
}
else
{
servers
.
ReportFormat
(
c
,
true
,
"修改数据成功"
,
gin
.
H
{})
}
}
\ No newline at end of file
QMPlusServer/controller/servers/paging.go
浏览文件 @
a7cc8c32
...
@@ -11,6 +11,6 @@ func PagingServer(paging modelInterface.Paging, info modelInterface.PageInfo) (e
...
@@ -11,6 +11,6 @@ func PagingServer(paging modelInterface.Paging, info modelInterface.PageInfo) (e
limit
:=
info
.
PageSize
limit
:=
info
.
PageSize
offset
:=
info
.
PageSize
*
(
info
.
Page
-
1
)
offset
:=
info
.
PageSize
*
(
info
.
Page
-
1
)
err
=
qmsql
.
DEFAULTDB
.
Model
(
paging
)
.
Count
(
&
total
)
.
Error
err
=
qmsql
.
DEFAULTDB
.
Model
(
paging
)
.
Count
(
&
total
)
.
Error
db
=
qmsql
.
DEFAULTDB
.
Limit
(
limit
)
.
Offset
(
offset
)
db
=
qmsql
.
DEFAULTDB
.
Limit
(
limit
)
.
Offset
(
offset
)
.
Order
(
"id desc"
)
return
err
,
db
,
total
return
err
,
db
,
total
}
}
QMPlusServer/model/dbModel/api.go
浏览文件 @
a7cc8c32
...
@@ -16,7 +16,7 @@ type Api struct {
...
@@ -16,7 +16,7 @@ type Api struct {
func
(
a
*
Api
)
CreateApi
()
(
err
error
)
{
func
(
a
*
Api
)
CreateApi
()
(
err
error
)
{
findOne
:=
qmsql
.
DEFAULTDB
.
Where
(
"path = ?"
,
a
.
Path
)
.
Find
(
&
Menu
{})
.
Error
findOne
:=
qmsql
.
DEFAULTDB
.
Where
(
"path = ?"
,
a
.
Path
)
.
Find
(
&
Menu
{})
.
Error
if
findOne
!
=
nil
{
if
findOne
=
=
nil
{
return
errors
.
New
(
"存在相同api"
)
return
errors
.
New
(
"存在相同api"
)
}
else
{
}
else
{
err
=
qmsql
.
DEFAULTDB
.
Create
(
a
)
.
Error
err
=
qmsql
.
DEFAULTDB
.
Create
(
a
)
.
Error
...
@@ -29,11 +29,16 @@ func (a *Api) DeleteApi() (err error) {
...
@@ -29,11 +29,16 @@ func (a *Api) DeleteApi() (err error) {
return
err
return
err
}
}
func
(
a
*
Api
)
Edit
Api
()
(
err
error
)
{
func
(
a
*
Api
)
Updata
Api
()
(
err
error
)
{
err
=
qmsql
.
DEFAULTDB
.
Updat
e
(
a
)
.
Error
err
=
qmsql
.
DEFAULTDB
.
Sav
e
(
a
)
.
Error
return
err
return
err
}
}
func
(
a
*
Api
)
GetApiById
(
id
float64
)(
err
error
,
api
Api
){
err
=
qmsql
.
DEFAULTDB
.
Where
(
"id = ?"
,
id
)
.
First
(
&
api
)
.
Error
return
}
// 分页获取数据 需要分页实现这个接口即可
// 分页获取数据 需要分页实现这个接口即可
func
(
a
*
Api
)
GetInfoList
(
info
modelInterface
.
PageInfo
)
(
err
error
,
list
interface
{},
total
int
)
{
func
(
a
*
Api
)
GetInfoList
(
info
modelInterface
.
PageInfo
)
(
err
error
,
list
interface
{},
total
int
)
{
// 封装分页方法 调用即可 传入 当前的结构体和分页信息
// 封装分页方法 调用即可 传入 当前的结构体和分页信息
...
...
QMPlusServer/model/dbModel/api_authority.go
浏览文件 @
a7cc8c32
package
dbModel
package
dbModel
import
(
import
(
"fmt"
"github.com/jinzhu/gorm"
"github.com/jinzhu/gorm"
"main/init/qmsql"
"main/init/qmsql"
)
)
...
@@ -10,15 +9,15 @@ type ApiAuthority struct {
...
@@ -10,15 +9,15 @@ type ApiAuthority struct {
gorm
.
Model
gorm
.
Model
AuthorityId
string
AuthorityId
string
Authority
Authority
`gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId"`
//其实没有关联的必要
Authority
Authority
`gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId"`
//其实没有关联的必要
ApiId
string
ApiId
uint
Api
Api
Api
Api
}
}
//创建角色api关联关系
//创建角色api关联关系
func
(
a
*
ApiAuthority
)
SetAuthAnd
Path
(
authId
string
,
apis
[]
Api
)
(
err
error
)
{
func
(
a
*
ApiAuthority
)
SetAuthAnd
Api
(
authId
string
,
apis
[]
Api
)
(
err
error
)
{
err
=
qmsql
.
DEFAULTDB
.
Where
(
"authority_id = ?"
,
authId
)
.
Delete
(
&
ApiAuthority
{})
.
Error
err
=
qmsql
.
DEFAULTDB
.
Where
(
"authority_id = ?"
,
authId
)
.
Delete
(
&
ApiAuthority
{})
.
Error
for
_
,
v
:=
range
apis
{
for
_
,
v
:=
range
apis
{
err
=
qmsql
.
DEFAULTDB
.
Create
(
&
ApiAuthority
{
AuthorityId
:
authId
,
ApiId
:
fmt
.
Sprintf
(
"%v"
,
v
.
ID
)
})
.
Error
err
=
qmsql
.
DEFAULTDB
.
Create
(
&
ApiAuthority
{
AuthorityId
:
authId
,
ApiId
:
v
.
ID
})
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
QMPlusServer/model/dbModel/authority.go
浏览文件 @
a7cc8c32
...
@@ -9,7 +9,7 @@ import (
...
@@ -9,7 +9,7 @@ import (
)
)
type
Authority
struct
{
type
Authority
struct
{
gorm
.
Model
`json:"-"`
gorm
.
Model
AuthorityId
string
`json:"authorityId" gorm:"not null;unique"`
AuthorityId
string
`json:"authorityId" gorm:"not null;unique"`
AuthorityName
string
`json:"authorityName"`
AuthorityName
string
`json:"authorityName"`
}
}
...
...
QMPlusServer/router/api.go
浏览文件 @
a7cc8c32
...
@@ -9,9 +9,11 @@ import (
...
@@ -9,9 +9,11 @@ import (
func
InitApiRouter
(
Router
*
gin
.
Engine
)
{
func
InitApiRouter
(
Router
*
gin
.
Engine
)
{
ApiRouter
:=
Router
.
Group
(
"api"
)
.
Use
(
middleware
.
JWTAuth
())
ApiRouter
:=
Router
.
Group
(
"api"
)
.
Use
(
middleware
.
JWTAuth
())
{
{
ApiRouter
.
POST
(
"createApi"
,
api
.
CreateApi
)
ApiRouter
.
POST
(
"createApi"
,
api
.
CreateApi
)
//创建Api
ApiRouter
.
POST
(
"deleteApi"
,
api
.
DeleteApi
)
ApiRouter
.
POST
(
"deleteApi"
,
api
.
DeleteApi
)
//删除Api
ApiRouter
.
POST
(
"setAuthAndPath"
,
api
.
SetAuthAndPath
)
ApiRouter
.
POST
(
"setAuthAndPath"
,
api
.
SetAuthAndApi
)
// 设置api和角色关系
ApiRouter
.
POST
(
"getApiList"
,
api
.
GetApiList
)
ApiRouter
.
POST
(
"getApiList"
,
api
.
GetApiList
)
//获取Api列表
ApiRouter
.
POST
(
"getApiById"
,
api
.
GetApiById
)
//获取单条Api消息
ApiRouter
.
POST
(
"updataApi"
,
api
.
UpdataApi
)
//更新api
}
}
}
}
QMPlusVuePage/src/api/api.js
浏览文件 @
a7cc8c32
...
@@ -18,3 +18,72 @@ export const getApiList = (data) => {
...
@@ -18,3 +18,72 @@ export const getApiList = (data) => {
data
data
})
})
}
}
// @Tags Api
// @Summary 创建基础api
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.CreateApiParams true "创建api"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/createApi [post]
export
const
createApi
=
(
data
)
=>
{
return
service
({
url
:
"
/api/createApi
"
,
method
:
'
post
'
,
data
})
}
// @Tags menu
// @Summary 根据id获取菜单
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.GetById true "根据id获取菜单"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /menu/getApiById [post]
export
const
getApiById
=
(
data
)
=>
{
return
service
({
url
:
"
/api/getApiById
"
,
method
:
'
post
'
,
data
})
}
// @Tags Api
// @Summary 更新api
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.CreateApiParams true "更新api"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /api/updataApi [post]
export
const
updataApi
=
(
data
)
=>
{
return
service
({
url
:
"
/api/updataApi
"
,
method
:
'
post
'
,
data
})
}
// @Tags Api
// @Summary 更新api
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.CreateApiParams true "更新api"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /api/setAuthApi [post]
export
const
setAuthApi
=
(
data
)
=>
{
return
service
({
url
:
"
/api/setAuthApi
"
,
method
:
'
post
'
,
data
})
}
\ No newline at end of file
QMPlusVuePage/src/api/menu.js
浏览文件 @
a7cc8c32
...
@@ -98,3 +98,20 @@ export const updataBaseMenu = (data) => {
...
@@ -98,3 +98,20 @@ export const updataBaseMenu = (data) => {
data
data
})
})
}
}
// @Tags menu
// @Summary 根据id获取菜单
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.GetById true "根据id获取菜单"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /menu/getBaseMenuById [post]
export
const
getBaseMenuById
=
(
data
)
=>
{
return
service
({
url
:
"
/menu/getBaseMenuById
"
,
method
:
'
post
'
,
data
})
}
\ No newline at end of file
QMPlusVuePage/src/view/superAdmin/api/api.vue
浏览文件 @
a7cc8c32
<
template
>
<
template
>
<div>
<div>
<div
class=
"button-box clearflex"
>
<div
class=
"button-box clearflex"
>
<el-button
@
click=
"
addApi
"
type=
"primary"
>
新增api
</el-button>
<el-button
@
click=
"
openDialog('addApi')
"
type=
"primary"
>
新增api
</el-button>
</div>
</div>
<el-table
:data=
"tableData"
border
stripe
>
<el-table
:data=
"tableData"
border
stripe
>
<el-table-column
label=
"id"
min-width=
"
18
0"
prop=
"ID"
></el-table-column>
<el-table-column
label=
"id"
min-width=
"
6
0"
prop=
"ID"
></el-table-column>
<el-table-column
label=
"api路径"
min-width=
"1
8
0"
prop=
"path"
></el-table-column>
<el-table-column
label=
"api路径"
min-width=
"1
5
0"
prop=
"path"
></el-table-column>
<el-table-column
label=
"api简介"
min-width=
"1
8
0"
prop=
"description"
></el-table-column>
<el-table-column
label=
"api简介"
min-width=
"1
5
0"
prop=
"description"
></el-table-column>
<el-table-column
fixed=
"right"
label=
"操作"
width=
"200"
>
<el-table-column
fixed=
"right"
label=
"操作"
width=
"200"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<el-button
@
click=
"editApi(scope.row)"
size=
"small"
type=
"text"
>
编辑
</el-button>
<el-button
@
click=
"editApi(scope.row)"
size=
"small"
type=
"text"
>
编辑
</el-button>
...
@@ -25,6 +25,21 @@
...
@@ -25,6 +25,21 @@
hide-on-single-page
hide-on-single-page
layout=
"total, sizes, prev, pager, next, jumper"
layout=
"total, sizes, prev, pager, next, jumper"
></el-pagination>
></el-pagination>
<el-dialog
:visible.sync=
"dialogFormVisible"
title=
"新增Api"
>
<el-form
:inline=
"true"
:model=
"form"
label-width=
"80px"
>
<el-form-item
label=
"路径"
>
<el-input
autocomplete=
"off"
v-model=
"form.path"
></el-input>
</el-form-item>
<el-form-item
label=
"说明"
>
<el-input
autocomplete=
"off"
v-model=
"form.description"
></el-input>
</el-form-item>
</el-form>
<div
class=
"dialog-footer"
slot=
"footer"
>
<el-button
@
click=
"closeDialog"
>
取 消
</el-button>
<el-button
@
click=
"enterDialog"
type=
"primary"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
</div>
</template>
</template>
...
@@ -32,23 +47,90 @@
...
@@ -32,23 +47,90 @@
<
script
>
<
script
>
// 获取列表内容封装在mixins内部 getTableData方法 初始化已封装完成
// 获取列表内容封装在mixins内部 getTableData方法 初始化已封装完成
import
{
getApi
List
}
from
'
@/api/api
'
import
{
getApi
ById
,
getApiList
,
createApi
,
updataApi
}
from
'
@/api/api
'
import
infoList
from
'
@/view/superAdmin/mixins/infoList
'
import
infoList
from
'
@/view/superAdmin/mixins/infoList
'
export
default
{
export
default
{
name
:
'
Api
'
,
name
:
'
Api
'
,
mixins
:[
infoList
],
mixins
:
[
infoList
],
data
()
{
data
()
{
return
{
return
{
listApi
:
getApiList
,
listApi
:
getApiList
,
listKey
:
'
list
'
listKey
:
'
list
'
,
dialogFormVisible
:
false
,
form
:
{
path
:
''
,
description
:
''
},
type
:
''
}
}
},
},
methods
:
{
methods
:
{
initForm
()
{
this
.
form
=
{
path
:
''
,
description
:
''
}
},
closeDialog
()
{
this
.
initForm
()
this
.
dialogFormVisible
=
false
},
openDialog
(
type
)
{
this
.
type
=
type
this
.
dialogFormVisible
=
true
},
addApi
()
{
createApi
()
},
async
editApi
(
row
)
{
const
res
=
await
getApiById
({
id
:
row
.
ID
})
this
.
form
=
res
.
data
.
api
this
.
openDialog
(
'
edit
'
)
},
deleteApi
()
{},
async
enterDialog
()
{
switch
(
this
.
type
)
{
case
'
addApi
'
:
{
const
res
=
await
createApi
(
this
.
form
)
if
(
res
.
success
)
{
this
.
$message
({
type
:
'
success
'
,
message
:
'
添加成功
'
,
showClose
:
true
})
}
this
.
getTableData
()
this
.
closeDialog
()
}
addApi
()
{},
break
editApi
()
{},
case
'
edit
'
:
deleteApi
()
{}
{
const
res
=
await
updataApi
(
this
.
form
)
if
(
res
.
success
)
{
this
.
$message
({
type
:
'
success
'
,
message
:
'
添加成功
'
,
showClose
:
true
})
}
this
.
getTableData
()
this
.
closeDialog
()
}
break
default
:
{
this
.
$message
({
type
:
'
error
'
,
message
:
'
未知操作
'
,
showClose
:
true
})
}
break
}
}
},
},
created
()
{
created
()
{
this
.
getTableData
()
this
.
getTableData
()
...
...
QMPlusVuePage/src/view/superAdmin/authority/authority.vue
浏览文件 @
a7cc8c32
...
@@ -4,11 +4,13 @@
...
@@ -4,11 +4,13 @@
<el-button
@
click=
"addAuthority"
type=
"primary"
>
新增角色
</el-button>
<el-button
@
click=
"addAuthority"
type=
"primary"
>
新增角色
</el-button>
</div>
</div>
<el-table
:data=
"tableData"
border
stripe
>
<el-table
:data=
"tableData"
border
stripe
>
<el-table-column
label=
"id"
min-width=
"180"
prop=
"ID"
></el-table-column>
<el-table-column
label=
"角色id"
min-width=
"180"
prop=
"authorityId"
></el-table-column>
<el-table-column
label=
"角色id"
min-width=
"180"
prop=
"authorityId"
></el-table-column>
<el-table-column
label=
"角色名称"
min-width=
"180"
prop=
"authorityName"
></el-table-column>
<el-table-column
label=
"角色名称"
min-width=
"180"
prop=
"authorityName"
></el-table-column>
<el-table-column
fixed=
"right"
label=
"操作"
width=
"500"
>
<el-table-column
fixed=
"right"
label=
"操作"
width=
"500"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<el-button
@
click=
"addAuthMenu(scope.row)"
size=
"small"
type=
"text"
>
增加角色菜单
</el-button>
<el-button
@
click=
"addAuthMenu(scope.row)"
size=
"small"
type=
"text"
>
变更角色菜单
</el-button>
<el-button
@
click=
"addAuthApi(scope.row)"
size=
"small"
type=
"text"
>
变更角色Api
</el-button>
<el-button
@
click=
"deleteAuth(scope.row)"
size=
"small"
type=
"text"
>
删除角色
</el-button>
<el-button
@
click=
"deleteAuth(scope.row)"
size=
"small"
type=
"text"
>
删除角色
</el-button>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
...
...
QMPlusVuePage/src/view/superAdmin/menu/menu.vue
浏览文件 @
a7cc8c32
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
<el-table-column
fixed=
"right"
label=
"操作"
width=
"300"
>
<el-table-column
fixed=
"right"
label=
"操作"
width=
"300"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-button
@
click=
"deleteMenu(scope.row.ID)"
size=
"small"
type=
"text"
>
删除菜单
</el-button>
<el-button
@
click=
"deleteMenu(scope.row.ID)"
size=
"small"
type=
"text"
>
删除菜单
</el-button>
<el-button
@
click=
"editMenu(scope.row)"
size=
"small"
type=
"text"
>
编辑菜单
</el-button>
<el-button
@
click=
"editMenu(scope.row
.ID
)"
size=
"small"
type=
"text"
>
编辑菜单
</el-button>
<el-button
@
click=
"addMenu(scope.row.ID)"
size=
"small"
type=
"text"
>
添加子菜单
</el-button>
<el-button
@
click=
"addMenu(scope.row.ID)"
size=
"small"
type=
"text"
>
添加子菜单
</el-button>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
<
script
>
<
script
>
// 获取列表内容封装在mixins内部 getTableData方法 初始化已封装完成
// 获取列表内容封装在mixins内部 getTableData方法 初始化已封装完成
import
{
updataBaseMenu
,
getMenuList
,
addBaseMenu
,
deleteBaseMenu
}
from
'
@/api/menu
'
import
{
updataBaseMenu
,
getMenuList
,
addBaseMenu
,
deleteBaseMenu
,
getBaseMenuById
}
from
'
@/api/menu
'
import
infoList
from
'
@/view/superAdmin/mixins/infoList
'
import
infoList
from
'
@/view/superAdmin/mixins/infoList
'
export
default
{
export
default
{
name
:
'
Menus
'
,
name
:
'
Menus
'
,
...
@@ -93,6 +93,7 @@ export default {
...
@@ -93,6 +93,7 @@ export default {
listKey
:
'
list
'
,
listKey
:
'
list
'
,
dialogFormVisible
:
false
,
dialogFormVisible
:
false
,
form
:
{
form
:
{
ID
:
0
,
path
:
''
,
path
:
''
,
name
:
''
,
name
:
''
,
hidden
:
''
,
hidden
:
''
,
...
@@ -102,7 +103,8 @@ export default {
...
@@ -102,7 +103,8 @@ export default {
title
:
''
,
title
:
''
,
icon
:
''
icon
:
''
}
}
}
},
isEdit
:
false
}
}
},
},
methods
:
{
methods
:
{
...
@@ -151,7 +153,12 @@ export default {
...
@@ -151,7 +153,12 @@ export default {
},
},
// 添加menu
// 添加menu
async
enterDialog
()
{
async
enterDialog
()
{
const
res
=
await
addBaseMenu
(
this
.
form
)
let
res
if
(
this
.
isEdit
){
res
=
await
updataBaseMenu
(
this
.
form
)
}
else
{
res
=
await
addBaseMenu
(
this
.
form
)
}
if
(
res
.
success
)
{
if
(
res
.
success
)
{
this
.
$message
({
this
.
$message
({
type
:
'
success
'
,
type
:
'
success
'
,
...
@@ -172,15 +179,15 @@ export default {
...
@@ -172,15 +179,15 @@ export default {
// 添加菜单方法,id为 0则为添加根菜单
// 添加菜单方法,id为 0则为添加根菜单
addMenu
(
id
)
{
addMenu
(
id
)
{
this
.
form
.
parentId
=
String
(
id
)
this
.
form
.
parentId
=
String
(
id
)
this
.
isEdit
=
false
this
.
dialogFormVisible
=
true
this
.
dialogFormVisible
=
true
},
},
// 修改菜单方法
// 修改菜单方法
async
editMenu
(
row
){
async
editMenu
(
id
){
row
.
name
=
"
修改测试
"
const
res
=
await
getBaseMenuById
({
id
})
row
.
meta
.
title
=
"
修改测试
"
this
.
form
=
res
.
data
.
menu
row
.
meta
.
icon
=
"
share
"
this
.
dialogFormVisible
=
true
const
res
=
await
updataBaseMenu
(
row
)
this
.
isEdit
=
true
console
.
log
(
res
)
}
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录