更新前端看板

This commit is contained in:
wangjiming
2026-08-03 16:20:21 +08:00
parent 15c4223f2c
commit 0c601934a0
18 changed files with 356 additions and 187 deletions

View File

@@ -2,6 +2,7 @@
import { computed, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { getAcl, setAcl, type AclEntry } from '@/api/modules/acl'
import { getUsers, type SystemUser } from '@/api/modules/system'
const props = defineProps<{
modelValue: boolean
@@ -15,13 +16,20 @@ const visible = computed({
set: (v) => emit('update:modelValue', v),
})
const entries = ref<AclEntry[]>([])
const users = ref<SystemUser[]>([])
const loading = ref(false)
const ALL_PERMS = ['read', 'write', 'execute', 'download', 'delete', 'share']
const PROJECT_ROLES = ['member', 'admin', 'viewer']
async function load() {
loading.value = true
try {
entries.value = await getAcl(props.resourceType, props.resourceId)
const [acl, us] = await Promise.all([
getAcl(props.resourceType, props.resourceId),
getUsers().catch(() => [] as SystemUser[]),
])
entries.value = acl
users.value = us
} finally {
loading.value = false
}
@@ -53,7 +61,12 @@ async function save() {
<el-option label="用户" value="user" />
<el-option label="项目角色" value="project_role" />
</el-select>
<el-input v-model="entry.subject_id" placeholder="subject ID" style="width: 200px" />
<el-select v-if="entry.subject_type === 'user'" v-model="entry.subject_id" placeholder="选择用户" style="width: 200px" filterable>
<el-option v-for="u in users" :key="u.id" :label="`${u.username} (${u.id})`" :value="u.id" />
</el-select>
<el-select v-else v-model="entry.subject_id" placeholder="选择角色" style="width: 200px">
<el-option v-for="r in PROJECT_ROLES" :key="r" :label="r" :value="r" />
</el-select>
<el-checkbox-group v-model="entry.permissions">
<el-checkbox v-for="p in ALL_PERMS" :key="p" :value="p">{{ p }}</el-checkbox>
</el-checkbox-group>

View File

@@ -132,8 +132,8 @@ async function handleSelect(key: string) {
}
}
function handleLogout() {
auth.logout()
async function handleLogout() {
await auth.logout()
router.push('/login')
}
</script>