feat: btn permission
parent
2572e1db8a
commit
e3ca40287b
|
@ -109,6 +109,7 @@ export const usePermissionStore = defineStore('app-permission', {
|
|||
|
||||
let routes: AppRouteRecordRaw[] = []
|
||||
const roleList = toRaw(userStore.getRoleList) || []
|
||||
const userInfo = toRaw(userStore.getUserInfo) || {}
|
||||
const { permissionMode = projectSetting.permissionMode } = appStore.getProjectConfig
|
||||
|
||||
// 路由过滤器 在 函数filter 作为回调传入遍历使用
|
||||
|
@ -237,6 +238,11 @@ export const usePermissionStore = defineStore('app-permission', {
|
|||
break
|
||||
}
|
||||
|
||||
// 从用户中获取权限
|
||||
if (userInfo) {
|
||||
this.setPermCodeList(userInfo.permissions)
|
||||
}
|
||||
|
||||
patchHomeAffix(routes)
|
||||
return routes
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import { createPost, getPost, updatePost } from '@/api/system/post'
|
|||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
|
@ -29,7 +28,6 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
|
|||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getPost(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({ ...res })
|
||||
}
|
||||
})
|
||||
|
|
|
@ -2,18 +2,23 @@
|
|||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #toolbar>
|
||||
<a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button>
|
||||
<a-button type="warning" :preIcon="IconEnum.EXPORT" @click="handleExport"> {{ t('action.export') }} </a-button>
|
||||
<a-button type="primary" v-auth="['system:post:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
|
||||
{{ t('action.create') }}
|
||||
</a-button>
|
||||
<a-button type="warning" v-auth="['system:post:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
|
||||
{{ t('action.export') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{ icon: IconEnum.EDIT, label: t('action.edit'), onClick: handleEdit.bind(null, record) },
|
||||
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:post:update', onClick: handleEdit.bind(null, record) },
|
||||
{
|
||||
icon: IconEnum.DELETE,
|
||||
color: 'error',
|
||||
label: t('action.delete'),
|
||||
auth: 'system:post:delete',
|
||||
popConfirm: {
|
||||
title: t('common.delMessage'),
|
||||
placement: 'left',
|
||||
|
|
Loading…
Reference in New Issue