feat: 初始化项目并完成基础功能开发
- 完成项目初始化
- 实现用户注册、登录功能
- 完成用户管理与权限管理模块
- 开发后端 Tracker 服务器项目管理接口
- 实现日志管理接口
Change-Id: Ia4bde1c9ff600352a7ff0caca0cc50b02cad1af7
diff --git a/react-ui/src/services/ant-design-pro/api.ts b/react-ui/src/services/ant-design-pro/api.ts
new file mode 100644
index 0000000..64a950a
--- /dev/null
+++ b/react-ui/src/services/ant-design-pro/api.ts
@@ -0,0 +1,11 @@
+// @ts-ignore
+/* eslint-disable */
+import { request } from '@umijs/max';
+
+/** 此处后端没有提供注释 GET /api/notices */
+export async function getNotices(options?: { [key: string]: any }) {
+ return request<API.NoticeIconList>('/api/notices', {
+ method: 'GET',
+ ...(options || {}),
+ });
+}
diff --git a/react-ui/src/services/ant-design-pro/index.ts b/react-ui/src/services/ant-design-pro/index.ts
new file mode 100644
index 0000000..9ae58be
--- /dev/null
+++ b/react-ui/src/services/ant-design-pro/index.ts
@@ -0,0 +1,12 @@
+// @ts-ignore
+/* eslint-disable */
+// API 更新时间:
+// API 唯一标识:
+import * as api from './api';
+import * as login from './login';
+import * as rule from './rule';
+export default {
+ api,
+ login,
+ rule,
+};
diff --git a/react-ui/src/services/ant-design-pro/login.ts b/react-ui/src/services/ant-design-pro/login.ts
new file mode 100644
index 0000000..3b00b43
--- /dev/null
+++ b/react-ui/src/services/ant-design-pro/login.ts
@@ -0,0 +1,38 @@
+// @ts-ignore
+/* eslint-disable */
+import { request } from '@umijs/max';
+
+/** 登录接口 POST /api/login/account */
+export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
+ return request<API.LoginResult>('/api/login/account', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** 发送验证码 POST /api/login/captcha */
+export async function getFakeCaptcha(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.getFakeCaptchaParams,
+ options?: { [key: string]: any },
+) {
+ return request<API.FakeCaptcha>('/api/login/captcha', {
+ method: 'POST',
+ params: {
+ ...params,
+ },
+ ...(options || {}),
+ });
+}
+
+/** 登录接口 POST /api/login/outLogin */
+export async function outLogin(options?: { [key: string]: any }) {
+ return request<Record<string, any>>('/api/login/outLogin', {
+ method: 'POST',
+ ...(options || {}),
+ });
+}
diff --git a/react-ui/src/services/ant-design-pro/rule.ts b/react-ui/src/services/ant-design-pro/rule.ts
new file mode 100644
index 0000000..4b8ebc5
--- /dev/null
+++ b/react-ui/src/services/ant-design-pro/rule.ts
@@ -0,0 +1,42 @@
+// @ts-ignore
+/* eslint-disable */
+import { request } from '@umijs/max';
+
+/** 获取规则列表 GET /api/rule */
+export async function rule(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.ruleParams,
+ options?: { [key: string]: any },
+) {
+ return request<API.RuleList>('/api/rule', {
+ method: 'GET',
+ params: {
+ ...params,
+ },
+ ...(options || {}),
+ });
+}
+
+/** 新建规则 PUT /api/rule */
+export async function updateRule(options?: { [key: string]: any }) {
+ return request<API.RuleListItem>('/api/rule', {
+ method: 'PUT',
+ ...(options || {}),
+ });
+}
+
+/** 新建规则 POST /api/rule */
+export async function addRule(options?: { [key: string]: any }) {
+ return request<API.RuleListItem>('/api/rule', {
+ method: 'POST',
+ ...(options || {}),
+ });
+}
+
+/** 删除规则 DELETE /api/rule */
+export async function removeRule(options?: { [key: string]: any }) {
+ return request<Record<string, any>>('/api/rule', {
+ method: 'DELETE',
+ ...(options || {}),
+ });
+}
diff --git a/react-ui/src/services/ant-design-pro/typings.d.ts b/react-ui/src/services/ant-design-pro/typings.d.ts
new file mode 100644
index 0000000..4ee1264
--- /dev/null
+++ b/react-ui/src/services/ant-design-pro/typings.d.ts
@@ -0,0 +1,108 @@
+declare namespace API {
+ type CurrentUser = UserInfo & {
+ signature?: string;
+ title?: string;
+ group?: string;
+ tags?: { key?: string; label?: string }[];
+ notifyCount?: number;
+ unreadCount?: number;
+ country?: string;
+ access?: string;
+ geographic?: {
+ province?: { label?: string; key?: string };
+ city?: { label?: string; key?: string };
+ };
+ address?: string;
+ phone?: string;
+ };
+
+ type ErrorResponse = {
+ /** 业务约定的错误码 */
+ errorCode: string;
+ /** 业务上的错误信息 */
+ errorMessage?: string;
+ /** 业务上的请求是否成功 */
+ success?: boolean;
+ };
+
+ type FakeCaptcha = {
+ code?: number;
+ status?: string;
+ };
+
+ type getFakeCaptchaParams = {
+ /** 手机号 */
+ phone?: string;
+ };
+
+ type LoginParams = {
+ username?: string;
+ password?: string;
+ uuid?: string;
+ autoLogin?: boolean;
+ type?: string;
+ };
+
+ type LoginResult = {
+ code: number;
+ msg?: string;
+ type?: string;
+ token?: string;
+ };
+
+ type NoticeIconItem = {
+ id?: string;
+ extra?: string;
+ key?: string;
+ read?: boolean;
+ avatar?: string;
+ title?: string;
+ status?: string;
+ datetime?: string;
+ description?: string;
+ type?: NoticeIconItemType;
+ };
+
+ type NoticeIconItemType = 'notification' | 'message' | 'event';
+
+ type NoticeIconList = {
+ data?: NoticeIconItem[];
+ /** 列表的内容总数 */
+ total?: number;
+ success?: boolean;
+ };
+
+ type PageParams = {
+ current?: number;
+ pageSize?: number;
+ };
+
+ type RuleList = {
+ data?: RuleListItem[];
+ /** 列表的内容总数 */
+ total?: number;
+ success?: boolean;
+ };
+
+ type RuleListItem = {
+ key?: number;
+ disabled?: boolean;
+ href?: string;
+ avatar?: string;
+ name?: string;
+ owner?: string;
+ desc?: string;
+ callNo?: number;
+ status?: number;
+ updatedAt?: string;
+ createdAt?: string;
+ progress?: number;
+ };
+
+ type ruleParams = {
+ /** 当前的页码 */
+ current?: number;
+ /** 页面的容量 */
+ pageSize?: number;
+ };
+}
diff --git a/react-ui/src/services/monitor/cache.ts b/react-ui/src/services/monitor/cache.ts
new file mode 100644
index 0000000..244368e
--- /dev/null
+++ b/react-ui/src/services/monitor/cache.ts
@@ -0,0 +1,17 @@
+import { request } from '@umijs/max';
+
+
+/* *
+ *
+ * @author whiteshader@163.com
+ * @datetime 2021/09/16
+ *
+ * */
+
+
+// 获取服务器信息
+export async function getCacheInfo() {
+ return request<API.Monitor.CacheInfoResult>('/api/monitor/cache', {
+ method: 'GET',
+ });
+}
diff --git a/react-ui/src/services/monitor/cachelist.ts b/react-ui/src/services/monitor/cachelist.ts
new file mode 100644
index 0000000..d348d4b
--- /dev/null
+++ b/react-ui/src/services/monitor/cachelist.ts
@@ -0,0 +1,51 @@
+import { request } from '@umijs/max';
+
+/* *
+ *
+ * @author whiteshader@163.com
+ * @datetime 2022/06/27
+ *
+ * */
+
+
+// 查询缓存名称列表
+export function listCacheName() {
+ return request<API.Monitor.CacheNamesResponse>('/api/monitor/cache/getNames', {
+ method: 'get'
+ })
+}
+
+// 查询缓存键名列表
+export function listCacheKey(cacheName: string) {
+ return request<API.Monitor.CacheKeysResponse>('/api/monitor/cache/getKeys/' + cacheName, {
+ method: 'get'
+ })
+}
+
+// 查询缓存内容
+export function getCacheValue(cacheName: string, cacheKey: string) {
+ return request<API.Monitor.CacheValueResponse>('/api/monitor/cache/getValue/' + cacheName + '/' + cacheKey, {
+ method: 'get'
+ })
+}
+
+// 清理指定名称缓存
+export function clearCacheName(cacheName: string) {
+ return request<API.Result>('/api/monitor/cache/clearCacheName/' + cacheName, {
+ method: 'delete'
+ })
+}
+
+// 清理指定键名缓存
+export function clearCacheKey(cacheKey: string) {
+ return request<API.Result>('/api/monitor/cache/clearCacheKey/' + cacheKey, {
+ method: 'delete'
+ })
+}
+
+// 清理全部缓存
+export function clearCacheAll() {
+ return request<API.Result>('/api/monitor/cache/clearCacheAll', {
+ method: 'delete'
+ })
+}
diff --git a/react-ui/src/services/monitor/job.ts b/react-ui/src/services/monitor/job.ts
new file mode 100644
index 0000000..192f819
--- /dev/null
+++ b/react-ui/src/services/monitor/job.ts
@@ -0,0 +1,73 @@
+import { request } from '@umijs/max';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+/**
+ * 定时任务调度 API
+ *
+ * @author whiteshader@163.com
+ * @date 2023-02-07
+ */
+
+// 查询定时任务调度列表
+export async function getJobList(params?: API.Monitor.JobListParams) {
+ return request<API.Monitor.JobPageResult>('/api/monitor/job/list', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ params
+ });
+}
+
+// 查询定时任务调度详细
+export function getJob(jobId: number) {
+ return request<API.Monitor.JobInfoResult>(`/api/monitor/job/${jobId}`, {
+ method: 'GET'
+ });
+}
+
+// 新增定时任务调度
+export async function addJob(params: API.Monitor.Job) {
+ return request<API.Result>('/api/monitor/job', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 修改定时任务调度
+export async function updateJob(params: API.Monitor.Job) {
+ return request<API.Result>('/api/monitor/job', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 删除定时任务调度
+export async function removeJob(ids: string) {
+ return request<API.Result>(`/api/monitor/job/${ids}`, {
+ method: 'DELETE'
+ });
+}
+
+// 导出定时任务调度
+export function exportJob(params?: API.Monitor.JobListParams) {
+ return downLoadXlsx(`/api/monitor/job/export`, { params }, `job_${new Date().getTime()}.xlsx`);
+}
+
+// 定时任务立即执行一次
+export async function runJob(jobId: number, jobGroup: string) {
+ const job = {
+ jobId,
+ jobGroup,
+ };
+ return request('/api/monitor/job/run', {
+ method: 'PUT',
+ data: job,
+ });
+}
diff --git a/react-ui/src/services/monitor/jobLog.ts b/react-ui/src/services/monitor/jobLog.ts
new file mode 100644
index 0000000..9885aa7
--- /dev/null
+++ b/react-ui/src/services/monitor/jobLog.ts
@@ -0,0 +1,40 @@
+import { request } from '@umijs/max';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+/**
+ * 定时任务调度日志 API
+ *
+ * @author whiteshader
+ * @date 2023-02-07
+ */
+
+// 查询定时任务调度日志列表
+export async function getJobLogList(params?: API.Monitor.JobLogListParams) {
+ return request<API.Monitor.JobLogPageResult>('/api/schedule/job/log/list', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ params
+ });
+}
+
+
+// 删除定时任务调度日志
+export async function removeJobLog(jobLogId: string) {
+ return request<API.Result>(`/api/schedule/job/log/${jobLogId}`, {
+ method: 'DELETE'
+ });
+}
+
+// 清空调度日志
+export function cleanJobLog() {
+ return request('/api/schedule/job/log/clean', {
+ method: 'delete'
+ })
+}
+
+// 导出定时任务调度日志
+export function exportJobLog(params?: API.Monitor.JobLogListParams) {
+ return downLoadXlsx(`/api/monitor/jobLog/export`, { params }, `joblog_${new Date().getTime()}.xlsx`);
+}
diff --git a/react-ui/src/services/monitor/logininfor.ts b/react-ui/src/services/monitor/logininfor.ts
new file mode 100644
index 0000000..ea1864a
--- /dev/null
+++ b/react-ui/src/services/monitor/logininfor.ts
@@ -0,0 +1,68 @@
+import { request } from '@umijs/max';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+// 查询系统访问记录列表
+export async function getLogininforList(params?: API.Monitor.LogininforListParams) {
+ return request<API.Monitor.LogininforPageResult>('/api/monitor/logininfor/list', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ params
+ });
+}
+
+// 查询系统访问记录详细
+export function getLogininfor(infoId: number) {
+ return request<API.Monitor.LogininforInfoResult>(`/api/monitor/logininfor/${infoId}`, {
+ method: 'GET'
+ });
+}
+
+// 新增系统访问记录
+export async function addLogininfor(params: API.Monitor.Logininfor) {
+ return request<API.Result>('/api/monitor/logininfor', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 修改系统访问记录
+export async function updateLogininfor(params: API.Monitor.Logininfor) {
+ return request<API.Result>('/api/monitor/logininfor', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 删除系统访问记录
+export async function removeLogininfor(ids: string) {
+ return request<API.Result>(`/api/monitor/logininfor/${ids}`, {
+ method: 'DELETE'
+ });
+}
+
+// 导出系统访问记录
+export function exportLogininfor(params?: API.Monitor.LogininforListParams) {
+ return downLoadXlsx(`/api/monitor/logininfor/export`, { params }, `logininfor_${new Date().getTime()}.xlsx`);
+}
+
+// 解锁用户登录状态
+export function unlockLogininfor(userName: string) {
+ return request<API.Result>('/api/monitor/logininfor/unlock/' + userName, {
+ method: 'get'
+ })
+}
+
+// 清空登录日志
+export function cleanLogininfor() {
+ return request<API.Result>('/api/monitor/logininfor/clean', {
+ method: 'delete'
+ })
+}
diff --git a/react-ui/src/services/monitor/online.ts b/react-ui/src/services/monitor/online.ts
new file mode 100644
index 0000000..ae2a6ac
--- /dev/null
+++ b/react-ui/src/services/monitor/online.ts
@@ -0,0 +1,23 @@
+import { request } from '@umijs/max';
+
+/* *
+ *
+ * @author whiteshader@163.com
+ * @datetime 2021/09/16
+ *
+ * */
+
+// 查询在线用户列表
+export async function getOnlineUserList(params?: API.Monitor.OnlineUserListParams) {
+ return request<API.Monitor.OnlineUserPageResult>('/api/monitor/online/list', {
+ method: 'GET',
+ params,
+ });
+}
+
+// 强退用户
+export async function forceLogout(tokenId: string) {
+ return request(`/api/monitor/online/${tokenId}`, {
+ method: 'DELETE',
+ });
+}
diff --git a/react-ui/src/services/monitor/operlog.ts b/react-ui/src/services/monitor/operlog.ts
new file mode 100644
index 0000000..004863a
--- /dev/null
+++ b/react-ui/src/services/monitor/operlog.ts
@@ -0,0 +1,60 @@
+import { request } from '@umijs/max';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+// 查询操作日志记录列表
+export async function getOperlogList(params?: API.Monitor.OperlogListParams) {
+ return request<API.Monitor.OperlogPageResult>('/api/monitor/operlog/list', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ params
+ });
+}
+
+// 查询操作日志记录详细
+export function getOperlog(operId: number) {
+ return request<API.Monitor.OperlogInfoResult>(`/api/monitor/operlog/${operId}`, {
+ method: 'GET'
+ });
+}
+
+// 新增操作日志记录
+export async function addOperlog(params: API.Monitor.Operlog) {
+ return request<API.Result>('/api/monitor/operlog', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 修改操作日志记录
+export async function updateOperlog(params: API.Monitor.Operlog) {
+ return request<API.Result>('/api/monitor/operlog', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 删除操作日志记录
+export async function removeOperlog(ids: string) {
+ return request<API.Result>(`/api/monitor/operlog/${ids}`, {
+ method: 'DELETE'
+ });
+}
+
+export async function cleanAllOperlog() {
+ return request<API.Result>(`/api/monitor/operlog/clean`, {
+ method: 'DELETE'
+ });
+}
+
+// 导出操作日志记录
+export function exportOperlog(params?: API.Monitor.OperlogListParams) {
+ return downLoadXlsx(`/api/monitor/operlog/export`, { params }, `operlog_${new Date().getTime()}.xlsx`);
+}
diff --git a/react-ui/src/services/monitor/server.ts b/react-ui/src/services/monitor/server.ts
new file mode 100644
index 0000000..24a849f
--- /dev/null
+++ b/react-ui/src/services/monitor/server.ts
@@ -0,0 +1,16 @@
+import { request } from '@umijs/max';
+
+/* *
+ *
+ * @author whiteshader@163.com
+ * @datetime 2023/02/07
+ *
+ * */
+
+
+// 获取服务器信息
+export async function getServerInfo() {
+ return request('/api/monitor/server', {
+ method: 'GET',
+ });
+}
diff --git a/react-ui/src/services/session.ts b/react-ui/src/services/session.ts
new file mode 100644
index 0000000..8b4e0d3
--- /dev/null
+++ b/react-ui/src/services/session.ts
@@ -0,0 +1,159 @@
+import { createIcon } from '@/utils/IconUtil';
+import { MenuDataItem } from '@ant-design/pro-components';
+import { request } from '@umijs/max';
+import React, { lazy } from 'react';
+
+
+let remoteMenu: any = null;
+
+export function getRemoteMenu() {
+ return remoteMenu;
+}
+
+export function setRemoteMenu(data: any) {
+ remoteMenu = data;
+}
+
+
+function patchRouteItems(route: any, menu: any, parentPath: string) {
+ for (const menuItem of menu) {
+ if (menuItem.component === 'Layout' || menuItem.component === 'ParentView') {
+ if (menuItem.routes) {
+ let hasItem = false;
+ let newItem = null;
+ for (const routeChild of route.routes) {
+ if (routeChild.path === menuItem.path) {
+ hasItem = true;
+ newItem = routeChild;
+ }
+ }
+ if (!hasItem) {
+ newItem = {
+ path: menuItem.path,
+ routes: [],
+ children: []
+ }
+ route.routes.push(newItem)
+ }
+ patchRouteItems(newItem, menuItem.routes, parentPath + menuItem.path + '/');
+ }
+ } else {
+ const names: string[] = menuItem.component.split('/');
+ let path = '';
+ names.forEach(name => {
+ if (path.length > 0) {
+ path += '/';
+ }
+ if (name !== 'index') {
+ path += name.at(0)?.toUpperCase() + name.substr(1);
+ } else {
+ path += name;
+ }
+ })
+ if (!path.endsWith('.tsx')) {
+ path += '.tsx'
+ }
+ if (route.routes === undefined) {
+ route.routes = [];
+ }
+ if (route.children === undefined) {
+ route.children = [];
+ }
+ const newRoute = {
+ element: React.createElement(lazy(() => import('@/pages/' + path))),
+ path: parentPath + menuItem.path,
+ }
+ route.children.push(newRoute);
+ route.routes.push(newRoute);
+ }
+ }
+}
+
+export function patchRouteWithRemoteMenus(routes: any) {
+ if (remoteMenu === null) { return; }
+ let proLayout = null;
+ for (const routeItem of routes) {
+ if (routeItem.id === 'ant-design-pro-layout') {
+ proLayout = routeItem;
+ break;
+ }
+ }
+ patchRouteItems(proLayout, remoteMenu, '');
+}
+
+/** 获取当前的用户 GET /api/getUserInfo */
+export async function getUserInfo(options?: Record<string, any>) {
+ return request<API.UserInfoResult>('/api/getInfo', {
+ method: 'GET',
+ ...(options || {}),
+ });
+}
+
+// 刷新方法
+export async function refreshToken() {
+ return request('/api/auth/refresh', {
+ method: 'post'
+ })
+}
+
+export async function getRouters(): Promise<any> {
+ return request('/api/getRouters');
+}
+
+export function convertCompatRouters(childrens: API.RoutersMenuItem[]): any[] {
+ return childrens.map((item: API.RoutersMenuItem) => {
+ return {
+ path: item.path,
+ icon: createIcon(item.meta.icon),
+ // icon: item.meta.icon,
+ name: item.meta.title,
+ routes: item.children ? convertCompatRouters(item.children) : undefined,
+ hideChildrenInMenu: item.hidden,
+ hideInMenu: item.hidden,
+ component: item.component,
+ authority: item.perms,
+ };
+ });
+}
+
+export async function getRoutersInfo(): Promise<MenuDataItem[]> {
+ return getRouters().then((res) => {
+ if (res.code === 200) {
+ return convertCompatRouters(res.data);
+ } else {
+ return [];
+ }
+ });
+}
+
+export function getMatchMenuItem(
+ path: string,
+ menuData: MenuDataItem[] | undefined,
+): MenuDataItem[] {
+ if (!menuData) return [];
+ let items: MenuDataItem[] = [];
+ menuData.forEach((item) => {
+ if (item.path) {
+ if (item.path === path) {
+ items.push(item);
+ return;
+ }
+ if (path.length >= item.path?.length) {
+ const exp = `${item.path}/*`;
+ if (path.match(exp)) {
+ if (item.routes) {
+ const subpath = path.substr(item.path.length + 1);
+ const subItem: MenuDataItem[] = getMatchMenuItem(subpath, item.routes);
+ items = items.concat(subItem);
+ } else {
+ const paths = path.split('/');
+ if (paths.length >= 2 && paths[0] === item.path && paths[1] === 'index') {
+ items.push(item);
+ }
+ }
+ }
+ }
+ }
+ });
+ return items;
+}
diff --git a/react-ui/src/services/swagger/index.ts b/react-ui/src/services/swagger/index.ts
new file mode 100644
index 0000000..83cf97c
--- /dev/null
+++ b/react-ui/src/services/swagger/index.ts
@@ -0,0 +1,12 @@
+// @ts-ignore
+/* eslint-disable */
+// API 更新时间:
+// API 唯一标识:
+import * as pet from './pet';
+import * as store from './store';
+import * as user from './user';
+export default {
+ pet,
+ store,
+ user,
+};
diff --git a/react-ui/src/services/swagger/pet.ts b/react-ui/src/services/swagger/pet.ts
new file mode 100644
index 0000000..b887475
--- /dev/null
+++ b/react-ui/src/services/swagger/pet.ts
@@ -0,0 +1,153 @@
+// @ts-ignore
+/* eslint-disable */
+import { request } from '@umijs/max';
+
+/** Update an existing pet PUT /pet */
+export async function updatePet(body: API.Pet, options?: { [key: string]: any }) {
+ return request<any>('/pet', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Add a new pet to the store POST /pet */
+export async function addPet(body: API.Pet, options?: { [key: string]: any }) {
+ return request<any>('/pet', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Find pet by ID Returns a single pet GET /pet/${param0} */
+export async function getPetById(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.getPetByIdParams,
+ options?: { [key: string]: any },
+) {
+ const { petId: param0, ...queryParams } = params;
+ return request<API.Pet>(`/pet/${param0}`, {
+ method: 'GET',
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
+
+/** Updates a pet in the store with form data POST /pet/${param0} */
+export async function updatePetWithForm(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.updatePetWithFormParams,
+ body: { name?: string; status?: string },
+ options?: { [key: string]: any },
+) {
+ const { petId: param0, ...queryParams } = params;
+ const formData = new FormData();
+
+ Object.keys(body).forEach((ele) => {
+ const item = (body as any)[ele];
+
+ if (item !== undefined && item !== null) {
+ formData.append(
+ ele,
+ typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item,
+ );
+ }
+ });
+
+ return request<any>(`/pet/${param0}`, {
+ method: 'POST',
+ params: { ...queryParams },
+ data: formData,
+ ...(options || {}),
+ });
+}
+
+/** Deletes a pet DELETE /pet/${param0} */
+export async function deletePet(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.deletePetParams & {
+ // header
+ api_key?: string;
+ },
+ options?: { [key: string]: any },
+) {
+ const { petId: param0, ...queryParams } = params;
+ return request<any>(`/pet/${param0}`, {
+ method: 'DELETE',
+ headers: {},
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
+
+/** uploads an image POST /pet/${param0}/uploadImage */
+export async function uploadFile(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.uploadFileParams,
+ body: { additionalMetadata?: string; file?: string },
+ file?: File,
+ options?: { [key: string]: any },
+) {
+ const { petId: param0, ...queryParams } = params;
+ const formData = new FormData();
+
+ if (file) {
+ formData.append('file', file);
+ }
+
+ Object.keys(body).forEach((ele) => {
+ const item = (body as any)[ele];
+
+ if (item !== undefined && item !== null) {
+ formData.append(
+ ele,
+ typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item,
+ );
+ }
+ });
+
+ return request<API.ApiResponse>(`/pet/${param0}/uploadImage`, {
+ method: 'POST',
+ params: { ...queryParams },
+ data: formData,
+ requestType: 'form',
+ ...(options || {}),
+ });
+}
+
+/** Finds Pets by status Multiple status values can be provided with comma separated strings GET /pet/findByStatus */
+export async function findPetsByStatus(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.findPetsByStatusParams,
+ options?: { [key: string]: any },
+) {
+ return request<API.Pet[]>('/pet/findByStatus', {
+ method: 'GET',
+ params: {
+ ...params,
+ },
+ ...(options || {}),
+ });
+}
+
+/** Finds Pets by tags Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. GET /pet/findByTags */
+export async function findPetsByTags(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.findPetsByTagsParams,
+ options?: { [key: string]: any },
+) {
+ return request<API.Pet[]>('/pet/findByTags', {
+ method: 'GET',
+ params: {
+ ...params,
+ },
+ ...(options || {}),
+ });
+}
diff --git a/react-ui/src/services/swagger/store.ts b/react-ui/src/services/swagger/store.ts
new file mode 100644
index 0000000..b9c689a
--- /dev/null
+++ b/react-ui/src/services/swagger/store.ts
@@ -0,0 +1,48 @@
+// @ts-ignore
+/* eslint-disable */
+import { request } from '@umijs/max';
+
+/** Returns pet inventories by status Returns a map of status codes to quantities GET /store/inventory */
+export async function getInventory(options?: { [key: string]: any }) {
+ return request<Record<string, any>>('/store/inventory', {
+ method: 'GET',
+ ...(options || {}),
+ });
+}
+
+/** Place an order for a pet POST /store/order */
+export async function placeOrder(body: API.Order, options?: { [key: string]: any }) {
+ return request<API.Order>('/store/order', {
+ method: 'POST',
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Find purchase order by ID For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions GET /store/order/${param0} */
+export async function getOrderById(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.getOrderByIdParams,
+ options?: { [key: string]: any },
+) {
+ const { orderId: param0, ...queryParams } = params;
+ return request<API.Order>(`/store/order/${param0}`, {
+ method: 'GET',
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
+
+/** Delete purchase order by ID For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors DELETE /store/order/${param0} */
+export async function deleteOrder(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.deleteOrderParams,
+ options?: { [key: string]: any },
+) {
+ const { orderId: param0, ...queryParams } = params;
+ return request<any>(`/store/order/${param0}`, {
+ method: 'DELETE',
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
diff --git a/react-ui/src/services/swagger/typings.d.ts b/react-ui/src/services/swagger/typings.d.ts
new file mode 100644
index 0000000..d06bcfc
--- /dev/null
+++ b/react-ui/src/services/swagger/typings.d.ts
@@ -0,0 +1,112 @@
+declare namespace API {
+ type ApiResponse = {
+ code?: number;
+ type?: string;
+ message?: string;
+ };
+
+ type Category = {
+ id?: number;
+ name?: string;
+ };
+
+ type deleteOrderParams = {
+ /** ID of the order that needs to be deleted */
+ orderId: number;
+ };
+
+ type deletePetParams = {
+ api_key?: string;
+ /** Pet id to delete */
+ petId: number;
+ };
+
+ type deleteUserParams = {
+ /** The name that needs to be deleted */
+ username: string;
+ };
+
+ type findPetsByStatusParams = {
+ /** Status values that need to be considered for filter */
+ status: ('available' | 'pending' | 'sold')[];
+ };
+
+ type findPetsByTagsParams = {
+ /** Tags to filter by */
+ tags: string[];
+ };
+
+ type getOrderByIdParams = {
+ /** ID of pet that needs to be fetched */
+ orderId: number;
+ };
+
+ type getPetByIdParams = {
+ /** ID of pet to return */
+ petId: number;
+ };
+
+ type getUserByNameParams = {
+ /** The name that needs to be fetched. Use user1 for testing. */
+ username: string;
+ };
+
+ type loginUserParams = {
+ /** The user name for login */
+ username: string;
+ /** The password for login in clear text */
+ password: string;
+ };
+
+ type Order = {
+ id?: number;
+ petId?: number;
+ quantity?: number;
+ shipDate?: string;
+ /** Order Status */
+ status?: 'placed' | 'approved' | 'delivered';
+ complete?: boolean;
+ };
+
+ type Pet = {
+ id?: number;
+ category?: Category;
+ name: string;
+ photoUrls: string[];
+ tags?: Tag[];
+ /** pet status in the store */
+ status?: 'available' | 'pending' | 'sold';
+ };
+
+ type Tag = {
+ id?: number;
+ name?: string;
+ };
+
+ type updatePetWithFormParams = {
+ /** ID of pet that needs to be updated */
+ petId: number;
+ };
+
+ type updateUserParams = {
+ /** name that need to be updated */
+ username: string;
+ };
+
+ type uploadFileParams = {
+ /** ID of pet to update */
+ petId: number;
+ };
+
+ type User = {
+ id?: number;
+ username?: string;
+ firstName?: string;
+ lastName?: string;
+ email?: string;
+ password?: string;
+ phone?: string;
+ /** User Status */
+ userStatus?: number;
+ };
+}
diff --git a/react-ui/src/services/swagger/user.ts b/react-ui/src/services/swagger/user.ts
new file mode 100644
index 0000000..4dd6f42
--- /dev/null
+++ b/react-ui/src/services/swagger/user.ts
@@ -0,0 +1,100 @@
+// @ts-ignore
+/* eslint-disable */
+import { request } from '@umijs/max';
+
+/** Create user This can only be done by the logged in user. POST /user */
+export async function createUser(body: API.User, options?: { [key: string]: any }) {
+ return request<any>('/user', {
+ method: 'POST',
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Get user by user name GET /user/${param0} */
+export async function getUserByName(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.getUserByNameParams,
+ options?: { [key: string]: any },
+) {
+ const { username: param0, ...queryParams } = params;
+ return request<API.User>(`/user/${param0}`, {
+ method: 'GET',
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
+
+/** Updated user This can only be done by the logged in user. PUT /user/${param0} */
+export async function updateUser(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.updateUserParams,
+ body: API.User,
+ options?: { [key: string]: any },
+) {
+ const { username: param0, ...queryParams } = params;
+ return request<any>(`/user/${param0}`, {
+ method: 'PUT',
+ params: { ...queryParams },
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Delete user This can only be done by the logged in user. DELETE /user/${param0} */
+export async function deleteUser(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.deleteUserParams,
+ options?: { [key: string]: any },
+) {
+ const { username: param0, ...queryParams } = params;
+ return request<any>(`/user/${param0}`, {
+ method: 'DELETE',
+ params: { ...queryParams },
+ ...(options || {}),
+ });
+}
+
+/** Creates list of users with given input array POST /user/createWithArray */
+export async function createUsersWithArrayInput(
+ body: API.User[],
+ options?: { [key: string]: any },
+) {
+ return request<any>('/user/createWithArray', {
+ method: 'POST',
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Creates list of users with given input array POST /user/createWithList */
+export async function createUsersWithListInput(body: API.User[], options?: { [key: string]: any }) {
+ return request<any>('/user/createWithList', {
+ method: 'POST',
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** Logs user into the system GET /user/login */
+export async function loginUser(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.loginUserParams,
+ options?: { [key: string]: any },
+) {
+ return request<string>('/user/login', {
+ method: 'GET',
+ params: {
+ ...params,
+ },
+ ...(options || {}),
+ });
+}
+
+/** Logs out current logged in user session GET /user/logout */
+export async function logoutUser(options?: { [key: string]: any }) {
+ return request<any>('/user/logout', {
+ method: 'GET',
+ ...(options || {}),
+ });
+}
diff --git a/react-ui/src/services/system/auth.ts b/react-ui/src/services/system/auth.ts
new file mode 100644
index 0000000..b757618
--- /dev/null
+++ b/react-ui/src/services/system/auth.ts
@@ -0,0 +1,39 @@
+import { request } from '@umijs/max';
+
+export async function getCaptchaImg(params?: Record<string, any>, options?: Record<string, any>) {
+ return request('/api/captchaImage', {
+ method: 'GET',
+ params: {
+ ...params,
+ },
+ headers: {
+ isToken: false,
+ },
+ ...(options || {}),
+ });
+}
+
+/** 登录接口 POST /api/login/account */
+export async function login(body: API.LoginParams, options?: Record<string, any>) {
+ return request<API.LoginResult>('/api/login', {
+ method: 'POST',
+ headers: {
+ isToken: false,
+ 'Content-Type': 'application/json',
+ },
+ data: body,
+ ...(options || {}),
+ });
+}
+
+/** 退出登录接口 POST /api/login/outLogin */
+export async function logout() {
+ return request<Record<string, any>>('/api/logout', {
+ method: 'delete',
+ });
+}
+
+// 获取手机验证码
+export async function getMobileCaptcha(mobile: string) {
+ return request(`/api/login/captcha?mobile=${mobile}`);
+}
diff --git a/react-ui/src/services/system/config.ts b/react-ui/src/services/system/config.ts
new file mode 100644
index 0000000..9843daf
--- /dev/null
+++ b/react-ui/src/services/system/config.ts
@@ -0,0 +1,62 @@
+import { request } from '@umijs/max';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+// 查询参数配置列表
+export async function getConfigList(params?: API.System.ConfigListParams) {
+ return request<API.System.ConfigPageResult>('/api/system/config/list', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ params
+ });
+}
+
+// 查询参数配置详细
+export function getConfig(configId: number) {
+ return request<API.System.ConfigInfoResult>(`/api/system/config/${configId}`, {
+ method: 'GET'
+ });
+}
+
+// 新增参数配置
+export async function addConfig(params: API.System.Config) {
+ return request<API.Result>('/api/system/config', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 修改参数配置
+export async function updateConfig(params: API.System.Config) {
+ return request<API.Result>('/api/system/config', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 删除参数配置
+export async function removeConfig(ids: string) {
+ return request<API.Result>(`/api/system/config/${ids}`, {
+ method: 'DELETE'
+ });
+}
+
+// 导出参数配置
+export function exportConfig(params?: API.System.ConfigListParams) {
+ return downLoadXlsx(`/api/system/config/export`, { params }, `config_${new Date().getTime()}.xlsx`);
+}
+
+
+// 刷新参数缓存
+export function refreshConfigCache() {
+ return request<API.Result>('/api/system/config/refreshCache', {
+ method: 'delete'
+ })
+}
diff --git a/react-ui/src/services/system/dept.ts b/react-ui/src/services/system/dept.ts
new file mode 100644
index 0000000..ad58807
--- /dev/null
+++ b/react-ui/src/services/system/dept.ts
@@ -0,0 +1,56 @@
+import { request } from '@umijs/max';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+// 查询部门列表
+export async function getDeptList(params?: API.System.DeptListParams) {
+ return request<API.System.DeptPageResult>('/api/system/dept/list', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ params
+ });
+}
+
+// 查询部门列表(排除节点)
+export function getDeptListExcludeChild(deptId: number) {
+ return request(`/api/system/dept/list/exclude/${deptId}`, {
+ method: 'get',
+ });
+}
+
+// 查询部门详细
+export function getDept(deptId: number) {
+ return request<API.System.DeptInfoResult>(`/api/system/dept/${deptId}`, {
+ method: 'GET'
+ });
+}
+
+// 新增部门
+export async function addDept(params: API.System.Dept) {
+ return request<API.Result>('/api/system/dept', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 修改部门
+export async function updateDept(params: API.System.Dept) {
+ return request<API.Result>('/api/system/dept', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 删除部门
+export async function removeDept(ids: string) {
+ return request<API.Result>(`/api/system/dept/${ids}`, {
+ method: 'DELETE'
+ });
+}
diff --git a/react-ui/src/services/system/dict.ts b/react-ui/src/services/system/dict.ts
new file mode 100644
index 0000000..5671124
--- /dev/null
+++ b/react-ui/src/services/system/dict.ts
@@ -0,0 +1,120 @@
+import { request } from '@umijs/max';
+import { DictValueEnumObj } from '@/components/DictTag';
+import { HttpResult } from '@/enums/httpEnum';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+/* *
+ *
+ * @author whiteshader@163.com
+ * @datetime 2021/09/16
+ *
+ * */
+
+// 查询字典类型列表
+export async function getDictTypeList(params?: API.DictTypeListParams) {
+ return request(`/api/system/dict/type/list`, {
+ params: {
+ ...params,
+ },
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ });
+}
+
+// 查询字典类型详细
+export function getDictType(dictId: string) {
+ return request(`/api/system/dict/type/${dictId}`, {
+ method: 'GET',
+ });
+}
+
+// 查询字典数据详细
+export async function getDictValueEnum(dictType: string, isDigital?: boolean): Promise<DictValueEnumObj> {
+ const resp = await request<API.System.DictTypeResult>(`/api/system/dict/data/type/${dictType}`, {
+ method: 'GET',
+ });
+ if(resp.code === HttpResult.SUCCESS) {
+ const opts: DictValueEnumObj = {};
+ resp.data.forEach((item: any) => {
+ opts[item.dictValue] = {
+ text: item.dictLabel,
+ label: item.dictLabel,
+ value: isDigital ? Number(item.dictValue) : item.dictValue,
+ key: item.dictCode,
+ listClass: item.listClass,
+ status: item.listClass };
+ });
+ return opts;
+ } else {
+ return {};
+ }
+}
+
+export async function getDictSelectOption(dictType: string, isDigital?: boolean) {
+ const resp = await request<API.System.DictTypeResult>(`/api/system/dict/data/type/${dictType}`, {
+ method: 'GET',
+ });
+ if (resp.code === 200) {
+ const options: DictValueEnumObj[] = resp.data.map((item) => {
+ return {
+ text: item.dictLabel,
+ label: item.dictLabel,
+ value: isDigital ? Number(item.dictValue) : item.dictValue,
+ key: item.dictCode,
+ listClass: item.listClass,
+ status: item.listClass
+ };
+ });
+ return options;
+ }
+ return [];
+};
+
+// 新增字典类型
+export async function addDictType(params: API.System.DictType) {
+ return request<API.Result>('/api/system/dict/type', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 修改字典类型
+export async function updateDictType(params: API.System.DictType) {
+ return request<API.Result>('/api/system/dict/type', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 删除字典类型
+export async function removeDictType(ids: string) {
+ return request<API.Result>(`/api/system/dict/type/${ids}`, {
+ method: 'DELETE'
+ });
+}
+
+// 导出字典类型
+export function exportDictType(params?: API.System.DictTypeListParams) {
+ return downLoadXlsx(`/api/system/dict/type/export`, { params }, `dict_type_${new Date().getTime()}.xlsx`);
+}
+
+// 获取字典选择框列表
+export async function getDictTypeOptionSelect(params?: API.DictTypeListParams) {
+ return request('/api/system/dict/type/optionselect', {
+ params: {
+ ...params,
+ },
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ });
+}
diff --git a/react-ui/src/services/system/dictdata.ts b/react-ui/src/services/system/dictdata.ts
new file mode 100644
index 0000000..f7856e8
--- /dev/null
+++ b/react-ui/src/services/system/dictdata.ts
@@ -0,0 +1,65 @@
+import { request } from '@umijs/max';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+// 查询字典数据列表
+export async function getDictDataList(
+ params?: API.System.DictDataListParams,
+ options?: { [key: string]: any },
+) {
+ return request<API.System.DictDataPageResult>('/api/system/dict/data/list', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ params,
+ ...(options || {}),
+ });
+}
+
+// 查询字典数据详细
+export function getDictData(dictCode: number, options?: { [key: string]: any }) {
+ return request<API.System.DictDataInfoResult>(`/api/system/dict/data/${dictCode}`, {
+ method: 'GET',
+ ...(options || {}),
+ });
+}
+
+// 新增字典数据
+export async function addDictData(params: API.System.DictData, options?: { [key: string]: any }) {
+ return request<API.Result>('/api/system/dict/data', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params,
+ ...(options || {}),
+ });
+}
+
+// 修改字典数据
+export async function updateDictData(params: API.System.DictData, options?: { [key: string]: any }) {
+ return request<API.Result>('/api/system/dict/data', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params,
+ ...(options || {}),
+ });
+}
+
+// 删除字典数据
+export async function removeDictData(ids: string, options?: { [key: string]: any }) {
+ return request<API.Result>(`/api/system/dict/data/${ids}`, {
+ method: 'DELETE',
+ ...(options || {}),
+ });
+}
+
+// 导出字典数据
+export function exportDictData(
+ params?: API.System.DictDataListParams,
+ options?: { [key: string]: any },
+) {
+ return downLoadXlsx(`/api/system/dict/data/export`, { params }, `dict_data_${new Date().getTime()}.xlsx`);
+}
diff --git a/react-ui/src/services/system/index.ts b/react-ui/src/services/system/index.ts
new file mode 100644
index 0000000..24ce62d
--- /dev/null
+++ b/react-ui/src/services/system/index.ts
@@ -0,0 +1,14 @@
+/* eslint-disable */
+// 该文件由 OneAPI 自动生成,请勿手动修改!
+
+import * as Auth from './auth';
+import * as User from './User';
+import * as Dict from './dict';
+import * as Menu from './menu';
+
+export default {
+ Auth,
+ User,
+ Dict,
+ Menu,
+};
diff --git a/react-ui/src/services/system/menu.ts b/react-ui/src/services/system/menu.ts
new file mode 100644
index 0000000..b2f411b
--- /dev/null
+++ b/react-ui/src/services/system/menu.ts
@@ -0,0 +1,61 @@
+import { request } from '@umijs/max';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+// 查询菜单权限列表
+export async function getMenuList(params?: API.System.MenuListParams, options?: { [key: string]: any }) {
+ return request<API.System.MenuPageResult>('/api/system/menu/list', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ params,
+ ...(options || {}),
+ });
+}
+
+// 查询菜单权限详细
+export function getMenu(menuId: number, options?: { [key: string]: any }) {
+ return request<API.System.MenuInfoResult>(`/api/system/menu/${menuId}`, {
+ method: 'GET',
+ ...(options || {})
+ });
+}
+
+// 新增菜单权限
+export async function addMenu(params: API.System.Menu, options?: { [key: string]: any }) {
+ return request<API.Result>('/api/system/menu', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params,
+ ...(options || {})
+ });
+}
+
+// 修改菜单权限
+export async function updateMenu(params: API.System.Menu, options?: { [key: string]: any }) {
+ return request<API.Result>('/api/system/menu', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params,
+ ...(options || {})
+ });
+}
+
+// 删除菜单权限
+export async function removeMenu(ids: string, options?: { [key: string]: any }) {
+ return request<API.Result>(`/api/system/menu/${ids}`, {
+ method: 'DELETE',
+ ...(options || {})
+ });
+}
+
+// 查询菜单权限详细
+export function getMenuTree() {
+ return request('/api/system/menu/treeselect', {
+ method: 'GET',
+ });
+}
diff --git a/react-ui/src/services/system/notice.ts b/react-ui/src/services/system/notice.ts
new file mode 100644
index 0000000..2c86a08
--- /dev/null
+++ b/react-ui/src/services/system/notice.ts
@@ -0,0 +1,49 @@
+import { request } from '@umijs/max';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+// 查询通知公告列表
+export async function getNoticeList(params?: API.System.NoticeListParams) {
+ return request<API.System.NoticePageResult>('/api/system/notice/list', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ params
+ });
+}
+
+// 查询通知公告详细
+export function getNotice(noticeId: number) {
+ return request<API.System.NoticeInfoResult>(`/api/system/notice/${noticeId}`, {
+ method: 'GET'
+ });
+}
+
+// 新增通知公告
+export async function addNotice(params: API.System.Notice) {
+ return request<API.Result>('/api/system/notice', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 修改通知公告
+export async function updateNotice(params: API.System.Notice) {
+ return request<API.Result>('/api/system/notice', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 删除通知公告
+export async function removeNotice(ids: string) {
+ return request<API.Result>(`/api/system/notice/${ids}`, {
+ method: 'DELETE'
+ });
+}
diff --git a/react-ui/src/services/system/post.ts b/react-ui/src/services/system/post.ts
new file mode 100644
index 0000000..3170b89
--- /dev/null
+++ b/react-ui/src/services/system/post.ts
@@ -0,0 +1,54 @@
+import { request } from '@umijs/max';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+// 查询岗位信息列表
+export async function getPostList(params?: API.System.PostListParams) {
+ return request<API.System.PostPageResult>('/api/system/post/list', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ params
+ });
+}
+
+// 查询岗位信息详细
+export function getPost(postId: number) {
+ return request<API.System.PostInfoResult>(`/api/system/post/${postId}`, {
+ method: 'GET'
+ });
+}
+
+// 新增岗位信息
+export async function addPost(params: API.System.Post) {
+ return request<API.Result>('/api/system/post', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 修改岗位信息
+export async function updatePost(params: API.System.Post) {
+ return request<API.Result>('/api/system/post', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 删除岗位信息
+export async function removePost(ids: string) {
+ return request<API.Result>(`/api/system/post/${ids}`, {
+ method: 'DELETE'
+ });
+}
+
+// 导出岗位信息
+export function exportPost(params?: API.System.PostListParams) {
+ return downLoadXlsx(`/api/system/post/export`, { params }, `post_${new Date().getTime()}.xlsx`);
+}
diff --git a/react-ui/src/services/system/role.ts b/react-ui/src/services/system/role.ts
new file mode 100644
index 0000000..3836243
--- /dev/null
+++ b/react-ui/src/services/system/role.ts
@@ -0,0 +1,128 @@
+import { ContentType } from '@/enums/httpEnum';
+import { request } from '@umijs/max';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+// 查询角色信息列表
+export async function getRoleList(params?: API.System.RoleListParams) {
+ return request<API.System.RolePageResult>('/api/system/role/list', {
+ method: 'GET',
+ headers: { 'Content-Type': ContentType.FORM_URLENCODED },
+ params
+ });
+}
+
+// 查询角色信息详细
+export function getRole(roleId: number) {
+ return request<API.System.RoleInfoResult>(`/api/system/role/${roleId}`, {
+ method: 'GET'
+ });
+}
+
+// 新增角色信息
+export async function addRole(params: API.System.Role) {
+ return request<API.Result>('/api/system/role', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 修改角色信息
+export async function updateRole(params: API.System.Role) {
+ return request<API.Result>('/api/system/role', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params
+ });
+}
+
+// 删除角色信息
+export async function removeRole(ids: string) {
+ return request<API.Result>(`/api/system/role/${ids}`, {
+ method: 'DELETE'
+ });
+}
+
+// 导出角色信息
+export function exportRole(params?: API.System.RoleListParams) {
+ return downLoadXlsx(`/api/system/role/export`, { params }, `role_${new Date().getTime()}.xlsx`);
+}
+
+// 获取角色菜单列表
+export function getRoleMenuList(id: number) {
+ return request<API.System.RoleMenuResult>(`/api/system/menu/roleMenuTreeselect/${id}`, {
+ method: 'get',
+ });
+}
+
+// 角色数据权限
+export function updateRoleDataScope(data: Record<string, any>) {
+ return request('/api/system/role/dataScope', {
+ method: 'put',
+ data
+ })
+}
+
+// 角色状态修改
+export function changeRoleStatus(roleId: number, status: string) {
+ const data = {
+ roleId,
+ status
+ }
+ return request<API.Result>('/api/system/role/changeStatus', {
+ method: 'put',
+ data: data
+ })
+}
+
+// 查询角色已授权用户列表
+export function allocatedUserList(params?: API.System.RoleListParams) {
+ return request('/api/system/role/authUser/allocatedList', {
+ method: 'get',
+ params
+ })
+}
+
+// 查询角色未授权用户列表
+export function unallocatedUserList(params?: API.System.RoleListParams) {
+ return request('/api/system/role/authUser/unallocatedList', {
+ method: 'get',
+ params
+ })
+}
+
+// 取消用户授权角色
+export function authUserCancel(data: any) {
+ return request<API.Result>('/api/system/role/authUser/cancel', {
+ method: 'put',
+ data: data
+ })
+}
+
+// 批量取消用户授权角色
+export function authUserCancelAll(data: any) {
+ return request<API.Result>('/api/system/role/authUser/cancelAll', {
+ method: 'put',
+ params: data
+ })
+}
+
+// 授权用户选择
+export function authUserSelectAll(data: Record<string, any>) {
+ return request<API.Result>('/api/system/role/authUser/selectAll', {
+ method: 'put',
+ params: data,
+ headers: { 'Content-Type': ContentType.FORM_URLENCODED },
+ })
+}
+
+// 根据角色ID查询部门树结构
+export function getDeptTreeSelect(roleId: number) {
+ return request('/api/system/role/deptTree/' + roleId, {
+ method: 'get'
+ })
+}
diff --git a/react-ui/src/services/system/user.ts b/react-ui/src/services/system/user.ts
new file mode 100644
index 0000000..da997bf
--- /dev/null
+++ b/react-ui/src/services/system/user.ts
@@ -0,0 +1,152 @@
+import { formatTreeData } from '@/utils/tree';
+import { request } from '@umijs/max';
+import { DataNode } from 'antd/es/tree';
+import { downLoadXlsx } from '@/utils/downloadfile';
+
+// 查询用户信息列表
+export async function getUserList(params?: API.System.UserListParams, options?: { [key: string]: any }) {
+ return request<API.System.UserPageResult>('/api/system/user/list', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ params,
+ ...(options || {})
+ });
+}
+
+// 查询用户信息详细
+export function getUser(userId: number, options?: { [key: string]: any }) {
+ return request<API.System.UserInfoResult>(`/api/system/user/${userId}`, {
+ method: 'GET',
+ ...(options || {})
+ });
+}
+
+// 新增用户信息
+export async function addUser(params: API.System.User, options?: { [key: string]: any }) {
+ return request<API.Result>('/api/system/user', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params,
+ ...(options || {})
+ });
+}
+
+// 修改用户信息
+export async function updateUser(params: API.System.User, options?: { [key: string]: any }) {
+ return request<API.Result>('/api/system/user', {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json;charset=UTF-8',
+ },
+ data: params,
+ ...(options || {})
+ });
+}
+
+// 删除用户信息
+export async function removeUser(ids: string, options?: { [key: string]: any }) {
+ return request<API.Result>(`/api/system/user/${ids}`, {
+ method: 'DELETE',
+ ...(options || {})
+ });
+}
+
+// 导出用户信息
+export function exportUser(params?: API.System.UserListParams, options?: { [key: string]: any }) {
+ return downLoadXlsx(`/api/system/user/export`, { params }, `user_${new Date().getTime()}.xlsx`);
+}
+
+// 用户状态修改
+export function changeUserStatus(userId: number, status: string) {
+ const data = {
+ userId,
+ status
+ }
+ return request<API.Result>('/api/system/user/changeStatus', {
+ method: 'put',
+ data: data
+ })
+}
+
+// 查询用户个人信息
+export function getUserProfile() {
+ return request('/api/system/user/profile', {
+ method: 'get'
+ })
+}
+
+export function updateUserProfile(data: API.CurrentUser) {
+ return request<API.Result>('/api/system/user/profile', {
+ method: 'put',
+ data: data
+ })
+}
+
+// 用户密码重置
+export function resetUserPwd(userId: number, password: string) {
+ const data = {
+ userId,
+ password
+ }
+ return request<API.Result>('/api/system/user/resetPwd', {
+ method: 'put',
+ data: data
+ })
+}
+
+// 用户t个人密码重置
+export function updateUserPwd(oldPassword: string, newPassword: string) {
+ const data = {
+ oldPassword,
+ newPassword
+ }
+ return request<API.Result>('/api/system/user/profile/updatePwd', {
+ method: 'put',
+ params: data
+ })
+}
+
+// 用户头像上传
+export function uploadAvatar(data: any) {
+ return request('/api/system/user/profile/avatar', {
+ method: 'post',
+ data: data
+ })
+}
+
+
+// 查询授权角色
+export function getAuthRole(userId: number) {
+ return request('/system/user/authRole/' + userId, {
+ method: 'get'
+ })
+}
+
+// 保存授权角色
+export function updateAuthRole(data: Record<string, any>) {
+ return request('/system/user/authRole', {
+ method: 'put',
+ params: data
+ })
+}
+
+// 获取数据列表
+export function getDeptTree(params: any): Promise<DataNode[]> {
+ return new Promise((resolve) => {
+ request(`/api/system/user/deptTree`, {
+ method: 'get',
+ params,
+ }).then((res: any) => {
+ if (res && res.code === 200) {
+ const treeData = formatTreeData(res.data);
+ resolve(treeData);
+ } else {
+ resolve([]);
+ }
+ });
+ });
+}
diff --git a/react-ui/src/services/typings.d.ts b/react-ui/src/services/typings.d.ts
new file mode 100644
index 0000000..1e0b8b5
--- /dev/null
+++ b/react-ui/src/services/typings.d.ts
@@ -0,0 +1,191 @@
+/* eslint-disable */
+// 该文件由 OneAPI 自动生成,请勿手动修改!
+
+declare namespace API {
+ interface PageInfo {
+ current?: number;
+ pageSize?: number;
+ total?: number;
+ list?: Array<Record<string, any>>;
+ }
+
+ interface PageInfo_UserInfo_ {
+ current?: number;
+ pageSize?: number;
+ total?: number;
+ list?: Array<UserInfo>;
+ }
+
+ interface Result {
+ code: number;
+ msg: string;
+ data?: Record<string, any>;
+ }
+
+ interface Result_PageInfo_UserInfo__ {
+ code: number;
+ msg: string;
+ data?: PageInfo_UserInfo_;
+ }
+ interface UserInfoResult {
+ code?: number;
+ msg?: string;
+ user: UserInfo;
+ permissions: any;
+ roles: any;
+ }
+
+ interface Result_string_ {
+ success?: boolean;
+ errorMessage?: string;
+ data?: string;
+ }
+
+ type UserGenderEnum = 'MALE' | 'FEMALE';
+
+ interface UserInfo {
+ userId?: string;
+ userName?: string;
+ nickName?: string;
+ avatar?: string;
+ sex?: string;
+ email?: string;
+ gender?: UserGenderEnum;
+ unreadCount: number;
+ address?: string;
+ phonenumber?: string;
+ dept?: Dept;
+ roles?: Role[];
+ permissions: string[];
+ }
+
+ interface UserInfoVO {
+ name?: string;
+ /** nick */
+ nickName?: string;
+ /** email */
+ email?: string;
+ }
+
+ type definitions_0 = null;
+
+ type MenuItemMeta = {
+ title: string;
+ icon: string;
+ noCache: boolean;
+ link: string;
+ };
+
+ type RoutersMenuItem = {
+ alwaysShow?: boolean;
+ children?: RoutersMenuItem[];
+ component?: string;
+ hidden?: boolean;
+ meta: MenuItemMeta;
+ name: string;
+ path: string;
+ redirect?: string;
+ [key: string]: any;
+ };
+ interface GetRoutersResult {
+ code: number;
+ msg: string;
+ data: RoutersMenuItem[];
+ }
+
+ type NoticeIconList = {
+ data?: NoticeIconItem[];
+ /** 列表的内容总数 */
+ total?: number;
+ success?: boolean;
+ };
+
+ type NoticeIconItemType = 'notification' | 'message' | 'event';
+
+ type NoticeIconItem = {
+ id?: string;
+ extra?: string;
+ key?: string;
+ read?: boolean;
+ avatar?: string;
+ title?: string;
+ status?: string;
+ datetime?: string;
+ description?: string;
+ type?: NoticeIconItemType;
+ };
+
+ export type MenuType = {
+ menuId: number;
+ menuName: string;
+ parentId: string;
+ orderNum: number;
+ path: string;
+ component: string;
+ isFrame: number;
+ isCache: number;
+ menuType: string;
+ visible: string;
+ status: string;
+ perms: string;
+ icon: string;
+ createBy: string;
+ createTime: Date;
+ updateBy: string;
+ updateTime: Date;
+ remark: string;
+ };
+
+ export type MenuListParams = {
+ menuId?: string;
+ menuName?: string;
+ parentId?: string;
+ orderNum?: string;
+ path?: string;
+ component?: string;
+ isFrame?: string;
+ isCache?: string;
+ menuType?: string;
+ visible?: string;
+ status?: string;
+ perms?: string;
+ icon?: string;
+ createBy?: string;
+ createTime?: string;
+ updateBy?: string;
+ updateTime?: string;
+ remark?: string;
+ pageSize?: string;
+ currentPage?: string;
+ filter?: string;
+ sorter?: string;
+ };
+
+ export type DictTypeType = {
+ dictId: number;
+ dictName: string;
+ dictType: string;
+ status: string;
+ createBy: string;
+ createTime: Date;
+ updateBy: string;
+ updateTime: Date;
+ remark: string;
+ };
+
+ export type DictTypeListParams = {
+ dictId?: string;
+ dictName?: string;
+ dictType?: string;
+ status?: string;
+ createBy?: string;
+ createTime?: string;
+ updateBy?: string;
+ updateTime?: string;
+ remark?: string;
+ pageSize?: string;
+ currentPage?: string;
+ filter?: string;
+ sorter?: string;
+ };
+}