feat: 环境管理页面添加环境名称模糊查询,统一双卡片布局
This commit is contained in:
@@ -18,8 +18,13 @@ func NewProfileHandler() *ProfileHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *ProfileHandler) List(c *gin.Context) {
|
func (h *ProfileHandler) List(c *gin.Context) {
|
||||||
|
alias := c.Query("alias")
|
||||||
|
query := dao.Engine.Where("1=1")
|
||||||
|
if alias != "" {
|
||||||
|
query = query.Where("alias LIKE ?", "%"+alias+"%")
|
||||||
|
}
|
||||||
var profiles []model.Profile
|
var profiles []model.Profile
|
||||||
dao.Engine.Find(&profiles)
|
query.Find(&profiles)
|
||||||
c.JSON(http.StatusOK, model.WrapperResponse{Code: 0, Data: profiles})
|
c.JSON(http.StatusOK, model.WrapperResponse{Code: 0, Data: profiles})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-card style="margin-bottom: 16px">
|
||||||
|
<el-form :inline="true" @submit.native.prevent="handleSearch">
|
||||||
|
<el-form-item label="环境名称">
|
||||||
|
<el-input v-model="queryAlias" placeholder="请输入" clearable style="width: 200px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
||||||
|
<el-button @click="handleReset">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
<el-card>
|
<el-card>
|
||||||
<div slot="header" style="display: flex; justify-content: space-between; align-items: center">
|
<div slot="header" style="display: flex; justify-content: flex-end">
|
||||||
<span>环境列表</span>
|
|
||||||
<el-button type="primary" @click="showAdd">新建环境</el-button>
|
<el-button type="primary" @click="showAdd">新建环境</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table :data="list" v-loading="loading" border stripe>
|
<el-table :data="list" v-loading="loading" border stripe>
|
||||||
@@ -52,6 +64,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
list: [],
|
list: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
|
queryAlias: '',
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogTitle: '',
|
dialogTitle: '',
|
||||||
form: {},
|
form: {},
|
||||||
@@ -64,10 +77,19 @@ export default {
|
|||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleSearch() {
|
||||||
|
this.loadData()
|
||||||
|
},
|
||||||
|
handleReset() {
|
||||||
|
this.queryAlias = ''
|
||||||
|
this.loadData()
|
||||||
|
},
|
||||||
async loadData() {
|
async loadData() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
try {
|
try {
|
||||||
const res = await request({ url: '/admin/profile/list', method: 'get' })
|
const params = {}
|
||||||
|
if (this.queryAlias) params.alias = this.queryAlias
|
||||||
|
const res = await request({ url: '/admin/profile/list', method: 'get', params })
|
||||||
this.list = res.data || []
|
this.list = res.data || []
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
|||||||
Reference in New Issue
Block a user