feat(frontend): 完善前端权限系统
- 扩展 auth/roles.ts 添加13个新角色和40+权限定义 - 创建 services/permission.ts 权限API服务 - 创建 composables/usePermission.ts 权限组合函数 - 创建 router/permissionGuard.ts 路由权限守卫 - 更新路由配置使用新角色系统 - 更新 App.vue, LoginView, UsersView, PermissionsView 等使用新角色 - 更新 DemoDataService 使用新角色 - 前端编译验证通过
This commit is contained in:
@@ -13,9 +13,19 @@
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-mosquito-ink/70">角色</label>
|
||||
<select class="mos-input mt-2 w-full" v-model="form.role">
|
||||
<option value="管理员">管理员</option>
|
||||
<option value="运营">运营</option>
|
||||
<option value="只读">只读</option>
|
||||
<option value="super_admin">超级管理员</option>
|
||||
<option value="system_admin">系统管理员</option>
|
||||
<option value="operation_manager">运营经理</option>
|
||||
<option value="operation_member">运营成员</option>
|
||||
<option value="marketing_manager">市场经理</option>
|
||||
<option value="marketing_member">市场成员</option>
|
||||
<option value="finance_manager">财务经理</option>
|
||||
<option value="finance_member">财务成员</option>
|
||||
<option value="risk_manager">风控经理</option>
|
||||
<option value="risk_member">风控成员</option>
|
||||
<option value="customer_service">客服</option>
|
||||
<option value="auditor">审计员</option>
|
||||
<option value="viewer">只读</option>
|
||||
</select>
|
||||
</div>
|
||||
<button class="mos-btn mos-btn-accent w-full" @click="sendInvite">发送邀请(演示)</button>
|
||||
@@ -75,6 +85,7 @@ import { useAuditStore } from '../stores/audit'
|
||||
import { useUserStore } from '../stores/users'
|
||||
import { useDataService } from '../services'
|
||||
import ListSection from '../components/ListSection.vue'
|
||||
import { RoleLabels, type AdminRole } from '../auth/roles'
|
||||
|
||||
const auditStore = useAuditStore()
|
||||
const userStore = useUserStore()
|
||||
@@ -85,7 +96,7 @@ const page = ref(0)
|
||||
const pageSize = 6
|
||||
const form = ref({
|
||||
email: '',
|
||||
role: '运营'
|
||||
role: 'operation_manager'
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
@@ -94,18 +105,16 @@ onMounted(async () => {
|
||||
})
|
||||
|
||||
const roleLabel = (role: string) => {
|
||||
if (role === 'admin') return '管理员'
|
||||
if (role === 'operator') return '运营'
|
||||
return '只读'
|
||||
return RoleLabels[role as AdminRole] || role
|
||||
}
|
||||
|
||||
const formatDate = (value: string) => new Date(value).toLocaleString('zh-CN')
|
||||
|
||||
const sendInvite = () => {
|
||||
userStore.addInvite(form.value.email || '未填写邮箱', form.value.role === '管理员' ? 'admin' : form.value.role === '运营' ? 'operator' : 'viewer')
|
||||
userStore.addInvite(form.value.email || '未填写邮箱', form.value.role as AdminRole)
|
||||
auditStore.addLog('发送用户邀请', form.value.email || '未填写邮箱')
|
||||
form.value.email = ''
|
||||
form.value.role = '运营'
|
||||
form.value.role = 'operation_manager'
|
||||
}
|
||||
|
||||
const resendInvite = (id: string) => {
|
||||
|
||||
Reference in New Issue
Block a user