feat: 查询条件优化和 xorm session 修复
This commit is contained in:
@@ -3,9 +3,12 @@
|
||||
<div slot="header" style="display: flex; justify-content: space-between; align-items: center">
|
||||
<span>配置列表</span>
|
||||
<div>
|
||||
<el-select v-model="query.env" placeholder="环境" clearable style="width: 120px; margin-right: 10px" @change="loadData">
|
||||
<el-select v-model="query.env" placeholder="环境" clearable style="width: 160px; margin-right: 10px" @change="loadData">
|
||||
<el-option v-for="p in profiles" :key="p.value" :label="p.label" :value="p.value"></el-option>
|
||||
</el-select>
|
||||
<el-select v-model="query.appId" placeholder="应用" clearable filterable style="width: 200px; margin-right: 10px" @change="loadData">
|
||||
<el-option v-for="app in apps" :key="app.value" :label="app.label" :value="app.value"></el-option>
|
||||
</el-select>
|
||||
<el-button type="primary" @click="$router.push('/config/add')">新建配置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -192,8 +195,9 @@ export default {
|
||||
list: [],
|
||||
loading: false,
|
||||
total: 0,
|
||||
query: { pageNo: 1, pageSize: 20, env: '' },
|
||||
query: { pageNo: 1, pageSize: 20, env: '', appId: null },
|
||||
profiles: [],
|
||||
apps: [],
|
||||
historyVisible: false,
|
||||
historyList: [],
|
||||
currentConfig: null,
|
||||
@@ -206,12 +210,23 @@ export default {
|
||||
created() {
|
||||
this.loadData()
|
||||
this.loadProfiles()
|
||||
this.loadApps()
|
||||
},
|
||||
methods: {
|
||||
async loadData() {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await getConfigList(this.query)
|
||||
const params = {
|
||||
pageNo: this.query.pageNo,
|
||||
pageSize: this.query.pageSize
|
||||
}
|
||||
if (this.query.env) {
|
||||
params.env = this.query.env
|
||||
}
|
||||
if (this.query.appId) {
|
||||
params.appId = this.query.appId
|
||||
}
|
||||
const res = await getConfigList(params)
|
||||
this.list = res.data || []
|
||||
this.total = res.total || 0
|
||||
} finally {
|
||||
@@ -224,6 +239,12 @@ export default {
|
||||
this.profiles = res.data || []
|
||||
} catch (e) {}
|
||||
},
|
||||
async loadApps() {
|
||||
try {
|
||||
const res = await request({ url: '/admin/app/options', method: 'get' })
|
||||
this.apps = res.data || []
|
||||
} catch (e) {}
|
||||
},
|
||||
handlePageChange(page) {
|
||||
this.query.pageNo = page
|
||||
this.loadData()
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
<el-card>
|
||||
<div slot="header" style="display: flex; justify-content: space-between; align-items: center">
|
||||
<span>业务组管理</span>
|
||||
<el-button type="primary" @click="showAdd">新建业务组</el-button>
|
||||
<div>
|
||||
<el-select v-model="filterName" placeholder="组名称" clearable filterable style="width: 200px; margin-right: 10px">
|
||||
<el-option v-for="g in groupOptions" :key="g" :label="g" :value="g"></el-option>
|
||||
</el-select>
|
||||
<el-button type="primary" @click="showAdd">新建业务组</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table :data="list" v-loading="loading" border stripe>
|
||||
<el-table :data="filteredList" v-loading="loading" border stripe>
|
||||
<el-table-column prop="id" label="ID" width="60"></el-table-column>
|
||||
<el-table-column prop="name" label="组名称"></el-table-column>
|
||||
<el-table-column prop="master" label="负责人"></el-table-column>
|
||||
@@ -51,6 +56,7 @@ export default {
|
||||
return {
|
||||
list: [],
|
||||
loading: false,
|
||||
filterName: '',
|
||||
dialogVisible: false,
|
||||
dialogTitle: '',
|
||||
form: {},
|
||||
@@ -61,6 +67,15 @@ export default {
|
||||
users: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
groupOptions() {
|
||||
return [...new Set(this.list.map(g => g.name))].filter(name => name && name.trim())
|
||||
},
|
||||
filteredList() {
|
||||
if (!this.filterName) return this.list
|
||||
return this.list.filter(g => g.name === this.filterName)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadData()
|
||||
this.loadUsers()
|
||||
|
||||
@@ -2,7 +2,22 @@
|
||||
<el-card>
|
||||
<div slot="header" style="display: flex; justify-content: space-between; align-items: center">
|
||||
<span>用户管理</span>
|
||||
<el-button type="primary" @click="showAdd">新建用户</el-button>
|
||||
<div>
|
||||
<el-input v-model="query.name" placeholder="用户名" clearable style="width: 140px; margin-right: 10px" @clear="loadData" @keyup.enter.native="loadData"></el-input>
|
||||
<el-select v-model="query.type" placeholder="类型" clearable style="width: 120px; margin-right: 10px" @change="loadData">
|
||||
<el-option value="user" label="普通用户"></el-option>
|
||||
<el-option value="groupAdmin" label="组管理员"></el-option>
|
||||
<el-option value="superAdmin" label="超级管理员"></el-option>
|
||||
</el-select>
|
||||
<el-select v-model="query.groupId" placeholder="所属组" clearable filterable style="width: 160px; margin-right: 10px" @change="loadData">
|
||||
<el-option v-for="g in groups" :key="g.value" :label="g.label" :value="g.value"></el-option>
|
||||
</el-select>
|
||||
<el-select v-model="query.enabled" placeholder="状态" clearable style="width: 100px; margin-right: 10px" @change="loadData">
|
||||
<el-option :value="1" label="启用"></el-option>
|
||||
<el-option :value="0" label="禁用"></el-option>
|
||||
</el-select>
|
||||
<el-button type="primary" @click="showAdd">新建用户</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table :data="list" v-loading="loading" border stripe>
|
||||
<el-table-column prop="id" label="ID" width="60"></el-table-column>
|
||||
@@ -73,6 +88,13 @@ export default {
|
||||
return {
|
||||
list: [],
|
||||
loading: false,
|
||||
query: {
|
||||
name: '',
|
||||
type: '',
|
||||
groupId: '',
|
||||
enabled: ''
|
||||
},
|
||||
groups: [],
|
||||
dialogVisible: false,
|
||||
dialogTitle: '',
|
||||
form: {},
|
||||
@@ -85,17 +107,29 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.loadData()
|
||||
this.loadGroups()
|
||||
},
|
||||
methods: {
|
||||
async loadData() {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await request({ url: '/admin/user/list', method: 'get' })
|
||||
const params = {}
|
||||
if (this.query.name) params.name = this.query.name
|
||||
if (this.query.type) params.type = this.query.type
|
||||
if (this.query.groupId) params.groupId = this.query.groupId
|
||||
if (this.query.enabled !== '') params.enabled = this.query.enabled
|
||||
const res = await request({ url: '/admin/user/list', method: 'get', params })
|
||||
this.list = res.data || []
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
async loadGroups() {
|
||||
try {
|
||||
const res = await request({ url: '/admin/group/options', method: 'get' })
|
||||
this.groups = res.data || []
|
||||
} catch (e) {}
|
||||
},
|
||||
showAdd() {
|
||||
this.dialogTitle = '新建用户'
|
||||
this.form = { name: '', mobile: '', email: '', type: 'user', groupName: '' }
|
||||
|
||||
Reference in New Issue
Block a user