Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
飞一样的人
gin-vue-admin
提交
e60487bb
G
gin-vue-admin
项目概览
飞一样的人
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
1
Star
1
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,发现更多精彩内容 >>
提交
e60487bb
编写于
11月 09, 2019
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加条件搜索示例 前端文件参考src\view\superAdmin\api\api.vue 后台文件参考 model\dnModel\api.go
上级
58cf2717
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
8 deletion
+33
-8
QMPlusServer/controller/api/api.go
QMPlusServer/controller/api/api.go
+12
-5
QMPlusServer/model/dbModel/api.go
QMPlusServer/model/dbModel/api.go
+1
-1
QMPlusVuePage/src/components/mixins/infoList.js
QMPlusVuePage/src/components/mixins/infoList.js
+2
-1
QMPlusVuePage/src/view/superAdmin/api/api.vue
QMPlusVuePage/src/view/superAdmin/api/api.vue
+18
-1
未找到文件。
QMPlusServer/controller/api/api.go
浏览文件 @
e60487bb
...
...
@@ -79,6 +79,8 @@ func SetAuthAndApi(c *gin.Context) {
}
}
//条件搜索后端看此api
// @Tags Api
// @Summary 分页获取API列表
// @Security ApiKeyAuth
...
...
@@ -88,17 +90,22 @@ func SetAuthAndApi(c *gin.Context) {
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/getApiList [post]
func
GetApiList
(
c
*
gin
.
Context
)
{
var
pageInfo
modelInterface
.
PageInfo
_
=
c
.
BindJSON
(
&
pageInfo
)
err
,
list
,
total
:=
new
(
dbModel
.
Api
)
.
GetInfoList
(
pageInfo
)
// 此结构体仅本方法使用
type
searchParams
struct
{
dbModel
.
Api
modelInterface
.
PageInfo
}
var
sp
searchParams
_
=
c
.
ShouldBindJSON
(
&
sp
)
err
,
list
,
total
:=
sp
.
Api
.
GetInfoList
(
sp
.
PageInfo
)
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"获取数据失败,%v"
,
err
),
gin
.
H
{})
}
else
{
servers
.
ReportFormat
(
c
,
true
,
"获取数据成功"
,
gin
.
H
{
"list"
:
list
,
"total"
:
total
,
"page"
:
p
ageInfo
.
Page
,
"pageSize"
:
p
ageInfo
.
PageSize
,
"page"
:
sp
.
P
ageInfo
.
Page
,
"pageSize"
:
sp
.
P
ageInfo
.
PageSize
,
})
}
...
...
QMPlusServer/model/dbModel/api.go
浏览文件 @
e60487bb
...
...
@@ -55,7 +55,7 @@ func (a *Api) GetInfoList(info modelInterface.PageInfo) (err error, list interfa
return
}
else
{
var
apiList
[]
Api
err
=
db
.
Order
(
"group"
,
true
)
.
Find
(
&
apiList
)
.
Error
err
=
db
.
Order
(
"group"
,
true
)
.
Where
(
"path LIKE ?"
,
"%"
+
a
.
Path
+
"%"
)
.
Find
(
&
apiList
)
.
Error
return
err
,
apiList
,
total
}
}
QMPlusVuePage/src/components/mixins/infoList.js
浏览文件 @
e60487bb
...
...
@@ -5,6 +5,7 @@ export default {
total
:
10
,
pageSize
:
10
,
tableData
:
[],
searchInfo
:
{}
}
},
methods
:
{
...
...
@@ -17,7 +18,7 @@ export default {
this
.
getTableData
()
},
async
getTableData
(
page
=
this
.
page
,
pageSize
=
this
.
pageSize
)
{
const
table
=
await
this
.
listApi
({
page
,
pageSize
})
const
table
=
await
this
.
listApi
({
page
,
pageSize
,
...
this
.
searchInfo
})
this
.
tableData
=
table
.
data
[
this
.
listKey
]
this
.
total
=
table
.
data
.
total
this
.
page
=
table
.
data
.
page
...
...
QMPlusVuePage/src/view/superAdmin/api/api.vue
浏览文件 @
e60487bb
...
...
@@ -3,6 +3,17 @@
<div
class=
"button-box clearflex"
>
<el-button
@
click=
"openDialog('addApi')"
type=
"primary"
>
新增api
</el-button>
</div>
<div
class=
"search-term"
>
<el-form
:inline=
"true"
:model=
"searchInfo"
class=
"demo-form-inline"
>
<el-form-item
label=
"路径"
>
<el-input
v-model=
"searchInfo.path"
placeholder=
"路径"
></el-input>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"onSubmit"
>
查询
</el-button>
</el-form-item>
</el-form>
</div>
<el-table
:data=
"tableData"
border
stripe
>
<el-table-column
label=
"id"
min-width=
"60"
prop=
"ID"
></el-table-column>
<el-table-column
label=
"api路径"
min-width=
"150"
prop=
"path"
></el-table-column>
...
...
@@ -48,7 +59,7 @@
<
script
>
// 获取列表内容封装在mixins内部 getTableData方法 初始化已封装完成
// 获取列表内容封装在mixins内部 getTableData方法 初始化已封装完成
条件搜索时候 请把条件安好后台定制的结构体字段 放到 this.searchInfo 中即可实现条件搜索
import
{
getApiById
,
...
...
@@ -76,6 +87,12 @@ export default {
}
},
methods
:
{
//条件搜索前端看此方法
onSubmit
(){
this
.
page
=
1
this
.
pageSize
=
10
this
.
getTableData
()
},
// 自动设置api分组
autoGroup
()
{
this
.
form
.
group
=
this
.
form
.
path
.
split
(
'
/
'
)[
1
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录