From ce3d0a7e060e58b790dd9f6682870fad9e93e21f Mon Sep 17 00:00:00 2001 From: icssoa <615206459@qq.com> Date: Wed, 6 Jul 2022 12:35:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E5=85=B8=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/cool/temp/entity.d.ts | 507 ++++++++++++ build/cool/temp/eps.json | 2 +- build/cool/temp/service.d.ts | 789 +++++++++++-------- package.json | 4 +- src/cool/bootstrap.ts | 7 + src/modules/base/common/permission.ts | 14 +- src/modules/base/components/select/index.vue | 10 +- src/modules/base/components/view/group.vue | 154 ++++ src/modules/base/views/user.vue | 241 ++---- src/modules/demo/views/crud.vue | 17 + src/modules/dict/components/group.vue | 255 ++++++ src/modules/dict/index.ts | 7 + src/modules/dict/store/dict.ts | 52 ++ src/modules/dict/store/index.ts | 9 + src/modules/dict/views/list.vue | 120 +++ yarn.lock | 8 +- 16 files changed, 1672 insertions(+), 524 deletions(-) create mode 100644 src/modules/base/components/view/group.vue create mode 100644 src/modules/dict/components/group.vue create mode 100644 src/modules/dict/index.ts create mode 100644 src/modules/dict/store/dict.ts create mode 100644 src/modules/dict/store/index.ts create mode 100644 src/modules/dict/views/list.vue diff --git a/build/cool/temp/entity.d.ts b/build/cool/temp/entity.d.ts index e69de29..4a8e309 100644 --- a/build/cool/temp/entity.d.ts +++ b/build/cool/temp/entity.d.ts @@ -0,0 +1,507 @@ +declare interface BaseSysDepartmentEntity { + /** + * ID + */ + id?: number; + /** + * 部门名称 + */ + name?: string; + /** + * 上级部门ID + */ + parentId?: BigInt; + /** + * 排序 + */ + orderNum?: number; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} + +declare interface BaseSysLogEntity { + /** + * ID + */ + id?: number; + /** + * 用户ID + */ + userId?: BigInt; + /** + * 行为 + */ + action?: string; + /** + * ip + */ + ip?: string; + /** + * ip地址 + */ + ipAddr?: string; + /** + * 参数 + */ + params?: string; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} + +declare interface BaseSysMenuEntity { + /** + * ID + */ + id?: number; + /** + * 父菜单ID + */ + parentId?: BigInt; + /** + * 菜单名称 + */ + name?: string; + /** + * 菜单地址 + */ + router?: string; + /** + * 权限标识 + */ + perms?: string; + /** + * 类型 0:目录 1:菜单 2:按钮 + */ + type?: number; + /** + * 图标 + */ + icon?: string; + /** + * 排序 + */ + orderNum?: number; + /** + * 视图地址 + */ + viewPath?: string; + /** + * 路由缓存 + */ + keepAlive?: boolean; + /** + * 是否显示 + */ + isShow?: boolean; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} + +declare interface BaseSysParamEntity { + /** + * ID + */ + id?: number; + /** + * 键位 + */ + keyName?: string; + /** + * 名称 + */ + name?: string; + /** + * 数据 + */ + data?: string; + /** + * 数据类型 0:字符串 1:数组 2:键值对 + */ + dataType?: number; + /** + * 备注 + */ + remark?: string; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} + +declare interface BaseSysRoleEntity { + /** + * ID + */ + id?: number; + /** + * 用户ID + */ + userId?: string; + /** + * 名称 + */ + name?: string; + /** + * 角色标签 + */ + label?: string; + /** + * 备注 + */ + remark?: string; + /** + * 数据权限是否关联上下级 + */ + relevance?: number; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} + +declare interface BaseSysUserEntity { + /** + * ID + */ + id?: number; + /** + * 部门ID + */ + departmentId?: BigInt; + /** + * 姓名 + */ + name?: string; + /** + * 用户名 + */ + username?: string; + /** + * 密码 + */ + password?: string; + /** + * 密码版本, 作用是改完密码,让原来的token失效 + */ + passwordV?: number; + /** + * 昵称 + */ + nickName?: string; + /** + * 头像 + */ + headImg?: string; + /** + * 手机 + */ + phone?: string; + /** + * 邮箱 + */ + email?: string; + /** + * 备注 + */ + remark?: string; + /** + * 状态 0:禁用 1:启用 + */ + status?: boolean; + /** + * socketId + */ + socketId?: string; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} + +declare interface DemoGoodsEntity { + /** + * ID + */ + id?: number; + /** + * 标题 + */ + title?: string; + /** + * 图片 + */ + pic?: string; + /** + * 价格 + */ + price?: number; + /** + * 分类 + */ + type?: number; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} + +declare interface DictInfoEntity { + /** + * ID + */ + id?: number; + /** + * 类型ID + */ + typeId?: number; + /** + * 名称 + */ + name?: string; + /** + * 排序 + */ + orderNum?: number; + /** + * 备注 + */ + remark?: string; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} + +declare interface DictTypeEntity { + /** + * ID + */ + id?: number; + /** + * 名称 + */ + name?: string; + /** + * 标识 + */ + key?: string; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} + +declare interface SpaceInfoEntity { + /** + * ID + */ + id?: number; + /** + * 地址 + */ + url?: string; + /** + * 类型 + */ + type?: string; + /** + * 分类ID + */ + classifyId?: BigInt; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} + +declare interface SpaceTypeEntity { + /** + * ID + */ + id?: number; + /** + * 类别名称 + */ + name?: string; + /** + * 父分类ID + */ + parentId?: number; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} + +declare interface TaskInfoEntity { + /** + * ID + */ + id?: number; + /** + * 任务ID + */ + jobId?: string; + /** + * 任务配置 + */ + repeatConf?: string; + /** + * 名称 + */ + name?: string; + /** + * cron + */ + cron?: string; + /** + * 最大执行次数 不传为无限次 + */ + limit?: number; + /** + * 每间隔多少毫秒执行一次 如果cron设置了 这项设置就无效 + */ + every?: number; + /** + * 备注 + */ + remark?: string; + /** + * 状态 0:停止 1:运行 + */ + status?: boolean; + /** + * 开始时间 + */ + startDate?: Date; + /** + * 结束时间 + */ + endDate?: Date; + /** + * 数据 + */ + data?: string; + /** + * 执行的service实例ID + */ + service?: string; + /** + * 状态 0:系统 1:用户 + */ + type?: number; + /** + * 下一次执行时间 + */ + nextRunTime?: Date; + /** + * 状态 0:cron 1:时间间隔 + */ + taskType?: number; + /** + * 创建时间 + */ + createTime?: Date; + /** + * 更新时间 + */ + updateTime?: Date; + /** + * 任意键值 + */ + [key: string]: any; +} diff --git a/build/cool/temp/eps.json b/build/cool/temp/eps.json index 1b6bbdb..ca78d8e 100644 --- a/build/cool/temp/eps.json +++ b/build/cool/temp/eps.json @@ -1 +1 @@ -[["/admin/base/comm",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""],["","/personUpdate",""],["","/uploadMode",""],["","/permmenu",""],["","/logout",""]]],["/admin/base/open",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""],["","/refreshToken",""],["","/captcha",""],["","/login",""],["","/html",""],["","/eps",""]]],["/admin/base/sys/department",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""],["","/order",""]]],["/admin/base/sys/log",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""],["","/setKeep",""],["","/getKeep",""],["","/clear",""]]],["/admin/base/sys/menu",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/admin/base/sys/param",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""],["","/html",""]]],["/admin/base/sys/role",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/admin/base/sys/user",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""],["","/move",""]]],["/admin/demo/goods",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/admin/space/info",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/admin/space/type",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/admin/task/info",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""],["","/start",""],["","/once",""],["","/stop",""],["","/log",""]]],["/chat/message",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/chat/session",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/test",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]]] \ No newline at end of file +[["/admin/base/comm",[["post","/personUpdate",""],["get","/uploadMode",""],["get","/permmenu",""],["get","/person",""],["post","/upload",""],["post","/logout",""],["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/admin/base/open",[["get","/refreshToken",""],["get","/captcha",""],["post","/login",""],["get","/html",""],["get","/eps",""],["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/admin/base/sys/department",[["post","/delete",""],["post","/update",""],["post","/order",""],["post","/list",""],["post","/add",""],["","/page",""],["","/info",""]]],["/admin/base/sys/log",[["post","/setKeep",""],["get","/getKeep",""],["post","/clear",""],["post","/page",""],["","/list",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/admin/base/sys/menu",[["post","/delete",""],["post","/update",""],["get","/info",""],["post","/list",""],["post","/page",""],["post","/add",""]]],["/admin/base/sys/param",[["post","/delete",""],["post","/update",""],["get","/html",""],["get","/info",""],["post","/page",""],["post","/add",""],["","/list",""]]],["/admin/base/sys/role",[["post","/delete",""],["post","/update",""],["get","/info",""],["post","/list",""],["post","/page",""],["post","/add",""]]],["/admin/base/sys/user",[["post","/delete",""],["post","/update",""],["post","/move",""],["get","/info",""],["post","/list",""],["post","/page",""],["post","/add",""]]],["/admin/demo/goods",[["post","/delete",""],["post","/update",""],["get","/info",""],["post","/page",""],["post","/list",""],["post","/add",""]]],["/admin/dict/info",[["post","/delete",""],["post","/update",""],["post","/data",""],["get","/info",""],["post","/list",""],["post","/page",""],["post","/add",""]]],["/admin/dict/type",[["post","/delete",""],["post","/update",""],["get","/info",""],["post","/list",""],["post","/page",""],["post","/add",""]]],["/admin/space/info",[["post","/delete",""],["post","/update",""],["get","/info",""],["post","/list",""],["post","/page",""],["post","/add",""]]],["/admin/space/type",[["post","/delete",""],["post","/update",""],["get","/info",""],["post","/list",""],["post","/page",""],["post","/add",""]]],["/admin/task/info",[["post","/delete",""],["post","/update",""],["post","/start",""],["post","/once",""],["post","/stop",""],["get","/info",""],["post","/page",""],["get","/log",""],["post","/add",""],["","/list",""]]],["/chat/message",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/chat/session",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]],["/test",[["","/list",""],["","/page",""],["","/info",""],["","/update",""],["","/delete",""],["","/add",""]]]] \ No newline at end of file diff --git a/build/cool/temp/service.d.ts b/build/cool/temp/service.d.ts index d3ac4e8..65be1ac 100644 --- a/build/cool/temp/service.d.ts +++ b/build/cool/temp/service.d.ts @@ -50,6 +50,36 @@ declare interface RequestOptions { } declare interface BaseComm { + /** + * 修改个人信息 + * @returns Promise + */ + personUpdate(data?: any): Promise; + /** + * 文件上传模式 + * @returns Promise + */ + uploadMode(data?: any): Promise; + /** + * 权限与菜单 + * @returns Promise + */ + permmenu(data?: any): Promise; + /** + * 个人信息 + * @returns Promise + */ + person(data?: any): Promise; + /** + * 文件上传 + * @returns Promise + */ + upload(data?: any): Promise; + /** + * 退出 + * @returns Promise + */ + logout(data?: any): Promise; /** * list * @returns Promise @@ -80,44 +110,51 @@ declare interface BaseComm { * @returns Promise */ add(data?: any): Promise; - /** - * personUpdate - * @returns Promise - */ - personUpdate(data?: any): Promise; - /** - * uploadMode - * @returns Promise - */ - uploadMode(data?: any): Promise; - /** - * permmenu - * @returns Promise - */ - permmenu(data?: any): Promise; - /** - * logout - * @returns Promise - */ - logout(data?: any): Promise; /** * 权限 */ permission: { + personUpdate: string; + uploadMode: string; + permmenu: string; + person: string; + upload: string; + logout: string; list: string; page: string; info: string; update: string; delete: string; add: string; - personUpdate: string; - uploadMode: string; - permmenu: string; - logout: string; }; } declare interface BaseOpen { + /** + * 刷新token + * @returns Promise + */ + refreshToken(data?: any): Promise; + /** + * 验证码 + * @returns Promise + */ + captcha(data?: any): Promise; + /** + * 登录 + * @returns Promise + */ + login(data?: any): Promise; + /** + * 获得网页内容的参数值 + * @returns Promise + */ + html(data?: any): Promise; + /** + * 实体信息与路径 + * @returns Promise + */ + eps(data?: any): Promise; /** * list * @returns Promise @@ -148,55 +185,50 @@ declare interface BaseOpen { * @returns Promise */ add(data?: any): Promise; - /** - * refreshToken - * @returns Promise - */ - refreshToken(data?: any): Promise; - /** - * captcha - * @returns Promise - */ - captcha(data?: any): Promise; - /** - * login - * @returns Promise - */ - login(data?: any): Promise; - /** - * html - * @returns Promise - */ - html(data?: any): Promise; - /** - * eps - * @returns Promise - */ - eps(data?: any): Promise; /** * 权限 */ permission: { - list: string; - page: string; - info: string; - update: string; - delete: string; - add: string; refreshToken: string; captcha: string; login: string; html: string; eps: string; + list: string; + page: string; + info: string; + update: string; + delete: string; + add: string; }; } declare interface BaseSysDepartment { /** - * list + * 删除 + * @returns Promise + */ + delete(data?: any): Promise; + /** + * 修改 + * @returns Promise + */ + update(data?: any): Promise; + /** + * 排序 + * @returns Promise + */ + order(data?: any): Promise; + /** + * 列表查询 * @returns Promise */ list(data?: any): Promise; + /** + * 新增 + * @returns Promise + */ + add(data?: any): Promise; /** * page * @returns Promise @@ -207,51 +239,46 @@ declare interface BaseSysDepartment { * @returns Promise */ info(data?: any): Promise; - /** - * update - * @returns Promise - */ - update(data?: any): Promise; - /** - * delete - * @returns Promise - */ - delete(data?: any): Promise; - /** - * add - * @returns Promise - */ - add(data?: any): Promise; - /** - * order - * @returns Promise - */ - order(data?: any): Promise; /** * 权限 */ permission: { + delete: string; + update: string; + order: string; list: string; + add: string; page: string; info: string; - update: string; - delete: string; - add: string; - order: string; }; } declare interface BaseSysLog { + /** + * 日志保存时间 + * @returns Promise + */ + setKeep(data?: any): Promise; + /** + * 获得日志保存时间 + * @returns Promise + */ + getKeep(data?: any): Promise; + /** + * 清理 + * @returns Promise + */ + clear(data?: any): Promise; + /** + * 分页查询 + * @returns Promise + */ + page(data?: any): Promise; /** * list * @returns Promise */ list(data?: any): Promise; - /** - * page - * @returns Promise - */ - page(data?: any): Promise; /** * info * @returns Promise @@ -272,65 +299,50 @@ declare interface BaseSysLog { * @returns Promise */ add(data?: any): Promise; - /** - * setKeep - * @returns Promise - */ - setKeep(data?: any): Promise; - /** - * getKeep - * @returns Promise - */ - getKeep(data?: any): Promise; - /** - * clear - * @returns Promise - */ - clear(data?: any): Promise; /** * 权限 */ permission: { - list: string; + setKeep: string; + getKeep: string; + clear: string; page: string; + list: string; info: string; update: string; delete: string; add: string; - setKeep: string; - getKeep: string; - clear: string; }; } declare interface BaseSysMenu { /** - * list - * @returns Promise - */ - list(data?: any): Promise; - /** - * page - * @returns Promise - */ - page(data?: any): Promise; - /** - * info - * @returns Promise - */ - info(data?: any): Promise; - /** - * update - * @returns Promise - */ - update(data?: any): Promise; - /** - * delete + * 删除 * @returns Promise */ delete(data?: any): Promise; /** - * add + * 修改 + * @returns Promise + */ + update(data?: any): Promise; + /** + * 单个信息 + * @returns Promise + */ + info(data?: any): Promise; + /** + * 列表查询 + * @returns Promise + */ + list(data?: any): Promise; + /** + * 分页查询 + * @returns Promise + */ + page(data?: any): Promise; + /** + * 新增 * @returns Promise */ add(data?: any): Promise; @@ -338,93 +350,93 @@ declare interface BaseSysMenu { * 权限 */ permission: { + delete: string; + update: string; + info: string; list: string; page: string; - info: string; - update: string; - delete: string; add: string; }; } declare interface BaseSysParam { + /** + * 删除 + * @returns Promise + */ + delete(data?: any): Promise; + /** + * 修改 + * @returns Promise + */ + update(data?: any): Promise; + /** + * 获得网页内容的参数值 + * @returns Promise + */ + html(data?: any): Promise; + /** + * 单个信息 + * @returns Promise + */ + info(data?: any): Promise; + /** + * 分页查询 + * @returns Promise + */ + page(data?: any): Promise; + /** + * 新增 + * @returns Promise + */ + add(data?: any): Promise; /** * list * @returns Promise */ list(data?: any): Promise; - /** - * page - * @returns Promise - */ - page(data?: any): Promise; - /** - * info - * @returns Promise - */ - info(data?: any): Promise; - /** - * update - * @returns Promise - */ - update(data?: any): Promise; - /** - * delete - * @returns Promise - */ - delete(data?: any): Promise; - /** - * add - * @returns Promise - */ - add(data?: any): Promise; - /** - * html - * @returns Promise - */ - html(data?: any): Promise; /** * 权限 */ permission: { - list: string; - page: string; - info: string; - update: string; delete: string; - add: string; + update: string; html: string; + info: string; + page: string; + add: string; + list: string; }; } declare interface BaseSysRole { /** - * list - * @returns Promise - */ - list(data?: any): Promise; - /** - * page - * @returns Promise - */ - page(data?: any): Promise; - /** - * info - * @returns Promise - */ - info(data?: any): Promise; - /** - * update - * @returns Promise - */ - update(data?: any): Promise; - /** - * delete + * 删除 * @returns Promise */ delete(data?: any): Promise; /** - * add + * 修改 + * @returns Promise + */ + update(data?: any): Promise; + /** + * 单个信息 + * @returns Promise + */ + info(data?: any): Promise; + /** + * 列表查询 + * @returns Promise + */ + list(data?: any): Promise; + /** + * 分页查询 + * @returns Promise + */ + page(data?: any): Promise; + /** + * 新增 * @returns Promise */ add(data?: any): Promise; @@ -432,93 +444,93 @@ declare interface BaseSysRole { * 权限 */ permission: { + delete: string; + update: string; + info: string; list: string; page: string; - info: string; - update: string; - delete: string; add: string; }; } declare interface BaseSysUser { /** - * list - * @returns Promise - */ - list(data?: any): Promise; - /** - * page - * @returns Promise - */ - page(data?: any): Promise; - /** - * info - * @returns Promise - */ - info(data?: any): Promise; - /** - * update - * @returns Promise - */ - update(data?: any): Promise; - /** - * delete + * 删除 * @returns Promise */ delete(data?: any): Promise; /** - * add + * 修改 * @returns Promise */ - add(data?: any): Promise; + update(data?: any): Promise; /** - * move + * 移动部门 * @returns Promise */ move(data?: any): Promise; + /** + * 单个信息 + * @returns Promise + */ + info(data?: any): Promise; + /** + * 列表查询 + * @returns Promise + */ + list(data?: any): Promise; + /** + * 分页查询 + * @returns Promise + */ + page(data?: any): Promise; + /** + * 新增 + * @returns Promise + */ + add(data?: any): Promise; /** * 权限 */ permission: { + delete: string; + update: string; + move: string; + info: string; list: string; page: string; - info: string; - update: string; - delete: string; add: string; - move: string; }; } declare interface DemoGoods { /** - * list - * @returns Promise - */ - list(data?: any): Promise; - /** - * page - * @returns Promise - */ - page(data?: any): Promise; - /** - * info - * @returns Promise - */ - info(data?: any): Promise; - /** - * update - * @returns Promise - */ - update(data?: any): Promise; - /** - * delete + * 删除 * @returns Promise */ delete(data?: any): Promise; /** - * add + * 修改 + * @returns Promise + */ + update(data?: any): Promise; + /** + * 单个信息 + * @returns Promise + */ + info(data?: any): Promise; + /** + * 分页查询 + * @returns Promise + */ + page(data?: any): Promise; + /** + * 列表查询 + * @returns Promise + */ + list(data?: any): Promise; + /** + * 新增 * @returns Promise */ add(data?: any): Promise; @@ -526,43 +538,137 @@ declare interface DemoGoods { * 权限 */ permission: { + delete: string; + update: string; + info: string; + page: string; + list: string; + add: string; + }; +} + +declare interface DictInfo { + /** + * 删除 + * @returns Promise + */ + delete(data?: any): Promise; + /** + * 修改 + * @returns Promise + */ + update(data?: any): Promise; + /** + * 获得字典数据 + * @returns Promise + */ + data(data?: any): Promise; + /** + * 单个信息 + * @returns Promise + */ + info(data?: any): Promise; + /** + * 列表查询 + * @returns Promise + */ + list(data?: any): Promise; + /** + * 分页查询 + * @returns Promise + */ + page(data?: any): Promise; + /** + * 新增 + * @returns Promise + */ + add(data?: any): Promise; + /** + * 权限 + */ + permission: { + delete: string; + update: string; + data: string; + info: string; list: string; page: string; - info: string; - update: string; + add: string; + }; +} + +declare interface DictType { + /** + * 删除 + * @returns Promise + */ + delete(data?: any): Promise; + /** + * 修改 + * @returns Promise + */ + update(data?: any): Promise; + /** + * 单个信息 + * @returns Promise + */ + info(data?: any): Promise; + /** + * 列表查询 + * @returns Promise + */ + list(data?: any): Promise; + /** + * 分页查询 + * @returns Promise + */ + page(data?: any): Promise; + /** + * 新增 + * @returns Promise + */ + add(data?: any): Promise; + /** + * 权限 + */ + permission: { delete: string; + update: string; + info: string; + list: string; + page: string; add: string; }; } declare interface SpaceInfo { /** - * list - * @returns Promise - */ - list(data?: any): Promise; - /** - * page - * @returns Promise - */ - page(data?: any): Promise; - /** - * info - * @returns Promise - */ - info(data?: any): Promise; - /** - * update - * @returns Promise - */ - update(data?: any): Promise; - /** - * delete + * 删除 * @returns Promise */ delete(data?: any): Promise; /** - * add + * 修改 + * @returns Promise + */ + update(data?: any): Promise; + /** + * 单个信息 + * @returns Promise + */ + info(data?: any): Promise; + /** + * 列表查询 + * @returns Promise + */ + list(data?: any): Promise; + /** + * 分页查询 + * @returns Promise + */ + page(data?: any): Promise; + /** + * 新增 * @returns Promise */ add(data?: any): Promise; @@ -570,43 +676,43 @@ declare interface SpaceInfo { * 权限 */ permission: { + delete: string; + update: string; + info: string; list: string; page: string; - info: string; - update: string; - delete: string; add: string; }; } declare interface SpaceType { /** - * list - * @returns Promise - */ - list(data?: any): Promise; - /** - * page - * @returns Promise - */ - page(data?: any): Promise; - /** - * info - * @returns Promise - */ - info(data?: any): Promise; - /** - * update - * @returns Promise - */ - update(data?: any): Promise; - /** - * delete + * 删除 * @returns Promise */ delete(data?: any): Promise; /** - * add + * 修改 + * @returns Promise + */ + update(data?: any): Promise; + /** + * 单个信息 + * @returns Promise + */ + info(data?: any): Promise; + /** + * 列表查询 + * @returns Promise + */ + list(data?: any): Promise; + /** + * 分页查询 + * @returns Promise + */ + page(data?: any): Promise; + /** + * 新增 * @returns Promise */ add(data?: any): Promise; @@ -614,80 +720,80 @@ declare interface SpaceType { * 权限 */ permission: { + delete: string; + update: string; + info: string; list: string; page: string; - info: string; - update: string; - delete: string; add: string; }; } declare interface TaskInfo { + /** + * 删除 + * @returns Promise + */ + delete(data?: any): Promise; + /** + * 修改 + * @returns Promise + */ + update(data?: any): Promise; + /** + * 开始 + * @returns Promise + */ + start(data?: any): Promise; + /** + * 执行一次 + * @returns Promise + */ + once(data?: any): Promise; + /** + * 停止 + * @returns Promise + */ + stop(data?: any): Promise; + /** + * 单个信息 + * @returns Promise + */ + info(data?: any): Promise; + /** + * 分页查询 + * @returns Promise + */ + page(data?: any): Promise; + /** + * 日志 + * @returns Promise + */ + log(data?: any): Promise; + /** + * 新增 + * @returns Promise + */ + add(data?: any): Promise; /** * list * @returns Promise */ list(data?: any): Promise; - /** - * page - * @returns Promise - */ - page(data?: any): Promise; - /** - * info - * @returns Promise - */ - info(data?: any): Promise; - /** - * update - * @returns Promise - */ - update(data?: any): Promise; - /** - * delete - * @returns Promise - */ - delete(data?: any): Promise; - /** - * add - * @returns Promise - */ - add(data?: any): Promise; - /** - * start - * @returns Promise - */ - start(data?: any): Promise; - /** - * once - * @returns Promise - */ - once(data?: any): Promise; - /** - * stop - * @returns Promise - */ - stop(data?: any): Promise; - /** - * log - * @returns Promise - */ - log(data?: any): Promise; /** * 权限 */ permission: { - list: string; - page: string; - info: string; - update: string; delete: string; - add: string; + update: string; start: string; once: string; stop: string; + info: string; + page: string; log: string; + add: string; + list: string; }; } @@ -838,6 +944,7 @@ declare type Service = { }; }; demo: { goods: DemoGoods }; + dict: { info: DictInfo; type: DictType }; space: { info: SpaceInfo; type: SpaceType }; task: { info: TaskInfo }; chat: { message: ChatMessage; session: ChatSession }; diff --git a/package.json b/package.json index 46daad0..5a881f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "front-next", - "version": "5.5.1", + "version": "5.6.0", "scripts": { "dev": "vite --host", "build": "vite build", @@ -9,7 +9,7 @@ "lint:eslint": "eslint \"{src,mock}/**/*.{vue,ts,tsx}\" --fix" }, "dependencies": { - "@cool-vue/crud": "^5.2.7", + "@cool-vue/crud": "^5.2.10", "@element-plus/icons-vue": "^1.1.3", "@vueuse/core": "^8.2.5", "axios": "^0.27.2", diff --git a/src/cool/bootstrap.ts b/src/cool/bootstrap.ts index 86d7529..685859c 100644 --- a/src/cool/bootstrap.ts +++ b/src/cool/bootstrap.ts @@ -8,6 +8,7 @@ import VueECharts from "vue-echarts"; import ElementPlus from "element-plus"; import "element-plus/theme-chalk/src/index.scss"; import "uno.css"; +import { useDict } from "/$/dict"; export async function bootstrap(Vue: App) { // 缓存 @@ -38,6 +39,12 @@ export async function bootstrap(Vue: App) { app.showLoading(); if (user.token) { + // 字典 + const { dict } = useDict(); + + // 获取字典数据 + dict.refresh(); + // 获取用户信息 user.get(); diff --git a/src/modules/base/common/permission.ts b/src/modules/base/common/permission.ts index 512b495..4202b97 100644 --- a/src/modules/base/common/permission.ts +++ b/src/modules/base/common/permission.ts @@ -1,5 +1,5 @@ import { useStore } from "../store"; -import { isObject } from "lodash"; +import { isArray, isObject } from "lodash"; function parse(value: any) { const { menu } = useStore(); @@ -28,3 +28,15 @@ export function checkPerm(value: any) { return parse(value); } + +export function getPerm(service: any, names: string[] | string) { + if (!service._permission) { + return false; + } + + if (!isArray(names)) { + names = [names]; + } + + return !names.find((e) => !service._permission[e]); +} diff --git a/src/modules/base/components/select/index.vue b/src/modules/base/components/select/index.vue index 357ce40..7680b18 100644 --- a/src/modules/base/components/select/index.vue +++ b/src/modules/base/components/select/index.vue @@ -1,7 +1,7 @@