提交
This commit is contained in:
@@ -10,6 +10,7 @@ import PageHelp from '../components/PageHelp.vue'
|
||||
import { helpRole } from '../help'
|
||||
|
||||
const loading = ref(false)
|
||||
const keyword = ref('')
|
||||
const list = ref([])
|
||||
const perms = ref([]) // 全部权限(MENU + BUTTON)
|
||||
const treeRef = ref()
|
||||
@@ -43,23 +44,10 @@ const permTree = computed(() => {
|
||||
return nodes
|
||||
})
|
||||
|
||||
const filters = reactive({ keyword: '' })
|
||||
|
||||
function doSearch() {
|
||||
loadRoles()
|
||||
}
|
||||
|
||||
function resetFilters() {
|
||||
filters.keyword = ''
|
||||
loadRoles()
|
||||
}
|
||||
|
||||
async function loadRoles() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await request.get('/roles', {
|
||||
params: { keyword: filters.keyword || undefined }
|
||||
})
|
||||
const data = await request.get('/roles', { params: { keyword: keyword.value.trim() || undefined } })
|
||||
list.value = data?.list || []
|
||||
} finally {
|
||||
loading.value = false
|
||||
@@ -190,19 +178,17 @@ function permSummary(arr) {
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mb12">
|
||||
<el-form inline @submit.prevent="loadRoles">
|
||||
<el-card shadow="never">
|
||||
<el-form inline style="margin-bottom:12px" @submit.prevent="loadRoles">
|
||||
<el-form-item label="名称/编码">
|
||||
<el-input v-model="filters.keyword" placeholder="角色名称或编码(不区分大小写)" clearable style="width:220px" @keyup.enter="doSearch" @clear="doSearch" />
|
||||
<el-input v-model="keyword" placeholder="角色名称或编码(不区分大小写)" clearable style="width:220px"
|
||||
@keyup.enter="loadRoles" @clear="loadRoles" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="loading" @click="doSearch">查询</el-button>
|
||||
<el-button @click="resetFilters">重置</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="loadRoles">查询</el-button>
|
||||
<el-button @click="keyword=''; loadRoles()">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never">
|
||||
<el-table :data="list" border size="small" v-loading="loading" empty-text="暂无角色">
|
||||
<el-table-column prop="id" label="ID" width="64" align="center" />
|
||||
<el-table-column prop="code" label="编码" min-width="110" />
|
||||
|
||||
Reference in New Issue
Block a user