diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..66dbed6 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,20 @@ + + + diff --git a/src/animate.ts b/src/animate.ts new file mode 100644 index 0000000..7a23df8 --- /dev/null +++ b/src/animate.ts @@ -0,0 +1,48 @@ +// 前缀 +const animatePrefix = 'animate__animated '; +// 开启随机动画 随机动画值 +const animateList: string[] = [ + animatePrefix + 'animate__pulse', + animatePrefix + 'animate__rubberBand', + animatePrefix + 'animate__bounceIn', + animatePrefix + 'animate__bounceInLeft', + animatePrefix + 'animate__fadeIn', + animatePrefix + 'animate__fadeInLeft', + animatePrefix + 'animate__fadeInDown', + animatePrefix + 'animate__fadeInUp', + animatePrefix + 'animate__flipInX', + animatePrefix + 'animate__lightSpeedInLeft', + animatePrefix + 'animate__rotateInDownLeft', + animatePrefix + 'animate__rollIn', + animatePrefix + 'animate__rotateInDownLeft', + animatePrefix + 'animate__zoomIn', + animatePrefix + 'animate__zoomInDown', + animatePrefix + 'animate__slideInLeft', + animatePrefix + 'animate__lightSpeedIn' +]; +// 关闭随机动画后的默认效果 +const defaultAnimate = animatePrefix + 'animate__fadeIn'; +// 搜索隐藏显示动画 +const searchAnimate = { + enter: '', + leave: '' +}; + +// 菜单搜索动画 +const menuSearchAnimate = { + enter: animatePrefix + 'animate__fadeIn', + leave: animatePrefix + 'animate__fadeOut' +}; +// logo动画 +const logoAnimate = { + enter: animatePrefix + 'animate__fadeIn', + leave: animatePrefix + 'animate__fadeOut' +}; + +export default { + animateList, + defaultAnimate, + searchAnimate, + menuSearchAnimate, + logoAnimate +}; diff --git a/src/api/demo/demo/index.ts b/src/api/demo/demo/index.ts new file mode 100644 index 0000000..7441720 --- /dev/null +++ b/src/api/demo/demo/index.ts @@ -0,0 +1,62 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { DemoVO, DemoForm, DemoQuery } from '@/api/demo/demo/types'; + +/** + * 查询测试单列表 + * @param query + * @returns {*} + */ +export const listDemo = (query?: DemoQuery): AxiosPromise => { + return request({ + url: '/demo/demo/list', + method: 'get', + params: query + }); +}; + +/** + * 查询测试单详细 + * @param id + */ +export const getDemo = (id: string | number): AxiosPromise => { + return request({ + url: '/demo/demo/' + id, + method: 'get' + }); +}; + +/** + * 新增测试单 + * @param data + */ +export const addDemo = (data: DemoForm) => { + return request({ + url: '/demo/demo', + method: 'post', + data: data + }); +}; + +/** + * 修改测试单 + * @param data + */ +export const updateDemo = (data: DemoForm) => { + return request({ + url: '/demo/demo', + method: 'put', + data: data + }); +}; + +/** + * 删除测试单 + * @param id + */ +export const delDemo = (id: string | number | Array) => { + return request({ + url: '/demo/demo/' + id, + method: 'delete' + }); +}; diff --git a/src/api/demo/demo/types.ts b/src/api/demo/demo/types.ts new file mode 100644 index 0000000..ea51d32 --- /dev/null +++ b/src/api/demo/demo/types.ts @@ -0,0 +1,90 @@ +export interface DemoVO { + /** + * 主键 + */ + id: string | number; + + /** + * 部门id + */ + deptId: string | number; + + /** + * 用户id + */ + userId: string | number; + + /** + * 排序号 + */ + orderNum: number; + + /** + * key键 + */ + testKey: string; + + /** + * 值 + */ + value: string; +} + +export interface DemoForm extends BaseEntity { + /** + * 主键 + */ + id?: string | number; + + /** + * 部门id + */ + deptId?: string | number; + + /** + * 用户id + */ + userId?: string | number; + + /** + * 排序号 + */ + orderNum?: number; + + /** + * key键 + */ + testKey?: string; + + /** + * 值 + */ + value?: string; +} + +export interface DemoQuery extends PageQuery { + /** + * 部门id + */ + deptId?: string | number; + + /** + * 用户id + */ + userId?: string | number; + + /** + * 排序号 + */ + orderNum?: number; + + /** + * key键 + */ + testKey?: string; + + /** + * 值 + */ + value?: string; +} diff --git a/src/api/demo/tree/index.ts b/src/api/demo/tree/index.ts new file mode 100644 index 0000000..562deb6 --- /dev/null +++ b/src/api/demo/tree/index.ts @@ -0,0 +1,62 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { TreeVO, TreeForm, TreeQuery } from '@/api/demo/tree/types'; + +/** + * 查询测试树列表 + * @param query + * @returns {*} + */ +export const listTree = (query?: TreeQuery): AxiosPromise => { + return request({ + url: '/demo/tree/list', + method: 'get', + params: query + }); +}; + +/** + * 查询测试树详细 + * @param id + */ +export const getTree = (id: string | number): AxiosPromise => { + return request({ + url: '/demo/tree/' + id, + method: 'get' + }); +}; + +/** + * 新增测试树 + * @param data + */ +export const addTree = (data: TreeForm) => { + return request({ + url: '/demo/tree', + method: 'post', + data: data + }); +}; + +/** + * 修改测试树 + * @param data + */ +export const updateTree = (data: TreeForm) => { + return request({ + url: '/demo/tree', + method: 'put', + data: data + }); +}; + +/** + * 删除测试树 + * @param id + */ +export const delTree = (id: string | number | Array) => { + return request({ + url: '/demo/tree/' + id, + method: 'delete' + }); +}; diff --git a/src/api/demo/tree/types.ts b/src/api/demo/tree/types.ts new file mode 100644 index 0000000..e164d8b --- /dev/null +++ b/src/api/demo/tree/types.ts @@ -0,0 +1,80 @@ +export interface TreeVO { + /** + * 主键 + */ + id: string | number; + + /** + * 父id + */ + parentId: string | number; + + /** + * 部门id + */ + deptId: string | number; + + /** + * 用户id + */ + userId: string | number; + + /** + * 值 + */ + treeName: string; + + /** + * 子对象 + */ + children: TreeVO[]; +} + +export interface TreeForm extends BaseEntity { + /** + * 主键 + */ + id?: string | number; + + /** + * 父id + */ + parentId?: string | number; + + /** + * 部门id + */ + deptId?: string | number; + + /** + * 用户id + */ + userId?: string | number; + + /** + * 值 + */ + treeName?: string; +} + +export interface TreeQuery { + /** + * 父id + */ + parentId?: string | number; + + /** + * 部门id + */ + deptId?: string | number; + + /** + * 用户id + */ + userId?: string | number; + + /** + * 值 + */ + treeName?: string; +} diff --git a/src/api/login.ts b/src/api/login.ts new file mode 100644 index 0000000..35e6a4e --- /dev/null +++ b/src/api/login.ts @@ -0,0 +1,113 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from './types'; +import { UserInfo } from '@/api/system/user/types'; + +// pc端固定客户端授权id +const clientId = import.meta.env.VITE_APP_CLIENT_ID; + +/** + * @param data {LoginData} + * @returns + */ +export function login(data: LoginData): AxiosPromise { + const params = { + ...data, + clientId: data.clientId || clientId, + grantType: data.grantType || 'password' + }; + return request({ + url: '/auth/login', + headers: { + isToken: false, + isEncrypt: true, + repeatSubmit: false + }, + method: 'post', + data: params + }); +} + +// 注册方法 +export function register(data: any) { + const params = { + ...data, + clientId: clientId, + grantType: 'password' + }; + return request({ + url: '/auth/register', + headers: { + isToken: false, + isEncrypt: true, + repeatSubmit: false + }, + method: 'post', + data: params + }); +} + +/** + * 注销 + */ +export function logout() { + if (import.meta.env.VITE_APP_SSE === 'true') { + request({ + url: '/resource/sse/close', + method: 'get' + }); + } + return request({ + url: '/auth/logout', + method: 'post' + }); +} + +/** + * 获取验证码 + */ +export function getCodeImg(): AxiosPromise { + return request({ + url: '/auth/code', + headers: { + isToken: false + }, + method: 'get', + timeout: 20000 + }); +} + +/** + * 第三方登录 + */ +export function callback(data: LoginData): AxiosPromise { + const LoginData = { + ...data, + clientId: clientId, + grantType: 'social' + }; + return request({ + url: '/auth/social/callback', + method: 'post', + data: LoginData + }); +} + +// 获取用户详细信息 +export function getInfo(): AxiosPromise { + return request({ + url: '/system/user/getInfo', + method: 'get' + }); +} + +// 获取租户列表 +export function getTenantList(isToken: boolean): AxiosPromise { + return request({ + url: '/auth/tenant/list', + headers: { + isToken: isToken + }, + method: 'get' + }); +} diff --git a/src/api/menu.ts b/src/api/menu.ts new file mode 100644 index 0000000..a3ae80e --- /dev/null +++ b/src/api/menu.ts @@ -0,0 +1,11 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { RouteRecordRaw } from 'vue-router'; + +// 获取路由 +export function getRouters(): AxiosPromise { + return request({ + url: '/system/menu/getRouters', + method: 'get' + }); +} diff --git a/src/api/monitor/cache/index.ts b/src/api/monitor/cache/index.ts new file mode 100644 index 0000000..e45d6fb --- /dev/null +++ b/src/api/monitor/cache/index.ts @@ -0,0 +1,59 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { CacheVO } from './types'; + +// 查询缓存详细 +export function getCache(): AxiosPromise { + return request({ + url: '/monitor/cache', + method: 'get' + }); +} + +// 查询缓存名称列表 +export function listCacheName() { + return request({ + url: '/monitor/cache/getNames', + method: 'get' + }); +} + +// 查询缓存键名列表 +export function listCacheKey(cacheName: string) { + return request({ + url: '/monitor/cache/getKeys/' + cacheName, + method: 'get' + }); +} + +// 查询缓存内容 +export function getCacheValue(cacheName: string, cacheKey: string) { + return request({ + url: '/monitor/cache/getValue/' + cacheName + '/' + cacheKey, + method: 'get' + }); +} + +// 清理指定名称缓存 +export function clearCacheName(cacheName: string) { + return request({ + url: '/monitor/cache/clearCacheName/' + cacheName, + method: 'delete' + }); +} + +// 清理指定键名缓存 +export function clearCacheKey(cacheName: string, cacheKey: string) { + return request({ + url: '/monitor/cache/clearCacheKey/' + cacheName + '/' + cacheKey, + method: 'delete' + }); +} + +// 清理全部缓存 +export function clearCacheAll() { + return request({ + url: '/monitor/cache/clearCacheAll', + method: 'delete' + }); +} diff --git a/src/api/monitor/cache/types.ts b/src/api/monitor/cache/types.ts new file mode 100644 index 0000000..4017b65 --- /dev/null +++ b/src/api/monitor/cache/types.ts @@ -0,0 +1,7 @@ +export interface CacheVO { + commandStats: Array<{ name: string; value: string }>; + + dbSize: number; + + info: { [key: string]: string }; +} diff --git a/src/api/monitor/loginInfo/index.ts b/src/api/monitor/loginInfo/index.ts new file mode 100644 index 0000000..f8877c9 --- /dev/null +++ b/src/api/monitor/loginInfo/index.ts @@ -0,0 +1,36 @@ +import request from '@/utils/request'; +import { LoginInfoQuery, LoginInfoVO } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询登录日志列表 +export function list(query: LoginInfoQuery): AxiosPromise { + return request({ + url: '/monitor/logininfor/list', + method: 'get', + params: query + }); +} + +// 删除登录日志 +export function delLoginInfo(infoId: string | number | Array) { + return request({ + url: '/monitor/logininfor/' + infoId, + method: 'delete' + }); +} + +// 解锁用户登录状态 +export function unlockLoginInfo(userName: string | Array) { + return request({ + url: '/monitor/logininfor/unlock/' + userName, + method: 'get' + }); +} + +// 清空登录日志 +export function cleanLoginInfo() { + return request({ + url: '/monitor/logininfor/clean', + method: 'delete' + }); +} diff --git a/src/api/monitor/loginInfo/types.ts b/src/api/monitor/loginInfo/types.ts new file mode 100644 index 0000000..202c779 --- /dev/null +++ b/src/api/monitor/loginInfo/types.ts @@ -0,0 +1,20 @@ +export interface LoginInfoVO { + infoId: string | number; + tenantId: string | number; + userName: string; + status: string; + ipaddr: string; + loginLocation: string; + browser: string; + os: string; + msg: string; + loginTime: string; +} + +export interface LoginInfoQuery extends PageQuery { + ipaddr: string; + userName: string; + status: string; + orderByColumn: string; + isAsc: string; +} diff --git a/src/api/monitor/online/index.ts b/src/api/monitor/online/index.ts new file mode 100644 index 0000000..5b3221c --- /dev/null +++ b/src/api/monitor/online/index.ts @@ -0,0 +1,36 @@ +import request from '@/utils/request'; +import { OnlineQuery, OnlineVO } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询在线用户列表 +export function list(query: OnlineQuery): AxiosPromise { + return request({ + url: '/monitor/online/list', + method: 'get', + params: query + }); +} + +// 强退用户 +export function forceLogout(tokenId: string) { + return request({ + url: '/monitor/online/' + tokenId, + method: 'delete' + }); +} + +// 获取当前用户登录在线设备 +export function getOnline() { + return request({ + url: '/monitor/online', + method: 'get' + }); +} + +// 删除当前在线设备 +export function delOnline(tokenId: string) { + return request({ + url: '/monitor/online/myself/' + tokenId, + method: 'delete' + }); +} diff --git a/src/api/monitor/online/types.ts b/src/api/monitor/online/types.ts new file mode 100644 index 0000000..8c0ec27 --- /dev/null +++ b/src/api/monitor/online/types.ts @@ -0,0 +1,15 @@ +export interface OnlineQuery extends PageQuery { + ipaddr: string; + userName: string; +} + +export interface OnlineVO extends BaseEntity { + tokenId: string; + deptName: string; + userName: string; + ipaddr: string; + loginLocation: string; + browser: string; + os: string; + loginTime: number; +} diff --git a/src/api/monitor/operlog/index.ts b/src/api/monitor/operlog/index.ts new file mode 100644 index 0000000..7ac3453 --- /dev/null +++ b/src/api/monitor/operlog/index.ts @@ -0,0 +1,28 @@ +import request from '@/utils/request'; +import { OperLogQuery, OperLogVO } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询操作日志列表 +export function list(query: OperLogQuery): AxiosPromise { + return request({ + url: '/monitor/operlog/list', + method: 'get', + params: query + }); +} + +// 删除操作日志 +export function delOperlog(operId: string | number | Array) { + return request({ + url: '/monitor/operlog/' + operId, + method: 'delete' + }); +} + +// 清空操作日志 +export function cleanOperlog() { + return request({ + url: '/monitor/operlog/clean', + method: 'delete' + }); +} diff --git a/src/api/monitor/operlog/types.ts b/src/api/monitor/operlog/types.ts new file mode 100644 index 0000000..10f65c7 --- /dev/null +++ b/src/api/monitor/operlog/types.ts @@ -0,0 +1,53 @@ +export interface OperLogQuery extends PageQuery { + operIp: string; + title: string; + operName: string; + businessType: string; + status: string; + orderByColumn: string; + isAsc: string; +} + +export interface OperLogVO extends BaseEntity { + operId: string | number; + tenantId: string; + title: string; + businessType: number; + businessTypes: number[] | undefined; + method: string; + requestMethod: string; + operatorType: number; + operName: string; + deptName: string; + operUrl: string; + operIp: string; + operLocation: string; + operParam: string; + jsonResult: string; + status: number; + errorMsg: string; + operTime: string; + costTime: number; +} + +export interface OperLogForm { + operId: number | string | undefined; + tenantId: string | number | undefined; + title: string; + businessType: number; + businessTypes: number[] | undefined; + method: string; + requestMethod: string; + operatorType: number; + operName: string; + deptName: string; + operUrl: string; + operIp: string; + operLocation: string; + operParam: string; + jsonResult: string; + status: number; + errorMsg: string; + operTime: string; + costTime: number; +} diff --git a/src/api/system/client/index.ts b/src/api/system/client/index.ts new file mode 100644 index 0000000..6b302b0 --- /dev/null +++ b/src/api/system/client/index.ts @@ -0,0 +1,80 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { ClientVO, ClientForm, ClientQuery } from '@/api/system/client/types'; + +/** + * 查询客户端管理列表 + * @param query + * @returns {*} + */ + +export const listClient = (query?: ClientQuery): AxiosPromise => { + return request({ + url: '/system/client/list', + method: 'get', + params: query + }); +}; + +/** + * 查询客户端管理详细 + * @param id + */ +export const getClient = (id: string | number): AxiosPromise => { + return request({ + url: '/system/client/' + id, + method: 'get' + }); +}; + +/** + * 新增客户端管理 + * @param data + */ +export const addClient = (data: ClientForm) => { + return request({ + url: '/system/client', + method: 'post', + data: data + }); +}; + +/** + * 修改客户端管理 + * @param data + */ +export const updateClient = (data: ClientForm) => { + return request({ + url: '/system/client', + method: 'put', + data: data + }); +}; + +/** + * 删除客户端管理 + * @param id + */ +export const delClient = (id: string | number | Array) => { + return request({ + url: '/system/client/' + id, + method: 'delete' + }); +}; + +/** + * 状态修改 + * @param clientId 客户端id + * @param status 状态 + */ +export function changeStatus(clientId: string, status: string) { + const data = { + clientId, + status + }; + return request({ + url: '/system/client/changeStatus', + method: 'put', + data: data + }); +} diff --git a/src/api/system/client/types.ts b/src/api/system/client/types.ts new file mode 100644 index 0000000..142118d --- /dev/null +++ b/src/api/system/client/types.ts @@ -0,0 +1,135 @@ +export interface ClientVO { + /** + * id + */ + id: string | number; + + /** + * 客户端id + */ + clientId: string; + + /** + * 客户端key + */ + clientKey: string; + + /** + * 客户端秘钥 + */ + clientSecret: string; + + /** + * 授权类型 + */ + grantTypeList: string[]; + + /** + * 设备类型 + */ + deviceType: string; + + /** + * token活跃超时时间 + */ + activeTimeout: number; + + /** + * token固定超时 + */ + timeout: number; + + /** + * 状态(0正常 1停用) + */ + status: string; +} + +export interface ClientForm extends BaseEntity { + /** + * id + */ + id?: string | number; + + /** + * 客户端id + */ + clientId?: string | number; + + /** + * 客户端key + */ + clientKey?: string; + + /** + * 客户端秘钥 + */ + clientSecret?: string; + + /** + * 授权类型 + */ + grantTypeList?: string[]; + + /** + * 设备类型 + */ + deviceType?: string; + + /** + * token活跃超时时间 + */ + activeTimeout?: number; + + /** + * token固定超时 + */ + timeout?: number; + + /** + * 状态(0正常 1停用) + */ + status?: string; +} + +export interface ClientQuery extends PageQuery { + /** + * 客户端id + */ + clientId?: string | number; + + /** + * 客户端key + */ + clientKey?: string; + + /** + * 客户端秘钥 + */ + clientSecret?: string; + + /** + * 授权类型 + */ + grantType?: string; + + /** + * 设备类型 + */ + deviceType?: string; + + /** + * token活跃超时时间 + */ + activeTimeout?: number; + + /** + * token固定超时 + */ + timeout?: number; + + /** + * 状态(0正常 1停用) + */ + status?: string; +} diff --git a/src/api/system/config/index.ts b/src/api/system/config/index.ts new file mode 100644 index 0000000..1e4842d --- /dev/null +++ b/src/api/system/config/index.ts @@ -0,0 +1,74 @@ +import request from '@/utils/request'; +import { ConfigForm, ConfigQuery, ConfigVO } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询参数列表 +export function listConfig(query: ConfigQuery): AxiosPromise { + return request({ + url: '/system/config/list', + method: 'get', + params: query + }); +} + +// 查询参数详细 +export function getConfig(configId: string | number): AxiosPromise { + return request({ + url: '/system/config/' + configId, + method: 'get' + }); +} + +// 根据参数键名查询参数值 +export function getConfigKey(configKey: string): AxiosPromise { + return request({ + url: '/system/config/configKey/' + configKey, + method: 'get' + }); +} + +// 新增参数配置 +export function addConfig(data: ConfigForm) { + return request({ + url: '/system/config', + method: 'post', + data: data + }); +} + +// 修改参数配置 +export function updateConfig(data: ConfigForm) { + return request({ + url: '/system/config', + method: 'put', + data: data + }); +} + +// 修改参数配置 +export function updateConfigByKey(key: string, value: any) { + return request({ + url: '/system/config/updateByKey', + method: 'put', + data: { + configKey: key, + configValue: value + } + }); +} + +// 删除参数配置 +export function delConfig(configId: string | number | Array) { + return request({ + url: '/system/config/' + configId, + method: 'delete' + }); +} + +// 刷新参数缓存 +export function refreshCache() { + return request({ + url: '/system/config/refreshCache', + method: 'delete' + }); +} diff --git a/src/api/system/config/types.ts b/src/api/system/config/types.ts new file mode 100644 index 0000000..b68f073 --- /dev/null +++ b/src/api/system/config/types.ts @@ -0,0 +1,23 @@ +export interface ConfigVO extends BaseEntity { + configId: number | string; + configName: string; + configKey: string; + configValue: string; + configType: string; + remark: string; +} + +export interface ConfigForm { + configId: number | string | undefined; + configName: string; + configKey: string; + configValue: string; + configType: string; + remark: string; +} + +export interface ConfigQuery extends PageQuery { + configName: string; + configKey: string; + configType: string; +} diff --git a/src/api/system/dept/index.ts b/src/api/system/dept/index.ts new file mode 100644 index 0000000..f16cb2c --- /dev/null +++ b/src/api/system/dept/index.ts @@ -0,0 +1,73 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import {DeptForm, DeptQuery, DeptTreeVO, DeptVO} from './types'; + +// 查询部门列表 +export const listDept = (query?: DeptQuery) => { + return request({ + url: '/system/dept/list', + method: 'get', + params: query + }); +}; + +/** + * 通过deptIds查询部门 + * @param deptIds + */ +export const optionSelect = (deptIds: (number | string)[]): AxiosPromise => { + return request({ + url: '/system/dept/optionselect?deptIds=' + deptIds, + method: 'get' + }); +}; + +// 查询部门列表(排除节点) +export const listDeptExcludeChild = (deptId: string | number): AxiosPromise => { + return request({ + url: '/system/dept/list/exclude/' + deptId, + method: 'get' + }); +}; + +// 查询部门详细 +export const getDept = (deptId: string | number): AxiosPromise => { + return request({ + url: '/system/dept/' + deptId, + method: 'get' + }); +}; + +// 查询部门下拉树结构 +export const treeselect = (): AxiosPromise => { + return request({ + url: '/system/dept/treeselect', + method: 'get' + }); +}; + +// 新增部门 +export const addDept = (data: DeptForm) => { + return request({ + url: '/system/dept', + method: 'post', + data: data + }); +}; + +// 修改部门 +export const updateDept = (data: DeptForm) => { + return request({ + url: '/system/dept', + method: 'put', + data: data + }); +}; + +// 删除部门 +export const delDept = (deptId: number | string) => { + return request({ + url: '/system/dept/' + deptId, + method: 'delete' + }); +}; diff --git a/src/api/system/dept/types.ts b/src/api/system/dept/types.ts new file mode 100644 index 0000000..adaefd2 --- /dev/null +++ b/src/api/system/dept/types.ts @@ -0,0 +1,60 @@ +/** + * 部门查询参数 + */ +export interface DeptQuery extends PageQuery { + deptName?: string; + deptCategory?: string; + status?: number; +} + +/** + * 部门类型 + */ +export interface DeptVO extends BaseEntity { + id: number | string; + parentName: string; + parentId: number | string; + children: DeptVO[]; + deptId: number | string; + deptName: string; + deptCategory: string; + orderNum: number; + leader: string; + phone: string; + email: string; + status: string; + delFlag: string; + ancestors: string; + menuId: string | number; +} + +/** + * 部门类型 + */ +export interface DeptTreeVO extends BaseEntity { + id: number | string; + label: string; + parentId: number | string; + weight: number; + children: DeptTreeVO[]; + disabled: boolean; +} + +/** + * 部门表单类型 + */ +export interface DeptForm { + parentName?: string; + parentId?: number | string; + children?: DeptForm[]; + deptId?: number | string; + deptName?: string; + deptCategory?: string; + orderNum?: number; + leader?: string; + phone?: string; + email?: string; + status?: string; + delFlag?: string; + ancestors?: string; +} diff --git a/src/api/system/dict/data/index.ts b/src/api/system/dict/data/index.ts new file mode 100644 index 0000000..7692abc --- /dev/null +++ b/src/api/system/dict/data/index.ts @@ -0,0 +1,53 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { DictDataForm, DictDataQuery, DictDataVO } from './types'; +// 根据字典类型查询字典数据信息 +export function getDicts(dictType: string): AxiosPromise { + return request({ + url: '/system/dict/data/type/' + dictType, + method: 'get' + }); +} + +// 查询字典数据列表 +export function listData(query: DictDataQuery): AxiosPromise { + return request({ + url: '/system/dict/data/list', + method: 'get', + params: query + }); +} + +// 查询字典数据详细 +export function getData(dictCode: string | number): AxiosPromise { + return request({ + url: '/system/dict/data/' + dictCode, + method: 'get' + }); +} + +// 新增字典数据 +export function addData(data: DictDataForm) { + return request({ + url: '/system/dict/data', + method: 'post', + data: data + }); +} + +// 修改字典数据 +export function updateData(data: DictDataForm) { + return request({ + url: '/system/dict/data', + method: 'put', + data: data + }); +} + +// 删除字典数据 +export function delData(dictCode: string | number | Array) { + return request({ + url: '/system/dict/data/' + dictCode, + method: 'delete' + }); +} diff --git a/src/api/system/dict/data/types.ts b/src/api/system/dict/data/types.ts new file mode 100644 index 0000000..e4abb9b --- /dev/null +++ b/src/api/system/dict/data/types.ts @@ -0,0 +1,26 @@ +export interface DictDataQuery extends PageQuery { + dictName: string; + dictType: string; + dictLabel: string; +} + +export interface DictDataVO extends BaseEntity { + dictCode: string; + dictLabel: string; + dictValue: string; + cssClass: string; + listClass: ElTagType; + dictSort: number; + remark: string; +} + +export interface DictDataForm { + dictType?: string; + dictCode: string | undefined; + dictLabel: string; + dictValue: string; + cssClass: string; + listClass: ElTagType; + dictSort: number; + remark: string; +} diff --git a/src/api/system/dict/type/index.ts b/src/api/system/dict/type/index.ts new file mode 100644 index 0000000..7dc3d66 --- /dev/null +++ b/src/api/system/dict/type/index.ts @@ -0,0 +1,62 @@ +import request from '@/utils/request'; +import { DictTypeForm, DictTypeVO, DictTypeQuery } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询字典类型列表 +export function listType(query: DictTypeQuery): AxiosPromise { + return request({ + url: '/system/dict/type/list', + method: 'get', + params: query + }); +} + +// 查询字典类型详细 +export function getType(dictId: number | string): AxiosPromise { + return request({ + url: '/system/dict/type/' + dictId, + method: 'get' + }); +} + +// 新增字典类型 +export function addType(data: DictTypeForm) { + return request({ + url: '/system/dict/type', + method: 'post', + data: data + }); +} + +// 修改字典类型 +export function updateType(data: DictTypeForm) { + return request({ + url: '/system/dict/type', + method: 'put', + data: data + }); +} + +// 删除字典类型 +export function delType(dictId: string | number | Array) { + return request({ + url: '/system/dict/type/' + dictId, + method: 'delete' + }); +} + +// 刷新字典缓存 +export function refreshCache() { + return request({ + url: '/system/dict/type/refreshCache', + method: 'delete' + }); +} + +// 获取字典选择框列表 +export function optionselect(): AxiosPromise { + return request({ + url: '/system/dict/type/optionselect', + method: 'get' + }); +} diff --git a/src/api/system/dict/type/types.ts b/src/api/system/dict/type/types.ts new file mode 100644 index 0000000..4987dbf --- /dev/null +++ b/src/api/system/dict/type/types.ts @@ -0,0 +1,18 @@ +export interface DictTypeVO extends BaseEntity { + dictId: number | string; + dictName: string; + dictType: string; + remark: string; +} + +export interface DictTypeForm { + dictId: number | string | undefined; + dictName: string; + dictType: string; + remark: string; +} + +export interface DictTypeQuery extends PageQuery { + dictName: string; + dictType: string; +} diff --git a/src/api/system/menu/index.ts b/src/api/system/menu/index.ts new file mode 100644 index 0000000..7a0cf74 --- /dev/null +++ b/src/api/system/menu/index.ts @@ -0,0 +1,70 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { MenuQuery, MenuVO, MenuForm, MenuTreeOption, RoleMenuTree } from './types'; + +// 查询菜单列表 +export const listMenu = (query?: MenuQuery): AxiosPromise => { + return request({ + url: '/system/menu/list', + method: 'get', + params: query + }); +}; + +// 查询菜单详细 +export const getMenu = (menuId: string | number): AxiosPromise => { + return request({ + url: '/system/menu/' + menuId, + method: 'get' + }); +}; + +// 查询菜单下拉树结构 +export const treeselect = (): AxiosPromise => { + return request({ + url: '/system/menu/treeselect', + method: 'get' + }); +}; + +// 根据角色ID查询菜单下拉树结构 +export const roleMenuTreeselect = (roleId: string | number): AxiosPromise => { + return request({ + url: '/system/menu/roleMenuTreeselect/' + roleId, + method: 'get' + }); +}; + +// 根据角色ID查询菜单下拉树结构 +export const tenantPackageMenuTreeselect = (packageId: string | number): AxiosPromise => { + return request({ + url: '/system/menu/tenantPackageMenuTreeselect/' + packageId, + method: 'get' + }); +}; + +// 新增菜单 +export const addMenu = (data: MenuForm) => { + return request({ + url: '/system/menu', + method: 'post', + data: data + }); +}; + +// 修改菜单 +export const updateMenu = (data: MenuForm) => { + return request({ + url: '/system/menu', + method: 'put', + data: data + }); +}; + +// 删除菜单 +export const delMenu = (menuId: string | number) => { + return request({ + url: '/system/menu/' + menuId, + method: 'delete' + }); +}; diff --git a/src/api/system/menu/types.ts b/src/api/system/menu/types.ts new file mode 100644 index 0000000..ca19840 --- /dev/null +++ b/src/api/system/menu/types.ts @@ -0,0 +1,69 @@ +import { MenuTypeEnum } from '@/enums/MenuTypeEnum'; + +/** + * 菜单树形结构类型 + */ +export interface MenuTreeOption { + id: string | number; + label: string; + parentId: string | number; + weight: number; + children?: MenuTreeOption[]; +} + +export interface RoleMenuTree { + menus: MenuTreeOption[]; + checkedKeys: string[]; +} + +/** + * 菜单查询参数类型 + */ +export interface MenuQuery { + keywords?: string; + menuName?: string; + status?: string; +} + +/** + * 菜单视图对象类型 + */ +export interface MenuVO extends BaseEntity { + parentName: string; + parentId: string | number; + children: MenuVO[]; + menuId: string | number; + menuName: string; + orderNum: number; + path: string; + component: string; + queryParam: string; + isFrame: string; + isCache: string; + menuType: MenuTypeEnum; + visible: string; + status: string; + icon: string; + remark: string; +} + +export interface MenuForm { + parentName?: string; + parentId?: string | number; + children?: MenuForm[]; + menuId?: string | number; + menuName: string; + orderNum: number; + path: string; + component?: string; + queryParam?: string; + isFrame?: string; + isCache?: string; + menuType?: MenuTypeEnum; + visible?: string; + status?: string; + icon?: string; + remark?: string; + query?: string; + perms?: string; +} diff --git a/src/api/system/notice/index.ts b/src/api/system/notice/index.ts new file mode 100644 index 0000000..285d1f4 --- /dev/null +++ b/src/api/system/notice/index.ts @@ -0,0 +1,45 @@ +import request from '@/utils/request'; +import { NoticeForm, NoticeQuery, NoticeVO } from './types'; +import { AxiosPromise } from 'axios'; +// 查询公告列表 +export function listNotice(query: NoticeQuery): AxiosPromise { + return request({ + url: '/system/notice/list', + method: 'get', + params: query + }); +} + +// 查询公告详细 +export function getNotice(noticeId: string | number): AxiosPromise { + return request({ + url: '/system/notice/' + noticeId, + method: 'get' + }); +} + +// 新增公告 +export function addNotice(data: NoticeForm) { + return request({ + url: '/system/notice', + method: 'post', + data: data + }); +} + +// 修改公告 +export function updateNotice(data: NoticeForm) { + return request({ + url: '/system/notice', + method: 'put', + data: data + }); +} + +// 删除公告 +export function delNotice(noticeId: string | number | Array) { + return request({ + url: '/system/notice/' + noticeId, + method: 'delete' + }); +} diff --git a/src/api/system/notice/types.ts b/src/api/system/notice/types.ts new file mode 100644 index 0000000..abfd5b2 --- /dev/null +++ b/src/api/system/notice/types.ts @@ -0,0 +1,26 @@ +export interface NoticeVO extends BaseEntity { + noticeId: number; + noticeTitle: string; + noticeType: string; + noticeContent: string; + status: string; + remark: string; + createByName: string; +} + +export interface NoticeQuery extends PageQuery { + noticeTitle: string; + createByName: string; + status: string; + noticeType: string; +} + +export interface NoticeForm { + noticeId: number | string | undefined; + noticeTitle: string; + noticeType: string; + noticeContent: string; + status: string; + remark: string; + createByName: string; +} diff --git a/src/api/system/oss/index.ts b/src/api/system/oss/index.ts new file mode 100644 index 0000000..4472112 --- /dev/null +++ b/src/api/system/oss/index.ts @@ -0,0 +1,28 @@ +import request from '@/utils/request'; +import { OssQuery, OssVO } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询OSS对象存储列表 +export function listOss(query: OssQuery): AxiosPromise { + return request({ + url: '/resource/oss/list', + method: 'get', + params: query + }); +} + +// 查询OSS对象基于id串 +export function listByIds(ossId: string | number): AxiosPromise { + return request({ + url: '/resource/oss/listByIds/' + ossId, + method: 'get' + }); +} + +// 删除OSS对象存储 +export function delOss(ossId: string | number | Array) { + return request({ + url: '/resource/oss/' + ossId, + method: 'delete' + }); +} diff --git a/src/api/system/oss/types.ts b/src/api/system/oss/types.ts new file mode 100644 index 0000000..bc0bc1f --- /dev/null +++ b/src/api/system/oss/types.ts @@ -0,0 +1,22 @@ +export interface OssVO extends BaseEntity { + ossId: string | number; + fileName: string; + originalName: string; + fileSuffix: string; + url: string; + createByName: string; + service: string; +} + +export interface OssQuery extends PageQuery { + fileName: string; + originalName: string; + fileSuffix: string; + createTime: string; + service: string; + orderByColumn: string; + isAsc: string; +} +export interface OssForm { + file: undefined | string; +} diff --git a/src/api/system/ossConfig/index.ts b/src/api/system/ossConfig/index.ts new file mode 100644 index 0000000..d0faefe --- /dev/null +++ b/src/api/system/ossConfig/index.ts @@ -0,0 +1,60 @@ +import request from '@/utils/request'; +import { OssConfigForm, OssConfigQuery, OssConfigVO } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询对象存储配置列表 +export function listOssConfig(query: OssConfigQuery): AxiosPromise { + return request({ + url: '/resource/oss/config/list', + method: 'get', + params: query + }); +} + +// 查询对象存储配置详细 +export function getOssConfig(ossConfigId: string | number): AxiosPromise { + return request({ + url: '/resource/oss/config/' + ossConfigId, + method: 'get' + }); +} + +// 新增对象存储配置 +export function addOssConfig(data: OssConfigForm) { + return request({ + url: '/resource/oss/config', + method: 'post', + data: data + }); +} + +// 修改对象存储配置 +export function updateOssConfig(data: OssConfigForm) { + return request({ + url: '/resource/oss/config', + method: 'put', + data: data + }); +} + +// 删除对象存储配置 +export function delOssConfig(ossConfigId: string | number | Array) { + return request({ + url: '/resource/oss/config/' + ossConfigId, + method: 'delete' + }); +} + +// 对象存储状态修改 +export function changeOssConfigStatus(ossConfigId: string | number, status: string, configKey: string) { + const data = { + ossConfigId, + status, + configKey + }; + return request({ + url: '/resource/oss/config/changeStatus', + method: 'put', + data: data + }); +} diff --git a/src/api/system/ossConfig/types.ts b/src/api/system/ossConfig/types.ts new file mode 100644 index 0000000..d227bd0 --- /dev/null +++ b/src/api/system/ossConfig/types.ts @@ -0,0 +1,38 @@ +export interface OssConfigVO extends BaseEntity { + ossConfigId: number | string; + configKey: string; + accessKey: string; + secretKey: string; + bucketName: string; + prefix: string; + endpoint: string; + domain: string; + isHttps: string; + region: string; + status: string; + ext1: string; + remark: string; + accessPolicy: string; +} + +export interface OssConfigQuery extends PageQuery { + configKey: string; + bucketName: string; + status: string; +} + +export interface OssConfigForm { + ossConfigId: string | number | undefined; + configKey: string; + accessKey: string; + secretKey: string; + bucketName: string; + prefix: string; + endpoint: string; + domain: string; + isHttps: string; + accessPolicy: string; + region: string; + status: string; + remark: string; +} diff --git a/src/api/system/post/index.ts b/src/api/system/post/index.ts new file mode 100644 index 0000000..5f6ab18 --- /dev/null +++ b/src/api/system/post/index.ts @@ -0,0 +1,58 @@ +import request from '@/utils/request'; +import { PostForm, PostQuery, PostVO } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询岗位列表 +export function listPost(query: PostQuery): AxiosPromise { + return request({ + url: '/system/post/list', + method: 'get', + params: query + }); +} + +// 查询岗位详细 +export function getPost(postId: string | number): AxiosPromise { + return request({ + url: '/system/post/' + postId, + method: 'get' + }); +} + +// 获取岗位选择框列表 +export function optionselect(deptId?: number | string, postIds?: (number | string)[]): AxiosPromise { + return request({ + url: '/system/post/optionselect', + method: 'get', + params: { + postIds: postIds, + deptId: deptId + } + }); +} + +// 新增岗位 +export function addPost(data: PostForm) { + return request({ + url: '/system/post', + method: 'post', + data: data + }); +} + +// 修改岗位 +export function updatePost(data: PostForm) { + return request({ + url: '/system/post', + method: 'put', + data: data + }); +} + +// 删除岗位 +export function delPost(postId: string | number | (string | number)[]) { + return request({ + url: '/system/post/' + postId, + method: 'delete' + }); +} diff --git a/src/api/system/post/types.ts b/src/api/system/post/types.ts new file mode 100644 index 0000000..45a0540 --- /dev/null +++ b/src/api/system/post/types.ts @@ -0,0 +1,31 @@ +export interface PostVO extends BaseEntity { + postId: number | string; + deptId: number | string; + postCode: string; + postName: string; + postCategory: string; + deptName: string; + postSort: number; + status: string; + remark: string; +} + +export interface PostForm { + postId: number | string | undefined; + deptId: number | string | undefined; + postCode: string; + postName: string; + postCategory: string; + postSort: number; + status: string; + remark: string; +} + +export interface PostQuery extends PageQuery { + deptId: number | string; + belongDeptId: number | string; + postCode: string; + postName: string; + postCategory: string; + status: string; +} diff --git a/src/api/system/role/index.ts b/src/api/system/role/index.ts new file mode 100644 index 0000000..fb0fcab --- /dev/null +++ b/src/api/system/role/index.ts @@ -0,0 +1,160 @@ +import { UserVO } from '@/api/system/user/types'; +import { UserQuery } from '@/api/system/user/types'; +import { AxiosPromise } from 'axios'; +import { RoleQuery, RoleVO, RoleDeptTree } from './types'; +import request from '@/utils/request'; + +export const listRole = (query: RoleQuery): AxiosPromise => { + return request({ + url: '/system/role/list', + method: 'get', + params: query + }); +}; + +/** + * 通过roleIds查询角色 + * @param roleIds + */ +export const optionSelect = (roleIds: (number | string)[]): AxiosPromise => { + return request({ + url: '/system/role/optionselect?roleIds=' + roleIds, + method: 'get' + }); +}; + +/** + * 查询角色详细 + */ +export const getRole = (roleId: string | number): AxiosPromise => { + return request({ + url: '/system/role/' + roleId, + method: 'get' + }); +}; + +/** + * 新增角色 + */ +export const addRole = (data: any) => { + return request({ + url: '/system/role', + method: 'post', + data: data + }); +}; + +/** + * 修改角色 + * @param data + */ +export const updateRole = (data: any) => { + return request({ + url: '/system/role', + method: 'put', + data: data + }); +}; + +/** + * 角色数据权限 + */ +export const dataScope = (data: any) => { + return request({ + url: '/system/role/dataScope', + method: 'put', + data: data + }); +}; + +/** + * 角色状态修改 + */ +export const changeRoleStatus = (roleId: string | number, status: string) => { + const data = { + roleId, + status + }; + return request({ + url: '/system/role/changeStatus', + method: 'put', + data: data + }); +}; + +/** + * 删除角色 + */ +export const delRole = (roleId: Array | string | number) => { + return request({ + url: '/system/role/' + roleId, + method: 'delete' + }); +}; + +/** + * 查询角色已授权用户列表 + */ +export const allocatedUserList = (query: UserQuery): AxiosPromise => { + return request({ + url: '/system/role/authUser/allocatedList', + method: 'get', + params: query + }); +}; + +/** + * 查询角色未授权用户列表 + */ +export const unallocatedUserList = (query: UserQuery): AxiosPromise => { + return request({ + url: '/system/role/authUser/unallocatedList', + method: 'get', + params: query + }); +}; + +/** + * 取消用户授权角色 + */ +export const authUserCancel = (data: any) => { + return request({ + url: '/system/role/authUser/cancel', + method: 'put', + data: data + }); +}; + +/** + * 批量取消用户授权角色 + */ +export const authUserCancelAll = (data: any) => { + return request({ + url: '/system/role/authUser/cancelAll', + method: 'put', + params: data + }); +}; + +/** + * 授权用户选择 + */ +export const authUserSelectAll = (data: any) => { + return request({ + url: '/system/role/authUser/selectAll', + method: 'put', + params: data + }); +}; +// 根据角色ID查询部门树结构 +export const deptTreeSelect = (roleId: string | number): AxiosPromise => { + return request({ + url: '/system/role/deptTree/' + roleId, + method: 'get' + }); +}; + +export default { + optionSelect, + listRole +}; diff --git a/src/api/system/role/types.ts b/src/api/system/role/types.ts new file mode 100644 index 0000000..7dbb6ff --- /dev/null +++ b/src/api/system/role/types.ts @@ -0,0 +1,52 @@ +/** + * 菜单树形结构类型 + */ +export interface DeptTreeOption { + id: string; + label: string; + parentId: string; + weight: number; + children?: DeptTreeOption[]; +} + +export interface RoleDeptTree { + checkedKeys: string[]; + depts: DeptTreeOption[]; +} + +export interface RoleVO extends BaseEntity { + roleId: string | number; + roleName: string; + roleKey: string; + roleSort: number; + dataScope: string; + menuCheckStrictly: boolean; + deptCheckStrictly: boolean; + status: string; + delFlag: string; + remark?: any; + flag: boolean; + menuIds?: Array; + deptIds?: Array; + admin: boolean; +} + +export interface RoleQuery extends PageQuery { + roleName: string; + roleKey: string; + status: string; +} + +export interface RoleForm { + roleName: string; + roleKey: string; + roleSort: number; + status: string; + menuCheckStrictly: boolean; + deptCheckStrictly: boolean; + remark: string; + dataScope?: string; + roleId: string | undefined; + menuIds: Array; + deptIds: Array; +} diff --git a/src/api/system/social/auth.ts b/src/api/system/social/auth.ts new file mode 100644 index 0000000..69f0d7e --- /dev/null +++ b/src/api/system/social/auth.ts @@ -0,0 +1,28 @@ +import request from '@/utils/request'; + +// 绑定账号 +export function authBinding(source: string, tenantId: string) { + return request({ + url: '/auth/binding/' + source, + method: 'get', + params: { + tenantId: tenantId, + domain: window.location.host + } + }); +} + +// 解绑账号 +export function authUnlock(authId: string) { + return request({ + url: '/auth/unlock/' + authId, + method: 'delete' + }); +} +//获取授权列表 +export function getAuthList() { + return request({ + url: '/system/social/list', + method: 'get' + }); +} diff --git a/src/api/system/tenant/index.ts b/src/api/system/tenant/index.ts new file mode 100644 index 0000000..d1d8ff8 --- /dev/null +++ b/src/api/system/tenant/index.ts @@ -0,0 +1,101 @@ +import request from '@/utils/request'; +import { TenantForm, TenantQuery, TenantVO } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询租户列表 +export function listTenant(query: TenantQuery): AxiosPromise { + return request({ + url: '/system/tenant/list', + method: 'get', + params: query + }); +} + +// 查询租户详细 +export function getTenant(id: string | number): AxiosPromise { + return request({ + url: '/system/tenant/' + id, + method: 'get' + }); +} + +// 新增租户 +export function addTenant(data: TenantForm) { + return request({ + url: '/system/tenant', + method: 'post', + headers: { + isEncrypt: true, + repeatSubmit: false + }, + data: data + }); +} + +// 修改租户 +export function updateTenant(data: TenantForm) { + return request({ + url: '/system/tenant', + method: 'put', + data: data + }); +} + +// 租户状态修改 +export function changeTenantStatus(id: string | number, tenantId: string | number, status: string) { + const data = { + id, + tenantId, + status + }; + return request({ + url: '/system/tenant/changeStatus', + method: 'put', + data: data + }); +} + +// 删除租户 +export function delTenant(id: string | number | Array) { + return request({ + url: '/system/tenant/' + id, + method: 'delete' + }); +} + +// 动态切换租户 +export function dynamicTenant(tenantId: string | number) { + return request({ + url: '/system/tenant/dynamic/' + tenantId, + method: 'get' + }); +} + +// 清除动态租户 +export function dynamicClear() { + return request({ + url: '/system/tenant/dynamic/clear', + method: 'get' + }); +} + +// 同步租户套餐 +export function syncTenantPackage(tenantId: string | number, packageId: string | number) { + const data = { + tenantId, + packageId + }; + return request({ + url: '/system/tenant/syncTenantPackage', + method: 'get', + params: data + }); +} + +// 同步租户字典 +export function syncTenantDict() { + return request({ + url: '/system/tenant/syncTenantDict', + method: 'get' + }); +} diff --git a/src/api/system/tenant/types.ts b/src/api/system/tenant/types.ts new file mode 100644 index 0000000..25395fa --- /dev/null +++ b/src/api/system/tenant/types.ts @@ -0,0 +1,46 @@ +export interface TenantVO extends BaseEntity { + id: number | string; + tenantId: number | string; + username: string; + contactUserName: string; + contactPhone: string; + companyName: string; + licenseNumber: string; + address: string; + domain: string; + intro: string; + remark: string; + packageId: string | number; + expireTime: string; + accountCount: number; + status: string; +} + +export interface TenantQuery extends PageQuery { + tenantId: string | number; + + contactUserName: string; + + contactPhone: string; + + companyName: string; +} + +export interface TenantForm { + id: number | string | undefined; + tenantId: number | string | undefined; + username: string; + password: string; + contactUserName: string; + contactPhone: string; + companyName: string; + licenseNumber: string; + domain: string; + address: string; + intro: string; + remark: string; + packageId: string | number; + expireTime: string; + accountCount: number; + status: string; +} diff --git a/src/api/system/tenantPackage/index.ts b/src/api/system/tenantPackage/index.ts new file mode 100644 index 0000000..70d0dab --- /dev/null +++ b/src/api/system/tenantPackage/index.ts @@ -0,0 +1,67 @@ +import request from '@/utils/request'; +import { TenantPkgForm, TenantPkgQuery, TenantPkgVO } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询租户套餐列表 +export function listTenantPackage(query?: TenantPkgQuery): AxiosPromise { + return request({ + url: '/system/tenant/package/list', + method: 'get', + params: query + }); +} + +// 查询租户套餐下拉选列表 +export function selectTenantPackage(): AxiosPromise { + return request({ + url: '/system/tenant/package/selectList', + method: 'get' + }); +} + +// 查询租户套餐详细 +export function getTenantPackage(packageId: string | number): AxiosPromise { + return request({ + url: '/system/tenant/package/' + packageId, + method: 'get' + }); +} + +// 新增租户套餐 +export function addTenantPackage(data: TenantPkgForm) { + return request({ + url: '/system/tenant/package', + method: 'post', + data: data + }); +} + +// 修改租户套餐 +export function updateTenantPackage(data: TenantPkgForm) { + return request({ + url: '/system/tenant/package', + method: 'put', + data: data + }); +} + +// 租户套餐状态修改 +export function changePackageStatus(packageId: number | string, status: string) { + const data = { + packageId, + status + }; + return request({ + url: '/system/tenant/package/changeStatus', + method: 'put', + data: data + }); +} + +// 删除租户套餐 +export function delTenantPackage(packageId: string | number | Array) { + return request({ + url: '/system/tenant/package/' + packageId, + method: 'delete' + }); +} diff --git a/src/api/system/tenantPackage/types.ts b/src/api/system/tenantPackage/types.ts new file mode 100644 index 0000000..c24b8fc --- /dev/null +++ b/src/api/system/tenantPackage/types.ts @@ -0,0 +1,20 @@ +export interface TenantPkgVO extends BaseEntity { + packageId: string | number; + packageName: string; + menuIds: string; + remark: string; + menuCheckStrictly: boolean; + status: string; +} + +export interface TenantPkgQuery extends PageQuery { + packageName: string; +} + +export interface TenantPkgForm { + packageId: string | number | undefined; + packageName: string; + menuIds: string; + remark: string; + menuCheckStrictly: boolean; +} diff --git a/src/api/system/user/types.ts b/src/api/system/user/types.ts new file mode 100644 index 0000000..0787372 --- /dev/null +++ b/src/api/system/user/types.ts @@ -0,0 +1,84 @@ +import { RoleVO } from '@/api/system/role/types'; +import { PostVO } from '@/api/system/post/types'; + +/** + * 用户信息 + */ +export interface UserInfo { + user: UserVO; + roles: string[]; + permissions: string[]; +} + +/** + * 用户查询对象类型 + */ +export interface UserQuery extends PageQuery { + userName?: string; + phonenumber?: string; + status?: string; + deptId?: string | number; + roleId?: string | number; +} + +/** + * 用户返回对象 + */ +export interface UserVO extends BaseEntity { + userId: string | number; + tenantId: string; + deptId: number; + userName: string; + nickName: string; + userType: string; + email: string; + phonenumber: string; + sex: string; + avatar: string; + status: string; + delFlag: string; + loginIp: string; + loginDate: string; + remark: string; + deptName: string; + roles: RoleVO[]; + roleIds: any; + postIds: any; + roleId: any; + admin: boolean; +} + +/** + * 用户表单类型 + */ +export interface UserForm { + id?: string; + userId?: string; + deptId?: number; + userName: string; + nickName?: string; + password: string; + phonenumber?: string; + email?: string; + sex?: string; + status: string; + remark?: string; + postIds: string[]; + roleIds: string[]; +} + +export interface UserInfoVO { + user: UserVO; + roles: RoleVO[]; + roleIds: string[]; + posts: PostVO[]; + postIds: string[]; + roleGroup: string; + postGroup: string; +} + +export interface ResetPwdForm { + oldPassword: string; + newPassword: string; + confirmPassword: string; +} diff --git a/src/api/tool/gen/index.ts b/src/api/tool/gen/index.ts new file mode 100644 index 0000000..efe079c --- /dev/null +++ b/src/api/tool/gen/index.ts @@ -0,0 +1,86 @@ +import request from '@/utils/request'; +import { DbTableQuery, DbTableVO, TableQuery, TableVO, GenTableVO, DbTableForm } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询生成表数据 +export const listTable = (query: TableQuery): AxiosPromise => { + return request({ + url: '/tool/gen/list', + method: 'get', + params: query + }); +}; +// 查询db数据库列表 +export const listDbTable = (query: DbTableQuery): AxiosPromise => { + return request({ + url: '/tool/gen/db/list', + method: 'get', + params: query + }); +}; + +// 查询表详细信息 +export const getGenTable = (tableId: string | number): AxiosPromise => { + return request({ + url: '/tool/gen/' + tableId, + method: 'get' + }); +}; + +// 修改代码生成信息 +export const updateGenTable = (data: DbTableForm): AxiosPromise => { + return request({ + url: '/tool/gen', + method: 'put', + data: data + }); +}; + +// 导入表 +export const importTable = (data: { tables: string; dataName: string }): AxiosPromise => { + return request({ + url: '/tool/gen/importTable', + method: 'post', + params: data + }); +}; + +// 预览生成代码 +export const previewTable = (tableId: string | number) => { + return request({ + url: '/tool/gen/preview/' + tableId, + method: 'get' + }); +}; + +// 删除表数据 +export const delTable = (tableId: string | number | Array) => { + return request({ + url: '/tool/gen/' + tableId, + method: 'delete' + }); +}; + +// 生成代码(自定义路径) +export const genCode = (tableId: string | number) => { + return request({ + url: '/tool/gen/genCode/' + tableId, + method: 'get' + }); +}; + +// 同步数据库 +export const synchDb = (tableId: string | number) => { + return request({ + url: '/tool/gen/synchDb/' + tableId, + method: 'get' + }); +}; + +// 获取数据源名称 +export const getDataNames = () => { + return request({ + url: '/tool/gen/getDataNames', + method: 'get' + }); +}; diff --git a/src/api/tool/gen/types.ts b/src/api/tool/gen/types.ts new file mode 100644 index 0000000..7f7b62f --- /dev/null +++ b/src/api/tool/gen/types.ts @@ -0,0 +1,180 @@ +export interface TableVO extends BaseEntity { + createDept: number | string; + tableId: string | number; + dataName: string; + tableName: string; + tableComment: string; + subTableName?: any; + subTableFkName?: any; + className: string; + tplCategory: string; + packageName: string; + moduleName: string; + businessName: string; + functionName: string; + functionAuthor: string; + genType: string; + genPath: string; + pkColumn?: any; + columns?: any; + options?: any; + remark?: any; + treeCode?: any; + treeParentCode?: any; + treeName?: any; + menuIds?: any; + parentMenuId?: any; + parentMenuName?: any; + tree: boolean; + crud: boolean; +} + +export interface TableQuery extends PageQuery { + tableName: string; + tableComment: string; + dataName: string; +} + +export interface DbColumnVO extends BaseEntity { + createDept?: any; + columnId?: any; + tableId?: any; + columnName?: any; + columnComment?: any; + columnType?: any; + javaType?: any; + javaField?: any; + isPk?: any; + isIncrement?: any; + isRequired?: any; + isInsert?: any; + isEdit?: any; + isList?: any; + isQuery?: any; + queryType?: any; + htmlType?: any; + dictType?: any; + sort?: any; + increment: boolean; + capJavaField?: any; + usableColumn: boolean; + superColumn: boolean; + list: boolean; + pk: boolean; + insert: boolean; + edit: boolean; + query: boolean; + required: boolean; +} + +export interface DbTableVO { + createDept?: any; + tableId?: any; + tableName: string; + tableComment: string; + subTableName?: any; + subTableFkName?: any; + className?: any; + tplCategory?: any; + packageName?: any; + moduleName?: any; + businessName?: any; + functionName?: any; + functionAuthor?: any; + genType?: any; + genPath?: any; + pkColumn?: any; + columns: DbColumnVO[]; + options?: any; + remark?: any; + treeCode?: any; + treeParentCode?: any; + treeName?: any; + menuIds?: any; + parentMenuId?: any; + parentMenuName?: any; + tree: boolean; + crud: boolean; +} + +export interface DbTableQuery extends PageQuery { + dataName: string; + tableName: string; + tableComment: string; +} + +export interface GenTableVO { + info: DbTableVO; + rows: DbColumnVO[]; + tables: DbTableVO[]; +} + +export interface DbColumnForm extends BaseEntity { + createDept: number; + columnId: string; + tableId: string; + columnName: string; + columnComment: string; + columnType: string; + javaType: string; + javaField: string; + isPk: string; + isIncrement: string; + isRequired: string; + isInsert?: any; + isEdit: string; + isList: string; + isQuery?: any; + queryType: string; + htmlType: string; + dictType: string; + sort: number; + increment: boolean; + capJavaField: string; + usableColumn: boolean; + superColumn: boolean; + list: boolean; + pk: boolean; + insert: boolean; + edit: boolean; + query: boolean; + required: boolean; +} + +export interface DbParamForm { + treeCode?: any; + treeName?: any; + treeParentCode?: any; + parentMenuId: string; +} + +export interface DbTableForm extends BaseEntity { + createDept?: any; + tableId: string | string; + tableName: string; + tableComment: string; + subTableName?: any; + subTableFkName?: any; + className: string; + tplCategory: string; + packageName: string; + moduleName: string; + businessName: string; + functionName: string; + functionAuthor: string; + genType: string; + genPath: string; + pkColumn?: any; + columns: DbColumnForm[]; + options: string; + remark?: any; + treeCode?: any; + treeParentCode?: any; + treeName?: any; + menuIds?: any; + parentMenuId: string; + parentMenuName?: any; + tree: boolean; + crud: boolean; + params: DbParamForm; +} diff --git a/src/api/types.ts b/src/api/types.ts new file mode 100644 index 0000000..617286c --- /dev/null +++ b/src/api/types.ts @@ -0,0 +1,59 @@ +/** + * 注册 + */ +export type RegisterForm = { + tenantId: string; + username: string; + password: string; + confirmPassword?: string; + code?: string; + uuid?: string; + userType?: string; +}; + +/** + * 登录请求 + */ +export interface LoginData { + tenantId?: string; + username?: string; + password?: string; + rememberMe?: boolean; + socialCode?: string; + socialState?: string; + source?: string; + code?: string; + uuid?: string; + clientId: string; + grantType: string; +} + +/** + * 登录响应 + */ +export interface LoginResult { + access_token: string; +} + +/** + * 验证码返回 + */ +export interface VerifyCodeResult { + captchaEnabled: boolean; + uuid?: string; + img?: string; +} + +/** + * 租户 + */ +export interface TenantVO { + companyName: string; + domain: any; + tenantId: string; +} + +export interface TenantInfo { + tenantEnabled: boolean; + voList: TenantVO[]; +} diff --git a/src/api/workflow/category/index.ts b/src/api/workflow/category/index.ts new file mode 100644 index 0000000..b6a83ea --- /dev/null +++ b/src/api/workflow/category/index.ts @@ -0,0 +1,76 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { CategoryVO, CategoryForm, CategoryQuery, CategoryTreeVO } from '@/api/workflow/category/types'; + +/** + * 查询流程分类列表 + * @param query + * @returns {*} + */ + +export const listCategory = (query?: CategoryQuery): AxiosPromise => { + return request({ + url: '/workflow/category/list', + method: 'get', + params: query + }); +}; + +/** + * 查询流程分类详细 + * @param categoryId + */ +export const getCategory = (categoryId: string | number): AxiosPromise => { + return request({ + url: '/workflow/category/' + categoryId, + method: 'get' + }); +}; + +/** + * 新增流程分类 + * @param data + */ +export const addCategory = (data: CategoryForm) => { + return request({ + url: '/workflow/category', + method: 'post', + data: data + }); +}; + +/** + * 修改流程分类 + * @param data + */ +export const updateCategory = (data: CategoryForm) => { + return request({ + url: '/workflow/category', + method: 'put', + data: data + }); +}; + +/** + * 删除流程分类 + * @param categoryId + */ +export const delCategory = (categoryId: string | number | Array) => { + return request({ + url: '/workflow/category/' + categoryId, + method: 'delete' + }); +}; + +/** + * 获取流程分类树列表 + * @param query 流程实例id + * @returns + */ +export const categoryTree = (query?: CategoryForm): AxiosPromise => { + return request({ + url: `/workflow/category/categoryTree`, + method: 'get', + params: query + }); +}; diff --git a/src/api/workflow/category/types.ts b/src/api/workflow/category/types.ts new file mode 100644 index 0000000..a093073 --- /dev/null +++ b/src/api/workflow/category/types.ts @@ -0,0 +1,72 @@ +export interface CategoryTreeVO { + id: number | string; + label: string; + parentId: number | string; + weight: number; + children: CategoryTreeVO[]; +} +export interface CategoryVO { + + /** + * 流程分类ID + */ + categoryId: string | number; + + /** + * 父级id + */ + parentId: string | number; + + /** + * 流程分类名称 + */ + categoryName: string; + + /** + * 显示顺序 + */ + orderNum: number; + + /** + * 创建时间 + */ + createTime: string; + + /** + * 子对象 + */ + children: CategoryVO[]; +} + +export interface CategoryForm extends BaseEntity { + + /** + * 流程分类ID + */ + categoryId?: string | number; + + /** + * 流程分类名称 + */ + categoryName?: string; + + /** + * 父流程分类id + */ + parentId?: string | number; + + /** + * 显示顺序 + */ + orderNum?: number; + +} + +export interface CategoryQuery { + + /** + * 流程分类名称 + */ + categoryName?: string; + +} diff --git a/src/api/workflow/definition/index.ts b/src/api/workflow/definition/index.ts new file mode 100644 index 0000000..49e6ee8 --- /dev/null +++ b/src/api/workflow/definition/index.ts @@ -0,0 +1,170 @@ +import request from '@/utils/request'; +import { FlowDefinitionQuery, definitionXmlVO, FlowDefinitionForm, FlowDefinitionVo } from '@/api/workflow/definition/types'; +import { AxiosPromise } from 'axios'; + +/** + * 获取流程定义列表 + * @param query 流程实例id + * @returns + */ +export const listDefinition = (query: FlowDefinitionQuery): AxiosPromise => { + return request({ + url: `/workflow/definition/list`, + method: 'get', + params: query + }); +}; + +/** + * 查询未发布的流程定义列表 + * @param query 流程实例id + * @returns + */ +export const unPublishList = (query: FlowDefinitionQuery): AxiosPromise => { + return request({ + url: `/workflow/definition/unPublishList`, + method: 'get', + params: query + }); +}; + +/** + * 通过流程定义id获取xml + * @param definitionId 流程定义id + * @returns + */ +export const definitionXml = (definitionId: string): AxiosPromise => { + return request({ + url: `/workflow/definition/definitionXml/${definitionId}`, + method: 'get' + }); +}; + +/** + * 删除流程定义 + * @param id 流程定义id + * @returns + */ +export const deleteDefinition = (id: string | string[]) => { + return request({ + url: `/workflow/definition/${id}`, + method: 'delete' + }); +}; + +/** + * 挂起/激活 + * @param definitionId 流程定义id + * @param activityStatus 状态 + * @returns + */ +export const active = (definitionId: string, activityStatus: boolean) => { + return request({ + url: `/workflow/definition/active/${definitionId}`, + method: 'put', + params: { + active: activityStatus + } + }); +}; + +/** + * 通过zip或xml部署流程定义 + * @returns + */ +export function importDef(data: any) { + return request({ + url: '/workflow/definition/importDef', + method: 'post', + data: data, + headers: { + repeatSubmit: false + } + }); +} + +/** + * 发布流程定义 + * @param id 流程定义id + * @returns + */ +export const publish = (id: string) => { + return request({ + url: `/workflow/definition/publish/${id}`, + method: 'put' + }); +}; + +/** + * 取消发布流程定义 + * @param id 流程定义id + * @returns + */ +export const unPublish = (id: string) => { + return request({ + url: `/workflow/definition/unPublish/${id}`, + method: 'put' + }); +}; + +/** + * 获取流程定义xml字符串 + * @param id 流程定义id + * @returns + */ +export const xmlString = (id: string) => { + return request({ + url: `/workflow/definition/xmlString/${id}`, + method: 'get' + }); +}; + +/** + * 新增 + * @param data 参数 + * @returns + */ +export const add = (data: FlowDefinitionForm) => { + return request({ + url: `/workflow/definition`, + method: 'post', + data: data + }); +}; + +/** + * 修改 + * @param data 参数 + * @returns + */ +export const edit = (data: FlowDefinitionForm) => { + return request({ + url: `/workflow/definition`, + method: 'put', + data: data + }); +}; + +/** + * 查询详情 + * @param id 参数 + * @returns + */ +export const getInfo = (id: number | string) => { + return request({ + url: `/workflow/definition/${id}`, + method: 'get' + }); +}; + +/** + * 复制流程定义 + * @param id 流程定义id + * @returns + */ +export const copy = (id: string) => { + return request({ + url: `/workflow/definition/copy/${id}`, + method: 'post' + }); +}; diff --git a/src/api/workflow/definition/types.ts b/src/api/workflow/definition/types.ts new file mode 100644 index 0000000..5de7f77 --- /dev/null +++ b/src/api/workflow/definition/types.ts @@ -0,0 +1,31 @@ +export interface FlowDefinitionQuery extends PageQuery { + flowCode?: string; + flowName?: string; + category: string | number; + isPublish?: number; +} + +export interface FlowDefinitionVo { + id: string; + flowName: string; + flowCode: string; + formPath: string; + version: string; + isPublish: number; + activityStatus: number; + createTime: Date; + updateTime: Date; +} + +export interface FlowDefinitionForm { + id: string; + flowName: string; + flowCode: string; + category: string; + formPath: string; +} + +export interface definitionXmlVO { + xml: string[]; + xmlStr: string; +} diff --git a/src/api/workflow/instance/index.ts b/src/api/workflow/instance/index.ts new file mode 100644 index 0000000..42d748d --- /dev/null +++ b/src/api/workflow/instance/index.ts @@ -0,0 +1,101 @@ +import request from '@/utils/request'; +import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types'; +import { AxiosPromise } from 'axios'; + +/** + * 查询运行中实例列表 + * @param query + * @returns {*} + */ +export const pageByRunning = (query: FlowInstanceQuery): AxiosPromise => { + return request({ + url: '/workflow/instance/pageByRunning', + method: 'get', + params: query + }); +}; + +/** + * 查询已完成实例列表 + * @param query + * @returns {*} + */ +export const pageByFinish = (query: FlowInstanceQuery): AxiosPromise => { + return request({ + url: '/workflow/instance/pageByFinish', + method: 'get', + params: query + }); +}; + +/** + * 通过业务id获取历史流程图 + */ +export const flowImage = (businessId: string | number) => { + return request({ + url: `/workflow/instance/flowImage/${businessId}` + '?t' + Math.random(), + method: 'get' + }); +}; + +/** + * 分页查询当前登录人单据 + * @param query + * @returns {*} + */ +export const pageByCurrent = (query: FlowInstanceQuery): AxiosPromise => { + return request({ + url: '/workflow/instance/pageByCurrent', + method: 'get', + params: query + }); +}; + +/** + * 撤销流程 + * @param data 参数 + * @returns + */ +export const cancelProcessApply = (data: any) => { + return request({ + url: `/workflow/instance/cancelProcessApply`, + method: 'put', + data: data + }); +}; + +/** + * 获取流程变量 + * @param instanceId 实例id + * @returns + */ +export const instanceVariable = (instanceId: string | number) => { + return request({ + url: `/workflow/instance/instanceVariable/${instanceId}`, + method: 'get' + }); +}; + +/** + * 删除 + * @param instanceIds 流程实例id + * @returns + */ +export const deleteByInstanceIds = (instanceIds: Array | string | number) => { + return request({ + url: `/workflow/instance/deleteByInstanceIds/${instanceIds}`, + method: 'delete' + }); +}; +/** + * 作废流程 + * @param data 参数 + * @returns + */ +export const invalid = (data: any) => { + return request({ + url: `/workflow/instance/invalid`, + method: 'post', + data: data + }); +}; diff --git a/src/api/workflow/instance/types.ts b/src/api/workflow/instance/types.ts new file mode 100644 index 0000000..a12dab3 --- /dev/null +++ b/src/api/workflow/instance/types.ts @@ -0,0 +1,26 @@ +import { FlowTaskVO } from '@/api/workflow/task/types'; + +export interface FlowInstanceQuery extends PageQuery { + category?: string | number; + nodeName?: string; + flowCode?: string; + flowName?: string; + createByIds?: string[] | number[]; + businessId?: string; +} + +export interface FlowInstanceVO extends BaseEntity { + id: string | number; + definitionId: string; + flowName: string; + flowCode: string; + version: string; + businessId: string; + activityStatus: number; + tenantId: string; + createTime: string; + createBy: string; + flowStatus: string; + flowStatusName: string; + flowTaskList: FlowTaskVO[]; +} diff --git a/src/api/workflow/leave/index.ts b/src/api/workflow/leave/index.ts new file mode 100644 index 0000000..4e6f363 --- /dev/null +++ b/src/api/workflow/leave/index.ts @@ -0,0 +1,63 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { LeaveVO, LeaveQuery, LeaveForm } from '@/api/workflow/leave/types'; + +/** + * 查询请假列表 + * @param query + * @returns {*} + */ + +export const listLeave = (query?: LeaveQuery): AxiosPromise => { + return request({ + url: '/workflow/leave/list', + method: 'get', + params: query + }); +}; + +/** + * 查询请假详细 + * @param id + */ +export const getLeave = (id: string | number): AxiosPromise => { + return request({ + url: '/workflow/leave/' + id, + method: 'get' + }); +}; + +/** + * 新增请假 + * @param data + */ +export const addLeave = (data: LeaveForm): AxiosPromise => { + return request({ + url: '/workflow/leave', + method: 'post', + data: data + }); +}; + +/** + * 修改请假 + * @param data + */ +export const updateLeave = (data: LeaveForm): AxiosPromise => { + return request({ + url: '/workflow/leave', + method: 'put', + data: data + }); +}; + +/** + * 删除请假 + * @param id + */ +export const delLeave = (id: string | number | Array) => { + return request({ + url: '/workflow/leave/' + id, + method: 'delete' + }); +}; diff --git a/src/api/workflow/leave/types.ts b/src/api/workflow/leave/types.ts new file mode 100644 index 0000000..a44d35d --- /dev/null +++ b/src/api/workflow/leave/types.ts @@ -0,0 +1,24 @@ +export interface LeaveVO { + id: string | number; + leaveType: string; + startDate: string; + endDate: string; + leaveDays: number; + remark: string; + status?: string; +} + +export interface LeaveForm extends BaseEntity { + id?: string | number; + leaveType?: string; + startDate?: string; + endDate?: string; + leaveDays?: number; + remark?: string; + status?: string; +} + +export interface LeaveQuery extends PageQuery { + startLeaveDays?: number; + endLeaveDays?: number; +} diff --git a/src/api/workflow/task/index.ts b/src/api/workflow/task/index.ts new file mode 100644 index 0000000..55ede45 --- /dev/null +++ b/src/api/workflow/task/index.ts @@ -0,0 +1,180 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { TaskQuery, FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types'; + +/** + * 查询待办列表 + * @param query + * @returns {*} + */ +export const pageByTaskWait = (query: TaskQuery): AxiosPromise => { + return request({ + url: '/workflow/task/pageByTaskWait', + method: 'get', + params: query + }); +}; + +/** + * 查询已办列表 + * @param query + * @returns {*} + */ +export const pageByTaskFinish = (query: TaskQuery): AxiosPromise => { + return request({ + url: '/workflow/task/pageByTaskFinish', + method: 'get', + params: query + }); +}; + +/** + * 查询当前用户的抄送列表 + * @param query + * @returns {*} + */ +export const pageByTaskCopy = (query: TaskQuery): AxiosPromise => { + return request({ + url: '/workflow/task/pageByTaskCopy', + method: 'get', + params: query + }); +}; + +/** + * 当前租户所有待办任务 + * @param query + * @returns {*} + */ +export const pageByAllTaskWait = (query: TaskQuery): AxiosPromise => { + return request({ + url: '/workflow/task/pageByAllTaskWait', + method: 'get', + params: query + }); +}; + +/** + * 当前租户所有已办任务 + * @param query + * @returns {*} + */ +export const pageByAllTaskFinish = (query: TaskQuery): AxiosPromise => { + return request({ + url: '/workflow/task/pageByAllTaskFinish', + method: 'get', + params: query + }); +}; + +/** + * 启动流程 + * @param data + * @returns {*} + */ +export const startWorkFlow = (data: object): any => { + return request({ + url: '/workflow/task/startWorkFlow', + method: 'post', + data: data + }); +}; + +/** + * 办理流程 + * @param data + * @returns {*} + */ +export const completeTask = (data: object) => { + return request({ + url: '/workflow/task/completeTask', + method: 'post', + data: data + }); +}; + +/** + * 任务驳回 + * @param data + * @returns {*} + */ +export const backProcess = (data: any): any => { + return request({ + url: '/workflow/task/backProcess', + method: 'post', + data: data + }); +}; + +/** + * 获取当前任务 + * @param taskId + * @returns + */ +export const getTask = (taskId: string) => { + return request({ + url: '/workflow/task/getTask/' + taskId, + method: 'get' + }); +}; + +/** + * 修改任务办理人 + * @param taskIdList + * @param userId + * @returns + */ +export const updateAssignee = (taskIdList: Array, userId: string) => { + return request({ + url: `/workflow/task/updateAssignee/${userId}`, + method: 'put', + data: taskIdList + }); +}; + +/** + * 终止任务 + * @returns + */ +export const terminationTask = (data: any) => { + return request({ + url: `/workflow/task/terminationTask`, + method: 'post', + data: data + }); +}; + +/** + * 获取可驳回得任务节点 + * @returns + */ +export const getBackTaskNode = (definitionId: string, nodeCode: string) => { + return request({ + url: `/workflow/task/getBackTaskNode/${definitionId}/${nodeCode}`, + method: 'get' + }); +}; + +/** + * 任务操作 操作类型,委派 delegateTask、转办 transferTask、加签 addSignature、减签 reductionSignature + * @returns + */ +export const taskOperation = (data: TaskOperationBo, operation: string) => { + return request({ + url: `/workflow/task/taskOperation/${operation}`, + method: 'post', + data: data + }); +}; + +/** + * 获取当前任务办理人 + * @param taskId 任务id + * @returns + */ +export const currentTaskAllUser = (taskId: string | number) => { + return request({ + url: `/workflow/task/currentTaskAllUser/${taskId}`, + method: 'get' + }); +}; diff --git a/src/api/workflow/task/types.ts b/src/api/workflow/task/types.ts new file mode 100644 index 0000000..8ea803b --- /dev/null +++ b/src/api/workflow/task/types.ts @@ -0,0 +1,48 @@ +export interface TaskQuery extends PageQuery { + nodeName?: string; + flowCode?: string; + flowName?: string; + createByIds?: string[] | number[]; +} + +export interface ParticipantVo { + groupIds?: string[] | number[]; + candidate: string[] | number[]; + candidateName: string[]; + claim: boolean; +} +export interface FlowTaskVO { + id: string | number; + createTime?: Date; + updateTime?: Date; + tenantId?: string; + definitionId?: string; + instanceId: string; + flowName: string; + businessId: string; + nodeCode: string; + nodeName: string; + flowCode: string; + flowStatus: string; + formCustom: string; + formPath: string; + nodeType: number; + nodeRatio: string | number; + version?: string; +} + +export interface VariableVo { + key: string; + value: string; +} + +export interface TaskOperationBo { + //委派/转办人的用户ID(必填,准对委派/转办人操作) + userId?: string; + //加签/减签人的用户ID列表(必填,针对加签/减签操作) + userIds?: string[]; + //任务ID(必填) + taskId: string | number; + //意见或备注信息(可选) + message?: string; +} diff --git a/src/api/workflow/workflowCommon/index.ts b/src/api/workflow/workflowCommon/index.ts new file mode 100644 index 0000000..0f5ce1b --- /dev/null +++ b/src/api/workflow/workflowCommon/index.ts @@ -0,0 +1,15 @@ +import { RouterJumpVo } from '@/api/workflow/workflowCommon/types'; + +export default { + routerJump(routerJumpVo: RouterJumpVo, proxy) { + proxy.$tab.closePage(proxy.$route); + proxy.$router.push({ + path: routerJumpVo.formPath, + query: { + id: routerJumpVo.businessId, + type: routerJumpVo.type, + taskId: routerJumpVo.taskId + } + }); + } +}; diff --git a/src/api/workflow/workflowCommon/types.ts b/src/api/workflow/workflowCommon/types.ts new file mode 100644 index 0000000..3e7a71d --- /dev/null +++ b/src/api/workflow/workflowCommon/types.ts @@ -0,0 +1,13 @@ +export interface RouterJumpVo { + businessId: string; + taskId: string | number; + type: string; + formCustom: string; + formPath: string; +} + +export interface StartProcessBo { + businessId: string | number; + flowCode: string; + variables: any; +} diff --git a/src/assets/401_images/401.gif b/src/assets/401_images/401.gif new file mode 100644 index 0000000..cd6e0d9 Binary files /dev/null and b/src/assets/401_images/401.gif differ diff --git a/src/assets/404_images/404.png b/src/assets/404_images/404.png new file mode 100644 index 0000000..3d8e230 Binary files /dev/null and b/src/assets/404_images/404.png differ diff --git a/src/assets/404_images/404_cloud.png b/src/assets/404_images/404_cloud.png new file mode 100644 index 0000000..c6281d0 Binary files /dev/null and b/src/assets/404_images/404_cloud.png differ diff --git a/src/assets/icons/svg/404.svg b/src/assets/icons/svg/404.svg new file mode 100644 index 0000000..6df5019 --- /dev/null +++ b/src/assets/icons/svg/404.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/bug.svg b/src/assets/icons/svg/bug.svg new file mode 100644 index 0000000..05a150d --- /dev/null +++ b/src/assets/icons/svg/bug.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/build.svg b/src/assets/icons/svg/build.svg new file mode 100644 index 0000000..97c4688 --- /dev/null +++ b/src/assets/icons/svg/build.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/button.svg b/src/assets/icons/svg/button.svg new file mode 100644 index 0000000..904fddc --- /dev/null +++ b/src/assets/icons/svg/button.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/caret-back.svg b/src/assets/icons/svg/caret-back.svg new file mode 100644 index 0000000..9bae722 --- /dev/null +++ b/src/assets/icons/svg/caret-back.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/caret-forward.svg b/src/assets/icons/svg/caret-forward.svg new file mode 100644 index 0000000..1ec3f7d --- /dev/null +++ b/src/assets/icons/svg/caret-forward.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/cascader.svg b/src/assets/icons/svg/cascader.svg new file mode 100644 index 0000000..e256024 --- /dev/null +++ b/src/assets/icons/svg/cascader.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/category.svg b/src/assets/icons/svg/category.svg new file mode 100644 index 0000000..df92526 --- /dev/null +++ b/src/assets/icons/svg/category.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/chart.svg b/src/assets/icons/svg/chart.svg new file mode 100644 index 0000000..27728fb --- /dev/null +++ b/src/assets/icons/svg/chart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/checkbox.svg b/src/assets/icons/svg/checkbox.svg new file mode 100644 index 0000000..013fd3a --- /dev/null +++ b/src/assets/icons/svg/checkbox.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/clipboard.svg b/src/assets/icons/svg/clipboard.svg new file mode 100644 index 0000000..90923ff --- /dev/null +++ b/src/assets/icons/svg/clipboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/code.svg b/src/assets/icons/svg/code.svg new file mode 100644 index 0000000..5f9c5ab --- /dev/null +++ b/src/assets/icons/svg/code.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/color.svg b/src/assets/icons/svg/color.svg new file mode 100644 index 0000000..44a81aa --- /dev/null +++ b/src/assets/icons/svg/color.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/company.svg b/src/assets/icons/svg/company.svg new file mode 100644 index 0000000..fcf1394 --- /dev/null +++ b/src/assets/icons/svg/company.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/component.svg b/src/assets/icons/svg/component.svg new file mode 100644 index 0000000..29c3458 --- /dev/null +++ b/src/assets/icons/svg/component.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/dashboard.svg b/src/assets/icons/svg/dashboard.svg new file mode 100644 index 0000000..5317d37 --- /dev/null +++ b/src/assets/icons/svg/dashboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/date-range.svg b/src/assets/icons/svg/date-range.svg new file mode 100644 index 0000000..fda571e --- /dev/null +++ b/src/assets/icons/svg/date-range.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/date.svg b/src/assets/icons/svg/date.svg new file mode 100644 index 0000000..52dc73e --- /dev/null +++ b/src/assets/icons/svg/date.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/dict.svg b/src/assets/icons/svg/dict.svg new file mode 100644 index 0000000..4849377 --- /dev/null +++ b/src/assets/icons/svg/dict.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/documentation.svg b/src/assets/icons/svg/documentation.svg new file mode 100644 index 0000000..7043122 --- /dev/null +++ b/src/assets/icons/svg/documentation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/download.svg b/src/assets/icons/svg/download.svg new file mode 100644 index 0000000..c896951 --- /dev/null +++ b/src/assets/icons/svg/download.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/drag.svg b/src/assets/icons/svg/drag.svg new file mode 100644 index 0000000..4185d3c --- /dev/null +++ b/src/assets/icons/svg/drag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/druid.svg b/src/assets/icons/svg/druid.svg new file mode 100644 index 0000000..a2b4b4e --- /dev/null +++ b/src/assets/icons/svg/druid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/edit.svg b/src/assets/icons/svg/edit.svg new file mode 100644 index 0000000..d26101f --- /dev/null +++ b/src/assets/icons/svg/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/education.svg b/src/assets/icons/svg/education.svg new file mode 100644 index 0000000..7bfb01d --- /dev/null +++ b/src/assets/icons/svg/education.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/email.svg b/src/assets/icons/svg/email.svg new file mode 100644 index 0000000..74d25e2 --- /dev/null +++ b/src/assets/icons/svg/email.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/example.svg b/src/assets/icons/svg/example.svg new file mode 100644 index 0000000..46f42b5 --- /dev/null +++ b/src/assets/icons/svg/example.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/excel.svg b/src/assets/icons/svg/excel.svg new file mode 100644 index 0000000..74d97b8 --- /dev/null +++ b/src/assets/icons/svg/excel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/exit-fullscreen.svg b/src/assets/icons/svg/exit-fullscreen.svg new file mode 100644 index 0000000..485c128 --- /dev/null +++ b/src/assets/icons/svg/exit-fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/eye-open.svg b/src/assets/icons/svg/eye-open.svg new file mode 100644 index 0000000..88dcc98 --- /dev/null +++ b/src/assets/icons/svg/eye-open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/eye.svg b/src/assets/icons/svg/eye.svg new file mode 100644 index 0000000..16ed2d8 --- /dev/null +++ b/src/assets/icons/svg/eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/finish.svg b/src/assets/icons/svg/finish.svg new file mode 100644 index 0000000..4685c23 --- /dev/null +++ b/src/assets/icons/svg/finish.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/form.svg b/src/assets/icons/svg/form.svg new file mode 100644 index 0000000..dcbaa18 --- /dev/null +++ b/src/assets/icons/svg/form.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/fullscreen.svg b/src/assets/icons/svg/fullscreen.svg new file mode 100644 index 0000000..0e86b6f --- /dev/null +++ b/src/assets/icons/svg/fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/gitee.svg b/src/assets/icons/svg/gitee.svg new file mode 100644 index 0000000..6324608 --- /dev/null +++ b/src/assets/icons/svg/gitee.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/svg/github.svg b/src/assets/icons/svg/github.svg new file mode 100644 index 0000000..db0a0d4 --- /dev/null +++ b/src/assets/icons/svg/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/guide.svg b/src/assets/icons/svg/guide.svg new file mode 100644 index 0000000..b271001 --- /dev/null +++ b/src/assets/icons/svg/guide.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/icon.svg b/src/assets/icons/svg/icon.svg new file mode 100644 index 0000000..82be8ee --- /dev/null +++ b/src/assets/icons/svg/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/input.svg b/src/assets/icons/svg/input.svg new file mode 100644 index 0000000..ab91381 --- /dev/null +++ b/src/assets/icons/svg/input.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/international.svg b/src/assets/icons/svg/international.svg new file mode 100644 index 0000000..e9b56ee --- /dev/null +++ b/src/assets/icons/svg/international.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/job.svg b/src/assets/icons/svg/job.svg new file mode 100644 index 0000000..2a93a25 --- /dev/null +++ b/src/assets/icons/svg/job.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/language.svg b/src/assets/icons/svg/language.svg new file mode 100644 index 0000000..0082b57 --- /dev/null +++ b/src/assets/icons/svg/language.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/link.svg b/src/assets/icons/svg/link.svg new file mode 100644 index 0000000..48197ba --- /dev/null +++ b/src/assets/icons/svg/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/list.svg b/src/assets/icons/svg/list.svg new file mode 100644 index 0000000..20259ed --- /dev/null +++ b/src/assets/icons/svg/list.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/lock.svg b/src/assets/icons/svg/lock.svg new file mode 100644 index 0000000..74fee54 --- /dev/null +++ b/src/assets/icons/svg/lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/log.svg b/src/assets/icons/svg/log.svg new file mode 100644 index 0000000..d879d33 --- /dev/null +++ b/src/assets/icons/svg/log.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/logininfor.svg b/src/assets/icons/svg/logininfor.svg new file mode 100644 index 0000000..267f844 --- /dev/null +++ b/src/assets/icons/svg/logininfor.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/maxkey.svg b/src/assets/icons/svg/maxkey.svg new file mode 100644 index 0000000..f8f8a7d --- /dev/null +++ b/src/assets/icons/svg/maxkey.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icons/svg/message.svg b/src/assets/icons/svg/message.svg new file mode 100644 index 0000000..14ca817 --- /dev/null +++ b/src/assets/icons/svg/message.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/model.svg b/src/assets/icons/svg/model.svg new file mode 100644 index 0000000..0c57d70 --- /dev/null +++ b/src/assets/icons/svg/model.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/money.svg b/src/assets/icons/svg/money.svg new file mode 100644 index 0000000..c1580de --- /dev/null +++ b/src/assets/icons/svg/money.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/monitor.svg b/src/assets/icons/svg/monitor.svg new file mode 100644 index 0000000..bc308cb --- /dev/null +++ b/src/assets/icons/svg/monitor.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/my-copy.svg b/src/assets/icons/svg/my-copy.svg new file mode 100644 index 0000000..49f69fa --- /dev/null +++ b/src/assets/icons/svg/my-copy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/my-task.svg b/src/assets/icons/svg/my-task.svg new file mode 100644 index 0000000..1f1ea44 --- /dev/null +++ b/src/assets/icons/svg/my-task.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/nested.svg b/src/assets/icons/svg/nested.svg new file mode 100644 index 0000000..06713a8 --- /dev/null +++ b/src/assets/icons/svg/nested.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/number.svg b/src/assets/icons/svg/number.svg new file mode 100644 index 0000000..ad5ce9a --- /dev/null +++ b/src/assets/icons/svg/number.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/online.svg b/src/assets/icons/svg/online.svg new file mode 100644 index 0000000..330a202 --- /dev/null +++ b/src/assets/icons/svg/online.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/password.svg b/src/assets/icons/svg/password.svg new file mode 100644 index 0000000..6c64def --- /dev/null +++ b/src/assets/icons/svg/password.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/pdf.svg b/src/assets/icons/svg/pdf.svg new file mode 100644 index 0000000..957aa0c --- /dev/null +++ b/src/assets/icons/svg/pdf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/people.svg b/src/assets/icons/svg/people.svg new file mode 100644 index 0000000..2bd54ae --- /dev/null +++ b/src/assets/icons/svg/people.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/peoples.svg b/src/assets/icons/svg/peoples.svg new file mode 100644 index 0000000..aab852e --- /dev/null +++ b/src/assets/icons/svg/peoples.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/phone.svg b/src/assets/icons/svg/phone.svg new file mode 100644 index 0000000..ab8e8c4 --- /dev/null +++ b/src/assets/icons/svg/phone.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/post.svg b/src/assets/icons/svg/post.svg new file mode 100644 index 0000000..2922c61 --- /dev/null +++ b/src/assets/icons/svg/post.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/process-definition.svg b/src/assets/icons/svg/process-definition.svg new file mode 100644 index 0000000..202d200 --- /dev/null +++ b/src/assets/icons/svg/process-definition.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/qq.svg b/src/assets/icons/svg/qq.svg new file mode 100644 index 0000000..ee13d4e --- /dev/null +++ b/src/assets/icons/svg/qq.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/question.svg b/src/assets/icons/svg/question.svg new file mode 100644 index 0000000..cf75bd4 --- /dev/null +++ b/src/assets/icons/svg/question.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/radio.svg b/src/assets/icons/svg/radio.svg new file mode 100644 index 0000000..0cde345 --- /dev/null +++ b/src/assets/icons/svg/radio.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/rate.svg b/src/assets/icons/svg/rate.svg new file mode 100644 index 0000000..aa3b14d --- /dev/null +++ b/src/assets/icons/svg/rate.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/redis-list.svg b/src/assets/icons/svg/redis-list.svg new file mode 100644 index 0000000..98a15b2 --- /dev/null +++ b/src/assets/icons/svg/redis-list.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/redis.svg b/src/assets/icons/svg/redis.svg new file mode 100644 index 0000000..2f1d62d --- /dev/null +++ b/src/assets/icons/svg/redis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/row.svg b/src/assets/icons/svg/row.svg new file mode 100644 index 0000000..0780992 --- /dev/null +++ b/src/assets/icons/svg/row.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/search.svg b/src/assets/icons/svg/search.svg new file mode 100644 index 0000000..84233dd --- /dev/null +++ b/src/assets/icons/svg/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/select.svg b/src/assets/icons/svg/select.svg new file mode 100644 index 0000000..d628382 --- /dev/null +++ b/src/assets/icons/svg/select.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/server.svg b/src/assets/icons/svg/server.svg new file mode 100644 index 0000000..eb287e3 --- /dev/null +++ b/src/assets/icons/svg/server.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/shopping.svg b/src/assets/icons/svg/shopping.svg new file mode 100644 index 0000000..87513e7 --- /dev/null +++ b/src/assets/icons/svg/shopping.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/size.svg b/src/assets/icons/svg/size.svg new file mode 100644 index 0000000..ddb25b8 --- /dev/null +++ b/src/assets/icons/svg/size.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/skill.svg b/src/assets/icons/svg/skill.svg new file mode 100644 index 0000000..a3b7312 --- /dev/null +++ b/src/assets/icons/svg/skill.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/slider.svg b/src/assets/icons/svg/slider.svg new file mode 100644 index 0000000..fbe4f39 --- /dev/null +++ b/src/assets/icons/svg/slider.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/star.svg b/src/assets/icons/svg/star.svg new file mode 100644 index 0000000..6cf86e6 --- /dev/null +++ b/src/assets/icons/svg/star.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/swagger.svg b/src/assets/icons/svg/swagger.svg new file mode 100644 index 0000000..05d4e7b --- /dev/null +++ b/src/assets/icons/svg/swagger.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/switch.svg b/src/assets/icons/svg/switch.svg new file mode 100644 index 0000000..0ba61e3 --- /dev/null +++ b/src/assets/icons/svg/switch.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/system.svg b/src/assets/icons/svg/system.svg new file mode 100644 index 0000000..5992593 --- /dev/null +++ b/src/assets/icons/svg/system.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/tab.svg b/src/assets/icons/svg/tab.svg new file mode 100644 index 0000000..b4b48e4 --- /dev/null +++ b/src/assets/icons/svg/tab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/table.svg b/src/assets/icons/svg/table.svg new file mode 100644 index 0000000..0e3dc9d --- /dev/null +++ b/src/assets/icons/svg/table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/textarea.svg b/src/assets/icons/svg/textarea.svg new file mode 100644 index 0000000..2709f29 --- /dev/null +++ b/src/assets/icons/svg/textarea.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/theme.svg b/src/assets/icons/svg/theme.svg new file mode 100644 index 0000000..5982a2f --- /dev/null +++ b/src/assets/icons/svg/theme.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/time-range.svg b/src/assets/icons/svg/time-range.svg new file mode 100644 index 0000000..13c1202 --- /dev/null +++ b/src/assets/icons/svg/time-range.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/time.svg b/src/assets/icons/svg/time.svg new file mode 100644 index 0000000..b376e32 --- /dev/null +++ b/src/assets/icons/svg/time.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/tool.svg b/src/assets/icons/svg/tool.svg new file mode 100644 index 0000000..48e0e35 --- /dev/null +++ b/src/assets/icons/svg/tool.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/topiam.svg b/src/assets/icons/svg/topiam.svg new file mode 100644 index 0000000..e7ea057 --- /dev/null +++ b/src/assets/icons/svg/topiam.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/icons/svg/tree-table.svg b/src/assets/icons/svg/tree-table.svg new file mode 100644 index 0000000..8aafdb8 --- /dev/null +++ b/src/assets/icons/svg/tree-table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/tree.svg b/src/assets/icons/svg/tree.svg new file mode 100644 index 0000000..dd4b7dd --- /dev/null +++ b/src/assets/icons/svg/tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/upload.svg b/src/assets/icons/svg/upload.svg new file mode 100644 index 0000000..bae49c0 --- /dev/null +++ b/src/assets/icons/svg/upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/user.svg b/src/assets/icons/svg/user.svg new file mode 100644 index 0000000..0ba0716 --- /dev/null +++ b/src/assets/icons/svg/user.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/validCode.svg b/src/assets/icons/svg/validCode.svg new file mode 100644 index 0000000..cfb1021 --- /dev/null +++ b/src/assets/icons/svg/validCode.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/waiting.svg b/src/assets/icons/svg/waiting.svg new file mode 100644 index 0000000..2c2042d --- /dev/null +++ b/src/assets/icons/svg/waiting.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/wechat.svg b/src/assets/icons/svg/wechat.svg new file mode 100644 index 0000000..c586e55 --- /dev/null +++ b/src/assets/icons/svg/wechat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/workflow.svg b/src/assets/icons/svg/workflow.svg new file mode 100644 index 0000000..2f7423a --- /dev/null +++ b/src/assets/icons/svg/workflow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/zip.svg b/src/assets/icons/svg/zip.svg new file mode 100644 index 0000000..f806fc4 --- /dev/null +++ b/src/assets/icons/svg/zip.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/images/dark.svg b/src/assets/images/dark.svg new file mode 100644 index 0000000..f646bd7 --- /dev/null +++ b/src/assets/images/dark.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/images/light.svg b/src/assets/images/light.svg new file mode 100644 index 0000000..ab7cc08 --- /dev/null +++ b/src/assets/images/light.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/images/profile.jpg b/src/assets/images/profile.jpg new file mode 100644 index 0000000..f4fde57 Binary files /dev/null and b/src/assets/images/profile.jpg differ diff --git a/src/assets/logo/logo.png b/src/assets/logo/logo.png new file mode 100644 index 0000000..3f919d8 Binary files /dev/null and b/src/assets/logo/logo.png differ diff --git a/src/assets/styles/btn.scss b/src/assets/styles/btn.scss new file mode 100644 index 0000000..a1ccd01 --- /dev/null +++ b/src/assets/styles/btn.scss @@ -0,0 +1,99 @@ +@import './variables.module.scss'; + +@mixin colorBtn($color) { + background: $color; + + &:hover { + color: $color; + + &:before, + &:after { + background: $color; + } + } +} + +.blue-btn { + @include colorBtn($blue); +} + +.light-blue-btn { + @include colorBtn($light-blue); +} + +.red-btn { + @include colorBtn($red); +} + +.pink-btn { + @include colorBtn($pink); +} + +.green-btn { + @include colorBtn($green); +} + +.tiffany-btn { + @include colorBtn($tiffany); +} + +.yellow-btn { + @include colorBtn($yellow); +} + +.pan-btn { + font-size: 14px; + color: #fff; + padding: 14px 36px; + border-radius: 8px; + border: none; + outline: none; + transition: 600ms ease all; + position: relative; + display: inline-block; + + &:hover { + background: #fff; + + &:before, + &:after { + width: 100%; + transition: 600ms ease all; + } + } + + &:before, + &:after { + content: ''; + position: absolute; + top: 0; + right: 0; + height: 2px; + width: 0; + transition: 400ms ease all; + } + + &::after { + right: inherit; + top: inherit; + left: 0; + bottom: 0; + } +} + +.custom-button { + display: inline-block; + line-height: 1; + white-space: nowrap; + cursor: pointer; + background: #fff; + color: #fff; + -webkit-appearance: none; + text-align: center; + box-sizing: border-box; + outline: 0; + margin: 0; + padding: 10px 15px; + font-size: 14px; + border-radius: 4px; +} diff --git a/src/assets/styles/element-ui.scss b/src/assets/styles/element-ui.scss new file mode 100644 index 0000000..e38c703 --- /dev/null +++ b/src/assets/styles/element-ui.scss @@ -0,0 +1,153 @@ +.el-collapse { + .collapse__title { + font-weight: 600; + padding: 0 8px; + font-size: 1.2em; + line-height: 1.1em; + } + .el-collapse-item__content { + padding: 0 8px; + } +} + +.el-divider--horizontal { + margin-bottom: 10px; + margin-top: 10px; +} + +.el-breadcrumb__inner, +.el-breadcrumb__inner a { + font-weight: 400 !important; +} + +.el-upload { + input[type='file'] { + display: none !important; + } +} + +.el-upload__input { + display: none; +} + +.cell { + .el-tag { + margin-right: 0px; + } +} + +.small-padding { + .cell { + padding-left: 5px; + padding-right: 5px; + } +} + +.fixed-width { + .el-button--mini { + padding: 7px 10px; + width: 60px; + } +} + +.status-col { + .cell { + padding: 0 10px; + text-align: center; + + .el-tag { + margin-right: 0px; + } + } +} + +/*-------------Dialog-------------**/ +.el-overlay { + overflow: hidden; + + .el-overlay-dialog { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; + + .el-dialog { + margin: 0 auto !important; + + .el-dialog__body { + padding: 15px !important; + } + .el-dialog__header { + padding: 16px 16px 8px 16px; + box-sizing: border-box; + border-bottom: 1px solid var(--brder-color); + margin-right: 0; + } + } + } +} + +.el-dialog__body { + max-height: calc(90vh - 111px) !important; + overflow-y: auto; + overflow-x: hidden; +} + +// refine element ui upload +.upload-container { + .el-upload { + width: 100%; + + .el-upload-dragger { + width: 100%; + height: 200px; + } + } +} + +// dropdown +.el-dropdown-menu { + a { + display: block; + } +} + +// fix date-picker ui bug in filter-item +.el-range-editor.el-input__inner { + display: inline-flex !important; +} + +// to fix el-date-picker css style +.el-range-separator { + box-sizing: content-box; +} + +.el-menu--collapse > div > .el-submenu > .el-submenu__title .el-submenu__icon-arrow { + display: none; +} + +.el-dropdown .el-dropdown-link { + color: var(--el-color-primary) !important; +} + +/* 当 el-form 的 inline 属性为 true 时 */ +/* 设置 label 的宽度默认为 68px */ +.el-form--inline .el-form-item__label { + width: 68px; +} + +/* 设置 el-select 的宽度默认为 240px */ +.el-form--inline .el-select { + width: 240px; +} + +/* 设置 el-input 的宽度默认为 240px */ +.el-form--inline .el-input { + width: 240px; +} + +/* 设置 el-message-box 消息弹框内容强制换行 */ +.el-message-box .el-message-box__message { + word-break: break-word; +} diff --git a/src/assets/styles/mixin.scss b/src/assets/styles/mixin.scss new file mode 100644 index 0000000..5250e71 --- /dev/null +++ b/src/assets/styles/mixin.scss @@ -0,0 +1,60 @@ +@mixin clearfix { + &:after { + content: ''; + display: table; + clear: both; + } +} + +@mixin scrollBar { + &::-webkit-scrollbar-track-piece { + background: #d3dce6; + } + + &::-webkit-scrollbar { + width: 6px; + } + + &::-webkit-scrollbar-thumb { + background: #99a9bf; + border-radius: 20px; + } +} + +@mixin relative { + position: relative; + width: 100%; + height: 100%; +} + +@mixin pct($pct) { + width: #{$pct}; + position: relative; + margin: 0 auto; +} + +@mixin triangle($width, $height, $color, $direction) { + $width: $width/2; + $color-border-style: $height solid $color; + $transparent-border-style: $width solid transparent; + height: 0; + width: 0; + + @if $direction==up { + border-bottom: $color-border-style; + border-left: $transparent-border-style; + border-right: $transparent-border-style; + } @else if $direction==right { + border-left: $color-border-style; + border-top: $transparent-border-style; + border-bottom: $transparent-border-style; + } @else if $direction==down { + border-top: $color-border-style; + border-left: $transparent-border-style; + border-right: $transparent-border-style; + } @else if $direction==left { + border-right: $color-border-style; + border-top: $transparent-border-style; + border-bottom: $transparent-border-style; + } +} diff --git a/src/assets/styles/sidebar.scss b/src/assets/styles/sidebar.scss new file mode 100644 index 0000000..d85da55 --- /dev/null +++ b/src/assets/styles/sidebar.scss @@ -0,0 +1,232 @@ +#app { + .main-container { + height: 100%; + transition: margin-left 0.28s; + margin-left: $base-sidebar-width; + position: relative; + } + + .sidebarHide { + margin-left: 0 !important; + } + + .sidebar-container { + -webkit-transition: width 0.28s; + transition: width 0.28s; + width: $base-sidebar-width !important; + background-color: $base-menu-background; + height: 100%; + position: fixed; + font-size: 0; + top: 0; + bottom: 0; + left: 0; + z-index: 1001; + overflow: hidden; + -webkit-box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35); + box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35); + + // reset element-ui css + .horizontal-collapse-transition { + transition: + 0s width ease-in-out, + 0s padding-left ease-in-out, + 0s padding-right ease-in-out; + } + + .scrollbar-wrapper { + overflow-x: hidden !important; + } + + .el-scrollbar__bar.is-vertical { + right: 0; + } + + .el-scrollbar { + height: 100%; + } + + &.has-logo { + .el-scrollbar { + height: calc(100% - 50px); + } + } + + .is-horizontal { + display: none; + } + + a { + display: inline-block; + width: 100%; + overflow: hidden; + } + + .svg-icon { + margin-right: 16px; + } + + .el-menu { + border: none; + height: 100%; + width: 100% !important; + } + + .el-menu-item, + .menu-title { + overflow: hidden !important; + text-overflow: ellipsis !important; + white-space: nowrap !important; + } + + .el-menu-item .el-menu-tooltip__trigger { + display: inline-block !important; + } + + // menu hover + .theme-dark .sub-menu-title-noDropdown, + .theme-dark .el-sub-menu__title { + &:hover { + background-color: $base-sub-menu-title-hover !important; + } + } + .sub-menu-title-noDropdown, + .el-sub-menu__title { + &:hover { + background-color: rgba(0, 0, 0, 0.05) !important; + } + } + + & .theme-dark .is-active > .el-sub-menu__title { + color: $base-menu-color-active !important; + } + + & .nest-menu .el-sub-menu > .el-sub-menu__title, + & .el-sub-menu .el-menu-item { + min-width: $base-sidebar-width !important; + &:hover { + background-color: rgba(0, 0, 0, 0.1) !important; + } + } + + & .theme-dark .nest-menu .el-sub-menu > .el-sub-menu__title, + & .theme-dark .el-sub-menu .el-menu-item { + background-color: $base-sub-menu-background !important; + + &:hover { + background-color: $base-sub-menu-hover !important; + } + } + + & .theme-dark .nest-menu .el-sub-menu > .el-sub-menu__title, + & .theme-dark .el-menu-item { + &:hover { + // you can use $sub-menuHover + background-color: $base-menu-hover !important; + } + } + & .nest-menu .el-sub-menu > .el-sub-menu__title, + & .el-menu-item { + &:hover { + // you can use $sub-menuHover + background-color: rgba(0, 0, 0, 0.04) !important; + } + } + } + + .hideSidebar { + .sidebar-container { + width: 54px !important; + } + + .main-container { + margin-left: 54px; + } + + .sub-menu-title-noDropdown { + padding: 0 !important; + position: relative; + + .el-tooltip { + padding: 0 !important; + + .svg-icon { + margin-left: 20px; + } + } + } + + .el-sub-menu { + overflow: hidden; + + & > .el-sub-menu__title { + padding: 0 !important; + + .svg-icon { + margin-left: 20px; + } + } + } + + .el-menu--collapse { + .el-sub-menu { + & > .el-sub-menu__title { + & > span { + height: 0; + width: 0; + overflow: hidden; + visibility: hidden; + display: inline-block; + } + & > i { + height: 0; + width: 0; + overflow: hidden; + visibility: hidden; + display: inline-block; + } + } + } + } + } + + .el-menu--collapse .el-menu .el-sub-menu { + min-width: $base-sidebar-width !important; + } + + // mobile responsive + .mobile { + .main-container { + margin-left: 0px; + } + + .sidebar-container { + transition: transform 0.28s; + width: $base-sidebar-width !important; + } + + &.hideSidebar { + .sidebar-container { + pointer-events: none; + transition-duration: 0.3s; + transform: translate3d(-$base-sidebar-width, 0, 0); + } + } + } + + .withoutAnimation { + .main-container, + .sidebar-container { + transition: none; + } + } +} + +// when menu collapsed +.el-menu--vertical { + & > .el-menu { + .svg-icon { + margin-right: 16px; + } + } +} diff --git a/src/assets/styles/transition.scss b/src/assets/styles/transition.scss new file mode 100644 index 0000000..468ad3c --- /dev/null +++ b/src/assets/styles/transition.scss @@ -0,0 +1,49 @@ +// global transition css + +/* fade */ +.fade-enter-active, +.fade-leave-active { + transition: opacity 0.28s; +} + +.fade-enter, +.fade-leave-active { + opacity: 0; +} + +/* fade-transform */ +.fade-transform--move, +.fade-transform-leave-active, +.fade-transform-enter-active { + transition: all 0.5s; +} + +.fade-transform-enter { + opacity: 0; + transform: translateX(-30px); +} + +.fade-transform-leave-to { + opacity: 0; + transform: translateX(30px); +} + +/* breadcrumb transition */ +.breadcrumb-enter-active, +.breadcrumb-leave-active { + transition: all 0.5s; +} + +.breadcrumb-enter, +.breadcrumb-leave-active { + opacity: 0; + transform: translateX(20px); +} + +.breadcrumb-move { + transition: all 0.5s; +} + +.breadcrumb-leave-active { + position: absolute; +} diff --git a/src/assets/styles/variables.module.scss b/src/assets/styles/variables.module.scss new file mode 100644 index 0000000..3aa871b --- /dev/null +++ b/src/assets/styles/variables.module.scss @@ -0,0 +1,135 @@ +// 全局SCSS变量 +:root { + --menuBg: #304156; + --menuColor: #bfcbd9; + --menuActiveText: #f4f4f5; + --menuHover: #263445; + + --subMenuBg: #1f2d3d; + --subMenuActiveText: #f4f4f5; + --subMenuHover: #001528; + --subMenuTitleHover: #293444; + + --fixedHeaderBg: #ffffff; + --tableHeaderBg: #f8f8f9; + --tableHeaderTextColor: #515a6e; + + // ele + --brder-color: #e8e8e8; + + // 添加 tag 相关变量 + --tags-view-active-bg: var(--el-color-primary); + --tags-view-active-border-color: var(--el-color-primary); +} + +html.dark { + --menuBg: #1d1e1f; + --menuColor: #bfcbd9; + --menuActiveText: #f4f4f5; + --menuHover: #171819; + + --subMenuBg: #1d1e1f; + --subMenuActiveText: #1d1e1f; + --subMenuHover: #171819; + --subMenuTitleHover: #171819; + + --fixedHeaderBg: #171819; + --tableHeaderBg: var(--el-bg-color); + --tableHeaderTextColor: var(--el-text-color); + + // 覆盖ele 高亮当前行的标准暗色 + .el-tree-node__content { + --el-color-primary-light-9: #262727; + } + + .el-button--primary { + --el-button-bg-color: var(--el-color-primary-dark-6); + --el-button-border-color: var(--el-color-primary-light-2); + } + + .el-switch { + --el-switch-on-color: var(--el-color-primary-dark-6); + --el-switch-border-color: var(--el-color-primary-light-2); + } + + .el-tag--primary { + --el-tag-bg-color: var(--el-color-primary-dark-6); + --el-tag-border-color: var(--el-color-primary-light-2); + } + + // 在深色模式下使用更深的颜色 + --tags-view-active-bg: var(--el-color-primary-dark-6); + --tags-view-active-border-color: var(--el-color-primary-light-2); + // vxe-table 主题 + --vxe-font-color: #98989e; + --vxe-primary-color: #2c7ecf; + --vxe-icon-background-color: #98989e; + --vxe-table-font-color: #98989e; + --vxe-table-resizable-color: #95969a; + --vxe-table-header-background-color: #28282a; + --vxe-table-body-background-color: #151518; + --vxe-table-background-color: #4a5663; + --vxe-table-border-width: 1px; + --vxe-table-border-color: #37373a; + --vxe-toolbar-background-color: #37373a; + + // ele + --brder-color: #37373a; +} + +// base color +$blue: #324157; +$light-blue: #3a71a8; +$red: #c03639; +$pink: #e65d6e; +$green: #30b08f; +$tiffany: #4ab7bd; +$yellow: #fec171; +$panGreen: #30b08f; + +// 默认菜单主题风格 +$base-menu-color: var(--menuColor); +$base-menu-hover: var(--menuHover); +$base-menu-color-active: var(--menuActiveText); +$base-menu-background: var(--menuBg); +$base-logo-title-color: #ffffff; + +$base-menu-light-color: rgba(0, 0, 0, 0.7); +$base-menu-light-background: #ffffff; +$base-logo-light-title-color: #001529; + +$base-sub-menu-background: var(--subMenuBg); +$base-sub-menu-hover: var(--subMenuHover); +$base-sub-menu-title-hover: var(--subMenuTitleHover); +// 表单头背景色和标题颜色 +$fixed-header-bg: var(--fixedHeaderBg); +$table-header-bg: var(--tableHeaderBg); +$table-header-text-color: var(--tableHeaderTextColor); + +$--color-primary: #409eff; +$--color-success: #67c23a; +$--color-warning: #e6a23c; +$--color-danger: #f56c6c; +$--color-info: #909399; + +$base-sidebar-width: 200px; + +// the :export directive is the magic sauce for webpack +// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass +:export { + menuColor: $base-menu-color; + menuLightColor: $base-menu-light-color; + menuColorActive: $base-menu-color-active; + menuBackground: $base-menu-background; + menuLightBackground: $base-menu-light-background; + subMenuBackground: $base-sub-menu-background; + subMenuHover: $base-sub-menu-hover; + sideBarWidth: $base-sidebar-width; + logoTitleColor: $base-logo-title-color; + logoLightTitleColor: $base-logo-light-title-color; + primaryColor: $--color-primary; + successColor: $--color-success; + dangerColor: $--color-danger; + infoColor: $--color-info; + warningColor: $--color-warning; +} \ No newline at end of file diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue new file mode 100644 index 0000000..a8b2f68 --- /dev/null +++ b/src/components/Breadcrumb/index.vue @@ -0,0 +1,95 @@ + + + + + diff --git a/src/components/BuildCode/index.vue b/src/components/BuildCode/index.vue new file mode 100644 index 0000000..0b8e3f4 --- /dev/null +++ b/src/components/BuildCode/index.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/src/components/BuildCode/render.vue b/src/components/BuildCode/render.vue new file mode 100644 index 0000000..aeb9312 --- /dev/null +++ b/src/components/BuildCode/render.vue @@ -0,0 +1,57 @@ + + + + diff --git a/src/components/DictTag/index.vue b/src/components/DictTag/index.vue new file mode 100644 index 0000000..ad326c2 --- /dev/null +++ b/src/components/DictTag/index.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue new file mode 100644 index 0000000..ba70fbb --- /dev/null +++ b/src/components/Editor/index.vue @@ -0,0 +1,244 @@ + + + + + diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue new file mode 100644 index 0000000..b22d09a --- /dev/null +++ b/src/components/FileUpload/index.vue @@ -0,0 +1,234 @@ + + + + + diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue new file mode 100644 index 0000000..f9f5e62 --- /dev/null +++ b/src/components/Hamburger/index.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue new file mode 100644 index 0000000..3bfde4d --- /dev/null +++ b/src/components/IconSelect/index.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/src/components/IconSelect/requireIcons.ts b/src/components/IconSelect/requireIcons.ts new file mode 100644 index 0000000..9f06d69 --- /dev/null +++ b/src/components/IconSelect/requireIcons.ts @@ -0,0 +1,7 @@ +const icons: string[] = []; +const modules = import.meta.glob('./../../assets/icons/svg/*.svg'); +for (const path in modules) { + const p = path.split('assets/icons/svg/')[1].split('.svg')[0]; + icons.push(p); +} +export default icons; diff --git a/src/components/ImagePreview/index.vue b/src/components/ImagePreview/index.vue new file mode 100644 index 0000000..98e6479 --- /dev/null +++ b/src/components/ImagePreview/index.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue new file mode 100644 index 0000000..0778121 --- /dev/null +++ b/src/components/ImageUpload/index.vue @@ -0,0 +1,238 @@ + + + + + diff --git a/src/components/LangSelect/index.vue b/src/components/LangSelect/index.vue new file mode 100644 index 0000000..b5fafd3 --- /dev/null +++ b/src/components/LangSelect/index.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue new file mode 100644 index 0000000..ac02193 --- /dev/null +++ b/src/components/Pagination/index.vue @@ -0,0 +1,88 @@ + + + + + + + diff --git a/src/components/ParentView/index.vue b/src/components/ParentView/index.vue new file mode 100644 index 0000000..98240ae --- /dev/null +++ b/src/components/ParentView/index.vue @@ -0,0 +1,3 @@ + diff --git a/src/components/Process/approvalRecord.vue b/src/components/Process/approvalRecord.vue new file mode 100644 index 0000000..a4bd607 --- /dev/null +++ b/src/components/Process/approvalRecord.vue @@ -0,0 +1,280 @@ + + + diff --git a/src/components/Process/processMeddle.vue b/src/components/Process/processMeddle.vue new file mode 100644 index 0000000..7224755 --- /dev/null +++ b/src/components/Process/processMeddle.vue @@ -0,0 +1,207 @@ + + diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue new file mode 100644 index 0000000..1c985de --- /dev/null +++ b/src/components/Process/submitVerify.vue @@ -0,0 +1,421 @@ + + + diff --git a/src/components/RightToolbar/index.vue b/src/components/RightToolbar/index.vue new file mode 100644 index 0000000..e8c9d65 --- /dev/null +++ b/src/components/RightToolbar/index.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/components/RoleSelect/index.vue b/src/components/RoleSelect/index.vue new file mode 100644 index 0000000..56a784b --- /dev/null +++ b/src/components/RoleSelect/index.vue @@ -0,0 +1,250 @@ + + + diff --git a/src/components/RuoYiDoc/index.vue b/src/components/RuoYiDoc/index.vue new file mode 100644 index 0000000..1e27d89 --- /dev/null +++ b/src/components/RuoYiDoc/index.vue @@ -0,0 +1,13 @@ + + + diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue new file mode 100644 index 0000000..ce0b373 --- /dev/null +++ b/src/components/Screenfull/index.vue @@ -0,0 +1,9 @@ + + + diff --git a/src/components/SizeSelect/index.vue b/src/components/SizeSelect/index.vue new file mode 100644 index 0000000..abf72cc --- /dev/null +++ b/src/components/SizeSelect/index.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/src/components/SvgIcon/index.vue b/src/components/SvgIcon/index.vue new file mode 100644 index 0000000..05dfe87 --- /dev/null +++ b/src/components/SvgIcon/index.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/src/components/TopNav/index.vue b/src/components/TopNav/index.vue new file mode 100644 index 0000000..cfe2cd7 --- /dev/null +++ b/src/components/TopNav/index.vue @@ -0,0 +1,200 @@ + + + + + diff --git a/src/components/TreeSelect/index.vue b/src/components/TreeSelect/index.vue new file mode 100644 index 0000000..7accd6b --- /dev/null +++ b/src/components/TreeSelect/index.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/src/components/UserSelect/index.vue b/src/components/UserSelect/index.vue new file mode 100644 index 0000000..937a395 --- /dev/null +++ b/src/components/UserSelect/index.vue @@ -0,0 +1,306 @@ + + + + + diff --git a/src/components/iFrame/index.vue b/src/components/iFrame/index.vue new file mode 100644 index 0000000..98f2224 --- /dev/null +++ b/src/components/iFrame/index.vue @@ -0,0 +1,26 @@ + + + diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue new file mode 100644 index 0000000..3082beb --- /dev/null +++ b/src/layout/components/Settings/index.vue @@ -0,0 +1,238 @@ + + + + + diff --git a/src/layout/components/Sidebar/Link.vue b/src/layout/components/Sidebar/Link.vue new file mode 100644 index 0000000..fd75f35 --- /dev/null +++ b/src/layout/components/Sidebar/Link.vue @@ -0,0 +1,40 @@ + + + diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue new file mode 100644 index 0000000..a4f20d0 --- /dev/null +++ b/src/layout/components/Sidebar/index.vue @@ -0,0 +1,55 @@ + + + diff --git a/src/layout/components/SocialCallback/index.vue b/src/layout/components/SocialCallback/index.vue new file mode 100644 index 0000000..746de20 --- /dev/null +++ b/src/layout/components/SocialCallback/index.vue @@ -0,0 +1,95 @@ + + + diff --git a/src/layout/components/TagsView/ScrollPane.vue b/src/layout/components/TagsView/ScrollPane.vue new file mode 100644 index 0000000..3b30043 --- /dev/null +++ b/src/layout/components/TagsView/ScrollPane.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/layout/components/index.ts b/src/layout/components/index.ts new file mode 100644 index 0000000..47c83e1 --- /dev/null +++ b/src/layout/components/index.ts @@ -0,0 +1,4 @@ +export { default as AppMain } from './AppMain.vue'; +export { default as Navbar } from './Navbar.vue'; +export { default as Settings } from './Settings/index.vue'; +export { default as TagsView } from './TagsView/index.vue'; diff --git a/src/layout/index.vue b/src/layout/index.vue new file mode 100644 index 0000000..207a470 --- /dev/null +++ b/src/layout/index.vue @@ -0,0 +1,135 @@ + + + + + diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..592de58 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,57 @@ +import { createApp } from 'vue'; +// global css +import 'virtual:uno.css'; +import '@/assets/styles/index.scss'; +import 'element-plus/theme-chalk/dark/css-vars.css'; + +// App、router、store +import App from './App.vue'; +import store from './store'; +import router from './router'; + +// 自定义指令 +import directive from './directive'; + +// 注册插件 +import plugins from './plugins/index'; // plugins + +// 高亮组件 +// import 'highlight.js/styles/a11y-light.css'; +import 'highlight.js/styles/atom-one-dark.css'; +import 'highlight.js/lib/common'; +import HighLight from '@highlightjs/vue-plugin'; + +// svg图标 +import 'virtual:svg-icons-register'; +import ElementIcons from '@/plugins/svgicon'; + +// permission control +import './permission'; + +// 国际化 +import i18n from '@/lang/index'; + +// vxeTable +import VXETable from 'vxe-table'; +import 'vxe-table/lib/style.css'; +VXETable.config({ + zIndex: 999999 +}); + +// 修改 el-dialog 默认点击遮照为不关闭 +import { ElDialog } from 'element-plus'; +ElDialog.props.closeOnClickModal.default = false; + +const app = createApp(App); + +app.use(HighLight); +app.use(ElementIcons); +app.use(router); +app.use(store); +app.use(i18n); +app.use(VXETable); +app.use(plugins); +// 自定义指令 +directive(app); + +app.mount('#app'); diff --git a/src/permission.ts b/src/permission.ts new file mode 100644 index 0000000..b05f8c3 --- /dev/null +++ b/src/permission.ts @@ -0,0 +1,69 @@ +import { to as tos } from 'await-to-js'; +import router from './router'; +import NProgress from 'nprogress'; +import 'nprogress/nprogress.css'; +import { getToken } from '@/utils/auth'; +import { isHttp, isPathMatch } from '@/utils/validate'; +import { isRelogin } from '@/utils/request'; +import useUserStore from '@/store/modules/user'; +import useSettingsStore from '@/store/modules/settings'; +import usePermissionStore from '@/store/modules/permission'; + +NProgress.configure({ showSpinner: false }); +const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*']; + +const isWhiteList = (path: string) => { + return whiteList.some(pattern => isPathMatch(pattern, path)) +} + +router.beforeEach(async (to, from, next) => { + NProgress.start(); + if (getToken()) { + to.meta.title && useSettingsStore().setTitle(to.meta.title); + /* has token*/ + if (to.path === '/login') { + next({ path: '/' }); + NProgress.done(); + } else if (isWhiteList(to.path)) { + next(); + } else { + if (useUserStore().roles.length === 0) { + isRelogin.show = true; + // 判断当前用户是否已拉取完user_info信息 + const [err] = await tos(useUserStore().getInfo()); + if (err) { + await useUserStore().logout(); + ElMessage.error(err); + next({ path: '/' }); + } else { + isRelogin.show = false; + const accessRoutes = await usePermissionStore().generateRoutes(); + // 根据roles权限生成可访问的路由表 + accessRoutes.forEach((route) => { + if (!isHttp(route.path)) { + router.addRoute(route); // 动态添加可访问路由表 + } + }); + // @ts-expect-error hack方法 确保addRoutes已完成 + next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成 + } + } else { + next(); + } + } + } else { + // 没有token + if (isWhiteList(to.path)) { + // 在免登录白名单,直接进入 + next(); + } else { + const redirect = encodeURIComponent(to.fullPath || '/'); + next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页 + NProgress.done(); + } + } +}); + +router.afterEach(() => { + NProgress.done(); +}); diff --git a/src/plugins/auth.ts b/src/plugins/auth.ts new file mode 100644 index 0000000..74c91ee --- /dev/null +++ b/src/plugins/auth.ts @@ -0,0 +1,60 @@ +import useUserStore from '@/store/modules/user'; + +const authPermission = (permission: string): boolean => { + const all_permission = '*:*:*'; + const permissions: string[] = useUserStore().permissions; + if (permission && permission.length > 0) { + return permissions.some((v) => { + return all_permission === v || v === permission; + }); + } else { + return false; + } +}; + +const authRole = (role: string): boolean => { + const super_admin = 'admin'; + const roles = useUserStore().roles; + if (role && role.length > 0) { + return roles.some((v) => { + return super_admin === v || v === role; + }); + } else { + return false; + } +}; + +export default { + // 验证用户是否具备某权限 + hasPermi(permission: string): boolean { + return authPermission(permission); + }, + // 验证用户是否含有指定权限,只需包含其中一个 + hasPermiOr(permissions: string[]): boolean { + return permissions.some((item) => { + return authPermission(item); + }); + }, + // 验证用户是否含有指定权限,必须全部拥有 + hasPermiAnd(permissions: string[]): boolean { + return permissions.every((item) => { + return authPermission(item); + }); + }, + // 验证用户是否具备某角色 + hasRole(role: string): boolean { + return authRole(role); + }, + // 验证用户是否含有指定角色,只需包含其中一个 + hasRoleOr(roles: string[]): boolean { + return roles.some((item) => { + return authRole(item); + }); + }, + // 验证用户是否含有指定角色,必须全部拥有 + hasRoleAnd(roles: string[]): boolean { + return roles.every((item) => { + return authRole(item); + }); + } +}; diff --git a/src/plugins/cache.ts b/src/plugins/cache.ts new file mode 100644 index 0000000..e5ceead --- /dev/null +++ b/src/plugins/cache.ts @@ -0,0 +1,79 @@ +const sessionCache = { + set(key: string, value: any) { + if (!sessionStorage) { + return; + } + if (key != null && value != null) { + sessionStorage.setItem(key, value); + } + }, + get(key: string) { + if (!sessionStorage) { + return null; + } + if (key == null) { + return null; + } + return sessionStorage.getItem(key); + }, + setJSON(key: string, jsonValue: any) { + if (jsonValue != null) { + this.set(key, JSON.stringify(jsonValue)); + } + }, + getJSON(key: string) { + const value = this.get(key); + if (value != null) { + return JSON.parse(value); + } + return null; + }, + remove(key: string) { + sessionStorage.removeItem(key); + } +}; +const localCache = { + set(key: string, value: any) { + if (!localStorage) { + return; + } + if (key != null && value != null) { + localStorage.setItem(key, value); + } + }, + get(key: string) { + if (!localStorage) { + return null; + } + if (key == null) { + return null; + } + return localStorage.getItem(key); + }, + setJSON(key: string, jsonValue: any) { + if (jsonValue != null) { + this.set(key, JSON.stringify(jsonValue)); + } + }, + getJSON(key: string) { + const value = this.get(key); + if (value != null) { + return JSON.parse(value); + } + return null; + }, + remove(key: string) { + localStorage.removeItem(key); + } +}; + +export default { + /** + * 会话级缓存 + */ + session: sessionCache, + /** + * 本地缓存 + */ + local: localCache +}; diff --git a/src/plugins/modal.ts b/src/plugins/modal.ts new file mode 100644 index 0000000..a8b0548 --- /dev/null +++ b/src/plugins/modal.ts @@ -0,0 +1,81 @@ +import { MessageBoxData } from 'element-plus'; +import { LoadingInstance } from 'element-plus/es/components/loading/src/loading'; +let loadingInstance: LoadingInstance; +export default { + // 消息提示 + msg(content: any) { + ElMessage.info(content); + }, + // 错误消息 + msgError(content: any) { + ElMessage.error(content); + }, + // 成功消息 + msgSuccess(content: any) { + ElMessage.success(content); + }, + // 警告消息 + msgWarning(content: any) { + ElMessage.warning(content); + }, + // 弹出提示 + alert(content: any) { + ElMessageBox.alert(content, '系统提示'); + }, + // 错误提示 + alertError(content: any) { + ElMessageBox.alert(content, '系统提示', { type: 'error' }); + }, + // 成功提示 + alertSuccess(content: any) { + ElMessageBox.alert(content, '系统提示', { type: 'success' }); + }, + // 警告提示 + alertWarning(content: any) { + ElMessageBox.alert(content, '系统提示', { type: 'warning' }); + }, + // 通知提示 + notify(content: any) { + ElNotification.info(content); + }, + // 错误通知 + notifyError(content: any) { + ElNotification.error(content); + }, + // 成功通知 + notifySuccess(content: any) { + ElNotification.success(content); + }, + // 警告通知 + notifyWarning(content: any) { + ElNotification.warning(content); + }, + // 确认窗体 + confirm(content: any): Promise { + return ElMessageBox.confirm(content, '系统提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }); + }, + // 提交内容 + prompt(content: any) { + return ElMessageBox.prompt(content, '系统提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }); + }, + // 打开遮罩层 + loading(content: string) { + loadingInstance = ElLoading.service({ + lock: true, + text: content, + background: 'rgba(0, 0, 0, 0.7)' + }); + }, + // 关闭遮罩层 + closeLoading() { + loadingInstance.close(); + } +}; diff --git a/src/plugins/svgicon.ts b/src/plugins/svgicon.ts new file mode 100644 index 0000000..8c68609 --- /dev/null +++ b/src/plugins/svgicon.ts @@ -0,0 +1,10 @@ +import * as ElementPlusIconsVue from '@element-plus/icons-vue'; +import { App } from 'vue'; + +export default { + install: (app: App) => { + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component); + } + } +}; diff --git a/src/plugins/tab.ts b/src/plugins/tab.ts new file mode 100644 index 0000000..4b44dc6 --- /dev/null +++ b/src/plugins/tab.ts @@ -0,0 +1,96 @@ +import router from '@/router'; +import { RouteLocationMatched, RouteLocationNormalized, RouteLocationRaw } from 'vue-router'; +import useTagsViewStore from '@/store/modules/tagsView'; + +export default { + /** + * 刷新当前tab页签 + * @param obj 标签对象 + */ + async refreshPage(obj?: RouteLocationNormalized): Promise { + const { path, query, matched } = router.currentRoute.value; + if (obj === undefined) { + matched.forEach((m: RouteLocationMatched) => { + if (m.components && m.components.default && m.components.default.name) { + if (!['Layout', 'ParentView'].includes(m.components.default.name)) { + obj = { + name: m.components.default.name, + path: path, + query: query, + matched: undefined, + fullPath: undefined, + hash: undefined, + params: undefined, + redirectedFrom: undefined, + meta: undefined + }; + } + } + }); + } + let query1: undefined | {} = {}; + let path1: undefined | string = ''; + if (obj) { + query1 = obj.query; + path1 = obj.path; + } + await useTagsViewStore().delCachedView(obj); + await router.replace({ + path: '/redirect' + path1, + query: query1 + }); + }, + // 关闭当前tab页签,打开新页签 + closeOpenPage(obj: RouteLocationRaw): void { + useTagsViewStore().delView(router.currentRoute.value); + if (obj !== undefined) { + router.push(obj); + } + }, + // 关闭指定tab页签 + async closePage(obj?: RouteLocationNormalized): Promise<{ visitedViews: RouteLocationNormalized[]; cachedViews: string[] } | any> { + if (obj === undefined) { + // prettier-ignore + const { visitedViews } = await useTagsViewStore().delView(router.currentRoute.value) + const latestView = visitedViews.slice(-1)[0]; + if (latestView) { + return router.push(latestView.fullPath); + } + return router.push('/'); + } + return useTagsViewStore().delView(obj); + }, + // 关闭所有tab页签 + closeAllPage() { + return useTagsViewStore().delAllViews(); + }, + // 关闭左侧tab页签 + closeLeftPage(obj?: RouteLocationNormalized) { + return useTagsViewStore().delLeftTags(obj || router.currentRoute.value); + }, + // 关闭右侧tab页签 + closeRightPage(obj?: RouteLocationNormalized) { + return useTagsViewStore().delRightTags(obj || router.currentRoute.value); + }, + // 关闭其他tab页签 + closeOtherPage(obj?: RouteLocationNormalized) { + return useTagsViewStore().delOthersViews(obj || router.currentRoute.value); + }, + /** + * 打开tab页签 + * @param url 路由地址 + * @param title 标题 + * @param query 参数 + */ + openPage(url: string, title?: string, query?: any) { + const obj = { path: url, query: { ...query, title } }; + return router.push(obj); + }, + /** + * 修改tab页签 + * @param obj 标签对象 + */ + updatePage(obj: RouteLocationNormalized) { + return useTagsViewStore().updateVisitedView(obj); + } +}; diff --git a/src/router/index.ts b/src/router/index.ts new file mode 100644 index 0000000..2ab09dd --- /dev/null +++ b/src/router/index.ts @@ -0,0 +1,211 @@ +import { createWebHistory, createRouter, RouteRecordRaw } from 'vue-router'; +/* Layout */ +import Layout from '@/layout/index.vue'; + +/** + * Note: 路由配置项 + * + * hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1 + * alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 + * // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面 + * // 若你想不管路由下面的 children 声明的个数都显示你的根路由 + * // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由 + * redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 + * name:'router-name' // 设定路由的名字,一定要填写不然使用时会出现各种问题 + * query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数 + * roles: ['admin', 'common'] // 访问路由的角色权限 + * permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限 + * meta : { + noCache: true // 如果设置为true,则不会被 缓存(默认 false) + title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字 + icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg + breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示 + activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。 + } + */ + +// 公共路由 +export const constantRoutes: RouteRecordRaw[] = [ + { + path: '/redirect', + component: Layout, + hidden: true, + children: [ + { + path: '/redirect/:path(.*)', + component: () => import('@/views/redirect/index.vue') + } + ] + }, + { + path: '/social-callback', + hidden: true, + component: () => import('@/layout/components/SocialCallback/index.vue') + }, + { + path: '/login', + component: () => import('@/views/login.vue'), + hidden: true + }, + { + path: '/register', + component: () => import('@/views/register.vue'), + hidden: true + }, + { + path: '/:pathMatch(.*)*', + component: () => import('@/views/error/404.vue'), + hidden: true + }, + { + path: '/401', + component: () => import('@/views/error/401.vue'), + hidden: true + }, + { + path: '', + component: Layout, + redirect: '/index', + children: [ + { + path: '/index', + component: () => import('@/views/index.vue'), + name: 'Index', + meta: { title: '首页', icon: 'dashboard', affix: true } + } + ] + }, + { + path: '/user', + component: Layout, + hidden: true, + redirect: 'noredirect', + children: [ + { + path: 'profile', + component: () => import('@/views/system/user/profile/index.vue'), + name: 'Profile', + meta: { title: '个人中心', icon: 'user' } + } + ] + } +]; + +// 动态路由,基于用户权限动态去加载 +export const dynamicRoutes: RouteRecordRaw[] = [ + { + path: '/system/user-auth', + component: Layout, + hidden: true, + permissions: ['system:user:edit'], + children: [ + { + path: 'role/:userId(\\d+)', + component: () => import('@/views/system/user/authRole.vue'), + name: 'AuthRole', + meta: { title: '分配角色', activeMenu: '/system/user', icon: '', noCache: true } + } + ] + }, + { + path: '/system/role-auth', + component: Layout, + hidden: true, + permissions: ['system:role:edit'], + children: [ + { + path: 'user/:roleId(\\d+)', + component: () => import('@/views/system/role/authUser.vue'), + name: 'AuthUser', + meta: { title: '分配用户', activeMenu: '/system/role', icon: '', noCache: true } + } + ] + }, + { + path: '/system/dict-data', + component: Layout, + hidden: true, + permissions: ['system:dict:list'], + children: [ + { + path: 'index/:dictId(\\d+)', + component: () => import('@/views/system/dict/data.vue'), + name: 'Data', + meta: { title: '字典数据', activeMenu: '/system/dict', icon: '', noCache: true } + } + ] + }, + { + path: '/system/oss-config', + component: Layout, + hidden: true, + permissions: ['system:ossConfig:list'], + children: [ + { + path: 'index', + component: () => import('@/views/system/oss/config.vue'), + name: 'OssConfig', + meta: { title: '配置管理', activeMenu: '/system/oss', icon: '', noCache: true } + } + ] + }, + { + path: '/tool/gen-edit', + component: Layout, + hidden: true, + permissions: ['tool:gen:edit'], + children: [ + { + path: 'index/:tableId(\\d+)', + component: () => import('@/views/tool/gen/editTable.vue'), + name: 'GenEdit', + meta: { title: '修改生成配置', activeMenu: '/tool/gen', icon: '', noCache: true } + } + ] + }, + { + path: '/workflow/leaveEdit', + component: Layout, + hidden: true, + permissions: ['workflow:leave:edit'], + children: [ + { + path: 'index', + component: () => import('@/views/workflow/leave/leaveEdit.vue'), + name: 'leaveEdit', + meta: { title: '请假申请', activeMenu: '/workflow/leave', noCache: true } + } + ] + }, + { + path: '/workflow/design', + component: Layout, + hidden: true, + permissions: ['workflow:leave:edit'], + children: [ + { + path: 'index', + component: () => import('@/views/workflow/processDefinition/design.vue'), + name: 'design', + meta: { title: '流程设计', activeMenu: '/workflow/processDefinition', noCache: true } + } + ] + } +]; + +/** + * 创建路由 + */ +const router = createRouter({ + history: createWebHistory(import.meta.env.VITE_APP_CONTEXT_PATH), + routes: constantRoutes, + // 刷新时,滚动条位置还原 + scrollBehavior(to, from, savedPosition) { + if (savedPosition) { + return savedPosition; + } + return { top: 0 }; + } +}); + +export default router; diff --git a/src/store/index.ts b/src/store/index.ts new file mode 100644 index 0000000..069d54e --- /dev/null +++ b/src/store/index.ts @@ -0,0 +1,3 @@ +const store = createPinia(); + +export default store; diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts new file mode 100644 index 0000000..0205fab --- /dev/null +++ b/src/store/modules/app.ts @@ -0,0 +1,72 @@ +import zhCN from 'element-plus/es/locale/lang/zh-cn'; +import enUS from 'element-plus/es/locale/lang/en'; + +export const useAppStore = defineStore('app', () => { + const sidebarStatus = useStorage('sidebarStatus', '1'); + const sidebar = reactive({ + opened: sidebarStatus.value ? !!+sidebarStatus.value : true, + withoutAnimation: false, + hide: false + }); + const device = ref('desktop'); + const size = useStorage<'large' | 'default' | 'small'>('size', 'default'); + + // 语言 + const language = useStorage('language', 'zh_CN'); + const languageObj: any = { + en_US: enUS, + zh_CN: zhCN + }; + const locale = computed(() => { + return languageObj[language.value]; + }); + + const toggleSideBar = (withoutAnimation: boolean) => { + if (sidebar.hide) { + return false; + } + + sidebar.opened = !sidebar.opened; + sidebar.withoutAnimation = withoutAnimation; + if (sidebar.opened) { + sidebarStatus.value = '1'; + } else { + sidebarStatus.value = '0'; + } + }; + + const closeSideBar = ({ withoutAnimation }: any): void => { + sidebarStatus.value = '0'; + sidebar.opened = false; + sidebar.withoutAnimation = withoutAnimation; + }; + const toggleDevice = (d: string): void => { + device.value = d; + }; + const setSize = (s: 'large' | 'default' | 'small'): void => { + size.value = s; + }; + const toggleSideBarHide = (status: boolean): void => { + sidebar.hide = status; + }; + + const changeLanguage = (val: string): void => { + language.value = val; + }; + + return { + device, + sidebar, + language, + locale, + size, + changeLanguage, + toggleSideBar, + closeSideBar, + toggleDevice, + setSize, + toggleSideBarHide + }; +}); + +export default useAppStore; diff --git a/src/store/modules/dict.ts b/src/store/modules/dict.ts new file mode 100644 index 0000000..cd1a41d --- /dev/null +++ b/src/store/modules/dict.ts @@ -0,0 +1,65 @@ +export const useDictStore = defineStore('dict', () => { + const dict = ref>(new Map()); + + /** + * 获取字典 + * @param _key 字典key + */ + const getDict = (_key: string): DictDataOption[] | null => { + if (!_key) { + return null; + } + return dict.value.get(_key) || null; + }; + + /** + * 设置字典 + * @param _key 字典key + * @param _value 字典value + */ + const setDict = (_key: string, _value: DictDataOption[]) => { + if (!_key) { + return false; + } + try { + dict.value.set(_key, _value); + return true; + } catch (e) { + console.error('Error in setDict:', e); + return false; + } + }; + + /** + * 删除字典 + * @param _key + */ + const removeDict = (_key: string): boolean => { + if (!_key) { + return false; + } + try { + return dict.value.delete(_key); + } catch (e) { + console.error('Error in removeDict:', e); + return false; + } + }; + + /** + * 清空字典 + */ + const cleanDict = (): void => { + dict.value.clear(); + }; + + return { + dict, + getDict, + setDict, + removeDict, + cleanDict + }; +}); + +export default useDictStore; diff --git a/src/store/modules/notice.ts b/src/store/modules/notice.ts new file mode 100644 index 0000000..de980b6 --- /dev/null +++ b/src/store/modules/notice.ts @@ -0,0 +1,42 @@ +import { defineStore } from 'pinia'; + +interface NoticeItem { + title?: string; + read: boolean; + message: any; + time: string; +} + +export const useNoticeStore = defineStore('notice', () => { + const state = reactive({ + notices: [] as NoticeItem[] + }); + + const addNotice = (notice: NoticeItem) => { + state.notices.push(notice); + }; + + const removeNotice = (notice: NoticeItem) => { + state.notices.splice(state.notices.indexOf(notice), 1); + }; + + //实现全部已读 + const readAll = () => { + state.notices.forEach((item: any) => { + item.read = true; + }); + }; + + const clearNotice = () => { + state.notices = []; + }; + return { + state, + addNotice, + removeNotice, + readAll, + clearNotice + }; +}); + +export default useNoticeStore; diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts new file mode 100644 index 0000000..43fcef8 --- /dev/null +++ b/src/store/modules/permission.ts @@ -0,0 +1,221 @@ +import { defineStore } from 'pinia'; +import router, { constantRoutes, dynamicRoutes } from '@/router'; +import store from '@/store'; +import { getRouters } from '@/api/menu'; +import auth from '@/plugins/auth'; +import { RouteRecordRaw } from 'vue-router'; + +import Layout from '@/layout/index.vue'; +import ParentView from '@/components/ParentView/index.vue'; +import InnerLink from '@/layout/components/InnerLink/index.vue'; + +import { createCustomNameComponent } from '@/utils/createCustomNameComponent'; + +// 匹配views里面所有的.vue文件 +const modules = import.meta.glob('./../../views/**/*.vue'); +export const usePermissionStore = defineStore('permission', () => { + const routes = ref([]); + const addRoutes = ref([]); + const defaultRoutes = ref([]); + const topbarRouters = ref([]); + const sidebarRouters = ref([]); + + const getRoutes = (): RouteRecordRaw[] => { + return routes.value as RouteRecordRaw[]; + }; + const getSidebarRoutes = (): RouteRecordRaw[] => { + return sidebarRouters.value as RouteRecordRaw[]; + }; + const getTopbarRoutes = (): RouteRecordRaw[] => { + return topbarRouters.value as RouteRecordRaw[]; + }; + + const setRoutes = (newRoutes: RouteRecordRaw[]): void => { + addRoutes.value = newRoutes; + routes.value = constantRoutes.concat(newRoutes); + }; + const setDefaultRoutes = (routes: RouteRecordRaw[]): void => { + defaultRoutes.value = constantRoutes.concat(routes); + }; + const setTopbarRoutes = (routes: RouteRecordRaw[]): void => { + topbarRouters.value = routes; + }; + const setSidebarRouters = (routes: RouteRecordRaw[]): void => { + sidebarRouters.value = routes; + }; + const generateRoutes = async (): Promise => { + const res = await getRouters(); + const { data } = res; + const sdata = JSON.parse(JSON.stringify(data)); + const rdata = JSON.parse(JSON.stringify(data)); + const defaultData = JSON.parse(JSON.stringify(data)); + const sidebarRoutes = filterAsyncRouter(sdata); + const rewriteRoutes = filterAsyncRouter(rdata, undefined, true); + const defaultRoutes = filterAsyncRouter(defaultData); + const asyncRoutes = filterDynamicRoutes(dynamicRoutes); + asyncRoutes.forEach((route) => { + router.addRoute(route); + }); + setRoutes(rewriteRoutes); + setSidebarRouters(constantRoutes.concat(sidebarRoutes)); + setDefaultRoutes(sidebarRoutes); + setTopbarRoutes(defaultRoutes); + // 路由name重复检查 + duplicateRouteChecker(asyncRoutes, sidebarRoutes); + return new Promise((resolve) => resolve(rewriteRoutes)); + }; + + /** + * 遍历后台传来的路由字符串,转换为组件对象 + * @param asyncRouterMap 后台传来的路由字符串 + * @param lastRouter 上一级路由 + * @param type 是否是重写路由 + */ + const filterAsyncRouter = (asyncRouterMap: RouteRecordRaw[], lastRouter?: RouteRecordRaw, type = false): RouteRecordRaw[] => { + return asyncRouterMap.filter((route) => { + if (type && route.children) { + route.children = filterChildren(route.children, undefined); + } + // Layout ParentView 组件特殊处理 + if (route.component?.toString() === 'Layout') { + route.component = Layout; + } else if (route.component?.toString() === 'ParentView') { + route.component = ParentView; + } else if (route.component?.toString() === 'InnerLink') { + route.component = InnerLink; + } else { + route.component = loadView(route.component, route.name as string); + } + if (route.children != null && route.children && route.children.length) { + route.children = filterAsyncRouter(route.children, route, type); + } else { + delete route.children; + delete route.redirect; + } + return true; + }); + }; + const filterChildren = (childrenMap: RouteRecordRaw[], lastRouter?: RouteRecordRaw): RouteRecordRaw[] => { + let children: RouteRecordRaw[] = []; + childrenMap.forEach((el) => { + if (el.children && el.children.length) { + if (el.component?.toString() === 'ParentView' && !lastRouter) { + el.children.forEach((c) => { + c.path = el.path + '/' + c.path; + if (c.children && c.children.length) { + children = children.concat(filterChildren(c.children, c)); + return; + } + children.push(c); + }); + return; + } + } + if (lastRouter) { + el.path = lastRouter.path + '/' + el.path; + if (el.children && el.children.length) { + children = children.concat(filterChildren(el.children, el)); + return; + } + } + children = children.concat(el); + }); + return children; + }; + return { + routes, + topbarRouters, + sidebarRouters, + defaultRoutes, + + getRoutes, + getSidebarRoutes, + getTopbarRoutes, + + setRoutes, + generateRoutes, + setSidebarRouters + }; +}); + +// 动态路由遍历,验证是否具备权限 +export const filterDynamicRoutes = (routes: RouteRecordRaw[]) => { + const res: RouteRecordRaw[] = []; + routes.forEach((route) => { + if (route.permissions) { + if (auth.hasPermiOr(route.permissions)) { + res.push(route); + } + } else if (route.roles) { + if (auth.hasRoleOr(route.roles)) { + res.push(route); + } + } + }); + return res; +}; + +export const loadView = (view: any, name: string) => { + let res; + for (const path in modules) { + const viewsIndex = path.indexOf('/views/'); + let dir = path.substring(viewsIndex + 7); + dir = dir.substring(0, dir.lastIndexOf('.vue')); + if (dir === view) { + res = createCustomNameComponent(modules[path], { name }); + return res; + } + } + return res; +}; + +// 非setup +export const usePermissionStoreHook = () => { + return usePermissionStore(store); +}; + +interface Route { + name?: string | symbol; + path: string; + children?: Route[]; +} + +/** + * 检查路由name是否重复 + * @param localRoutes 本地路由 + * @param routes 动态路由 + */ +function duplicateRouteChecker(localRoutes: Route[], routes: Route[]) { + // 展平 + function flatRoutes(routes: Route[]) { + const res: Route[] = []; + routes.forEach((route) => { + if (route.children) { + res.push(...flatRoutes(route.children)); + } else { + res.push(route); + } + }); + return res; + } + + const allRoutes = flatRoutes([...localRoutes, ...routes]); + + const nameList: string[] = []; + allRoutes.forEach((route) => { + const name = route.name.toString(); + if (name && nameList.includes(name)) { + const message = `路由名称: [${name}] 重复, 会造成 404`; + console.error(message); + ElNotification({ + title: '路由名称重复', + message, + type: 'error' + }); + return; + } + nameList.push(route.name.toString()); + }); +} + +export default usePermissionStore; diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts new file mode 100644 index 0000000..ef49b3c --- /dev/null +++ b/src/store/modules/settings.ts @@ -0,0 +1,47 @@ +import { defineStore } from 'pinia'; +import defaultSettings from '@/settings'; +import { useDynamicTitle } from '@/utils/dynamicTitle'; + +export const useSettingsStore = defineStore('setting', () => { + const storageSetting = useStorage('layout-setting', { + topNav: defaultSettings.topNav, + tagsView: defaultSettings.tagsView, + fixedHeader: defaultSettings.fixedHeader, + sidebarLogo: defaultSettings.sidebarLogo, + dynamicTitle: defaultSettings.dynamicTitle, + sideTheme: defaultSettings.sideTheme, + theme: defaultSettings.theme + }); + const title = ref(defaultSettings.title); + const theme = ref(storageSetting.value.theme); + const sideTheme = ref(storageSetting.value.sideTheme); + const showSettings = ref(defaultSettings.showSettings); + const topNav = ref(storageSetting.value.topNav); + const tagsView = ref(storageSetting.value.tagsView); + const fixedHeader = ref(storageSetting.value.fixedHeader); + const sidebarLogo = ref(storageSetting.value.sidebarLogo); + const dynamicTitle = ref(storageSetting.value.dynamicTitle); + const animationEnable = ref(defaultSettings.animationEnable); + const dark = ref(defaultSettings.dark); + + const setTitle = (value: string) => { + title.value = value; + useDynamicTitle(); + }; + return { + title, + theme, + sideTheme, + showSettings, + topNav, + tagsView, + fixedHeader, + sidebarLogo, + dynamicTitle, + animationEnable, + dark, + setTitle + }; +}); + +export default useSettingsStore; diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts new file mode 100644 index 0000000..b6cf434 --- /dev/null +++ b/src/store/modules/tagsView.ts @@ -0,0 +1,233 @@ +import { RouteLocationNormalized } from 'vue-router'; + +export const useTagsViewStore = defineStore('tagsView', () => { + const visitedViews = ref([]); + const cachedViews = ref([]); + const iframeViews = ref([]); + + const getVisitedViews = (): RouteLocationNormalized[] => { + return visitedViews.value as RouteLocationNormalized[]; + }; + const getIframeViews = (): RouteLocationNormalized[] => { + return iframeViews.value as RouteLocationNormalized[]; + }; + const getCachedViews = (): string[] => { + return cachedViews.value; + }; + + const addView = (view: RouteLocationNormalized) => { + addVisitedView(view); + addCachedView(view); + }; + + const addIframeView = (view: RouteLocationNormalized): void => { + if (iframeViews.value.some((v: RouteLocationNormalized) => v.path === view.path)) return; + iframeViews.value.push( + Object.assign({}, view, { + title: view.meta?.title || 'no-name' + }) + ); + }; + const delIframeView = (view: RouteLocationNormalized): Promise => { + return new Promise((resolve) => { + iframeViews.value = iframeViews.value.filter((item: RouteLocationNormalized) => item.path !== view.path); + resolve([...(iframeViews.value as RouteLocationNormalized[])]); + }); + }; + const addVisitedView = (view: RouteLocationNormalized): void => { + if (visitedViews.value.some((v: RouteLocationNormalized) => v.path === view.path)) return; + visitedViews.value.push( + Object.assign({}, view, { + title: view.meta?.title || 'no-name' + }) + ); + }; + const delView = ( + view: RouteLocationNormalized + ): Promise<{ + visitedViews: RouteLocationNormalized[]; + cachedViews: string[]; + }> => { + return new Promise((resolve) => { + delVisitedView(view); + if (!isDynamicRoute(view)) { + delCachedView(view); + } + resolve({ + visitedViews: [...(visitedViews.value as RouteLocationNormalized[])], + cachedViews: [...cachedViews.value] + }); + }); + }; + + const delVisitedView = (view: RouteLocationNormalized): Promise => { + return new Promise((resolve) => { + for (const [i, v] of visitedViews.value.entries()) { + if (v.path === view.path) { + visitedViews.value.splice(i, 1); + break; + } + } + resolve([...(visitedViews.value as RouteLocationNormalized[])]); + }); + }; + const delCachedView = (view?: RouteLocationNormalized): Promise => { + let viewName = ''; + if (view) { + viewName = view.name as string; + } + return new Promise((resolve) => { + const index = cachedViews.value.indexOf(viewName); + index > -1 && cachedViews.value.splice(index, 1); + resolve([...cachedViews.value]); + }); + }; + const delOthersViews = ( + view: RouteLocationNormalized + ): Promise<{ + visitedViews: RouteLocationNormalized[]; + cachedViews: string[]; + }> => { + return new Promise((resolve) => { + delOthersVisitedViews(view); + delOthersCachedViews(view); + resolve({ + visitedViews: [...(visitedViews.value as RouteLocationNormalized[])], + cachedViews: [...cachedViews.value] + }); + }); + }; + + const delOthersVisitedViews = (view: RouteLocationNormalized): Promise => { + return new Promise((resolve) => { + visitedViews.value = visitedViews.value.filter((v: RouteLocationNormalized) => { + return v.meta?.affix || v.path === view.path; + }); + resolve([...(visitedViews.value as RouteLocationNormalized[])]); + }); + }; + const delOthersCachedViews = (view: RouteLocationNormalized): Promise => { + const viewName = view.name as string; + return new Promise((resolve) => { + const index = cachedViews.value.indexOf(viewName); + if (index > -1) { + cachedViews.value = cachedViews.value.slice(index, index + 1); + } else { + cachedViews.value = []; + } + resolve([...cachedViews.value]); + }); + }; + + const delAllViews = (): Promise<{ visitedViews: RouteLocationNormalized[]; cachedViews: string[] }> => { + return new Promise((resolve) => { + delAllVisitedViews(); + delAllCachedViews(); + resolve({ + visitedViews: [...(visitedViews.value as RouteLocationNormalized[])], + cachedViews: [...cachedViews.value] + }); + }); + }; + const delAllVisitedViews = (): Promise => { + return new Promise((resolve) => { + visitedViews.value = visitedViews.value.filter((tag: RouteLocationNormalized) => tag.meta?.affix); + resolve([...(visitedViews.value as RouteLocationNormalized[])]); + }); + }; + + const delAllCachedViews = (): Promise => { + return new Promise((resolve) => { + cachedViews.value = []; + resolve([...cachedViews.value]); + }); + }; + + const updateVisitedView = (view: RouteLocationNormalized): void => { + for (let v of visitedViews.value) { + if (v.path === view.path) { + v = Object.assign(v, view); + break; + } + } + }; + const delRightTags = (view: RouteLocationNormalized): Promise => { + return new Promise((resolve) => { + const index = visitedViews.value.findIndex((v: RouteLocationNormalized) => v.path === view.path); + if (index === -1) { + return; + } + visitedViews.value = visitedViews.value.filter((item: RouteLocationNormalized, idx: number) => { + if (idx <= index || (item.meta && item.meta.affix)) { + return true; + } + const i = cachedViews.value.indexOf(item.name as string); + if (i > -1) { + cachedViews.value.splice(i, 1); + } + return false; + }); + resolve([...(visitedViews.value as RouteLocationNormalized[])]); + }); + }; + const delLeftTags = (view: RouteLocationNormalized): Promise => { + return new Promise((resolve) => { + const index = visitedViews.value.findIndex((v: RouteLocationNormalized) => v.path === view.path); + if (index === -1) { + return; + } + visitedViews.value = visitedViews.value.filter((item: RouteLocationNormalized, idx: number) => { + if (idx >= index || (item.meta && item.meta.affix)) { + return true; + } + const i = cachedViews.value.indexOf(item.name as string); + if (i > -1) { + cachedViews.value.splice(i, 1); + } + return false; + }); + resolve([...(visitedViews.value as RouteLocationNormalized[])]); + }); + }; + + const addCachedView = (view: RouteLocationNormalized): void => { + const viewName = view.name as string; + if (!viewName) return; + if (cachedViews.value.includes(viewName)) return; + if (!view.meta?.noCache) { + cachedViews.value.push(viewName); + } + }; + + const isDynamicRoute = (view: RouteLocationNormalized): boolean => { + // 检查匹配的路由记录中是否有动态段 + return view.matched.some((m) => m.path.includes(':')); + }; + + return { + visitedViews, + cachedViews, + iframeViews, + + getVisitedViews, + getIframeViews, + getCachedViews, + + addVisitedView, + addCachedView, + delVisitedView, + delCachedView, + updateVisitedView, + addView, + delView, + delAllViews, + delAllVisitedViews, + delAllCachedViews, + delOthersViews, + delRightTags, + delLeftTags, + addIframeView, + delIframeView + }; +}); +export default useTagsViewStore; diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts new file mode 100644 index 0000000..56f369b --- /dev/null +++ b/src/store/modules/user.ts @@ -0,0 +1,91 @@ +import { to } from 'await-to-js'; +import { getToken, removeToken, setToken } from '@/utils/auth'; +import { login as loginApi, logout as logoutApi, getInfo as getUserInfo } from '@/api/login'; +import { LoginData } from '@/api/types'; +import defAva from '@/assets/images/profile.jpg'; +import store from '@/store'; + +export const useUserStore = defineStore('user', () => { + const token = ref(getToken()); + const name = ref(''); + const nickname = ref(''); + const userId = ref(''); + const tenantId = ref(''); + const avatar = ref(''); + const roles = ref>([]); // 用户角色编码集合 → 判断路由权限 + const permissions = ref>([]); // 用户权限编码集合 → 判断按钮权限 + + /** + * 登录 + * @param userInfo + * @returns + */ + const login = async (userInfo: LoginData): Promise => { + const [err, res] = await to(loginApi(userInfo)); + if (res) { + const data = res.data; + setToken(data.access_token); + token.value = data.access_token; + return Promise.resolve(); + } + return Promise.reject(err); + }; + + // 获取用户信息 + const getInfo = async (): Promise => { + const [err, res] = await to(getUserInfo()); + if (res) { + const data = res.data; + const user = data.user; + const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar; + + if (data.roles && data.roles.length > 0) { + // 验证返回的roles是否是一个非空数组 + roles.value = data.roles; + permissions.value = data.permissions; + } else { + roles.value = ['ROLE_DEFAULT']; + } + name.value = user.userName; + nickname.value = user.nickName; + avatar.value = profile; + userId.value = user.userId; + tenantId.value = user.tenantId; + return Promise.resolve(); + } + return Promise.reject(err); + }; + + // 注销 + const logout = async (): Promise => { + await logoutApi(); + token.value = ''; + roles.value = []; + permissions.value = []; + removeToken(); + }; + + const setAvatar = (value: string) => { + avatar.value = value; + }; + + return { + userId, + tenantId, + token, + nickname, + avatar, + roles, + permissions, + login, + getInfo, + logout, + setAvatar + }; +}); + +export default useUserStore; +// 非setup +export function useUserStoreHook() { + return useUserStore(store); +} diff --git a/src/types/axios.d.ts b/src/types/axios.d.ts new file mode 100644 index 0000000..9f2c6d2 --- /dev/null +++ b/src/types/axios.d.ts @@ -0,0 +1,9 @@ +export {}; +declare module 'axios' { + interface AxiosResponse { + code: number; + msg: string; + rows: T; + total: number; + } +} diff --git a/src/types/element.d.ts b/src/types/element.d.ts new file mode 100644 index 0000000..ae6ecfc --- /dev/null +++ b/src/types/element.d.ts @@ -0,0 +1,35 @@ +import type * as ep from 'element-plus'; +declare global { + declare type ElTagType = 'primary' | 'success' | 'info' | 'warning' | 'danger'; + declare type ElFormInstance = ep.FormInstance; + declare type ElTableInstance = ep.TableInstance; + declare type ElUploadInstance = ep.UploadInstance; + declare type ElScrollbarInstance = ep.ScrollbarInstance; + declare type ElInputInstance = ep.InputInstance; + declare type ElInputNumberInstance = ep.InputNumberInstance; + declare type ElRadioInstance = ep.RadioInstance; + declare type ElRadioGroupInstance = ep.RadioGroupInstance; + declare type ElRadioButtonInstance = ep.RadioButtonInstance; + declare type ElCheckboxInstance = ep.CheckboxInstance; + declare type ElSwitchInstance = ep.SwitchInstance; + declare type ElCascaderInstance = ep.CascaderInstance; + declare type ElColorPickerInstance = ep.ColorPickerInstance; + declare type ElRateInstance = ep.RateInstance; + declare type ElSliderInstance = ep.SliderInstance; + + declare type ElTreeInstance = InstanceType; + declare type ElTreeSelectInstance = InstanceType; + declare type ElSelectInstance = InstanceType; + declare type ElCardInstance = InstanceType; + declare type ElDialogInstance = InstanceType; + declare type ElCheckboxGroupInstance = InstanceType; + declare type ElDatePickerInstance = InstanceType; + declare type ElTimePickerInstance = InstanceType; + declare type ElTimeSelectInstance = InstanceType; + + declare type TransferKey = ep.TransferKey; + declare type CheckboxValueType = ep.CheckboxValueType; + declare type ElFormRules = ep.FormRules; + declare type DateModelType = ep.DateModelType; + declare type UploadFile = ep.UploadFile; +} diff --git a/src/types/env.d.ts b/src/types/env.d.ts new file mode 100644 index 0000000..1fb9f62 --- /dev/null +++ b/src/types/env.d.ts @@ -0,0 +1,27 @@ +declare module '*.vue' { + import { DefineComponent } from 'vue'; + const Component: DefineComponent<{}, {}, any>; + export default Component; +} + +// 环境变量 +interface ImportMetaEnv { + VITE_APP_TITLE: string; + VITE_APP_PORT: number; + VITE_APP_BASE_API: string; + VITE_APP_BASE_URL: string; + VITE_APP_CONTEXT_PATH: string; + VITE_APP_MONITOR_ADMIN: string; + VITE_APP_SNAILJOB_ADMIN: string; + VITE_APP_ENV: string; + VITE_APP_ENCRYPT: string; + VITE_APP_RSA_PUBLIC_KEY: string; + VITE_APP_RSA_PRIVATE_KEY: string; + VITE_APP_CLIENT_ID: string; + VITE_APP_WEBSOCKET: string; + VITE_APP_SSE: string; +} +interface ImportMeta { + readonly env: ImportMetaEnv; + // readonly glob: any; +} diff --git a/src/types/global.d.ts b/src/types/global.d.ts new file mode 100644 index 0000000..229e181 --- /dev/null +++ b/src/types/global.d.ts @@ -0,0 +1,164 @@ +import type { PropType as VuePropType, ComponentInternalInstance as ComponentInstance } from 'vue'; +import { LanguageEnum } from '@/enums/LanguageEnum'; + +declare global { + /** vue Instance */ + declare type ComponentInternalInstance = ComponentInstance; + + /** + * 界面字段隐藏属性 + */ + declare interface FieldOption { + key: number; + label: string; + visible: boolean; + children?: Array; + } + + /** + * 弹窗属性 + */ + declare interface DialogOption { + /** + * 弹窗标题 + */ + title?: string; + /** + * 是否显示 + */ + visible: boolean; + } + + declare interface UploadOption { + /** 设置上传的请求头部 */ + headers: { [key: string]: any }; + + /** 上传的地址 */ + url: string; + } + + /** + * 导入属性 + */ + declare interface ImportOption extends UploadOption { + /** 是否显示弹出层 */ + open: boolean; + /** 弹出层标题 */ + title: string; + /** 是否禁用上传 */ + isUploading: boolean; + + updateSupport: number; + + /** 其他参数 */ + [key: string]: any; + } + /** + * 字典数据 数据配置 + */ + declare interface DictDataOption { + label: string; + value: string; + elTagType?: ElTagType; + elTagClass?: string; + } + + declare interface BaseEntity { + createBy?: any; + createDept?: any; + createTime?: string; + updateBy?: any; + updateTime?: any; + } + + /** + * 分页数据 + * T : 表单数据 + * D : 查询参数 + */ + declare interface PageData { + form: T; + queryParams: D; + rules: ElFormRules; + } + /** + * 分页查询参数 + */ + declare interface PageQuery { + pageNum: number; + pageSize: number; + } + declare interface LayoutSetting { + /** + * 是否显示顶部导航 + */ + topNav: boolean; + + /** + * 是否显示多标签导航 + */ + tagsView: boolean; + /** + * 是否固定头部 + */ + fixedHeader: boolean; + /** + * 是否显示侧边栏Logo + */ + sidebarLogo: boolean; + /** + * 是否显示动态标题 + */ + dynamicTitle: boolean; + /** + * 侧边栏主题 theme-dark | theme-light + */ + sideTheme: string; + /** + * 主题模式 + */ + theme: string; + } + + declare interface DefaultSettings extends LayoutSetting { + /** + * 网页标题 + */ + title: string; + + /** + * 是否显示系统布局设置 + */ + showSettings: boolean; + + /** + * 导航栏布局 + */ + layout: string; + + /** + * 布局大小 + */ + size: 'large' | 'default' | 'small'; + + /** + * 语言 + */ + language: LanguageEnum; + + /** + * 是否启用动画效果 + */ + animationEnable: boolean; + /** + * 是否启用暗黑模式 + * + * true:暗黑模式 + * false: 明亮模式 + */ + dark: boolean; + + errorLog: string; + } +} +export {}; diff --git a/src/types/router.d.ts b/src/types/router.d.ts new file mode 100644 index 0000000..11a60a0 --- /dev/null +++ b/src/types/router.d.ts @@ -0,0 +1,38 @@ +import { LocationQuery, type RouteMeta as VRouteMeta } from 'vue-router'; +declare module 'vue-router' { + interface RouteMeta extends VRouteMeta { + link?: string; + title?: string; + affix?: boolean; + noCache?: boolean; + activeMenu?: string; + icon?: string; + breadcrumb?: boolean; + } + + interface _RouteRecordBase { + hidden?: boolean | string | number; + permissions?: string[]; + roles?: string[]; + alwaysShow?: boolean; + query?: string; + parentPath?: string; + } + + interface _RouteLocationBase { + children?: _RouteRecordBase[]; + path?: string; + title?: string; + } + + interface TagView { + fullPath?: string; + name?: string; + path?: string; + title?: string; + meta?: RouteMeta; + query?: LocationQuery; + } +} + +export {}; diff --git a/src/utils/auth.ts b/src/utils/auth.ts new file mode 100644 index 0000000..db50ac9 --- /dev/null +++ b/src/utils/auth.ts @@ -0,0 +1,9 @@ +const TokenKey = 'Admin-Token'; + +const tokenStorage = useStorage(TokenKey, null); + +export const getToken = () => tokenStorage.value; + +export const setToken = (access_token: string) => (tokenStorage.value = access_token); + +export const removeToken = () => (tokenStorage.value = null); diff --git a/src/utils/createCustomNameComponent.tsx b/src/utils/createCustomNameComponent.tsx new file mode 100644 index 0000000..daf5866 --- /dev/null +++ b/src/utils/createCustomNameComponent.tsx @@ -0,0 +1,39 @@ +/** + * 后台返回的路由动态生成name 解决缓存问题 + * 感谢 @fourteendp + * 详见 https://github.com/vbenjs/vue-vben-admin/issues/3927 + */ +import { Component, defineComponent, h } from 'vue'; + +interface Options { + name?: string; +} + +export function createCustomNameComponent(loader: () => Promise, options: Options = {}): () => Promise { + const { name } = options; + let component: Component | null = null; + + const load = async () => { + try { + const { default: loadedComponent } = await loader(); + component = loadedComponent; + } catch (error) { + console.error(`Cannot resolve component ${name}, error:`, error); + } + }; + + return async () => { + if (!component) { + await load(); + } + + return Promise.resolve( + defineComponent({ + name, + render() { + return h(component as Component); + } + }) + ); + }; +} diff --git a/src/utils/crypto.ts b/src/utils/crypto.ts new file mode 100644 index 0000000..8217146 --- /dev/null +++ b/src/utils/crypto.ts @@ -0,0 +1,66 @@ +import CryptoJS from 'crypto-js'; + +/** + * 随机生成32位的字符串 + * @returns {string} + */ +const generateRandomString = () => { + const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + let result = ''; + const charactersLength = characters.length; + for (let i = 0; i < 32; i++) { + result += characters.charAt(Math.floor(Math.random() * charactersLength)); + } + return result; +}; + +/** + * 随机生成aes 密钥 + * @returns {string} + */ +export const generateAesKey = () => { + return CryptoJS.enc.Utf8.parse(generateRandomString()); +}; + +/** + * 加密base64 + * @returns {string} + */ +export const encryptBase64 = (str: CryptoJS.lib.WordArray) => { + return CryptoJS.enc.Base64.stringify(str); +}; + +/** + * 解密base64 + */ +export const decryptBase64 = (str: string) => { + return CryptoJS.enc.Base64.parse(str); +}; + +/** + * 使用密钥对数据进行加密 + * @param message + * @param aesKey + * @returns {string} + */ +export const encryptWithAes = (message: string, aesKey: CryptoJS.lib.WordArray) => { + const encrypted = CryptoJS.AES.encrypt(message, aesKey, { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7 + }); + return encrypted.toString(); +}; + +/** + * 使用密钥对数据进行解密 + * @param message + * @param aesKey + * @returns {string} + */ +export const decryptWithAes = (message: string, aesKey: CryptoJS.lib.WordArray) => { + const decrypted = CryptoJS.AES.decrypt(message, aesKey, { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7 + }); + return decrypted.toString(CryptoJS.enc.Utf8); +}; diff --git a/src/utils/dict.ts b/src/utils/dict.ts new file mode 100644 index 0000000..0575072 --- /dev/null +++ b/src/utils/dict.ts @@ -0,0 +1,27 @@ +import { getDicts } from '@/api/system/dict/data'; +import { useDictStore } from '@/store/modules/dict'; +/** + * 获取字典数据 + */ +export const useDict = (...args: string[]): { [key: string]: DictDataOption[] } => { + const res = ref<{ + [key: string]: DictDataOption[]; + }>({}); + return (() => { + args.forEach(async (dictType) => { + res.value[dictType] = []; + const dicts = useDictStore().getDict(dictType); + if (dicts) { + res.value[dictType] = dicts; + } else { + await getDicts(dictType).then((resp) => { + res.value[dictType] = resp.data.map( + (p): DictDataOption => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass }) + ); + useDictStore().setDict(dictType, res.value[dictType]); + }); + } + }); + return res.value; + })(); +}; diff --git a/src/utils/dynamicTitle.ts b/src/utils/dynamicTitle.ts new file mode 100644 index 0000000..8e23ef8 --- /dev/null +++ b/src/utils/dynamicTitle.ts @@ -0,0 +1,14 @@ +import defaultSettings from '@/settings'; +import { useSettingsStore } from '@/store/modules/settings'; + +/** + * 动态修改标题 + */ +export const useDynamicTitle = () => { + const settingsStore = useSettingsStore(); + if (settingsStore.dynamicTitle) { + document.title = settingsStore.title + ' - ' + import.meta.env.VITE_APP_TITLE; + } else { + document.title = defaultSettings.title as string; + } +}; diff --git a/src/utils/errorCode.ts b/src/utils/errorCode.ts new file mode 100644 index 0000000..d85914e --- /dev/null +++ b/src/utils/errorCode.ts @@ -0,0 +1,7 @@ +export const errorCode: any = { + '401': '认证失败,无法访问系统资源', + '403': '当前操作没有权限', + '404': '访问资源不存在', + default: '系统未知错误,请反馈给管理员' +}; +export default errorCode; diff --git a/src/utils/i18n.ts b/src/utils/i18n.ts new file mode 100644 index 0000000..ab77af0 --- /dev/null +++ b/src/utils/i18n.ts @@ -0,0 +1,16 @@ +// translate router.meta.title, be used in breadcrumb sidebar tagsview +import i18n from '@/lang/index'; + +/** + * 获取国际化路由,如果不存在则原生返回 + * @param title 路由名称 + * @returns {string} + */ +export const translateRouteTitle = (title: string): string => { + const hasKey = i18n.global.te('route.' + title); + if (hasKey) { + const translatedTitle = i18n.global.t('route.' + title); + return translatedTitle; + } + return title; +}; diff --git a/src/utils/jsencrypt.ts b/src/utils/jsencrypt.ts new file mode 100644 index 0000000..42de5a0 --- /dev/null +++ b/src/utils/jsencrypt.ts @@ -0,0 +1,21 @@ +import JSEncrypt from 'jsencrypt'; +// 密钥对生成 http://web.chacuo.net/netrsakeypair + +const publicKey = import.meta.env.VITE_APP_RSA_PUBLIC_KEY; + +// 前端不建议存放私钥 不建议解密数据 因为都是透明的意义不大 +const privateKey = import.meta.env.VITE_APP_RSA_PRIVATE_KEY; + +// 加密 +export const encrypt = (txt: string) => { + const encryptor = new JSEncrypt(); + encryptor.setPublicKey(publicKey); // 设置公钥 + return encryptor.encrypt(txt); // 对数据进行加密 +}; + +// 解密 +export const decrypt = (txt: string) => { + const encryptor = new JSEncrypt(); + encryptor.setPrivateKey(privateKey); // 设置私钥 + return encryptor.decrypt(txt); // 对数据进行解密 +}; diff --git a/src/utils/permission.ts b/src/utils/permission.ts new file mode 100644 index 0000000..eb3838a --- /dev/null +++ b/src/utils/permission.ts @@ -0,0 +1,51 @@ +import useUserStore from '@/store/modules/user'; + +/** + * 字符权限校验 + * @param {Array} value 校验值 + * @returns {Boolean} + */ +export const checkPermi = (value: any) => { + if (value && value instanceof Array && value.length > 0) { + const permissions = useUserStore().permissions; + const permissionDatas = value; + const all_permission = '*:*:*'; + + const hasPermission = permissions.some((permission) => { + return all_permission === permission || permissionDatas.includes(permission); + }); + + if (!hasPermission) { + return false; + } + return true; + } else { + console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`); + return false; + } +}; + +/** + * 角色权限校验 + * @param {Array} value 校验值 + * @returns {Boolean} + */ +export const checkRole = (value: any): boolean => { + if (value && value instanceof Array && value.length > 0) { + const roles = useUserStore().roles; + const permissionRoles = value; + const super_admin = 'admin'; + + const hasRole = roles.some((role) => { + return super_admin === role || permissionRoles.includes(role); + }); + + if (!hasRole) { + return false; + } + return true; + } else { + console.error(`need roles! Like checkRole="['admin','editor']"`); + return false; + } +}; diff --git a/src/utils/propTypes.ts b/src/utils/propTypes.ts new file mode 100644 index 0000000..24d861d --- /dev/null +++ b/src/utils/propTypes.ts @@ -0,0 +1,26 @@ +import { CSSProperties } from 'vue'; +import VueTypes, { createTypes, toValidableType, VueTypeValidableDef, VueTypesInterface } from 'vue-types'; + +type PropTypes = VueTypesInterface & { + readonly style: VueTypeValidableDef; + readonly fieldOption: VueTypeValidableDef>; +}; + +const propTypes = createTypes({ + func: undefined, + bool: undefined, + string: undefined, + number: undefined, + object: undefined, + integer: undefined +}) as PropTypes; + +export default class ProjectTypes extends VueTypes { + static get style() { + return toValidableType('style', { + type: [String, Object], + default: undefined + }); + } +} +export { propTypes }; diff --git a/src/utils/scroll-to.ts b/src/utils/scroll-to.ts new file mode 100644 index 0000000..c2fa379 --- /dev/null +++ b/src/utils/scroll-to.ts @@ -0,0 +1,65 @@ +const easeInOutQuad = (t: number, b: number, c: number, d: number) => { + t /= d / 2; + if (t < 1) { + return (c / 2) * t * t + b; + } + t--; + return (-c / 2) * (t * (t - 2) - 1) + b; +}; + +// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts +const requestAnimFrame = (function () { + return ( + window.requestAnimationFrame || + (window as any).webkitRequestAnimationFrame || + (window as any).mozRequestAnimationFrame || + function (callback) { + window.setTimeout(callback, 1000 / 60); + } + ); +})(); + +/** + * Because it's so fucking difficult to detect the scrolling element, just move them all + * @param {number} amount + */ +const move = (amount: number) => { + document.documentElement.scrollTop = amount; + (document.body.parentNode as HTMLElement).scrollTop = amount; + document.body.scrollTop = amount; +}; + +const position = () => { + return document.documentElement.scrollTop || (document.body.parentNode as HTMLElement).scrollTop || document.body.scrollTop; +}; + +/** + * @param {number} to + * @param {number} duration + * @param {Function} callback + */ +export const scrollTo = (to: number, duration: number, callback?: any) => { + const start = position(); + const change = to - start; + const increment = 20; + let currentTime = 0; + duration = typeof duration === 'undefined' ? 500 : duration; + const animateScroll = function () { + // increment the time + currentTime += increment; + // find the value with the quadratic in-out easing function + const val = easeInOutQuad(currentTime, start, change, duration); + // move the document.body + move(val); + // do the animation unless its over + if (currentTime < duration) { + requestAnimFrame(animateScroll); + } else { + if (callback && typeof callback === 'function') { + // the animation is done so lets callback + callback(); + } + } + }; + animateScroll(); +}; diff --git a/src/utils/sse.ts b/src/utils/sse.ts new file mode 100644 index 0000000..69447ad --- /dev/null +++ b/src/utils/sse.ts @@ -0,0 +1,42 @@ +import { getToken } from '@/utils/auth'; +import { ElNotification } from 'element-plus'; +import useNoticeStore from '@/store/modules/notice'; + +// 初始化 +export const initSSE = (url: any) => { + if (import.meta.env.VITE_APP_SSE === 'false') { + return; + } + + url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID; + const { data, error } = useEventSource(url, [], { + autoReconnect: { + retries: 10, + delay: 3000, + onFailed() { + console.log('Failed to connect after 10 retries'); + } + } + }); + + watch(error, () => { + console.log('SSE connection error:', error.value); + error.value = null; + }); + + watch(data, () => { + if (!data.value) return; + useNoticeStore().addNotice({ + message: data.value, + read: false, + time: new Date().toLocaleString() + }); + ElNotification({ + title: '消息', + message: data.value, + type: 'success', + duration: 3000 + }); + data.value = null; + }); +}; diff --git a/src/utils/theme.ts b/src/utils/theme.ts new file mode 100644 index 0000000..3936248 --- /dev/null +++ b/src/utils/theme.ts @@ -0,0 +1,52 @@ +// 处理主题样式 +export const handleThemeStyle = (theme: string) => { + document.documentElement.style.setProperty('--el-color-primary', theme); + for (let i = 1; i <= 9; i++) { + document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, `${getLightColor(theme, i / 10)}`); + } + for (let i = 1; i <= 9; i++) { + document.documentElement.style.setProperty(`--el-color-primary-dark-${i}`, `${getDarkColor(theme, i / 10)}`); + } +}; + +// hex颜色转rgb颜色 +export const hexToRgb = (str: string): string[] => { + str = str.replace('#', ''); + const hexs = str.match(/../g); + for (let i = 0; i < 3; i++) { + if (hexs) { + hexs[i] = String(parseInt(hexs[i], 16)); + } + } + return hexs ? hexs : []; +}; + +// rgb颜色转Hex颜色 +export const rgbToHex = (r: string, g: string, b: string) => { + const hexs = [Number(r).toString(16), Number(g).toString(16), Number(b).toString(16)]; + for (let i = 0; i < 3; i++) { + if (hexs[i].length == 1) { + hexs[i] = `0${hexs[i]}`; + } + } + return `#${hexs.join('')}`; +}; + +// 变浅颜色值 +export const getLightColor = (color: string, level: number) => { + const rgb = hexToRgb(color); + for (let i = 0; i < 3; i++) { + const s = (255 - Number(rgb[i])) * level + Number(rgb[i]); + rgb[i] = String(Math.floor(s)); + } + return rgbToHex(rgb[0], rgb[1], rgb[2]); +}; + +// 变深颜色值 +export const getDarkColor = (color: string, level: number) => { + const rgb = hexToRgb(color); + for (let i = 0; i < 3; i++) { + rgb[i] = String(Math.floor(Number(rgb[i]) * (1 - level))); + } + return rgbToHex(rgb[0], rgb[1], rgb[2]); +}; diff --git a/src/utils/validate.ts b/src/utils/validate.ts new file mode 100644 index 0000000..e2886e4 --- /dev/null +++ b/src/utils/validate.ts @@ -0,0 +1,108 @@ +/** + * 路径匹配器 + * @param {string} pattern + * @param {string} path + * @returns {Boolean} + */ +export function isPathMatch(pattern: string, path: string) { + const regexPattern = pattern + .replace(/\//g, '\\/') + .replace(/\*\*/g, '__DOUBLE_STAR__') + .replace(/\*/g, '[^\\/]*') + .replace(/__DOUBLE_STAR__/g, '.*'); + const regex = new RegExp(`^${regexPattern}$`); + return regex.test(path); +} + +/** + * 判断url是否是http或https + * @returns {Boolean} + * @param url + */ +export const isHttp = (url: string): boolean => { + return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1; +}; + +/** + * 判断path是否为外链 + * @param {string} path + * @returns {Boolean} + */ +export const isExternal = (path: string) => { + return /^(https?:|mailto:|tel:)/.test(path); +}; + +/** + * @param {string} str + * @returns {Boolean} + */ +export const validUsername = (str: string) => { + const valid_map = ['admin', 'editor']; + return valid_map.indexOf(str.trim()) >= 0; +}; + +/** + * @param {string} url + * @returns {Boolean} + */ +export const validURL = (url: string) => { + const reg = + /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/; + return reg.test(url); +}; + +/** + * @param {string} str + * @returns {Boolean} + */ +export const validLowerCase = (str: string) => { + const reg = /^[a-z]+$/; + return reg.test(str); +}; + +/** + * @param {string} str + * @returns {Boolean} + */ +export const validUpperCase = (str: string) => { + const reg = /^[A-Z]+$/; + return reg.test(str); +}; + +/** + * @param {string} str + * @returns {Boolean} + */ +export const validAlphabets = (str: string) => { + const reg = /^[A-Za-z]+$/; + return reg.test(str); +}; + +/** + * @param {string} email + * @returns {Boolean} + */ +export const validEmail = (email: string) => { + const reg = + /^(([^<>()\]\\.,;:\s@"]+(\.[^<>()\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + return reg.test(email); +}; + +/** + * @param {string} str + * @returns {Boolean} + */ +export const isString = (str: any) => { + return typeof str === 'string' || str instanceof String; +}; + +/** + * @param {Array} arg + * @returns {Boolean} + */ +export const isArray = (arg: string | string[]) => { + if (typeof Array.isArray === 'undefined') { + return Object.prototype.toString.call(arg) === '[object Array]'; + } + return Array.isArray(arg); +}; diff --git a/src/utils/websocket.ts b/src/utils/websocket.ts new file mode 100644 index 0000000..c9b394c --- /dev/null +++ b/src/utils/websocket.ts @@ -0,0 +1,51 @@ +import { getToken } from '@/utils/auth'; +import { ElNotification } from 'element-plus'; +import useNoticeStore from '@/store/modules/notice'; + +// 初始化socket +export const initWebSocket = (url: any) => { + if (import.meta.env.VITE_APP_WEBSOCKET === 'false') { + return; + } + url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID; + useWebSocket(url, { + autoReconnect: { + // 重连最大次数 + retries: 3, + // 重连间隔 + delay: 1000, + onFailed() { + console.log('websocket重连失败'); + } + }, + heartbeat: { + message: JSON.stringify({ type: 'ping' }), + // 发送心跳的间隔 + interval: 10000, + // 接收到心跳response的超时时间 + pongTimeout: 2000 + }, + onConnected() { + console.log('websocket已经连接'); + }, + onDisconnected() { + console.log('websocket已经断开'); + }, + onMessage: (_, e) => { + if (e.data.indexOf('ping') > 0) { + return; + } + useNoticeStore().addNotice({ + message: e.data, + read: false, + time: new Date().toLocaleString() + }); + ElNotification({ + title: '消息', + message: e.data, + type: 'success', + duration: 3000 + }); + } + }); +}; diff --git a/src/views/demo/demo/index.vue b/src/views/demo/demo/index.vue new file mode 100644 index 0000000..da1bc16 --- /dev/null +++ b/src/views/demo/demo/index.vue @@ -0,0 +1,254 @@ + + + diff --git a/src/views/demo/tree/index.vue b/src/views/demo/tree/index.vue new file mode 100644 index 0000000..566d071 --- /dev/null +++ b/src/views/demo/tree/index.vue @@ -0,0 +1,258 @@ + + + diff --git a/src/views/error/401.vue b/src/views/error/401.vue new file mode 100644 index 0000000..968550c --- /dev/null +++ b/src/views/error/401.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/src/views/error/404.vue b/src/views/error/404.vue new file mode 100644 index 0000000..b9a9ea3 --- /dev/null +++ b/src/views/error/404.vue @@ -0,0 +1,223 @@ + + + + + diff --git a/src/views/monitor/admin/index.vue b/src/views/monitor/admin/index.vue new file mode 100644 index 0000000..b71a5cc --- /dev/null +++ b/src/views/monitor/admin/index.vue @@ -0,0 +1,9 @@ + + + diff --git a/src/views/monitor/cache/index.vue b/src/views/monitor/cache/index.vue new file mode 100644 index 0000000..81bbf2d --- /dev/null +++ b/src/views/monitor/cache/index.vue @@ -0,0 +1,192 @@ + + + diff --git a/src/views/monitor/logininfor/index.vue b/src/views/monitor/logininfor/index.vue new file mode 100644 index 0000000..d914544 --- /dev/null +++ b/src/views/monitor/logininfor/index.vue @@ -0,0 +1,208 @@ + + + diff --git a/src/views/monitor/online/index.vue b/src/views/monitor/online/index.vue new file mode 100644 index 0000000..7a58bb7 --- /dev/null +++ b/src/views/monitor/online/index.vue @@ -0,0 +1,116 @@ + + + diff --git a/src/views/monitor/operlog/index.vue b/src/views/monitor/operlog/index.vue new file mode 100644 index 0000000..0c64af4 --- /dev/null +++ b/src/views/monitor/operlog/index.vue @@ -0,0 +1,260 @@ + + + diff --git a/src/views/monitor/operlog/oper-info-dialog.vue b/src/views/monitor/operlog/oper-info-dialog.vue new file mode 100644 index 0000000..66491e2 --- /dev/null +++ b/src/views/monitor/operlog/oper-info-dialog.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/src/views/monitor/snailjob/index.vue b/src/views/monitor/snailjob/index.vue new file mode 100644 index 0000000..89e3b23 --- /dev/null +++ b/src/views/monitor/snailjob/index.vue @@ -0,0 +1,9 @@ + + + diff --git a/src/views/redirect/index.vue b/src/views/redirect/index.vue new file mode 100644 index 0000000..97a6556 --- /dev/null +++ b/src/views/redirect/index.vue @@ -0,0 +1,14 @@ + + + diff --git a/src/views/system/client/index.vue b/src/views/system/client/index.vue new file mode 100644 index 0000000..37e8609 --- /dev/null +++ b/src/views/system/client/index.vue @@ -0,0 +1,316 @@ + + + diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue new file mode 100644 index 0000000..ddc0753 --- /dev/null +++ b/src/views/system/config/index.vue @@ -0,0 +1,261 @@ + + + diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue new file mode 100644 index 0000000..1f5facb --- /dev/null +++ b/src/views/system/dept/index.vue @@ -0,0 +1,319 @@ + + + diff --git a/src/views/system/dict/data.vue b/src/views/system/dict/data.vue new file mode 100644 index 0000000..3e9b0a1 --- /dev/null +++ b/src/views/system/dict/data.vue @@ -0,0 +1,309 @@ + + + diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue new file mode 100644 index 0000000..d30ad54 --- /dev/null +++ b/src/views/system/dict/index.vue @@ -0,0 +1,246 @@ + + + diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue new file mode 100644 index 0000000..05630f4 --- /dev/null +++ b/src/views/system/menu/index.vue @@ -0,0 +1,410 @@ + + + diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue new file mode 100644 index 0000000..5d7d9ba --- /dev/null +++ b/src/views/system/notice/index.vue @@ -0,0 +1,243 @@ + + + diff --git a/src/views/system/oss/config.vue b/src/views/system/oss/config.vue new file mode 100644 index 0000000..0563a02 --- /dev/null +++ b/src/views/system/oss/config.vue @@ -0,0 +1,334 @@ + + + diff --git a/src/views/system/oss/index.vue b/src/views/system/oss/index.vue new file mode 100644 index 0000000..f76dbab --- /dev/null +++ b/src/views/system/oss/index.vue @@ -0,0 +1,332 @@ + + + diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue new file mode 100644 index 0000000..4aa4e3a --- /dev/null +++ b/src/views/system/post/index.vue @@ -0,0 +1,360 @@ + + + diff --git a/src/views/system/role/authUser.vue b/src/views/system/role/authUser.vue new file mode 100644 index 0000000..0af7b6d --- /dev/null +++ b/src/views/system/role/authUser.vue @@ -0,0 +1,160 @@ + + + + + diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue new file mode 100644 index 0000000..fc42cd5 --- /dev/null +++ b/src/views/system/role/index.vue @@ -0,0 +1,503 @@ + + + diff --git a/src/views/system/role/selectUser.vue b/src/views/system/role/selectUser.vue new file mode 100644 index 0000000..e55120a --- /dev/null +++ b/src/views/system/role/selectUser.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/src/views/system/tenant/index.vue b/src/views/system/tenant/index.vue new file mode 100644 index 0000000..df97b64 --- /dev/null +++ b/src/views/system/tenant/index.vue @@ -0,0 +1,371 @@ + + + diff --git a/src/views/system/tenantPackage/index.vue b/src/views/system/tenantPackage/index.vue new file mode 100644 index 0000000..f97bb35 --- /dev/null +++ b/src/views/system/tenantPackage/index.vue @@ -0,0 +1,335 @@ + + + diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue new file mode 100644 index 0000000..430c55a --- /dev/null +++ b/src/views/system/user/index.vue @@ -0,0 +1,664 @@ + + + + + diff --git a/src/views/system/user/profile/index.vue b/src/views/system/user/profile/index.vue new file mode 100644 index 0000000..7c1389a --- /dev/null +++ b/src/views/system/user/profile/index.vue @@ -0,0 +1,122 @@ + + + diff --git a/src/views/system/user/profile/onlineDevice.vue b/src/views/system/user/profile/onlineDevice.vue new file mode 100644 index 0000000..7634b06 --- /dev/null +++ b/src/views/system/user/profile/onlineDevice.vue @@ -0,0 +1,57 @@ + + + diff --git a/src/views/system/user/profile/resetPwd.vue b/src/views/system/user/profile/resetPwd.vue new file mode 100644 index 0000000..3ca5ee9 --- /dev/null +++ b/src/views/system/user/profile/resetPwd.vue @@ -0,0 +1,73 @@ + + + diff --git a/src/views/system/user/profile/thirdParty.vue b/src/views/system/user/profile/thirdParty.vue new file mode 100644 index 0000000..5cd7347 --- /dev/null +++ b/src/views/system/user/profile/thirdParty.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/src/views/system/user/profile/userAvatar.vue b/src/views/system/user/profile/userAvatar.vue new file mode 100644 index 0000000..32b6f5c --- /dev/null +++ b/src/views/system/user/profile/userAvatar.vue @@ -0,0 +1,182 @@ + + + + + diff --git a/src/views/system/user/profile/userInfo.vue b/src/views/system/user/profile/userInfo.vue new file mode 100644 index 0000000..d5b8a4c --- /dev/null +++ b/src/views/system/user/profile/userInfo.vue @@ -0,0 +1,69 @@ + + + diff --git a/src/views/tool/gen/basicInfoForm.vue b/src/views/tool/gen/basicInfoForm.vue new file mode 100644 index 0000000..5412088 --- /dev/null +++ b/src/views/tool/gen/basicInfoForm.vue @@ -0,0 +1,49 @@ + + + diff --git a/src/views/tool/gen/editTable.vue b/src/views/tool/gen/editTable.vue new file mode 100644 index 0000000..bbb0889 --- /dev/null +++ b/src/views/tool/gen/editTable.vue @@ -0,0 +1,198 @@ + + + diff --git a/src/views/tool/gen/importTable.vue b/src/views/tool/gen/importTable.vue new file mode 100644 index 0000000..f6e75cc --- /dev/null +++ b/src/views/tool/gen/importTable.vue @@ -0,0 +1,122 @@ + + + diff --git a/src/views/workflow/category/index.vue b/src/views/workflow/category/index.vue new file mode 100644 index 0000000..d3e87ea --- /dev/null +++ b/src/views/workflow/category/index.vue @@ -0,0 +1,257 @@ + + + diff --git a/src/views/workflow/leave/index.vue b/src/views/workflow/leave/index.vue new file mode 100644 index 0000000..2c8da0e --- /dev/null +++ b/src/views/workflow/leave/index.vue @@ -0,0 +1,236 @@ + + + diff --git a/src/views/workflow/leave/leaveEdit.vue b/src/views/workflow/leave/leaveEdit.vue new file mode 100644 index 0000000..a8c1bfd --- /dev/null +++ b/src/views/workflow/leave/leaveEdit.vue @@ -0,0 +1,308 @@ + + + diff --git a/src/views/workflow/processDefinition/design.vue b/src/views/workflow/processDefinition/design.vue new file mode 100644 index 0000000..05e6538 --- /dev/null +++ b/src/views/workflow/processDefinition/design.vue @@ -0,0 +1,46 @@ + + + diff --git a/src/views/workflow/processDefinition/index.vue b/src/views/workflow/processDefinition/index.vue new file mode 100644 index 0000000..9888892 --- /dev/null +++ b/src/views/workflow/processDefinition/index.vue @@ -0,0 +1,517 @@ + + + diff --git a/src/views/workflow/processInstance/index.vue b/src/views/workflow/processInstance/index.vue new file mode 100644 index 0000000..b58b189 --- /dev/null +++ b/src/views/workflow/processInstance/index.vue @@ -0,0 +1,417 @@ + + + diff --git a/src/views/workflow/task/allTaskWaiting.vue b/src/views/workflow/task/allTaskWaiting.vue new file mode 100644 index 0000000..0c6c46e --- /dev/null +++ b/src/views/workflow/task/allTaskWaiting.vue @@ -0,0 +1,252 @@ + + + diff --git a/src/views/workflow/task/myDocument.vue b/src/views/workflow/task/myDocument.vue new file mode 100644 index 0000000..baee949 --- /dev/null +++ b/src/views/workflow/task/myDocument.vue @@ -0,0 +1,245 @@ + + + diff --git a/src/views/workflow/task/taskCopyList.vue b/src/views/workflow/task/taskCopyList.vue new file mode 100644 index 0000000..6224fff --- /dev/null +++ b/src/views/workflow/task/taskCopyList.vue @@ -0,0 +1,135 @@ + + + diff --git a/src/views/workflow/task/taskFinish.vue b/src/views/workflow/task/taskFinish.vue new file mode 100644 index 0000000..0f5758e --- /dev/null +++ b/src/views/workflow/task/taskFinish.vue @@ -0,0 +1,180 @@ + + + diff --git a/src/views/workflow/task/taskWaiting.vue b/src/views/workflow/task/taskWaiting.vue new file mode 100644 index 0000000..339077d --- /dev/null +++ b/src/views/workflow/task/taskWaiting.vue @@ -0,0 +1,179 @@ + + +