mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-10-27 01:50:33 +08:00
优化ts
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
"consola": "^3.2.3",
|
||||
"crypto-js": "^4.2.0",
|
||||
"css-color-function": "^1.3.3",
|
||||
"dayjs": "^1.11.11",
|
||||
"echarts": "^5.5.0",
|
||||
"element-plus": "^2.7.2",
|
||||
"highlight.js": "^11.9.0",
|
||||
|
||||
@@ -10,18 +10,18 @@ export function articleCateAll(params?: any) {
|
||||
}
|
||||
|
||||
// 添加文章分类
|
||||
export function articleCateAdd(params: any) {
|
||||
return request.post({ url: '/article/cate/add', params })
|
||||
export function articleCateAdd(data: any) {
|
||||
return request.post({ url: '/article/cate/add', data })
|
||||
}
|
||||
|
||||
// 编辑文章分类
|
||||
export function articleCateEdit(params: any) {
|
||||
return request.post({ url: '/article/cate/edit', params })
|
||||
export function articleCateEdit(data: any) {
|
||||
return request.post({ url: '/article/cate/edit', data })
|
||||
}
|
||||
|
||||
// 删除文章分类
|
||||
export function articleCateDelete(params: any) {
|
||||
return request.post({ url: '/article/cate/del', params })
|
||||
export function articleCateDelete(data: any) {
|
||||
return request.post({ url: '/article/cate/del', data })
|
||||
}
|
||||
|
||||
// 文章分类详情
|
||||
@@ -30,8 +30,8 @@ export function articleCateDetail(params: any) {
|
||||
}
|
||||
|
||||
// 文章分类状态
|
||||
export function articleCateStatus(params: any) {
|
||||
return request.post({ url: '/article/cate/change', params })
|
||||
export function articleCateStatus(data: any) {
|
||||
return request.post({ url: '/article/cate/change', data })
|
||||
}
|
||||
|
||||
// 文章列表
|
||||
@@ -44,18 +44,18 @@ export function articleAll(params?: any) {
|
||||
}
|
||||
|
||||
// 添加文章
|
||||
export function articleAdd(params: any) {
|
||||
return request.post({ url: '/article/add', params })
|
||||
export function articleAdd(data: any) {
|
||||
return request.post({ url: '/article/add', data })
|
||||
}
|
||||
|
||||
// 编辑文章
|
||||
export function articleEdit(params: any) {
|
||||
return request.post({ url: '/article/edit', params })
|
||||
export function articleEdit(data: any) {
|
||||
return request.post({ url: '/article/edit', data })
|
||||
}
|
||||
|
||||
// 删除文章
|
||||
export function articleDelete(params: any) {
|
||||
return request.post({ url: '/article/del', params })
|
||||
export function articleDelete(data: any) {
|
||||
return request.post({ url: '/article/del', data })
|
||||
}
|
||||
|
||||
// 文章详情
|
||||
@@ -64,6 +64,6 @@ export function articleDetail(params: any) {
|
||||
}
|
||||
|
||||
// 文章分类状态
|
||||
export function articleStatus(params: any) {
|
||||
return request.post({ url: '/article/change', params })
|
||||
export function articleStatus(data: any) {
|
||||
return request.post({ url: '/article/change', data })
|
||||
}
|
||||
|
||||
@@ -11,16 +11,16 @@ export function article_collect_detail(params: Record<string, any>) {
|
||||
}
|
||||
|
||||
// 文章收藏新增
|
||||
export function article_collect_add(params: Record<string, any>) {
|
||||
return request.post({ url: '/article_collect/add', params })
|
||||
export function article_collect_add(data: Record<string, any>) {
|
||||
return request.post({ url: '/article_collect/add', data })
|
||||
}
|
||||
|
||||
// 文章收藏编辑
|
||||
export function article_collect_edit(params: Record<string, any>) {
|
||||
return request.post({ url: '/article_collect/edit', params })
|
||||
export function article_collect_edit(data: Record<string, any>) {
|
||||
return request.post({ url: '/article_collect/edit', data })
|
||||
}
|
||||
|
||||
// 文章收藏删除
|
||||
export function article_collect_delete(params: Record<string, any>) {
|
||||
return request.post({ url: '/article_collect/del', params })
|
||||
export function article_collect_delete(data: Record<string, any>) {
|
||||
return request.post({ url: '/article_collect/del', data })
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ export function getUserDetail(params: any) {
|
||||
}
|
||||
|
||||
// 用户编辑
|
||||
export function userEdit(params: any) {
|
||||
return request.post({ url: '/user/edit', params })
|
||||
export function userEdit(data: any) {
|
||||
return request.post({ url: '/user/edit', data })
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function fileCateAdd(params: Record<string, any>) {
|
||||
return request.post({ url: '/common/album/cateAdd', params })
|
||||
export function fileCateAdd(data: Record<string, any>) {
|
||||
return request.post({ url: '/common/album/cateAdd', data })
|
||||
}
|
||||
|
||||
export function fileCateEdit(params: Record<string, any>) {
|
||||
return request.post({ url: '/common/album/cateRename', params })
|
||||
export function fileCateEdit(data: Record<string, any>) {
|
||||
return request.post({ url: '/common/album/cateRename', data })
|
||||
}
|
||||
|
||||
// 文件分类删除
|
||||
export function fileCateDelete(params: Record<string, any>) {
|
||||
return request.post({ url: '/common/album/cateDel', params })
|
||||
export function fileCateDelete(data: Record<string, any>) {
|
||||
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>) {
|
||||
return request.post({ url: '/common/album/albumDel', params })
|
||||
export function fileDelete(data: Record<string, any>) {
|
||||
return request.post({ url: '/common/album/albumDel', data })
|
||||
}
|
||||
|
||||
// 文件移动
|
||||
export function fileMove(params: Record<string, any>) {
|
||||
return request.post({ url: '/common/album/albumMove', params })
|
||||
export function fileMove(data: Record<string, any>) {
|
||||
return request.post({ url: '/common/album/albumMove', data })
|
||||
}
|
||||
|
||||
// 文件重命名
|
||||
export function fileRename(params: { id: number; name: string }) {
|
||||
return request.post({ url: '/common/album/albumRename', params })
|
||||
export function fileRename(data: { id: number; name: string }) {
|
||||
return request.post({ url: '/common/album/albumRename', data })
|
||||
}
|
||||
|
||||
@@ -11,16 +11,16 @@ export function flow_apply_detail(params: Record<string, any>) {
|
||||
}
|
||||
|
||||
// 申请流程新增
|
||||
export function flow_apply_add(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_apply/add', params })
|
||||
export function flow_apply_add(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_apply/add', data })
|
||||
}
|
||||
|
||||
// 申请流程编辑
|
||||
export function flow_apply_edit(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_apply/edit', params })
|
||||
export function flow_apply_edit(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_apply/edit', data })
|
||||
}
|
||||
|
||||
// 申请流程删除
|
||||
export function flow_apply_delete(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_apply/del', params })
|
||||
export function flow_apply_delete(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_apply/del', data })
|
||||
}
|
||||
|
||||
@@ -15,33 +15,33 @@ export function flow_history_detail(params: Record<string, any>) {
|
||||
}
|
||||
|
||||
// 流程历史新增
|
||||
export function flow_history_add(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/add', params })
|
||||
export function flow_history_add(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/add', data })
|
||||
}
|
||||
|
||||
// 流程历史编辑
|
||||
export function flow_history_edit(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/edit', params })
|
||||
export function flow_history_edit(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/edit', data })
|
||||
}
|
||||
|
||||
// 流程历史删除
|
||||
export function flow_history_delete(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/del', params })
|
||||
export function flow_history_delete(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/del', data })
|
||||
}
|
||||
|
||||
// 获取下一个审批节点,中间可能有系统任务和结束节点被跳过
|
||||
export function flow_history_next_node(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/next_node', params })
|
||||
export function flow_history_next_node(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/next_node', data })
|
||||
}
|
||||
|
||||
// 获取下一个审批节点,中间可能有系统任务和结束节点被跳过
|
||||
export function flow_history_get_approver(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/get_approver', params })
|
||||
export function flow_history_get_approver(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/get_approver', data })
|
||||
}
|
||||
export function flow_history_pass(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/pass', params })
|
||||
export function flow_history_pass(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/pass', data })
|
||||
}
|
||||
|
||||
export function flow_history_back(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/back', params })
|
||||
export function flow_history_back(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_history/back', data })
|
||||
}
|
||||
|
||||
@@ -16,16 +16,16 @@ export function flow_template_detail(params: Record<string, any>) {
|
||||
}
|
||||
|
||||
// 流程模板新增
|
||||
export function flow_template_add(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_template/add', params })
|
||||
export function flow_template_add(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_template/add', data })
|
||||
}
|
||||
|
||||
// 流程模板编辑
|
||||
export function flow_template_edit(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_template/edit', params })
|
||||
export function flow_template_edit(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_template/edit', data })
|
||||
}
|
||||
|
||||
// 流程模板删除
|
||||
export function flow_template_delete(params: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_template/del', params })
|
||||
export function flow_template_delete(data: Record<string, any>) {
|
||||
return request.post({ url: '/flow/flow_template/del', data })
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ export function noticeDetail(params: any) {
|
||||
}
|
||||
|
||||
// 通知设置保存
|
||||
export function setNoticeConfig(params: any) {
|
||||
return request.post({ url: '/setting/notice/save', params })
|
||||
export function setNoticeConfig(data: any) {
|
||||
return request.post({ url: '/setting/notice/save', data })
|
||||
}
|
||||
|
||||
// 短信设置列表
|
||||
@@ -26,6 +26,6 @@ export function smsDetail(params: any) {
|
||||
}
|
||||
|
||||
// 短信设置保存
|
||||
export function setSmsConfig(params: any) {
|
||||
return request.post({ url: '/setting/sms/save', params })
|
||||
export function setSmsConfig(data: any) {
|
||||
return request.post({ url: '/setting/sms/save', data })
|
||||
}
|
||||
|
||||
@@ -15,16 +15,16 @@ export function monitor_client_detail(params: Record<string, any>) {
|
||||
}
|
||||
|
||||
// 客户端信息新增
|
||||
export function monitor_client_add(params: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_client/add', params })
|
||||
export function monitor_client_add(data: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_client/add', data })
|
||||
}
|
||||
|
||||
// 客户端信息编辑
|
||||
export function monitor_client_edit(params: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_client/edit', params })
|
||||
export function monitor_client_edit(data: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_client/edit', data })
|
||||
}
|
||||
|
||||
// 客户端信息删除
|
||||
export function monitor_client_delete(params: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_client/del', params })
|
||||
export function monitor_client_delete(data: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_client/del', data })
|
||||
}
|
||||
|
||||
@@ -15,16 +15,16 @@ export function monitor_project_detail(params: Record<string, any>) {
|
||||
}
|
||||
|
||||
// 错误项目新增
|
||||
export function monitor_project_add(params: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_project/add', params })
|
||||
export function monitor_project_add(data: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_project/add', data })
|
||||
}
|
||||
|
||||
// 错误项目编辑
|
||||
export function monitor_project_edit(params: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_project/edit', params })
|
||||
export function monitor_project_edit(data: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_project/edit', data })
|
||||
}
|
||||
|
||||
// 错误项目删除
|
||||
export function monitor_project_delete(params: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_project/del', params })
|
||||
export function monitor_project_delete(data: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_project/del', data })
|
||||
}
|
||||
|
||||
@@ -18,18 +18,18 @@ export function monitor_web_detail(params: Record<string, any>) {
|
||||
}
|
||||
|
||||
// 错误收集error新增
|
||||
export function monitor_web_add(params: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_web/add', params })
|
||||
export function monitor_web_add(data: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_web/add', data })
|
||||
}
|
||||
|
||||
// 错误收集error编辑
|
||||
export function monitor_web_edit(params: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_web/edit', params })
|
||||
export function monitor_web_edit(data: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_web/edit', data })
|
||||
}
|
||||
|
||||
// 错误收集error删除
|
||||
export function monitor_web_delete(params: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_web/del', params })
|
||||
export function monitor_web_delete(data: Record<string, any>) {
|
||||
return request.post({ url: '/monitor_web/del', data })
|
||||
}
|
||||
|
||||
// 错误收集error导入
|
||||
|
||||
@@ -8,22 +8,22 @@ export function deptLists(params?: any) {
|
||||
export function deptAll(params?: any) {
|
||||
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) {
|
||||
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 })
|
||||
}
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
import request from '@/utils/request'
|
||||
// 岗位详情
|
||||
export function postDetail(params: any) {
|
||||
return request.get({ url: '/system/post/detail', params })
|
||||
}
|
||||
|
||||
// 岗位列表
|
||||
export function postLists(params?: any) {
|
||||
return request.get({ url: '/system/post/list', params })
|
||||
}
|
||||
// 岗位列表
|
||||
// 岗位全部列表
|
||||
export function postAll(params?: any) {
|
||||
return request.get({ url: '/system/post/all', params })
|
||||
}
|
||||
|
||||
// 添加岗位
|
||||
export function postAdd(params: any) {
|
||||
return request.post({ url: '/system/post/add', params })
|
||||
export function postAdd(data: any) {
|
||||
return request.post({ url: '/system/post/add', data })
|
||||
}
|
||||
|
||||
// 编辑岗位
|
||||
export function postEdit(params: any) {
|
||||
return request.post({ url: '/system/post/edit', params })
|
||||
export function postEdit(data: any) {
|
||||
return request.post({ url: '/system/post/edit', data })
|
||||
}
|
||||
|
||||
// 删除岗位
|
||||
export function postDelete(params: any) {
|
||||
return request.post({ url: '/system/post/del', params })
|
||||
}
|
||||
|
||||
// 岗位详情
|
||||
export function postDetail(params: any) {
|
||||
return request.get({ url: '/system/post/detail', params })
|
||||
export function postDelete(data: any) {
|
||||
return request.post({ url: '/system/post/del', data })
|
||||
}
|
||||
|
||||
@@ -6,30 +6,29 @@ import config from '@/config'
|
||||
export function adminLists(params: any) {
|
||||
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) {
|
||||
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) {
|
||||
return request.post({ url: '/system/admin/edit', params })
|
||||
export function adminEdit(data: any) {
|
||||
return request.post({ url: '/system/admin/edit', data })
|
||||
}
|
||||
|
||||
// 管理员删除
|
||||
export function adminDelete(params: any) {
|
||||
return request.post({ url: '/system/admin/del', params })
|
||||
export function adminDelete(data: any) {
|
||||
return request.post({ url: '/system/admin/del', data })
|
||||
}
|
||||
|
||||
// 管理员删除
|
||||
export function adminStatus(params: any) {
|
||||
return request.post({ url: '/system/admin/disable', params })
|
||||
export function adminStatus(data: any) {
|
||||
return request.post({ url: '/system/admin/disable', data })
|
||||
}
|
||||
|
||||
// 部门下的管理员
|
||||
|
||||
@@ -4,23 +4,22 @@ import request from '@/utils/request'
|
||||
export function menuLists(params?: Record<string, any>) {
|
||||
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>) {
|
||||
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 })
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@ export function roleDetail(params: any) {
|
||||
}
|
||||
|
||||
// 添加角色
|
||||
export function roleAdd(params: any) {
|
||||
return request.post({ url: '/system/role/add', params })
|
||||
export function roleAdd(data: any) {
|
||||
return request.post({ url: '/system/role/add', data })
|
||||
}
|
||||
// 编辑角色
|
||||
export function roleEdit(params: any) {
|
||||
return request.post({ url: '/system/role/edit', params })
|
||||
export function roleEdit(data: any) {
|
||||
return request.post({ url: '/system/role/edit', data })
|
||||
}
|
||||
// 删除角色
|
||||
export function roleDelete(params: any) {
|
||||
return request.post({ url: '/system/role/del', params })
|
||||
export function roleDelete(data: any) {
|
||||
return request.post({ url: '/system/role/del', data })
|
||||
}
|
||||
|
||||
@@ -11,51 +11,43 @@ export function dictTypeAll(params?: any) {
|
||||
}
|
||||
|
||||
// 添加字典类型
|
||||
export function dictTypeAdd(params: any) {
|
||||
return request.post({ url: '/setting/dict/type/add', params })
|
||||
export function dictTypeAdd(data: any) {
|
||||
return request.post({ url: '/setting/dict/type/add', data })
|
||||
}
|
||||
|
||||
// 编辑字典类型
|
||||
export function dictTypeEdit(params: any) {
|
||||
return request.post({ url: '/setting/dict/type/edit', params })
|
||||
export function dictTypeEdit(data: any) {
|
||||
return request.post({ url: '/setting/dict/type/edit', data })
|
||||
}
|
||||
|
||||
// 删除字典类型
|
||||
export function dictTypeDelete(params: any) {
|
||||
return request.post({ url: '/setting/dict/type/del', params })
|
||||
export function dictTypeDelete(data: any) {
|
||||
return request.post({ url: '/setting/dict/type/del', data })
|
||||
}
|
||||
|
||||
// 字典数据列表
|
||||
// export function dictDataLists(params: any) {
|
||||
// return request.get(
|
||||
// { url: '/setting/dict/data/list', params },
|
||||
// {
|
||||
// ignoreCancelToken: true
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
|
||||
// 字典数据列表
|
||||
export function dictDataAll(params: any) {
|
||||
return request.get(
|
||||
{ url: '/setting/dict/data/all', params },
|
||||
{
|
||||
ignoreCancelToken: true
|
||||
}
|
||||
)
|
||||
return request.get({ url: '/setting/dict/data/all', params })
|
||||
}
|
||||
|
||||
// 添加字典数据
|
||||
export function dictDataAdd(params: any) {
|
||||
return request.post({ url: '/setting/dict/data/add', params })
|
||||
export function dictDataAdd(data: any) {
|
||||
return request.post({ url: '/setting/dict/data/add', data })
|
||||
}
|
||||
|
||||
// 编辑字典数据
|
||||
export function dictDataEdit(params: any) {
|
||||
return request.post({ url: '/setting/dict/data/edit', params })
|
||||
export function dictDataEdit(data: any) {
|
||||
return request.post({ url: '/setting/dict/data/edit', data })
|
||||
}
|
||||
|
||||
// 删除字典数据
|
||||
export function dictDataDelete(params: any) {
|
||||
return request.post({ url: '/setting/dict/data/del', params })
|
||||
export function dictDataDelete(data: any) {
|
||||
return request.post({ url: '/setting/dict/data/del', data })
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ export function getUserSetup() {
|
||||
* @param { string } defaultAvatar 默认用户头像
|
||||
* @description 设置用户设置
|
||||
*/
|
||||
export function setUserSetup(params: { defaultAvatar: string }) {
|
||||
return request.post({ url: '/setting/user/save', params })
|
||||
export function setUserSetup(data: { defaultAvatar: string }) {
|
||||
return request.post({ url: '/setting/user/save', data })
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,6 +37,6 @@ export interface LoginSetup {
|
||||
* @param { LoginSetup } LoginSetup
|
||||
* @description 设置登录注册规则
|
||||
*/
|
||||
export function setLogin(params: LoginSetup) {
|
||||
return request.post({ url: '/setting/login/save', params })
|
||||
export function setLogin(data: LoginSetup) {
|
||||
return request.post({ url: '/setting/login/save', data })
|
||||
}
|
||||
|
||||
@@ -5,16 +5,16 @@ export function getCopyright() {
|
||||
return request.get({ url: '/setting/copyright/detail' })
|
||||
}
|
||||
// 设置备案信息
|
||||
export function setCopyright(params: any) {
|
||||
return request.post({ url: '/setting/copyright/save', params })
|
||||
export function setCopyright(data: any) {
|
||||
return request.post({ url: '/setting/copyright/save', data })
|
||||
}
|
||||
// 获取网站信息
|
||||
export function getWebsite() {
|
||||
return request.get({ url: '/setting/website/detail' })
|
||||
}
|
||||
// 设置网站信息
|
||||
export function setWebsite(params: any) {
|
||||
return request.post({ url: '/setting/website/save', params })
|
||||
export function setWebsite(data: any) {
|
||||
return request.post({ url: '/setting/website/save', data })
|
||||
}
|
||||
|
||||
// 获取政策协议
|
||||
@@ -22,8 +22,8 @@ export function getProtocol() {
|
||||
return request.get({ url: '/setting/protocol/detail' })
|
||||
}
|
||||
// 设置政策协议
|
||||
export function setProtocol(params: any) {
|
||||
return request.post({ url: '/setting/protocol/save', params })
|
||||
export function setProtocol(data: any) {
|
||||
return request.post({ url: '/setting/protocol/save', data })
|
||||
}
|
||||
|
||||
// 获取网站接口列表
|
||||
|
||||
@@ -12,12 +12,7 @@ export function dataTable(params: any) {
|
||||
|
||||
//选择要生成代码的数据表
|
||||
export function selectTable(params: any) {
|
||||
return request.post(
|
||||
{ url: '/gen/importTable', params },
|
||||
{
|
||||
isParamsToData: false
|
||||
}
|
||||
)
|
||||
return request.post({ url: '/gen/importTable', params })
|
||||
}
|
||||
|
||||
// 已选择的数据表详情
|
||||
@@ -27,27 +22,22 @@ export function tableDetail(params: any) {
|
||||
|
||||
//同步字段
|
||||
export function syncColumn(params: any) {
|
||||
return request.post(
|
||||
{ url: '/gen/syncTable', params },
|
||||
{
|
||||
isParamsToData: false
|
||||
}
|
||||
)
|
||||
return request.post({ url: '/gen/syncTable', params })
|
||||
}
|
||||
|
||||
//删除已选择的数据表
|
||||
export function generateDelete(params: any) {
|
||||
return request.post({ url: '/gen/delTable', params })
|
||||
export function generateDelete(data: any) {
|
||||
return request.post({ url: '/gen/delTable', data })
|
||||
}
|
||||
|
||||
//编辑已选表字段
|
||||
export function generateEdit(params: any) {
|
||||
return request.post({ url: '/gen/editTable', params })
|
||||
export function generateEdit(data: any) {
|
||||
return request.post({ url: '/gen/editTable', data })
|
||||
}
|
||||
|
||||
//预览代码
|
||||
export function generatePreview(params: any) {
|
||||
return request.get({ url: '/gen/previewCode', params })
|
||||
export function generatePreview(data: any) {
|
||||
return request.get({ url: '/gen/previewCode', data })
|
||||
}
|
||||
|
||||
//下载代码
|
||||
|
||||
@@ -2,8 +2,8 @@ import config from '@/config'
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 登录
|
||||
export function login(params: Record<string, any>) {
|
||||
return request.post({ url: '/system/login', params: { ...params, terminal: config.terminal } })
|
||||
export function login(data: Record<string, any>) {
|
||||
return request.post({ url: '/system/login', data: { ...data, terminal: config.terminal } })
|
||||
}
|
||||
|
||||
// 退出登录
|
||||
@@ -22,6 +22,6 @@ export function getMenu() {
|
||||
}
|
||||
|
||||
// 编辑管理员信息
|
||||
export function setUserInfo(params: any) {
|
||||
return request.post({ url: '/system/admin/upInfo', params })
|
||||
export function setUserInfo(data: any) {
|
||||
return request.post({ url: '/system/admin/upInfo', data })
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { RequestMethodsEnum } from '@/enums/requestEnums'
|
||||
import axios, { AxiosError } from 'axios'
|
||||
|
||||
import type {
|
||||
AxiosInstance,
|
||||
AxiosRequestConfig,
|
||||
@@ -8,15 +9,17 @@ import type {
|
||||
} from 'axios'
|
||||
import { isFunction, merge, cloneDeep } from 'lodash-es'
|
||||
|
||||
import type { RequestData, RequestOptions } from './type'
|
||||
import type { RequestOptions, AxiosHooks } from './type'
|
||||
|
||||
export class Axios {
|
||||
private axiosInstance: AxiosInstance
|
||||
private readonly config: AxiosRequestConfig
|
||||
// private readonly config: AxiosRequestConfig
|
||||
private readonly options: RequestOptions
|
||||
constructor(config: AxiosRequestConfig) {
|
||||
this.config = config
|
||||
this.options = config.requestOptions
|
||||
private readonly axiosHooks: AxiosHooks
|
||||
constructor(config: AxiosRequestConfig, options: RequestOptions, axiosHooks: AxiosHooks) {
|
||||
// this.config = config
|
||||
this.axiosHooks = axiosHooks
|
||||
this.options = options
|
||||
this.axiosInstance = axios.create(config)
|
||||
this.setupInterceptors()
|
||||
}
|
||||
@@ -32,7 +35,7 @@ export class Axios {
|
||||
* @description 设置拦截器
|
||||
*/
|
||||
setupInterceptors() {
|
||||
if (!this.config.axiosHooks) {
|
||||
if (!this.axiosHooks) {
|
||||
return
|
||||
}
|
||||
const {
|
||||
@@ -40,7 +43,7 @@ export class Axios {
|
||||
requestInterceptorsCatchHook,
|
||||
responseInterceptorsHook,
|
||||
responseInterceptorsCatchHook
|
||||
} = this.config.axiosHooks
|
||||
} = this.axiosHooks
|
||||
this.axiosInstance.interceptors.request.use(
|
||||
(config) => {
|
||||
if (isFunction(requestInterceptorsHook)) {
|
||||
@@ -56,7 +59,7 @@ export class Axios {
|
||||
}
|
||||
)
|
||||
this.axiosInstance.interceptors.response.use(
|
||||
(response: any) => {
|
||||
(response: AxiosResponse) => {
|
||||
if (isFunction(responseInterceptorsHook)) {
|
||||
response = responseInterceptorsHook(response)
|
||||
}
|
||||
@@ -95,23 +98,20 @@ export class Axios {
|
||||
/**
|
||||
* @description 请求函数
|
||||
*/
|
||||
request<T = any>(
|
||||
config: Partial<AxiosRequestConfig>,
|
||||
options?: Partial<RequestOptions>
|
||||
): Promise<any> {
|
||||
request(config: Partial<AxiosRequestConfig>, options?: Partial<RequestOptions>): Promise<any> {
|
||||
const opt: RequestOptions = merge({}, this.options, options)
|
||||
const axioxConfig: AxiosRequestConfig = {
|
||||
const axiosConfig: AxiosRequestConfig = {
|
||||
...cloneDeep(config),
|
||||
requestOptions: opt
|
||||
}
|
||||
const { urlPrefix } = opt
|
||||
// 拼接请求前缀如api
|
||||
if (urlPrefix) {
|
||||
axioxConfig.url = `${urlPrefix}${config.url}`
|
||||
axiosConfig.url = `${urlPrefix}${config.url}`
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
this.axiosInstance
|
||||
.request<any, AxiosResponse<RequestData<T>>>(axioxConfig)
|
||||
.request(axiosConfig)
|
||||
.then((res) => {
|
||||
resolve(res)
|
||||
})
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { merge } from 'lodash-es'
|
||||
import configs from '@/config'
|
||||
import { Axios } from './axios'
|
||||
import { ContentTypeEnum, RequestCodeEnum, RequestMethodsEnum } from '@/enums/requestEnums'
|
||||
import { ContentTypeEnum, RequestCodeEnum } from '@/enums/requestEnums'
|
||||
import type { AxiosHooks } from './type'
|
||||
import { clearAuthInfo, getToken } from '../auth'
|
||||
import feedback from '../feedback'
|
||||
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 { PageEnum } from '@/enums/pageEnum'
|
||||
|
||||
@@ -14,24 +16,16 @@ import { PageEnum } from '@/enums/pageEnum'
|
||||
const axiosHooks: AxiosHooks = {
|
||||
requestInterceptorsHook(config) {
|
||||
NProgress.start()
|
||||
const { withToken, isParamsToData } = config.requestOptions
|
||||
const params = config.params || {}
|
||||
|
||||
// const params = config.params || {}
|
||||
const headers = config.headers || {}
|
||||
|
||||
// 添加token
|
||||
if (withToken) {
|
||||
const token = getToken()
|
||||
if (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
|
||||
return config
|
||||
},
|
||||
@@ -39,7 +33,9 @@ const axiosHooks: AxiosHooks = {
|
||||
NProgress.done()
|
||||
return err
|
||||
},
|
||||
async responseInterceptorsHook(response) {
|
||||
async responseInterceptorsHook(response: AxiosResponse) {
|
||||
console.log('返回Hook', response)
|
||||
|
||||
NProgress.done()
|
||||
const { isTransformResponse, isReturnDefaultResponse } = response.config.requestOptions
|
||||
|
||||
@@ -51,12 +47,9 @@ const axiosHooks: AxiosHooks = {
|
||||
if (!isTransformResponse) {
|
||||
return response.data
|
||||
}
|
||||
const { code, data, show, msg } = response.data
|
||||
const { code, data, msg } = response.data
|
||||
switch (code) {
|
||||
case RequestCodeEnum.SUCCESS:
|
||||
if (show) {
|
||||
msg && feedback.msgSuccess(msg)
|
||||
}
|
||||
return data
|
||||
|
||||
case RequestCodeEnum.PARAMS_TYPE_ERROR:
|
||||
@@ -82,7 +75,15 @@ const axiosHooks: AxiosHooks = {
|
||||
return data
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 错误处理
|
||||
* @param error
|
||||
* @returns
|
||||
*/
|
||||
responseInterceptorsCatchHook(error) {
|
||||
console.log('返回异常Hook', error)
|
||||
|
||||
NProgress.done()
|
||||
if (error.code !== AxiosError.ERR_CANCELED) {
|
||||
error.message && feedback.msgError(error.message)
|
||||
@@ -95,35 +96,27 @@ const defaultOptions: AxiosRequestConfig = {
|
||||
timeout: configs.timeout,
|
||||
// 基础接口地址
|
||||
baseURL: configs.baseUrl,
|
||||
headers: { 'Content-Type': ContentTypeEnum.JSON, version: configs.version },
|
||||
headers: { 'Content-Type': ContentTypeEnum.JSON, version: configs.version }
|
||||
|
||||
// 处理 axios的钩子函数
|
||||
axiosHooks: axiosHooks,
|
||||
// // 处理 axios的钩子函数
|
||||
// axiosHooks: axiosHooks,
|
||||
// 每个接口可以单独配置
|
||||
requestOptions: {
|
||||
// 是否将params视为data参数,仅限post请求
|
||||
isParamsToData: true,
|
||||
}
|
||||
const requestOptions = {
|
||||
//是否返回默认的响应
|
||||
isReturnDefaultResponse: false,
|
||||
// 需要对返回数据进行处理
|
||||
isTransformResponse: true,
|
||||
// 接口拼接地址
|
||||
urlPrefix: configs.urlPrefix,
|
||||
// 忽略重复请求
|
||||
ignoreCancelToken: false,
|
||||
// 是否携带token
|
||||
withToken: true,
|
||||
// 开启请求超时重新发起请求请求机制
|
||||
isOpenRetry: true,
|
||||
// 重新请求次数
|
||||
retryCount: 2
|
||||
}
|
||||
urlPrefix: configs.urlPrefix
|
||||
}
|
||||
|
||||
function createAxios(opt?: Partial<AxiosRequestConfig>) {
|
||||
return new Axios(
|
||||
// 深度合并
|
||||
merge(defaultOptions, opt || {})
|
||||
merge(defaultOptions, opt || {}),
|
||||
requestOptions,
|
||||
axiosHooks
|
||||
)
|
||||
}
|
||||
const request = createAxios()
|
||||
|
||||
9
admin/src/utils/request/type.d.ts
vendored
9
admin/src/utils/request/type.d.ts
vendored
@@ -4,20 +4,14 @@ import 'axios'
|
||||
declare module 'axios' {
|
||||
// 扩展 RouteMeta
|
||||
interface AxiosRequestConfig {
|
||||
axiosHooks?: AxiosHooks
|
||||
requestOptions?: RequestOptions
|
||||
}
|
||||
}
|
||||
|
||||
export interface RequestOptions {
|
||||
isParamsToData: boolean
|
||||
isReturnDefaultResponse: boolean
|
||||
isTransformResponse: boolean
|
||||
urlPrefix: string
|
||||
ignoreCancelToken: boolean
|
||||
withToken: boolean
|
||||
isOpenRetry: boolean
|
||||
retryCount: number
|
||||
}
|
||||
|
||||
export interface AxiosHooks {
|
||||
@@ -27,9 +21,8 @@ export interface AxiosHooks {
|
||||
responseInterceptorsCatchHook?: (error: AxiosError) => void
|
||||
}
|
||||
|
||||
export interface RequestData<T = any> {
|
||||
export interface ResponseData<T = any> {
|
||||
code: number
|
||||
data: T
|
||||
msg: string
|
||||
show: boolean
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ const formRules = {
|
||||
],
|
||||
clientTime: [
|
||||
{
|
||||
required: true,
|
||||
required: false,
|
||||
message: '请输入客户端时间',
|
||||
trigger: ['blur']
|
||||
}
|
||||
@@ -152,10 +152,14 @@ const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data: any = { ...formData }
|
||||
mode.value == 'edit' ? await monitor_web_edit(data) : await monitor_web_add(data)
|
||||
popupRef.value?.close()
|
||||
// popupRef.value?.close()
|
||||
feedback.msgSuccess('操作成功')
|
||||
emit('success')
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
console.log('error', error)
|
||||
|
||||
feedback.msgError(error?.message || error || '操作失败')
|
||||
}
|
||||
}
|
||||
|
||||
const open = (type = 'add') => {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
label-width="70px"
|
||||
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-option
|
||||
:label="project.projectName"
|
||||
|
||||
@@ -19,18 +19,18 @@ export function {{{.ModuleName}}}_detail(params: Record<string, any>) {
|
||||
}
|
||||
|
||||
// {{{.FunctionName}}}新增
|
||||
export function {{{.ModuleName}}}_add(params: Record<string, any>) {
|
||||
return request.post({ url: '/{{{.ModuleName}}}/add', params })
|
||||
export function {{{.ModuleName}}}_add(data: Record<string, any>) {
|
||||
return request.post({ url: '/{{{.ModuleName}}}/add', data })
|
||||
}
|
||||
|
||||
// {{{.FunctionName}}}编辑
|
||||
export function {{{.ModuleName}}}_edit(params: Record<string, any>) {
|
||||
return request.post({ url: '/{{{.ModuleName}}}/edit', params })
|
||||
export function {{{.ModuleName}}}_edit(data: Record<string, any>) {
|
||||
return request.post({ url: '/{{{.ModuleName}}}/edit', data })
|
||||
}
|
||||
|
||||
// {{{.FunctionName}}}删除
|
||||
export function {{{.ModuleName}}}_delete(params: Record<string, any>) {
|
||||
return request.post({ url: '/{{{.ModuleName}}}/del', params })
|
||||
export function {{{.ModuleName}}}_delete(data: Record<string, any>) {
|
||||
return request.post({ url: '/{{{.ModuleName}}}/del', data })
|
||||
}
|
||||
|
||||
// {{{.FunctionName}}}导入
|
||||
|
||||
@@ -29,7 +29,7 @@ type MonitorWebAddReq struct {
|
||||
Page string `form:"page"` // URL地址
|
||||
Message string `form:"message"` // 错误消息
|
||||
Stack string `form:"stack"` // 错误堆栈
|
||||
ClientTime string `form:"clientTime"` // 客户端时间
|
||||
ClientTime core.TsTime `form:"clientTime"` // 客户端时间
|
||||
}
|
||||
|
||||
//MonitorWebEditReq 错误收集error编辑参数
|
||||
@@ -41,7 +41,7 @@ type MonitorWebEditReq struct {
|
||||
Page string `form:"page"` // URL地址
|
||||
Message string `form:"message"` // 错误消息
|
||||
Stack string `form:"stack"` // 错误堆栈
|
||||
ClientTime string `form:"clientTime"` // 客户端时间
|
||||
ClientTime core.TsTime `form:"clientTime"` // 客户端时间
|
||||
}
|
||||
|
||||
//MonitorWebDelReq 错误收集error新增参数
|
||||
|
||||
@@ -94,9 +94,9 @@ func (loginSrv systemLoginService) Login(c *gin.Context, req *SystemLoginReq) (r
|
||||
util.RedisUtil.Set(config.AdminConfig.BackstageTokenKey+token, adminIdStr, 7200)
|
||||
admin.Service.CacheAdminUserByUid(sysAdmin.ID)
|
||||
|
||||
u := system_model.SystemAuthAdmin{LastLoginIp: c.ClientIP(), LastLoginTime: core.NowTime()}
|
||||
// 更新登录信息
|
||||
err = loginSrv.db.Model(&sysAdmin).Updates(
|
||||
system_model.SystemAuthAdmin{LastLoginIp: c.ClientIP(), LastLoginTime: core.NowTime()}).Error
|
||||
err = loginSrv.db.Model(&sysAdmin).Updates(u).Error
|
||||
if err != nil {
|
||||
if e = loginSrv.RecordLoginLog(c, sysAdmin.ID, req.Username, response.SystemError.Msg()); e != nil {
|
||||
return
|
||||
|
||||
@@ -15,25 +15,6 @@ const TimeFormat = "2006-01-02 15:04:05"
|
||||
|
||||
// TsTime 自定义时间格式
|
||||
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 {
|
||||
@@ -43,17 +24,11 @@ func ToUnix(date string) int64 {
|
||||
tt, _ := time.ParseInLocation(TimeFormat, date, time.Local)
|
||||
return tt.Unix()
|
||||
}
|
||||
|
||||
func NowTime() TsTime {
|
||||
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 {
|
||||
var date string
|
||||
err := json.Unmarshal(bs, &date)
|
||||
|
||||
@@ -31,7 +31,7 @@ type SystemAuthAdmin struct {
|
||||
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=是'"`
|
||||
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:'创建时间'"`
|
||||
UpdateTime core.TsTime `gorm:"autoUpdateTime;not null;comment:'更新时间'"`
|
||||
DeleteTime core.TsTime `gorm:"default:null;comment:'删除时间'"`
|
||||
|
||||
Reference in New Issue
Block a user