This commit is contained in:
xiangheng
2024-05-19 01:29:52 +08:00
parent 852cc87152
commit 79011609ba
32 changed files with 264 additions and 319 deletions

View File

@@ -24,6 +24,7 @@
"consola": "^3.2.3", "consola": "^3.2.3",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"css-color-function": "^1.3.3", "css-color-function": "^1.3.3",
"dayjs": "^1.11.11",
"echarts": "^5.5.0", "echarts": "^5.5.0",
"element-plus": "^2.7.2", "element-plus": "^2.7.2",
"highlight.js": "^11.9.0", "highlight.js": "^11.9.0",

View File

@@ -10,18 +10,18 @@ export function articleCateAll(params?: any) {
} }
// 添加文章分类 // 添加文章分类
export function articleCateAdd(params: any) { export function articleCateAdd(data: any) {
return request.post({ url: '/article/cate/add', params }) return request.post({ url: '/article/cate/add', data })
} }
// 编辑文章分类 // 编辑文章分类
export function articleCateEdit(params: any) { export function articleCateEdit(data: any) {
return request.post({ url: '/article/cate/edit', params }) return request.post({ url: '/article/cate/edit', data })
} }
// 删除文章分类 // 删除文章分类
export function articleCateDelete(params: any) { export function articleCateDelete(data: any) {
return request.post({ url: '/article/cate/del', params }) return request.post({ url: '/article/cate/del', data })
} }
// 文章分类详情 // 文章分类详情
@@ -30,8 +30,8 @@ export function articleCateDetail(params: any) {
} }
// 文章分类状态 // 文章分类状态
export function articleCateStatus(params: any) { export function articleCateStatus(data: any) {
return request.post({ url: '/article/cate/change', params }) return request.post({ url: '/article/cate/change', data })
} }
// 文章列表 // 文章列表
@@ -44,18 +44,18 @@ export function articleAll(params?: any) {
} }
// 添加文章 // 添加文章
export function articleAdd(params: any) { export function articleAdd(data: any) {
return request.post({ url: '/article/add', params }) return request.post({ url: '/article/add', data })
} }
// 编辑文章 // 编辑文章
export function articleEdit(params: any) { export function articleEdit(data: any) {
return request.post({ url: '/article/edit', params }) return request.post({ url: '/article/edit', data })
} }
// 删除文章 // 删除文章
export function articleDelete(params: any) { export function articleDelete(data: any) {
return request.post({ url: '/article/del', params }) return request.post({ url: '/article/del', data })
} }
// 文章详情 // 文章详情
@@ -64,6 +64,6 @@ export function articleDetail(params: any) {
} }
// 文章分类状态 // 文章分类状态
export function articleStatus(params: any) { export function articleStatus(data: any) {
return request.post({ url: '/article/change', params }) return request.post({ url: '/article/change', data })
} }

View File

@@ -11,16 +11,16 @@ export function article_collect_detail(params: Record<string, any>) {
} }
// 文章收藏新增 // 文章收藏新增
export function article_collect_add(params: Record<string, any>) { export function article_collect_add(data: Record<string, any>) {
return request.post({ url: '/article_collect/add', params }) return request.post({ url: '/article_collect/add', data })
} }
// 文章收藏编辑 // 文章收藏编辑
export function article_collect_edit(params: Record<string, any>) { export function article_collect_edit(data: Record<string, any>) {
return request.post({ url: '/article_collect/edit', params }) return request.post({ url: '/article_collect/edit', data })
} }
// 文章收藏删除 // 文章收藏删除
export function article_collect_delete(params: Record<string, any>) { export function article_collect_delete(data: Record<string, any>) {
return request.post({ url: '/article_collect/del', params }) return request.post({ url: '/article_collect/del', data })
} }

View File

@@ -11,6 +11,6 @@ export function getUserDetail(params: any) {
} }
// 用户编辑 // 用户编辑
export function userEdit(params: any) { export function userEdit(data: any) {
return request.post({ url: '/user/edit', params }) return request.post({ url: '/user/edit', data })
} }

View File

@@ -1,16 +1,16 @@
import request from '@/utils/request' import request from '@/utils/request'
export function fileCateAdd(params: Record<string, any>) { export function fileCateAdd(data: Record<string, any>) {
return request.post({ url: '/common/album/cateAdd', params }) return request.post({ url: '/common/album/cateAdd', data })
} }
export function fileCateEdit(params: Record<string, any>) { export function fileCateEdit(data: Record<string, any>) {
return request.post({ url: '/common/album/cateRename', params }) return request.post({ url: '/common/album/cateRename', data })
} }
// 文件分类删除 // 文件分类删除
export function fileCateDelete(params: Record<string, any>) { export function fileCateDelete(data: Record<string, any>) {
return request.post({ url: '/common/album/cateDel', params }) return request.post({ url: '/common/album/cateDel', data })
} }
// 文件分类列表 // 文件分类列表
@@ -24,16 +24,16 @@ export function fileList(params: Record<string, any>) {
} }
// 文件删除 // 文件删除
export function fileDelete(params: Record<string, any>) { export function fileDelete(data: Record<string, any>) {
return request.post({ url: '/common/album/albumDel', params }) return request.post({ url: '/common/album/albumDel', data })
} }
// 文件移动 // 文件移动
export function fileMove(params: Record<string, any>) { export function fileMove(data: Record<string, any>) {
return request.post({ url: '/common/album/albumMove', params }) return request.post({ url: '/common/album/albumMove', data })
} }
// 文件重命名 // 文件重命名
export function fileRename(params: { id: number; name: string }) { export function fileRename(data: { id: number; name: string }) {
return request.post({ url: '/common/album/albumRename', params }) return request.post({ url: '/common/album/albumRename', data })
} }

View File

@@ -11,16 +11,16 @@ export function flow_apply_detail(params: Record<string, any>) {
} }
// 申请流程新增 // 申请流程新增
export function flow_apply_add(params: Record<string, any>) { export function flow_apply_add(data: Record<string, any>) {
return request.post({ url: '/flow/flow_apply/add', params }) return request.post({ url: '/flow/flow_apply/add', data })
} }
// 申请流程编辑 // 申请流程编辑
export function flow_apply_edit(params: Record<string, any>) { export function flow_apply_edit(data: Record<string, any>) {
return request.post({ url: '/flow/flow_apply/edit', params }) return request.post({ url: '/flow/flow_apply/edit', data })
} }
// 申请流程删除 // 申请流程删除
export function flow_apply_delete(params: Record<string, any>) { export function flow_apply_delete(data: Record<string, any>) {
return request.post({ url: '/flow/flow_apply/del', params }) return request.post({ url: '/flow/flow_apply/del', data })
} }

View File

@@ -15,33 +15,33 @@ export function flow_history_detail(params: Record<string, any>) {
} }
// 流程历史新增 // 流程历史新增
export function flow_history_add(params: Record<string, any>) { export function flow_history_add(data: Record<string, any>) {
return request.post({ url: '/flow/flow_history/add', params }) return request.post({ url: '/flow/flow_history/add', data })
} }
// 流程历史编辑 // 流程历史编辑
export function flow_history_edit(params: Record<string, any>) { export function flow_history_edit(data: Record<string, any>) {
return request.post({ url: '/flow/flow_history/edit', params }) return request.post({ url: '/flow/flow_history/edit', data })
} }
// 流程历史删除 // 流程历史删除
export function flow_history_delete(params: Record<string, any>) { export function flow_history_delete(data: Record<string, any>) {
return request.post({ url: '/flow/flow_history/del', params }) return request.post({ url: '/flow/flow_history/del', data })
} }
// 获取下一个审批节点,中间可能有系统任务和结束节点被跳过 // 获取下一个审批节点,中间可能有系统任务和结束节点被跳过
export function flow_history_next_node(params: Record<string, any>) { export function flow_history_next_node(data: Record<string, any>) {
return request.post({ url: '/flow/flow_history/next_node', params }) return request.post({ url: '/flow/flow_history/next_node', data })
} }
// 获取下一个审批节点,中间可能有系统任务和结束节点被跳过 // 获取下一个审批节点,中间可能有系统任务和结束节点被跳过
export function flow_history_get_approver(params: Record<string, any>) { export function flow_history_get_approver(data: Record<string, any>) {
return request.post({ url: '/flow/flow_history/get_approver', params }) return request.post({ url: '/flow/flow_history/get_approver', data })
} }
export function flow_history_pass(params: Record<string, any>) { export function flow_history_pass(data: Record<string, any>) {
return request.post({ url: '/flow/flow_history/pass', params }) return request.post({ url: '/flow/flow_history/pass', data })
} }
export function flow_history_back(params: Record<string, any>) { export function flow_history_back(data: Record<string, any>) {
return request.post({ url: '/flow/flow_history/back', params }) return request.post({ url: '/flow/flow_history/back', data })
} }

View File

@@ -16,16 +16,16 @@ export function flow_template_detail(params: Record<string, any>) {
} }
// 流程模板新增 // 流程模板新增
export function flow_template_add(params: Record<string, any>) { export function flow_template_add(data: Record<string, any>) {
return request.post({ url: '/flow/flow_template/add', params }) return request.post({ url: '/flow/flow_template/add', data })
} }
// 流程模板编辑 // 流程模板编辑
export function flow_template_edit(params: Record<string, any>) { export function flow_template_edit(data: Record<string, any>) {
return request.post({ url: '/flow/flow_template/edit', params }) return request.post({ url: '/flow/flow_template/edit', data })
} }
// 流程模板删除 // 流程模板删除
export function flow_template_delete(params: Record<string, any>) { export function flow_template_delete(data: Record<string, any>) {
return request.post({ url: '/flow/flow_template/del', params }) return request.post({ url: '/flow/flow_template/del', data })
} }

View File

@@ -11,8 +11,8 @@ export function noticeDetail(params: any) {
} }
// 通知设置保存 // 通知设置保存
export function setNoticeConfig(params: any) { export function setNoticeConfig(data: any) {
return request.post({ url: '/setting/notice/save', params }) return request.post({ url: '/setting/notice/save', data })
} }
// 短信设置列表 // 短信设置列表
@@ -26,6 +26,6 @@ export function smsDetail(params: any) {
} }
// 短信设置保存 // 短信设置保存
export function setSmsConfig(params: any) { export function setSmsConfig(data: any) {
return request.post({ url: '/setting/sms/save', params }) return request.post({ url: '/setting/sms/save', data })
} }

View File

@@ -15,16 +15,16 @@ export function monitor_client_detail(params: Record<string, any>) {
} }
// 客户端信息新增 // 客户端信息新增
export function monitor_client_add(params: Record<string, any>) { export function monitor_client_add(data: Record<string, any>) {
return request.post({ url: '/monitor_client/add', params }) return request.post({ url: '/monitor_client/add', data })
} }
// 客户端信息编辑 // 客户端信息编辑
export function monitor_client_edit(params: Record<string, any>) { export function monitor_client_edit(data: Record<string, any>) {
return request.post({ url: '/monitor_client/edit', params }) return request.post({ url: '/monitor_client/edit', data })
} }
// 客户端信息删除 // 客户端信息删除
export function monitor_client_delete(params: Record<string, any>) { export function monitor_client_delete(data: Record<string, any>) {
return request.post({ url: '/monitor_client/del', params }) return request.post({ url: '/monitor_client/del', data })
} }

View File

@@ -15,16 +15,16 @@ export function monitor_project_detail(params: Record<string, any>) {
} }
// 错误项目新增 // 错误项目新增
export function monitor_project_add(params: Record<string, any>) { export function monitor_project_add(data: Record<string, any>) {
return request.post({ url: '/monitor_project/add', params }) return request.post({ url: '/monitor_project/add', data })
} }
// 错误项目编辑 // 错误项目编辑
export function monitor_project_edit(params: Record<string, any>) { export function monitor_project_edit(data: Record<string, any>) {
return request.post({ url: '/monitor_project/edit', params }) return request.post({ url: '/monitor_project/edit', data })
} }
// 错误项目删除 // 错误项目删除
export function monitor_project_delete(params: Record<string, any>) { export function monitor_project_delete(data: Record<string, any>) {
return request.post({ url: '/monitor_project/del', params }) return request.post({ url: '/monitor_project/del', data })
} }

View File

@@ -18,18 +18,18 @@ export function monitor_web_detail(params: Record<string, any>) {
} }
// 错误收集error新增 // 错误收集error新增
export function monitor_web_add(params: Record<string, any>) { export function monitor_web_add(data: Record<string, any>) {
return request.post({ url: '/monitor_web/add', params }) return request.post({ url: '/monitor_web/add', data })
} }
// 错误收集error编辑 // 错误收集error编辑
export function monitor_web_edit(params: Record<string, any>) { export function monitor_web_edit(data: Record<string, any>) {
return request.post({ url: '/monitor_web/edit', params }) return request.post({ url: '/monitor_web/edit', data })
} }
// 错误收集error删除 // 错误收集error删除
export function monitor_web_delete(params: Record<string, any>) { export function monitor_web_delete(data: Record<string, any>) {
return request.post({ url: '/monitor_web/del', params }) return request.post({ url: '/monitor_web/del', data })
} }
// 错误收集error导入 // 错误收集error导入

View File

@@ -8,22 +8,22 @@ export function deptLists(params?: any) {
export function deptAll(params?: any) { export function deptAll(params?: any) {
return request.get({ url: '/system/dept/all', params }) return request.get({ url: '/system/dept/all', params })
} }
// 添加部门
export function deptAdd(params: any) {
return request.post({ url: '/system/dept/add', params })
}
// 编辑部门
export function deptEdit(params: any) {
return request.post({ url: '/system/dept/edit', params })
}
// 删除部门
export function deptDelete(params: any) {
return request.post({ url: '/system/dept/del', params })
}
// 部门详情 // 部门详情
export function deptDetail(params?: any) { export function deptDetail(params?: any) {
return request.get({ url: '/system/dept/detail', params }) return request.get({ url: '/system/dept/detail', params })
} }
// 添加部门
export function deptAdd(data: any) {
return request.post({ url: '/system/dept/add', data })
}
// 编辑部门
export function deptEdit(data: any) {
return request.post({ url: '/system/dept/edit', data })
}
// 删除部门
export function deptDelete(data: any) {
return request.post({ url: '/system/dept/del', data })
}

View File

@@ -1,30 +1,29 @@
import request from '@/utils/request' import request from '@/utils/request'
// 岗位详情
export function postDetail(params: any) {
return request.get({ url: '/system/post/detail', params })
}
// 岗位列表 // 岗位列表
export function postLists(params?: any) { export function postLists(params?: any) {
return request.get({ url: '/system/post/list', params }) return request.get({ url: '/system/post/list', params })
} }
// 岗位列表 // 岗位全部列表
export function postAll(params?: any) { export function postAll(params?: any) {
return request.get({ url: '/system/post/all', params }) return request.get({ url: '/system/post/all', params })
} }
// 添加岗位 // 添加岗位
export function postAdd(params: any) { export function postAdd(data: any) {
return request.post({ url: '/system/post/add', params }) return request.post({ url: '/system/post/add', data })
} }
// 编辑岗位 // 编辑岗位
export function postEdit(params: any) { export function postEdit(data: any) {
return request.post({ url: '/system/post/edit', params }) return request.post({ url: '/system/post/edit', data })
} }
// 删除岗位 // 删除岗位
export function postDelete(params: any) { export function postDelete(data: any) {
return request.post({ url: '/system/post/del', params }) return request.post({ url: '/system/post/del', data })
}
// 岗位详情
export function postDetail(params: any) {
return request.get({ url: '/system/post/detail', params })
} }

View File

@@ -6,30 +6,29 @@ import config from '@/config'
export function adminLists(params: any) { export function adminLists(params: any) {
return request.get({ url: '/system/admin/list', params }) return request.get({ url: '/system/admin/list', params })
} }
// 管理员详情
// 管理员添加
export function adminAdd(params: any) {
return request.post({ url: '/system/admin/add', params })
}
// 管理员编辑
export function adminDetail(params: any) { export function adminDetail(params: any) {
return request.get({ url: '/system/admin/detail', params }) return request.get({ url: '/system/admin/detail', params })
} }
// 管理员添加
export function adminAdd(data: any) {
return request.post({ url: '/system/admin/add', data })
}
// 管理员编辑 // 管理员编辑
export function adminEdit(params: any) { export function adminEdit(data: any) {
return request.post({ url: '/system/admin/edit', params }) return request.post({ url: '/system/admin/edit', data })
} }
// 管理员删除 // 管理员删除
export function adminDelete(params: any) { export function adminDelete(data: any) {
return request.post({ url: '/system/admin/del', params }) return request.post({ url: '/system/admin/del', data })
} }
// 管理员删除 // 管理员删除
export function adminStatus(params: any) { export function adminStatus(data: any) {
return request.post({ url: '/system/admin/disable', params }) return request.post({ url: '/system/admin/disable', data })
} }
// 部门下的管理员 // 部门下的管理员

View File

@@ -4,23 +4,22 @@ import request from '@/utils/request'
export function menuLists(params?: Record<string, any>) { export function menuLists(params?: Record<string, any>) {
return request.get({ url: '/system/menu/list', params }) return request.get({ url: '/system/menu/list', params })
} }
// 菜单
// 添加菜单
export function menuAdd(params: Record<string, any>) {
return request.post({ url: '/system/menu/add', params })
}
// 编辑菜单
export function menuEdit(params: Record<string, any>) {
return request.post({ url: '/system/menu/edit', params })
}
// 菜单删除
export function menuDelete(params: Record<string, any>) {
return request.post({ url: '/system/menu/del', params })
}
// 菜单删除
export function menuDetail(params: Record<string, any>) { export function menuDetail(params: Record<string, any>) {
return request.get({ url: '/system/menu/detail', params }) return request.get({ url: '/system/menu/detail', params })
} }
// 添加菜单
export function menuAdd(data: Record<string, any>) {
return request.post({ url: '/system/menu/add', data })
}
// 编辑菜单
export function menuEdit(data: Record<string, any>) {
return request.post({ url: '/system/menu/edit', data })
}
// 菜单删除
export function menuDelete(data: Record<string, any>) {
return request.post({ url: '/system/menu/del', data })
}

View File

@@ -16,14 +16,14 @@ export function roleDetail(params: any) {
} }
// 添加角色 // 添加角色
export function roleAdd(params: any) { export function roleAdd(data: any) {
return request.post({ url: '/system/role/add', params }) return request.post({ url: '/system/role/add', data })
} }
// 编辑角色 // 编辑角色
export function roleEdit(params: any) { export function roleEdit(data: any) {
return request.post({ url: '/system/role/edit', params }) return request.post({ url: '/system/role/edit', data })
} }
// 删除角色 // 删除角色
export function roleDelete(params: any) { export function roleDelete(data: any) {
return request.post({ url: '/system/role/del', params }) return request.post({ url: '/system/role/del', data })
} }

View File

@@ -11,51 +11,43 @@ export function dictTypeAll(params?: any) {
} }
// 添加字典类型 // 添加字典类型
export function dictTypeAdd(params: any) { export function dictTypeAdd(data: any) {
return request.post({ url: '/setting/dict/type/add', params }) return request.post({ url: '/setting/dict/type/add', data })
} }
// 编辑字典类型 // 编辑字典类型
export function dictTypeEdit(params: any) { export function dictTypeEdit(data: any) {
return request.post({ url: '/setting/dict/type/edit', params }) return request.post({ url: '/setting/dict/type/edit', data })
} }
// 删除字典类型 // 删除字典类型
export function dictTypeDelete(params: any) { export function dictTypeDelete(data: any) {
return request.post({ url: '/setting/dict/type/del', params }) return request.post({ url: '/setting/dict/type/del', data })
} }
// 字典数据列表 // 字典数据列表
// export function dictDataLists(params: any) { // export function dictDataLists(params: any) {
// return request.get( // return request.get(
// { url: '/setting/dict/data/list', params }, // { url: '/setting/dict/data/list', params },
// {
// ignoreCancelToken: true
// }
// ) // )
// } // }
// 字典数据列表 // 字典数据列表
export function dictDataAll(params: any) { export function dictDataAll(params: any) {
return request.get( return request.get({ url: '/setting/dict/data/all', params })
{ url: '/setting/dict/data/all', params },
{
ignoreCancelToken: true
}
)
} }
// 添加字典数据 // 添加字典数据
export function dictDataAdd(params: any) { export function dictDataAdd(data: any) {
return request.post({ url: '/setting/dict/data/add', params }) return request.post({ url: '/setting/dict/data/add', data })
} }
// 编辑字典数据 // 编辑字典数据
export function dictDataEdit(params: any) { export function dictDataEdit(data: any) {
return request.post({ url: '/setting/dict/data/edit', params }) return request.post({ url: '/setting/dict/data/edit', data })
} }
// 删除字典数据 // 删除字典数据
export function dictDataDelete(params: any) { export function dictDataDelete(data: any) {
return request.post({ url: '/setting/dict/data/del', params }) return request.post({ url: '/setting/dict/data/del', data })
} }

View File

@@ -13,8 +13,8 @@ export function getUserSetup() {
* @param { string } defaultAvatar 默认用户头像 * @param { string } defaultAvatar 默认用户头像
* @description 设置用户设置 * @description 设置用户设置
*/ */
export function setUserSetup(params: { defaultAvatar: string }) { export function setUserSetup(data: { defaultAvatar: string }) {
return request.post({ url: '/setting/user/save', params }) return request.post({ url: '/setting/user/save', data })
} }
/** /**
@@ -37,6 +37,6 @@ export interface LoginSetup {
* @param { LoginSetup } LoginSetup * @param { LoginSetup } LoginSetup
* @description 设置登录注册规则 * @description 设置登录注册规则
*/ */
export function setLogin(params: LoginSetup) { export function setLogin(data: LoginSetup) {
return request.post({ url: '/setting/login/save', params }) return request.post({ url: '/setting/login/save', data })
} }

View File

@@ -5,16 +5,16 @@ export function getCopyright() {
return request.get({ url: '/setting/copyright/detail' }) return request.get({ url: '/setting/copyright/detail' })
} }
// 设置备案信息 // 设置备案信息
export function setCopyright(params: any) { export function setCopyright(data: any) {
return request.post({ url: '/setting/copyright/save', params }) return request.post({ url: '/setting/copyright/save', data })
} }
// 获取网站信息 // 获取网站信息
export function getWebsite() { export function getWebsite() {
return request.get({ url: '/setting/website/detail' }) return request.get({ url: '/setting/website/detail' })
} }
// 设置网站信息 // 设置网站信息
export function setWebsite(params: any) { export function setWebsite(data: any) {
return request.post({ url: '/setting/website/save', params }) return request.post({ url: '/setting/website/save', data })
} }
// 获取政策协议 // 获取政策协议
@@ -22,8 +22,8 @@ export function getProtocol() {
return request.get({ url: '/setting/protocol/detail' }) return request.get({ url: '/setting/protocol/detail' })
} }
// 设置政策协议 // 设置政策协议
export function setProtocol(params: any) { export function setProtocol(data: any) {
return request.post({ url: '/setting/protocol/save', params }) return request.post({ url: '/setting/protocol/save', data })
} }
// 获取网站接口列表 // 获取网站接口列表

View File

@@ -12,12 +12,7 @@ export function dataTable(params: any) {
//选择要生成代码的数据表 //选择要生成代码的数据表
export function selectTable(params: any) { export function selectTable(params: any) {
return request.post( return request.post({ url: '/gen/importTable', params })
{ url: '/gen/importTable', params },
{
isParamsToData: false
}
)
} }
// 已选择的数据表详情 // 已选择的数据表详情
@@ -27,27 +22,22 @@ export function tableDetail(params: any) {
//同步字段 //同步字段
export function syncColumn(params: any) { export function syncColumn(params: any) {
return request.post( return request.post({ url: '/gen/syncTable', params })
{ url: '/gen/syncTable', params },
{
isParamsToData: false
}
)
} }
//删除已选择的数据表 //删除已选择的数据表
export function generateDelete(params: any) { export function generateDelete(data: any) {
return request.post({ url: '/gen/delTable', params }) return request.post({ url: '/gen/delTable', data })
} }
//编辑已选表字段 //编辑已选表字段
export function generateEdit(params: any) { export function generateEdit(data: any) {
return request.post({ url: '/gen/editTable', params }) return request.post({ url: '/gen/editTable', data })
} }
//预览代码 //预览代码
export function generatePreview(params: any) { export function generatePreview(data: any) {
return request.get({ url: '/gen/previewCode', params }) return request.get({ url: '/gen/previewCode', data })
} }
//下载代码 //下载代码

View File

@@ -2,8 +2,8 @@ import config from '@/config'
import request from '@/utils/request' import request from '@/utils/request'
// 登录 // 登录
export function login(params: Record<string, any>) { export function login(data: Record<string, any>) {
return request.post({ url: '/system/login', params: { ...params, terminal: config.terminal } }) return request.post({ url: '/system/login', data: { ...data, terminal: config.terminal } })
} }
// 退出登录 // 退出登录
@@ -22,6 +22,6 @@ export function getMenu() {
} }
// 编辑管理员信息 // 编辑管理员信息
export function setUserInfo(params: any) { export function setUserInfo(data: any) {
return request.post({ url: '/system/admin/upInfo', params }) return request.post({ url: '/system/admin/upInfo', data })
} }

View File

@@ -1,5 +1,6 @@
import { RequestMethodsEnum } from '@/enums/requestEnums' import { RequestMethodsEnum } from '@/enums/requestEnums'
import axios, { AxiosError } from 'axios' import axios, { AxiosError } from 'axios'
import type { import type {
AxiosInstance, AxiosInstance,
AxiosRequestConfig, AxiosRequestConfig,
@@ -8,15 +9,17 @@ import type {
} from 'axios' } from 'axios'
import { isFunction, merge, cloneDeep } from 'lodash-es' import { isFunction, merge, cloneDeep } from 'lodash-es'
import type { RequestData, RequestOptions } from './type' import type { RequestOptions, AxiosHooks } from './type'
export class Axios { export class Axios {
private axiosInstance: AxiosInstance private axiosInstance: AxiosInstance
private readonly config: AxiosRequestConfig // private readonly config: AxiosRequestConfig
private readonly options: RequestOptions private readonly options: RequestOptions
constructor(config: AxiosRequestConfig) { private readonly axiosHooks: AxiosHooks
this.config = config constructor(config: AxiosRequestConfig, options: RequestOptions, axiosHooks: AxiosHooks) {
this.options = config.requestOptions // this.config = config
this.axiosHooks = axiosHooks
this.options = options
this.axiosInstance = axios.create(config) this.axiosInstance = axios.create(config)
this.setupInterceptors() this.setupInterceptors()
} }
@@ -32,7 +35,7 @@ export class Axios {
* @description 设置拦截器 * @description 设置拦截器
*/ */
setupInterceptors() { setupInterceptors() {
if (!this.config.axiosHooks) { if (!this.axiosHooks) {
return return
} }
const { const {
@@ -40,7 +43,7 @@ export class Axios {
requestInterceptorsCatchHook, requestInterceptorsCatchHook,
responseInterceptorsHook, responseInterceptorsHook,
responseInterceptorsCatchHook responseInterceptorsCatchHook
} = this.config.axiosHooks } = this.axiosHooks
this.axiosInstance.interceptors.request.use( this.axiosInstance.interceptors.request.use(
(config) => { (config) => {
if (isFunction(requestInterceptorsHook)) { if (isFunction(requestInterceptorsHook)) {
@@ -56,7 +59,7 @@ export class Axios {
} }
) )
this.axiosInstance.interceptors.response.use( this.axiosInstance.interceptors.response.use(
(response: any) => { (response: AxiosResponse) => {
if (isFunction(responseInterceptorsHook)) { if (isFunction(responseInterceptorsHook)) {
response = responseInterceptorsHook(response) response = responseInterceptorsHook(response)
} }
@@ -95,23 +98,20 @@ export class Axios {
/** /**
* @description 请求函数 * @description 请求函数
*/ */
request<T = any>( request(config: Partial<AxiosRequestConfig>, options?: Partial<RequestOptions>): Promise<any> {
config: Partial<AxiosRequestConfig>,
options?: Partial<RequestOptions>
): Promise<any> {
const opt: RequestOptions = merge({}, this.options, options) const opt: RequestOptions = merge({}, this.options, options)
const axioxConfig: AxiosRequestConfig = { const axiosConfig: AxiosRequestConfig = {
...cloneDeep(config), ...cloneDeep(config),
requestOptions: opt requestOptions: opt
} }
const { urlPrefix } = opt const { urlPrefix } = opt
// 拼接请求前缀如api // 拼接请求前缀如api
if (urlPrefix) { if (urlPrefix) {
axioxConfig.url = `${urlPrefix}${config.url}` axiosConfig.url = `${urlPrefix}${config.url}`
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.axiosInstance this.axiosInstance
.request<any, AxiosResponse<RequestData<T>>>(axioxConfig) .request(axiosConfig)
.then((res) => { .then((res) => {
resolve(res) resolve(res)
}) })

View File

@@ -1,12 +1,14 @@
import { merge } from 'lodash-es' import { merge } from 'lodash-es'
import configs from '@/config' import configs from '@/config'
import { Axios } from './axios' import { Axios } from './axios'
import { ContentTypeEnum, RequestCodeEnum, RequestMethodsEnum } from '@/enums/requestEnums' import { ContentTypeEnum, RequestCodeEnum } from '@/enums/requestEnums'
import type { AxiosHooks } from './type' import type { AxiosHooks } from './type'
import { clearAuthInfo, getToken } from '../auth' import { clearAuthInfo, getToken } from '../auth'
import feedback from '../feedback' import feedback from '../feedback'
import NProgress from 'nprogress' import NProgress from 'nprogress'
import { AxiosError, type AxiosRequestConfig } from 'axios' import { AxiosError } from 'axios'
import type { AxiosRequestConfig, AxiosResponse } from 'axios'
import router from '@/router' import router from '@/router'
import { PageEnum } from '@/enums/pageEnum' import { PageEnum } from '@/enums/pageEnum'
@@ -14,24 +16,16 @@ import { PageEnum } from '@/enums/pageEnum'
const axiosHooks: AxiosHooks = { const axiosHooks: AxiosHooks = {
requestInterceptorsHook(config) { requestInterceptorsHook(config) {
NProgress.start() NProgress.start()
const { withToken, isParamsToData } = config.requestOptions
const params = config.params || {} // const params = config.params || {}
const headers = config.headers || {} const headers = config.headers || {}
// 添加token // 添加token
if (withToken) { const token = getToken()
const token = getToken() if (token) {
headers.token = token headers.token = token
} }
// POST请求下如果无data则将params视为data
if (
isParamsToData &&
!Reflect.has(config, 'data') &&
config.method?.toUpperCase() === RequestMethodsEnum.POST
) {
config.data = params
config.params = {}
}
config.headers = headers config.headers = headers
return config return config
}, },
@@ -39,7 +33,9 @@ const axiosHooks: AxiosHooks = {
NProgress.done() NProgress.done()
return err return err
}, },
async responseInterceptorsHook(response) { async responseInterceptorsHook(response: AxiosResponse) {
console.log('返回Hook', response)
NProgress.done() NProgress.done()
const { isTransformResponse, isReturnDefaultResponse } = response.config.requestOptions const { isTransformResponse, isReturnDefaultResponse } = response.config.requestOptions
@@ -51,12 +47,9 @@ const axiosHooks: AxiosHooks = {
if (!isTransformResponse) { if (!isTransformResponse) {
return response.data return response.data
} }
const { code, data, show, msg } = response.data const { code, data, msg } = response.data
switch (code) { switch (code) {
case RequestCodeEnum.SUCCESS: case RequestCodeEnum.SUCCESS:
if (show) {
msg && feedback.msgSuccess(msg)
}
return data return data
case RequestCodeEnum.PARAMS_TYPE_ERROR: case RequestCodeEnum.PARAMS_TYPE_ERROR:
@@ -82,7 +75,15 @@ const axiosHooks: AxiosHooks = {
return data return data
} }
}, },
/**
* 错误处理
* @param error
* @returns
*/
responseInterceptorsCatchHook(error) { responseInterceptorsCatchHook(error) {
console.log('返回异常Hook', error)
NProgress.done() NProgress.done()
if (error.code !== AxiosError.ERR_CANCELED) { if (error.code !== AxiosError.ERR_CANCELED) {
error.message && feedback.msgError(error.message) error.message && feedback.msgError(error.message)
@@ -95,35 +96,27 @@ const defaultOptions: AxiosRequestConfig = {
timeout: configs.timeout, timeout: configs.timeout,
// 基础接口地址 // 基础接口地址
baseURL: configs.baseUrl, baseURL: configs.baseUrl,
headers: { 'Content-Type': ContentTypeEnum.JSON, version: configs.version }, headers: { 'Content-Type': ContentTypeEnum.JSON, version: configs.version }
// 处理 axios的钩子函数 // // 处理 axios的钩子函数
axiosHooks: axiosHooks, // axiosHooks: axiosHooks,
// 每个接口可以单独配置 // 每个接口可以单独配置
requestOptions: { }
// 是否将params视为data参数仅限post请求 const requestOptions = {
isParamsToData: true, //是否返回默认的响应
//是否返回默认的响应 isReturnDefaultResponse: false,
isReturnDefaultResponse: false, // 需要对返回数据进行处理
// 需要对返回数据进行处理 isTransformResponse: true,
isTransformResponse: true, // 接口拼接地址
// 接口拼接地址 urlPrefix: configs.urlPrefix
urlPrefix: configs.urlPrefix,
// 忽略重复请求
ignoreCancelToken: false,
// 是否携带token
withToken: true,
// 开启请求超时重新发起请求请求机制
isOpenRetry: true,
// 重新请求次数
retryCount: 2
}
} }
function createAxios(opt?: Partial<AxiosRequestConfig>) { function createAxios(opt?: Partial<AxiosRequestConfig>) {
return new Axios( return new Axios(
// 深度合并 // 深度合并
merge(defaultOptions, opt || {}) merge(defaultOptions, opt || {}),
requestOptions,
axiosHooks
) )
} }
const request = createAxios() const request = createAxios()

View File

@@ -4,20 +4,14 @@ import 'axios'
declare module 'axios' { declare module 'axios' {
// 扩展 RouteMeta // 扩展 RouteMeta
interface AxiosRequestConfig { interface AxiosRequestConfig {
axiosHooks?: AxiosHooks
requestOptions?: RequestOptions requestOptions?: RequestOptions
} }
} }
export interface RequestOptions { export interface RequestOptions {
isParamsToData: boolean
isReturnDefaultResponse: boolean isReturnDefaultResponse: boolean
isTransformResponse: boolean isTransformResponse: boolean
urlPrefix: string urlPrefix: string
ignoreCancelToken: boolean
withToken: boolean
isOpenRetry: boolean
retryCount: number
} }
export interface AxiosHooks { export interface AxiosHooks {
@@ -27,9 +21,8 @@ export interface AxiosHooks {
responseInterceptorsCatchHook?: (error: AxiosError) => void responseInterceptorsCatchHook?: (error: AxiosError) => void
} }
export interface RequestData<T = any> { export interface ResponseData<T = any> {
code: number code: number
data: T data: T
msg: string msg: string
show: boolean
} }

View File

@@ -140,7 +140,7 @@ const formRules = {
], ],
clientTime: [ clientTime: [
{ {
required: true, required: false,
message: '请输入客户端时间', message: '请输入客户端时间',
trigger: ['blur'] trigger: ['blur']
} }
@@ -152,10 +152,14 @@ const handleSubmit = async () => {
await formRef.value?.validate() await formRef.value?.validate()
const data: any = { ...formData } const data: any = { ...formData }
mode.value == 'edit' ? await monitor_web_edit(data) : await monitor_web_add(data) mode.value == 'edit' ? await monitor_web_edit(data) : await monitor_web_add(data)
popupRef.value?.close() // popupRef.value?.close()
feedback.msgSuccess('操作成功') feedback.msgSuccess('操作成功')
emit('success') emit('success')
} catch (error) {} } catch (error) {
console.log('error', error)
feedback.msgError(error?.message || error || '操作失败')
}
} }
const open = (type = 'add') => { const open = (type = 'add') => {

View File

@@ -9,7 +9,7 @@
label-width="70px" label-width="70px"
label-position="left" label-position="left"
> >
<el-form-item label="项目Key" prop="projectKey" class="w-[280px]"> <el-form-item label="项目" prop="projectKey" class="w-[280px]">
<el-select v-model="queryParams.projectKey" clearable> <el-select v-model="queryParams.projectKey" clearable>
<el-option <el-option
:label="project.projectName" :label="project.projectName"

View File

@@ -19,18 +19,18 @@ export function {{{.ModuleName}}}_detail(params: Record<string, any>) {
} }
// {{{.FunctionName}}}新增 // {{{.FunctionName}}}新增
export function {{{.ModuleName}}}_add(params: Record<string, any>) { export function {{{.ModuleName}}}_add(data: Record<string, any>) {
return request.post({ url: '/{{{.ModuleName}}}/add', params }) return request.post({ url: '/{{{.ModuleName}}}/add', data })
} }
// {{{.FunctionName}}}编辑 // {{{.FunctionName}}}编辑
export function {{{.ModuleName}}}_edit(params: Record<string, any>) { export function {{{.ModuleName}}}_edit(data: Record<string, any>) {
return request.post({ url: '/{{{.ModuleName}}}/edit', params }) return request.post({ url: '/{{{.ModuleName}}}/edit', data })
} }
// {{{.FunctionName}}}删除 // {{{.FunctionName}}}删除
export function {{{.ModuleName}}}_delete(params: Record<string, any>) { export function {{{.ModuleName}}}_delete(data: Record<string, any>) {
return request.post({ url: '/{{{.ModuleName}}}/del', params }) return request.post({ url: '/{{{.ModuleName}}}/del', data })
} }
// {{{.FunctionName}}}导入 // {{{.FunctionName}}}导入

View File

@@ -23,25 +23,25 @@ type MonitorWebDetailReq struct {
//MonitorWebAddReq 错误收集error新增参数 //MonitorWebAddReq 错误收集error新增参数
type MonitorWebAddReq struct { type MonitorWebAddReq struct {
ProjectKey string `form:"projectKey"` // 项目key ProjectKey string `form:"projectKey"` // 项目key
ClientId string `form:"clientId"` // sdk生成的客户端id ClientId string `form:"clientId"` // sdk生成的客户端id
EventType string `form:"eventType"` // 事件类型 EventType string `form:"eventType"` // 事件类型
Page string `form:"page"` // URL地址 Page string `form:"page"` // URL地址
Message string `form:"message"` // 错误消息 Message string `form:"message"` // 错误消息
Stack string `form:"stack"` // 错误堆栈 Stack string `form:"stack"` // 错误堆栈
ClientTime string `form:"clientTime"` // 客户端时间 ClientTime core.TsTime `form:"clientTime"` // 客户端时间
} }
//MonitorWebEditReq 错误收集error编辑参数 //MonitorWebEditReq 错误收集error编辑参数
type MonitorWebEditReq struct { type MonitorWebEditReq struct {
Id int `form:"id"` // uuid Id int `form:"id"` // uuid
ProjectKey string `form:"projectKey"` // 项目key ProjectKey string `form:"projectKey"` // 项目key
ClientId string `form:"clientId"` // sdk生成的客户端id ClientId string `form:"clientId"` // sdk生成的客户端id
EventType string `form:"eventType"` // 事件类型 EventType string `form:"eventType"` // 事件类型
Page string `form:"page"` // URL地址 Page string `form:"page"` // URL地址
Message string `form:"message"` // 错误消息 Message string `form:"message"` // 错误消息
Stack string `form:"stack"` // 错误堆栈 Stack string `form:"stack"` // 错误堆栈
ClientTime string `form:"clientTime"` // 客户端时间 ClientTime core.TsTime `form:"clientTime"` // 客户端时间
} }
//MonitorWebDelReq 错误收集error新增参数 //MonitorWebDelReq 错误收集error新增参数

View File

@@ -94,9 +94,9 @@ func (loginSrv systemLoginService) Login(c *gin.Context, req *SystemLoginReq) (r
util.RedisUtil.Set(config.AdminConfig.BackstageTokenKey+token, adminIdStr, 7200) util.RedisUtil.Set(config.AdminConfig.BackstageTokenKey+token, adminIdStr, 7200)
admin.Service.CacheAdminUserByUid(sysAdmin.ID) admin.Service.CacheAdminUserByUid(sysAdmin.ID)
u := system_model.SystemAuthAdmin{LastLoginIp: c.ClientIP(), LastLoginTime: core.NowTime()}
// 更新登录信息 // 更新登录信息
err = loginSrv.db.Model(&sysAdmin).Updates( err = loginSrv.db.Model(&sysAdmin).Updates(u).Error
system_model.SystemAuthAdmin{LastLoginIp: c.ClientIP(), LastLoginTime: core.NowTime()}).Error
if err != nil { if err != nil {
if e = loginSrv.RecordLoginLog(c, sysAdmin.ID, req.Username, response.SystemError.Msg()); e != nil { if e = loginSrv.RecordLoginLog(c, sysAdmin.ID, req.Username, response.SystemError.Msg()); e != nil {
return return

View File

@@ -15,25 +15,6 @@ const TimeFormat = "2006-01-02 15:04:05"
// TsTime 自定义时间格式 // TsTime 自定义时间格式
type TsTime time.Time type TsTime time.Time
type OnlyRespTsTime time.Time
// func (tst *TsTime) UnmarshalJSON(bs []byte) error {
// var date string
// err := json.Unmarshal(bs, &date)
// if err != nil {
// return err
// }
// tt, _ := time.ParseInLocation(TimeFormat, date, time.Local)
// *tst = TsTime(tt.Unix())
// return nil
// }
// // MarshalJSON 将TsTime类型的时间转化为JSON字符串格式
// // 返回转化后的JSON字符串和错误信息
// func (tst TsTime) MarshalJSON() ([]byte, error) {
// tt := time.Unix(int64(tst), 0).Format(TimeFormat)
// return json.Marshal(tt)
// }
// 通过时间字符串生成时间戳 // 通过时间字符串生成时间戳
func ToUnix(date string) int64 { func ToUnix(date string) int64 {
@@ -43,17 +24,11 @@ func ToUnix(date string) int64 {
tt, _ := time.ParseInLocation(TimeFormat, date, time.Local) tt, _ := time.ParseInLocation(TimeFormat, date, time.Local)
return tt.Unix() return tt.Unix()
} }
func NowTime() TsTime { func NowTime() TsTime {
return TsTime(time.Now()) return TsTime(time.Now())
} }
func (otst OnlyRespTsTime) MarshalJSON() ([]byte, error) {
tt := time.Time(otst).Format(TimeFormat)
return json.Marshal(tt)
}
// type TsTime time.Time
func (tst *TsTime) UnmarshalJSON(bs []byte) error { func (tst *TsTime) UnmarshalJSON(bs []byte) error {
var date string var date string
err := json.Unmarshal(bs, &date) err := json.Unmarshal(bs, &date)

View File

@@ -31,7 +31,7 @@ type SystemAuthAdmin struct {
IsDisable uint8 `gorm:"not null;default:0;comment:'是否禁用: 0=否, 1=是'"` IsDisable uint8 `gorm:"not null;default:0;comment:'是否禁用: 0=否, 1=是'"`
IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"` IsDelete soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:flag,DeletedAtField:DeleteTime;comment:'是否删除: 0=否, 1=是'"`
LastLoginIp string `gorm:"not null;default:'';comment:'最后登录IP'"` LastLoginIp string `gorm:"not null;default:'';comment:'最后登录IP'"`
LastLoginTime core.TsTime `gorm:"not null;default:null;comment:'最后登录时间'"` LastLoginTime core.TsTime `gorm:"default:null;comment:'最后登录时间'"`
CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"` CreateTime core.TsTime `gorm:"autoCreateTime;not null;comment:'创建时间'"`
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"` UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"` DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`