78 lines
2.4 KiB
Plaintext
78 lines
2.4 KiB
Plaintext
<template>
|
||
<view class="permission-management-page">
|
||
<text class="page-title">{{ $t('perm_mgmt.title') }}</text>
|
||
<supadb
|
||
ref="permdb"
|
||
:collection="'ak_roles'"
|
||
:field="'*'"
|
||
:where="where"
|
||
:orderby="'level desc'"
|
||
:page-size="pageSize"
|
||
:page-current="pageCurrent"
|
||
getcount="exact"
|
||
loadtime="manual"
|
||
v-slot:default="{ data, pagination, loading, error }"
|
||
@load="onRoleLoad"
|
||
>
|
||
<view v-if="loading">{{ $t('common.loading') }}</view>
|
||
<view v-else-if="error">{{ error }}</view>
|
||
<view v-else>
|
||
<view class="table-header">
|
||
<text>{{ $t('role.name') }}</text>
|
||
<text>{{ $t('role.level') }}</text>
|
||
<text>{{ $t('role.description') }}</text>
|
||
<text>{{ $t('common.action') }}</text>
|
||
</view>
|
||
<view v-for="role in data" :key="role.get('id')" class="table-row">
|
||
<text>{{ role.get('name') }}</text>
|
||
<text>{{ role.get('level') }}</text>
|
||
<text>{{ role.get('description') }}</text>
|
||
<button @click="editRole(role)">{{ $t('common.edit') }}</button>
|
||
<button @click="deleteRole(role)">{{ $t('common.delete') }}</button>
|
||
</view>
|
||
<view class="pagination">
|
||
<button @click="prevPage(pagination)" :disabled="pagination.current <= 1">{{ $t('common.prev') }}</button>
|
||
<span>{{ pagination.current }}/{{ pagination.total }}</span>
|
||
<button @click="nextPage(pagination)" :disabled="pagination.current >= pagination.total">{{ $t('common.next') }}</button>
|
||
</view>
|
||
</view>
|
||
</supadb>
|
||
<!-- 权限分配、编辑弹窗等可后续补<E7BBAD>?-->
|
||
</view>
|
||
</template>
|
||
<script lang="uts">
|
||
export default {
|
||
name: 'PermissionManagement',
|
||
data() {
|
||
return {
|
||
where: {},
|
||
pageSize: 10,
|
||
pageCurrent: 1
|
||
}
|
||
},
|
||
methods: {
|
||
onRoleLoad(data: any[]) {
|
||
// 可处理数<E79086>?
|
||
},
|
||
prevPage(pagination: any) {
|
||
if (pagination.current > 1) this.pageCurrent--;
|
||
},
|
||
nextPage(pagination: any) {
|
||
if (pagination.current < pagination.total) this.pageCurrent++;
|
||
},
|
||
editRole(role: any) {
|
||
// 编辑逻辑
|
||
},
|
||
deleteRole(role: any) {
|
||
// 删除逻辑
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
<style scoped>
|
||
.permission-management-page { padding: 20px; }
|
||
.table-header, .table-row { display: flex; padding: 16px; align-items: center; }
|
||
.table-header { font-weight: bold; }
|
||
.pagination { margin-top: 16px; }
|
||
</style>
|