From 059ef47fdd904022520b763092aede23685d747d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E6=A0=A1=E4=BA=91?= <14135925+chenxilxy@user.noreply.gitee.com> Date: Wed, 24 Dec 2025 18:07:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=AE=A1=E7=90=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/calibration/roleManagement/index.ts | 81 +++++ src/router/index.ts | 8 + .../permissionManagement/index.vue | 2 +- .../calibration/personnelManagement/index.vue | 56 +++- .../components/GrantPermissionsForm.vue | 108 ++++++ .../roleManagement/components/RoleForm.vue | 112 +++++++ .../calibration/roleManagement/index.vue | 308 ++++++++++++++++++ vite.config.ts | 4 +- 8 files changed, 670 insertions(+), 9 deletions(-) create mode 100644 src/api/calibration/roleManagement/index.ts create mode 100644 src/views/calibration/roleManagement/components/GrantPermissionsForm.vue create mode 100644 src/views/calibration/roleManagement/components/RoleForm.vue create mode 100644 src/views/calibration/roleManagement/index.vue diff --git a/src/api/calibration/roleManagement/index.ts b/src/api/calibration/roleManagement/index.ts new file mode 100644 index 0000000..0401af9 --- /dev/null +++ b/src/api/calibration/roleManagement/index.ts @@ -0,0 +1,81 @@ +// roleManagement +import request from '@/utils/request' +const AUTH_BASE_URL = '/api2' + +/* + * 角色管理 + * */ + +// 添加角色 +export const BusinessAddRole = (data: any) => { + const formData = new FormData() + formData.append('RoleName', data.RoleName) + formData.append('remark', data.remark) + return request({ + url: `${AUTH_BASE_URL}/business/addRole`, + method: 'post', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data' + } + }) +} + +// 编辑角色 +export const BusinessEditRole = (data: any) => { + const formData = new FormData() + formData.append('id', data.id) + formData.append('RoleName', data.RoleName) + formData.append('remark', data.remark) + return request({ + url: `${AUTH_BASE_URL}/business/EditRole`, + method: 'post', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data' + } + }) +} + +// 角色展示 +export const BusinessDisplayRole = (data: any) => { + const formData = new FormData() + formData.append('RoleName', data.RoleName) + return request({ + url: `${AUTH_BASE_URL}/business/displayRole`, + method: 'post', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data' + } + }) +} + +// 删除角色 +export const BusinessDeleteRole = (id: string) => { + const formData = new FormData() + formData.append('id', id) + return request({ + url: `${AUTH_BASE_URL}/business/DeleteRole`, + method: 'post', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data' + } + }) +} + +// 赋予权限 +export const BusinessModifypermissions = (data: any) => { + const formData = new FormData() + formData.append('id', data.id) + formData.append('permissionId', data.permissionId) + return request({ + url: `${AUTH_BASE_URL}/business/modifypermissions`, + method: 'post', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data' + } + }) +} diff --git a/src/router/index.ts b/src/router/index.ts index 52ea23f..05cc293 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -92,6 +92,14 @@ export const constantRoutes: RouteRecordRaw[] = [ meta: { title: '权限管理' } + }, + { + path: 'roleManagement', + name: 'RoleManagement', + component: () => import('@/views/calibration/roleManagement/index.vue'), + meta: { + title: '角色管理' + } } ] }, diff --git a/src/views/calibration/permissionManagement/index.vue b/src/views/calibration/permissionManagement/index.vue index c98dcbc..d5ce7f5 100644 --- a/src/views/calibration/permissionManagement/index.vue +++ b/src/views/calibration/permissionManagement/index.vue @@ -173,7 +173,7 @@ function handleSelectionChange(selection: any) { } // 打开角色弹窗 -function handleOpenDialog(data?: any, parentId: string) { +function handleOpenDialog(data?: any, parentId?: string) { dialog.visible = true if (data?.id) { functionDialogBox( diff --git a/src/views/calibration/personnelManagement/index.vue b/src/views/calibration/personnelManagement/index.vue index 27e45d0..aeb6f27 100644 --- a/src/views/calibration/personnelManagement/index.vue +++ b/src/views/calibration/personnelManagement/index.vue @@ -92,6 +92,7 @@ v-loading="loading" :data="pageData" border + :resizable="false" stripe highlight-current-row class="data-table__content" @@ -106,7 +107,11 @@ - + + + {{ row.department.map((item: any) => item.username).join(',') }} + + @@ -222,11 +227,23 @@ - - - - - + + + + + + + @@ -435,6 +452,8 @@ import { UserPersonnelList } from '@/api/calibration/personnelManagement' import { getFileInfo, convertFilePathsToObject, isValidJson } from '@/utils/auxiliaryFunction' +import { UserDepartment } from '@/api/calibration/department' +import { BusinessDisplayRole } from '@/api/calibration/roleManagement' // ==================== 组件配置 ==================== defineOptions({ @@ -462,6 +481,8 @@ const queryParams = reactive({ // 列表数据 const pageData = ref([]) +const deptList = ref([]) +const roleList = ref([]) const total = ref(0) const loading = ref(false) @@ -478,9 +499,10 @@ const formData = reactive({ password: '', nation: '', IdCard: '', - department: '', + department: [], mobilePhone: '', position: '', + role: [], team: '', Dateofjoining: '', Confirmationtime: '', @@ -557,6 +579,13 @@ const rules = reactive({ trigger: 'blur' } ], + role: [ + { + required: true, + message: '请选择', + trigger: 'blur' + } + ], mobilePhone: [ { required: true, @@ -637,6 +666,17 @@ const fetchUserList = useDebounceFn(async () => { } }) +const DepartmentList = (name: string = '') => { + UserDepartment(name).then((res: any) => { + deptList.value = res.data + }) +} +const onBusinessDisplayRole = (name: string = '') => { + BusinessDisplayRole({ RoleName: name }).then((res: any) => { + roleList.value = res.data + }) +} + // ==================== 表格选择 ==================== const { selectedIds, hasSelection, handleSelectionChange } = useTableSelection() @@ -969,6 +1009,8 @@ async function handleExport(): Promise { */ onMounted(() => { handleQuery() + DepartmentList() + onBusinessDisplayRole() }) watch( () => queryParams.department, diff --git a/src/views/calibration/roleManagement/components/GrantPermissionsForm.vue b/src/views/calibration/roleManagement/components/GrantPermissionsForm.vue new file mode 100644 index 0000000..10c3bd1 --- /dev/null +++ b/src/views/calibration/roleManagement/components/GrantPermissionsForm.vue @@ -0,0 +1,108 @@ + + + + + + + + + diff --git a/src/views/calibration/roleManagement/components/RoleForm.vue b/src/views/calibration/roleManagement/components/RoleForm.vue new file mode 100644 index 0000000..2c84a1d --- /dev/null +++ b/src/views/calibration/roleManagement/components/RoleForm.vue @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + diff --git a/src/views/calibration/roleManagement/index.vue b/src/views/calibration/roleManagement/index.vue new file mode 100644 index 0000000..86bf898 --- /dev/null +++ b/src/views/calibration/roleManagement/index.vue @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 新增 + + 删除 + + + + + + + + + + + + 赋予权限 + + + 编辑 + + + 删除 + + + + + + + + + + + diff --git a/vite.config.ts b/vite.config.ts index a2d8667..dbcae5e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -47,7 +47,9 @@ export default defineConfig(({ mode }: ConfigEnv) => { '/dev-api/api2': { changeOrigin: true, // target: 'http://47.108.113.7:8000', - target: 'http://192.168.31.69:8006', + target: 'http://47.108.113.7:8000', + // target: 'http://192.168.31.69:8006', + // target: 'http://199.168.137.123:8000', rewrite: (path: string) => { return path.replace(/^\/dev-api\/api2/, '') }