diff --git a/src/api/permissionConfig.ts b/src/api/permissionConfig.ts new file mode 100644 index 0000000..c38cc5a --- /dev/null +++ b/src/api/permissionConfig.ts @@ -0,0 +1,72 @@ +import { request } from '@/utils/request' + +// 数据权限配置 类型定义 +export interface PermissionConfig { + id?: number + + mapperKey?: string + + controlMethod?: string + + permissionControl?: string + +} + +// 数据权限配置 API +export const permissionConfigApi = { + // 分页查询 + page(params: { page: number; pageSize: number; mapperKey?: string; controlMethod?: string }) { + return request({ url: '/biz/permissionConfig/page', method: 'get', params }) + }, + + // 新增 + options() { + return request({ url: '/biz/permissionConfig/options', method: 'get' }) + }, + + // 获取详情 + detail(id: string) { + return request({ url: `/biz/permissionConfig/${id}`, method: 'get' }) + }, + + // 新增 + create(data: PermissionConfig) { + return request({ url: '/biz/permissionConfig', method: 'post', data }) + }, + + // 修改 + update(data: PermissionConfig) { + return request({ url: '/biz/permissionConfig', method: 'put', data }) + }, + + // 删除 + delete(ids: string[]) { + return request({ url: `/biz/permissionConfig/${ids.join(',')}`, method: 'delete' }) + }, + + // 导出 + export(params?: { ids?: string[]; mapperKey?: string; controlMethod?: string }) { + const p: Record = {} + if (params?.ids?.length) p.ids = params.ids.join(',') + if (params?.mapperKey !== undefined && params?.mapperKey !== null) p.mapperKey = params.mapperKey + if (params?.controlMethod !== undefined && params?.controlMethod !== null) p.controlMethod = params.controlMethod + return request({ url: `/biz/permissionConfig/export`, method: 'get', params: p, responseType: 'blob' }) + }, + + // 导入 + importData(file: File) { + const formData = new FormData() + formData.append('file', file) + return request<{ success: number; fail: number; errors: string[] }>({ + url: `/biz/permissionConfig/import`, + method: 'post', + data: formData, + headers: { 'Content-Type': 'multipart/form-data' } + }) + }, + + // 下载导入模板 + downloadTemplate() { + return request({ url: `/biz/permissionConfig/template`, method: 'get', responseType: 'blob' }) + } +} diff --git a/src/router/index.ts b/src/router/index.ts index da9b3f5..8347676 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -216,6 +216,12 @@ const routes: RouteRecordRaw[] = [ meta: { title: '设备状态监控', icon: 'PulseOutline' } }, // 开发工具 + { + path: 'biz/permissionConfig', + name: 'permissionConfig', + component: () => import('@/views/biz/permissionConfig/index.vue'), + meta: { title: '数据权限配置', icon: 'ListOutline' } + }, { path: 'tool/gen', name: 'ToolGen', @@ -404,4 +410,4 @@ router.beforeEach(async (to, _from, next) => { }) -export default router \ No newline at end of file +export default router diff --git a/src/views/biz/permissionConfig/index.vue b/src/views/biz/permissionConfig/index.vue new file mode 100644 index 0000000..44a3874 --- /dev/null +++ b/src/views/biz/permissionConfig/index.vue @@ -0,0 +1,452 @@ + + + + +