Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
1532635456
gin-vue-admin
提交
ed6e8884
G
gin-vue-admin
项目概览
1532635456
/
gin-vue-admin
落后 Fork 源项目 1212 个版本
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
6
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,发现更多精彩内容 >>
提交
ed6e8884
编写于
4月 10, 2020
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改customer文件位restful模式 提供示例
上级
5d871db8
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
53 addition
and
45 deletion
+53
-45
server/api/v1/exa_customer.go
server/api/v1/exa_customer.go
+7
-7
server/model/exa_customer.go
server/model/exa_customer.go
+5
-5
server/model/request/common.go
server/model/request/common.go
+3
-3
server/resource/rbac_model.conf
server/resource/rbac_model.conf
+1
-1
server/router/exp_customer.go
server/router/exp_customer.go
+5
-5
server/service/sys_casbin.go
server/service/sys_casbin.go
+4
-1
web/src/api/customer.js
web/src/api/customer.js
+18
-18
web/src/view/example/customer/customer.vue
web/src/view/example/customer/customer.vue
+8
-5
web/src/view/superAdmin/user/user.vue
web/src/view/superAdmin/user/user.vue
+2
-0
未找到文件。
server/api/v1/exa_customer.go
浏览文件 @
ed6e8884
...
...
@@ -17,7 +17,7 @@ import (
// @Produce application/json
// @Param data body model.ExaCustomer true "创建客户"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/c
reateExaC
ustomer [post]
// @Router /customer/customer [post]
func
CreateExaCustomer
(
c
*
gin
.
Context
)
{
var
cu
model
.
ExaCustomer
_
=
c
.
ShouldBindJSON
(
&
cu
)
...
...
@@ -40,7 +40,7 @@ func CreateExaCustomer(c *gin.Context) {
// @Produce application/json
// @Param data body model.ExaCustomer true "删除客户"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/
deleteExaCustomer [post
]
// @Router /customer/
customer [delete
]
func
DeleteExaCustomer
(
c
*
gin
.
Context
)
{
var
cu
model
.
ExaCustomer
_
=
c
.
ShouldBindJSON
(
&
cu
)
...
...
@@ -59,7 +59,7 @@ func DeleteExaCustomer(c *gin.Context) {
// @Produce application/json
// @Param data body model.ExaCustomer true "创建客户"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/
updateExaCustomer [pos
t]
// @Router /customer/
customer [pu
t]
func
UpdateExaCustomer
(
c
*
gin
.
Context
)
{
var
cu
model
.
ExaCustomer
_
=
c
.
ShouldBindJSON
(
&
cu
)
...
...
@@ -78,10 +78,10 @@ func UpdateExaCustomer(c *gin.Context) {
// @Produce application/json
// @Param data body model.ExaCustomer true "获取单一客户信息"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/
getExaCustomer [pos
t]
// @Router /customer/
customer [ge
t]
func
GetExaCustomer
(
c
*
gin
.
Context
)
{
var
cu
model
.
ExaCustomer
_
=
c
.
ShouldBind
JSON
(
&
cu
)
_
=
c
.
ShouldBind
Query
(
&
cu
)
err
,
customer
:=
service
.
GetExaCustomer
(
cu
.
ID
)
if
err
!=
nil
{
response
.
FailWithMessage
(
fmt
.
Sprintf
(
"获取失败:%v"
,
err
),
c
)
...
...
@@ -97,12 +97,12 @@ func GetExaCustomer(c *gin.Context) {
// @Produce application/json
// @Param data body model.PageInfo true "获取权限客户列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/
getExaCustomerList [pos
t]
// @Router /customer/
customerList [ge
t]
func
GetExaCustomerList
(
c
*
gin
.
Context
)
{
claims
,
_
:=
c
.
Get
(
"claims"
)
waitUse
:=
claims
.
(
*
request
.
CustomClaims
)
var
pageInfo
request
.
PageInfo
_
=
c
.
ShouldBind
JSON
(
&
pageInfo
)
_
=
c
.
ShouldBind
Query
(
&
pageInfo
)
err
,
customerList
,
total
:=
service
.
GetCustomerInfoList
(
waitUse
.
AuthorityId
,
pageInfo
)
if
err
!=
nil
{
response
.
FailWithMessage
(
fmt
.
Sprintf
(
"获取失败:%v"
,
err
),
c
)
...
...
server/model/exa_customer.go
浏览文件 @
ed6e8884
...
...
@@ -6,9 +6,9 @@ import (
type
ExaCustomer
struct
{
gorm
.
Model
CustomerName
string
`json:"customerName"`
CustomerPhoneData
string
`json:"customerPhoneData"`
SysUserID
uint
`json:"sysUserId"`
SysUserAuthorityID
string
`json:"sysUserAuthorityID"`
SysUser
SysUser
`json:"sysUser"`
CustomerName
string
`json:"customerName"
form:"customerName"
`
CustomerPhoneData
string
`json:"customerPhoneData"
form:"customerPhoneData"
`
SysUserID
uint
`json:"sysUserId"
form:"sysUserId"
`
SysUserAuthorityID
string
`json:"sysUserAuthorityID"
form:"sysUserAuthorityID"
`
SysUser
SysUser
`json:"sysUser"
form:"sysUser"
`
}
\ No newline at end of file
server/model/request/common.go
浏览文件 @
ed6e8884
...
...
@@ -2,11 +2,11 @@ package request
// Paging common input parameter structure
type
PageInfo
struct
{
Page
int
`json:"page"`
PageSize
int
`json:"pageSize"`
Page
int
`json:"page"
form:"page"
`
PageSize
int
`json:"pageSize"
form:"pageSize"
`
}
// Find by id structure
type
GetById
struct
{
Id
float64
`json:"id"`
Id
float64
`json:"id"
form:"id"
`
}
server/resource/rbac_model.conf
浏览文件 @
ed6e8884
...
...
@@ -11,4 +11,4 @@ g = _, _
e
=
some
(
where
(
p
.
eft
==
allow
))
[
matchers
]
m
=
r
.
sub
==
p
.
sub
&&
r
.
obj
==
p
.
obj
&&
r
.
act
==
p
.
act
m
=
r
.
sub
==
p
.
sub
&&
ParamsMatch
(
r
.
obj
,
p
.
obj
)
&&
r
.
act
==
p
.
act
server/router/exp_customer.go
浏览文件 @
ed6e8884
...
...
@@ -9,10 +9,10 @@ import (
func
InitCustomerRouter
(
Router
*
gin
.
RouterGroup
)
{
ApiRouter
:=
Router
.
Group
(
"customer"
)
.
Use
(
middleware
.
JWTAuth
())
.
Use
(
middleware
.
CasbinHandler
())
{
ApiRouter
.
POST
(
"c
reateExaC
ustomer"
,
v1
.
CreateExaCustomer
)
// 创建客户
ApiRouter
.
P
OST
(
"updateExaC
ustomer"
,
v1
.
UpdateExaCustomer
)
// 更新客户
ApiRouter
.
POST
(
"deleteExaC
ustomer"
,
v1
.
DeleteExaCustomer
)
// 删除客户
ApiRouter
.
POST
(
"getExaC
ustomer"
,
v1
.
GetExaCustomer
)
// 获取单一客户信息
ApiRouter
.
POST
(
"getExaC
ustomerList"
,
v1
.
GetExaCustomerList
)
// 获取客户列表
ApiRouter
.
POST
(
"customer"
,
v1
.
CreateExaCustomer
)
// 创建客户
ApiRouter
.
P
UT
(
"c
ustomer"
,
v1
.
UpdateExaCustomer
)
// 更新客户
ApiRouter
.
DELETE
(
"c
ustomer"
,
v1
.
DeleteExaCustomer
)
// 删除客户
ApiRouter
.
GET
(
"c
ustomer"
,
v1
.
GetExaCustomer
)
// 获取单一客户信息
ApiRouter
.
GET
(
"c
ustomerList"
,
v1
.
GetExaCustomerList
)
// 获取客户列表
}
}
server/service/sys_casbin.go
浏览文件 @
ed6e8884
...
...
@@ -55,7 +55,10 @@ func AddCasbin(cm model.CasbinModel) bool {
// @return error
func
UpdateCasbinApi
(
oldPath
string
,
newPath
string
,
oldMethod
string
,
newMethod
string
)
error
{
var
cs
[]
model
.
CasbinModel
err
:=
global
.
GVA_DB
.
Table
(
"casbin_rule"
)
.
Where
(
"v1 = ? AND v2 = ?"
,
oldPath
,
oldMethod
)
.
Find
(
&
cs
)
.
Update
(
"v1"
,
newPath
)
.
Update
(
"v2"
,
newMethod
)
.
Error
err
:=
global
.
GVA_DB
.
Table
(
"casbin_rule"
)
.
Where
(
"v1 = ? AND v2 = ?"
,
oldPath
,
oldMethod
)
.
Find
(
&
cs
)
.
Updates
(
map
[
string
]
string
{
"v1"
:
newPath
,
"v2"
:
newMethod
,
})
.
Error
return
err
}
...
...
web/src/api/customer.js
浏览文件 @
ed6e8884
...
...
@@ -7,10 +7,10 @@ import service from '@/utils/request'
// @Produce application/json
// @Param data body dbModel.ExaCustomer true "删除客户"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/c
reateExaC
ustomer [post]
// @Router /customer/customer [post]
export
const
createExaCustomer
=
(
data
)
=>
{
return
service
({
url
:
"
/customer/c
reateExaC
ustomer
"
,
url
:
"
/customer/customer
"
,
method
:
'
post
'
,
data
})
...
...
@@ -25,11 +25,11 @@ export const createExaCustomer = (data) => {
// @Produce application/json
// @Param data body dbModel.ExaCustomer true "更新客户信息"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/
updateExaCustomer [pos
t]
// @Router /customer/
customer [pu
t]
export
const
updateExaCustomer
=
(
data
)
=>
{
return
service
({
url
:
"
/customer/
updateExaC
ustomer
"
,
method
:
'
p
os
t
'
,
url
:
"
/customer/
c
ustomer
"
,
method
:
'
p
u
t
'
,
data
})
}
...
...
@@ -42,11 +42,11 @@ export const updateExaCustomer = (data) => {
// @Produce application/json
// @Param data body dbModel.ExaCustomer true "创建客户"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/
deleteExaCustomer [post
]
// @Router /customer/
customer [delete
]
export
const
deleteExaCustomer
=
(
data
)
=>
{
return
service
({
url
:
"
/customer/
deleteExaC
ustomer
"
,
method
:
'
post
'
,
url
:
"
/customer/
c
ustomer
"
,
method
:
'
delete
'
,
data
})
}
...
...
@@ -59,12 +59,12 @@ export const deleteExaCustomer = (data) => {
// @Produce application/json
// @Param data body dbModel.ExaCustomer true "获取单一客户信息"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/
getExaCustomer [pos
t]
export
const
getExaCustomer
=
(
data
)
=>
{
// @Router /customer/
customer [ge
t]
export
const
getExaCustomer
=
(
params
)
=>
{
return
service
({
url
:
"
/customer/
getExaC
ustomer
"
,
method
:
'
pos
t
'
,
data
url
:
"
/customer/
c
ustomer
"
,
method
:
'
ge
t
'
,
params
})
}
...
...
@@ -76,11 +76,11 @@ export const getExaCustomer = (data) => {
// @Produce application/json
// @Param data body modelInterface.PageInfo true "获取权限客户列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/c
reateExaCustomer [pos
t]
export
const
getExaCustomerList
=
(
data
)
=>
{
// @Router /customer/c
ustomerList [ge
t]
export
const
getExaCustomerList
=
(
params
)
=>
{
return
service
({
url
:
"
/customer/
getExaC
ustomerList
"
,
method
:
'
pos
t
'
,
data
url
:
"
/customer/
c
ustomerList
"
,
method
:
'
ge
t
'
,
params
})
}
\ No newline at end of file
web/src/view/example/customer/customer.vue
浏览文件 @
ed6e8884
...
...
@@ -9,7 +9,6 @@
</div>
<el-table
:data=
"tableData"
@
selection-change=
"handleSelectionChange"
border
ref=
"multipleTable"
stripe
...
...
@@ -29,10 +28,10 @@
<el-popover
placement=
"top"
width=
"160"
v-model=
"visible"
>
v-model=
"
scope.row.
visible"
>
<p>
确定要删除吗?
</p>
<div
style=
"text-align: right; margin: 0"
>
<el-button
size=
"mini"
type=
"text"
@
click=
"visible = false"
>
取消
</el-button>
<el-button
size=
"mini"
type=
"text"
@
click=
"
scope.row.
visible = false"
>
取消
</el-button>
<el-button
type=
"primary"
size=
"mini"
@
click=
"deleteCustomer(scope.row)"
>
确定
</el-button>
</div>
<el-button
type=
"text"
size=
"mini"
slot=
"reference"
>
删除
</el-button>
...
...
@@ -113,7 +112,7 @@ export default {
},
methods
:{
async
updateCustomer
(
row
){
const
res
=
await
getExaCustomer
(
row
)
const
res
=
await
getExaCustomer
(
{
ID
:
row
.
ID
}
)
this
.
type
=
"
update
"
if
(
res
.
code
==
0
){
this
.
form
=
res
.
data
.
customer
...
...
@@ -125,8 +124,12 @@ export default {
},
async
deleteCustomer
(
row
){
this
.
visible
=
false
const
res
=
await
deleteExaCustomer
(
row
)
const
res
=
await
deleteExaCustomer
(
{
ID
:
row
.
ID
}
)
if
(
res
.
code
==
0
){
this
.
$message
({
type
:
"
success
"
,
message
:
"
删除成功
"
})
this
.
getTableData
()
}
},
...
...
web/src/view/superAdmin/user/user.vue
浏览文件 @
ed6e8884
...
...
@@ -163,6 +163,8 @@ export default {
const
res
=
await
getAuthorityList
({
page
:
1
,
pageSize
:
999
})
this
.
authOptions
=
res
.
data
.
list
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录