From 13999142aa3b57fb5632f967a69ff768d15da94d Mon Sep 17 00:00:00 2001 From: sheng <15292050171@163.com> Date: Mon, 7 Aug 2023 18:26:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(=20=E8=A7=92=E8=89=B2=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?):=20=E6=9D=83=E9=99=90=E9=85=8D=E7=BD=AE=E9=87=8D=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../role/components/PermissionCom/index.vue | 603 +++++++++--------- .../components/PermissionComNew/index.vue | 185 ++++++ web/src/views/system/role/crud.tsx | 46 +- web/src/views/system/role/index.vue | 49 +- 4 files changed, 538 insertions(+), 345 deletions(-) create mode 100644 web/src/views/system/role/components/PermissionComNew/index.vue diff --git a/web/src/views/system/role/components/PermissionCom/index.vue b/web/src/views/system/role/components/PermissionCom/index.vue index aee7dfd..3ffe14a 100644 --- a/web/src/views/system/role/components/PermissionCom/index.vue +++ b/web/src/views/system/role/components/PermissionCom/index.vue @@ -1,379 +1,350 @@ - - - - 当前角色:{{ editedRoleInfo.name }} - - - - - 保存菜单授权 - - - - - - - - 新增 - - - - - {{ scope.row.menu_button__name }} - - - - - - - {{ formatDataRange(scope.row.data_range) }} - - - - - - 删除 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 取消 - - 确定 - - - - - - + + + + 当前角色:{{ editedRoleInfo.name }} + + + + + 保存菜单授权 + + + + + + + + 新增 + + + + {{ scope.row.menu_button__name }} + + + + + + {{ formatDataRange(scope.row.data_range) }} + + + + + + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 取消 + 确定 + + + + + - + diff --git a/web/src/views/system/role/components/PermissionComNew/index.vue b/web/src/views/system/role/components/PermissionComNew/index.vue new file mode 100644 index 0000000..4245ce9 --- /dev/null +++ b/web/src/views/system/role/components/PermissionComNew/index.vue @@ -0,0 +1,185 @@ + + + 保存菜单授权 + + + + + + + {{ item.name }} + + + + {{ btn.label }} + + + + + + 允许对这些数据有以下操作 + + + {{ btn.label }} + + + + + + + + + 对这些数据有以下字段权限 + + + 全部字段可查看可编辑 + 全部字段仅可查看不可编辑 + 自定义字段权限 + + + + + + 字段 + + + 查看 + + + 编辑 + + + + + 姓名 + + + + + + 性别 + + + + + + + + + + + + + + + + diff --git a/web/src/views/system/role/crud.tsx b/web/src/views/system/role/crud.tsx index bd14dc1..1923708 100644 --- a/web/src/views/system/role/crud.tsx +++ b/web/src/views/system/role/crud.tsx @@ -1,15 +1,22 @@ import { CrudOptions, AddReq, DelReq, EditReq, dict, CrudExpose, compute } from '@fast-crud/fast-crud'; -import _ from 'lodash-es'; import * as api from './api'; import { dictionary } from '/@/utils/dictionary'; import { successMessage } from '../../../utils/message'; -import {inject} from "vue"; +import { inject } from 'vue'; interface CreateCrudOptionsTypes { crudOptions: CrudOptions; } //此处为crudOptions配置 -export const createCrudOptions = function ({ crudExpose, rolePermission }: { crudExpose: CrudExpose; rolePermission: any }): CreateCrudOptionsTypes { +export const createCrudOptions = function ({ + crudExpose, + rolePermission, + handleDrawerOpen, +}: { + crudExpose: CrudExpose; + rolePermission: any; + handleDrawerOpen: Function; +}): CreateCrudOptionsTypes { const pageRequest = async (query: any) => { return await api.GetList(query); }; @@ -25,7 +32,7 @@ export const createCrudOptions = function ({ crudExpose, rolePermission }: { cru }; //权限判定 - const hasPermissions = inject("$hasPermissions") + const hasPermissions: any = inject('$hasPermissions'); // @ts-ignore // @ts-ignore @@ -40,25 +47,34 @@ export const createCrudOptions = function ({ crudExpose, rolePermission }: { cru rowHandle: { //固定右侧 fixed: 'right', - width: 200, + width: 260, buttons: { view: { show: false, }, edit: { - iconRight: 'Edit', - type: 'text', - show:hasPermissions('role:Update') + show: hasPermissions('role:Update'), }, remove: { - iconRight: 'Delete', - type: 'text', - show:hasPermissions('role:Delete') + show: hasPermissions('role:Delete'), }, custom: { + type: 'primary', text: '权限配置', - type: 'text', - show:hasPermissions('role:Update'), + show: hasPermissions('role:Update'), + tooltip: { + placement: 'top', + content: '权限配置', + }, + click: (context: any): void => { + const { row } = context; + handleDrawerOpen(); + }, + }, + /* custom: { + type: 'primary', + text: '权限配置', + show: hasPermissions('role:Update'), tooltip: { placement: 'top', content: '权限配置', @@ -70,7 +86,7 @@ export const createCrudOptions = function ({ crudExpose, rolePermission }: { cru rolePermission.value.editedRoleInfo = row; rolePermission.value.initGet(); }, - }, + }, */ }, }, form: { @@ -172,7 +188,7 @@ export const createCrudOptions = function ({ crudExpose, rolePermission }: { cru search: { show: true }, type: 'dict-radio', column: { - width:100, + width: 100, component: { name: 'fs-dict-switch', activeText: '', diff --git a/web/src/views/system/role/index.vue b/web/src/views/system/role/index.vue index e15d0fd..4325948 100644 --- a/web/src/views/system/role/index.vue +++ b/web/src/views/system/role/index.vue @@ -5,36 +5,57 @@ {{ scope.row.url }} - - + + + + + 当前角色: 管理员 + + +
+ + {{ item.name }} + +
允许对这些数据有以下操作
+ {{ btn.label }} + + + +
对这些数据有以下字段权限