mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 20:55:14 +00:00
feat(system): 优化删除操作并添加清除在线用户功能
- 重构了多个模块的删除操作,支持批量删除 - 在线监控模块增加了清除所有在线用户的功能 - 优化了前端API接口,提高了可维护性
This commit is contained in:
@@ -43,7 +43,7 @@ async def get_online_list_controller(
|
|||||||
summary="强制下线",
|
summary="强制下线",
|
||||||
description="强制下线"
|
description="强制下线"
|
||||||
)
|
)
|
||||||
async def delete__online_controller(
|
async def delete_online_controller(
|
||||||
session_id: str = Body(..., description="会话编号"),
|
session_id: str = Body(..., description="会话编号"),
|
||||||
redis: Redis = Depends(redis_getter),
|
redis: Redis = Depends(redis_getter),
|
||||||
)->JSONResponse:
|
)->JSONResponse:
|
||||||
@@ -54,3 +54,20 @@ async def delete__online_controller(
|
|||||||
else:
|
else:
|
||||||
logger.info("强制下线失败")
|
logger.info("强制下线失败")
|
||||||
return ErrorResponse(msg="强制下线失败")
|
return ErrorResponse(msg="强制下线失败")
|
||||||
|
|
||||||
|
@router.delete(
|
||||||
|
'/clear',
|
||||||
|
dependencies=[Depends(AuthPermission(permissions=['monitor:online:delete']))],
|
||||||
|
summary="清除所有在线用户",
|
||||||
|
description="清除所有在线用户"
|
||||||
|
)
|
||||||
|
async def clear_online_controller(
|
||||||
|
redis: Redis = Depends(redis_getter),
|
||||||
|
)->JSONResponse:
|
||||||
|
is_ok = await OnlineService.clear_online_service(redis=redis)
|
||||||
|
if is_ok:
|
||||||
|
logger.info("清除所有在线用户成功")
|
||||||
|
return SuccessResponse(msg="清除所有在线用户成功")
|
||||||
|
else:
|
||||||
|
logger.info("清除所有在线用户失败")
|
||||||
|
return ErrorResponse(msg="清除所有在线用户失败")
|
||||||
@@ -63,7 +63,7 @@ async def get_new_token_controller(
|
|||||||
return SuccessResponse(data=token_dict, msg="刷新成功")
|
return SuccessResponse(data=token_dict, msg="刷新成功")
|
||||||
|
|
||||||
|
|
||||||
@router.post("/captcha/get", summary="获取验证码", description="获取登录验证码", response_model=CaptchaOutSchema)
|
@router.get("/captcha/get", summary="获取验证码", description="获取登录验证码", response_model=CaptchaOutSchema)
|
||||||
async def get_captcha_for_login_controller(
|
async def get_captcha_for_login_controller(
|
||||||
redis: Redis = Depends(redis_getter)
|
redis: Redis = Depends(redis_getter)
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Query, Request, UploadFile
|
from fastapi import APIRouter, Body, Depends, Query, Request, UploadFile
|
||||||
from fastapi.responses import JSONResponse, StreamingResponse
|
from fastapi.responses import JSONResponse, StreamingResponse
|
||||||
from aioredis import Redis
|
from aioredis import Redis
|
||||||
|
|
||||||
@@ -67,10 +67,10 @@ async def update_objs_controller(
|
|||||||
@router.delete("/delete", summary="删除系统配置", description="删除系统配置")
|
@router.delete("/delete", summary="删除系统配置", description="删除系统配置")
|
||||||
async def delete_type_controller(
|
async def delete_type_controller(
|
||||||
redis: Redis = Depends(redis_getter),
|
redis: Redis = Depends(redis_getter),
|
||||||
id: int = Query(..., description="系统配置ID"),
|
ids: list[int] = Body(..., description="ID列表"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:config:delete"]))
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:config:delete"]))
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
await ConfigService.delete_obj_service(auth=auth, redis=redis, id=id)
|
await ConfigService.delete_obj_service(auth=auth, redis=redis, ids=ids)
|
||||||
logger.info(f"删除系统配置成功: {id}")
|
logger.info(f"删除系统配置成功: {id}")
|
||||||
return SuccessResponse(msg="删除系统配置成功")
|
return SuccessResponse(msg="删除系统配置成功")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Query
|
from fastapi import APIRouter, Body, Depends, Query
|
||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
|
|
||||||
from app.common.response import SuccessResponse
|
from app.common.response import SuccessResponse
|
||||||
@@ -66,10 +66,10 @@ async def update_obj_controller(
|
|||||||
|
|
||||||
@router.delete("/delete", summary="删除部门", description="删除部门")
|
@router.delete("/delete", summary="删除部门", description="删除部门")
|
||||||
async def delete_obj_controller(
|
async def delete_obj_controller(
|
||||||
id: int = Query(..., description="部门ID"),
|
ids: list[int] = Body(..., description="ID列表"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:dept:delete"]))
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:dept:delete"]))
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
await DeptService.delete_dept_service(id=id, auth=auth)
|
await DeptService.delete_dept_service(ids=ids, auth=auth)
|
||||||
logger.info(f"删除部门成功: {id}")
|
logger.info(f"删除部门成功: {id}")
|
||||||
return SuccessResponse(msg="删除部门成功")
|
return SuccessResponse(msg="删除部门成功")
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from fastapi import APIRouter, Depends, Query
|
from fastapi import APIRouter, Body, Depends, Query
|
||||||
from fastapi.responses import JSONResponse, StreamingResponse
|
from fastapi.responses import JSONResponse, StreamingResponse
|
||||||
from aioredis import Redis
|
from aioredis import Redis
|
||||||
|
|
||||||
@@ -76,10 +76,10 @@ async def update_type_controller(
|
|||||||
@router.delete("/type/delete", summary="删除字典类型", description="删除字典类型")
|
@router.delete("/type/delete", summary="删除字典类型", description="删除字典类型")
|
||||||
async def delete_type_controller(
|
async def delete_type_controller(
|
||||||
redis: Redis = Depends(redis_getter),
|
redis: Redis = Depends(redis_getter),
|
||||||
id: int = Query(..., description="字典类型ID"),
|
ids: list[int] = Body(..., description="ID列表"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:dict_type:delete"]))
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:dict_type:delete"]))
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
await DictTypeService.delete_obj_service(auth=auth, redis=redis, id=id)
|
await DictTypeService.delete_obj_service(auth=auth, redis=redis, ids=ids)
|
||||||
logger.info(f"删除字典类型成功: {id}")
|
logger.info(f"删除字典类型成功: {id}")
|
||||||
return SuccessResponse(msg="删除字典类型成功")
|
return SuccessResponse(msg="删除字典类型成功")
|
||||||
|
|
||||||
@@ -144,10 +144,10 @@ async def update_data_controller(
|
|||||||
@router.delete("/data/delete", summary="删除字典数据", description="删除字典数据")
|
@router.delete("/data/delete", summary="删除字典数据", description="删除字典数据")
|
||||||
async def delete_data_controller(
|
async def delete_data_controller(
|
||||||
redis: Redis = Depends(redis_getter),
|
redis: Redis = Depends(redis_getter),
|
||||||
id: int = Query(..., description="字典数据ID"),
|
ids: list[int] = Body(..., description="ID列表"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:dict_data:delete"]))
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:dict_data:delete"]))
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
await DictDataService.delete_obj_service(auth=auth, redis=redis, id=id)
|
await DictDataService.delete_obj_service(auth=auth, redis=redis, ids=ids)
|
||||||
logger.info(f"删除字典数据成功: {id}")
|
logger.info(f"删除字典数据成功: {id}")
|
||||||
return SuccessResponse(msg="删除字典数据成功")
|
return SuccessResponse(msg="删除字典数据成功")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Query
|
from fastapi import APIRouter, Body, Depends, Query
|
||||||
from fastapi.responses import JSONResponse, StreamingResponse
|
from fastapi.responses import JSONResponse, StreamingResponse
|
||||||
|
|
||||||
from app.common.response import StreamResponse, SuccessResponse
|
from app.common.response import StreamResponse, SuccessResponse
|
||||||
@@ -62,10 +62,10 @@ async def update_obj_controller(
|
|||||||
|
|
||||||
@router.delete("/delete", summary="删除定时任务", description="删除定时任务")
|
@router.delete("/delete", summary="删除定时任务", description="删除定时任务")
|
||||||
async def delete_obj_controller(
|
async def delete_obj_controller(
|
||||||
id: int = Query(..., description="定时任务ID"),
|
ids: list[int] = Body(..., description="ID列表"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:job:delete"]))
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:job:delete"]))
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
await JobService.delete_job_service(auth=auth, id=id)
|
await JobService.delete_job_service(auth=auth, ids=ids)
|
||||||
logger.info(f"删除定时任务成功: {id}")
|
logger.info(f"删除定时任务成功: {id}")
|
||||||
return SuccessResponse(msg="删除定时任务成功")
|
return SuccessResponse(msg="删除定时任务成功")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Query
|
from fastapi import APIRouter, Body, Depends, Query
|
||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
|
|
||||||
from app.common.response import SuccessResponse
|
from app.common.response import SuccessResponse
|
||||||
@@ -67,10 +67,10 @@ async def update_obj_controller(
|
|||||||
|
|
||||||
@router.delete("/delete", summary="删除菜单", description="删除菜单")
|
@router.delete("/delete", summary="删除菜单", description="删除菜单")
|
||||||
async def delete_obj_controller(
|
async def delete_obj_controller(
|
||||||
id: int = Query(..., description="菜单ID"),
|
ids: list[int] = Body(..., description="ID列表"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:menu:delete"]))
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:menu:delete"]))
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
await MenuService.delete_menu_service(id=id, auth=auth)
|
await MenuService.delete_menu_service(ids=ids, auth=auth)
|
||||||
logger.info(f"删除菜单成功: {id}")
|
logger.info(f"删除菜单成功: {id}")
|
||||||
return SuccessResponse(msg="删除菜单成功")
|
return SuccessResponse(msg="删除菜单成功")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Query
|
from fastapi import APIRouter, Body, Depends, Query
|
||||||
from fastapi.responses import JSONResponse, StreamingResponse
|
from fastapi.responses import JSONResponse, StreamingResponse
|
||||||
|
|
||||||
from app.common.response import StreamResponse, SuccessResponse
|
from app.common.response import StreamResponse, SuccessResponse
|
||||||
@@ -62,10 +62,10 @@ async def update_obj_controller(
|
|||||||
|
|
||||||
@router.delete("/delete", summary="删除公告", description="删除公告")
|
@router.delete("/delete", summary="删除公告", description="删除公告")
|
||||||
async def delete_obj_controller(
|
async def delete_obj_controller(
|
||||||
id: int = Query(..., description="公告ID"),
|
ids: list[int] = Body(..., description="ID列表"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:notice:delete"]))
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:notice:delete"]))
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
await NoticeService.delete_notice_service(auth=auth, id=id)
|
await NoticeService.delete_notice_service(auth=auth, ids=ids)
|
||||||
logger.info(f"删除公告成功: {id}")
|
logger.info(f"删除公告成功: {id}")
|
||||||
return SuccessResponse(msg="删除公告成功")
|
return SuccessResponse(msg="删除公告成功")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Query
|
from fastapi import APIRouter, Body, Depends, Query
|
||||||
from fastapi.responses import JSONResponse, StreamingResponse
|
from fastapi.responses import JSONResponse, StreamingResponse
|
||||||
|
|
||||||
from app.common.request import PaginationService
|
from app.common.request import PaginationService
|
||||||
@@ -32,7 +32,7 @@ async def get_obj_list_controller(
|
|||||||
|
|
||||||
@router.get("/detail", summary="日志详情", description="日志详情")
|
@router.get("/detail", summary="日志详情", description="日志详情")
|
||||||
async def get_obj_detail_controller(
|
async def get_obj_detail_controller(
|
||||||
id: int = Query(..., description="操作日志ID"),
|
id: int = Body(..., description="操作日志ID"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:log:query"]))
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:log:query"]))
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
""" 详情日志 """
|
""" 详情日志 """
|
||||||
@@ -43,11 +43,11 @@ async def get_obj_detail_controller(
|
|||||||
|
|
||||||
@router.delete("/delete", summary="删除日志", description="删除日志")
|
@router.delete("/delete", summary="删除日志", description="删除日志")
|
||||||
async def delete_obj_log_controller(
|
async def delete_obj_log_controller(
|
||||||
id: int = Query(..., description="操作日志ID"),
|
ids: list[int] = Query(..., description="ID列表"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:log:delete"]))
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:log:delete"]))
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
""" 删除日志 """
|
""" 删除日志 """
|
||||||
await OperationLogService.delete_log_service(id=id, auth=auth)
|
await OperationLogService.delete_log_service(ids=ids, auth=auth)
|
||||||
logger.info(f"删除日志成功 {id}")
|
logger.info(f"删除日志成功 {id}")
|
||||||
return SuccessResponse(msg="删除日志成功")
|
return SuccessResponse(msg="删除日志成功")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Query
|
from fastapi import APIRouter, Body, Depends, Query
|
||||||
from fastapi.responses import JSONResponse, StreamingResponse
|
from fastapi.responses import JSONResponse, StreamingResponse
|
||||||
|
|
||||||
from app.common.response import StreamResponse, SuccessResponse
|
from app.common.response import StreamResponse, SuccessResponse
|
||||||
@@ -67,10 +67,10 @@ async def update_obj_controller(
|
|||||||
|
|
||||||
@router.delete("/delete", summary="删除岗位", description="删除岗位")
|
@router.delete("/delete", summary="删除岗位", description="删除岗位")
|
||||||
async def delete_obj_controller(
|
async def delete_obj_controller(
|
||||||
id: int = Query(..., description="岗位ID"),
|
ids: list[int] = Body(..., description="ID列表"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:position:delete"])),
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:position:delete"])),
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
await PositionService.delete_position_service(id=id, auth=auth)
|
await PositionService.delete_position_service(ids=ids, auth=auth)
|
||||||
logger.info(f"删除岗位成功: {id}")
|
logger.info(f"删除岗位成功: {id}")
|
||||||
return SuccessResponse(msg="删除岗位成功")
|
return SuccessResponse(msg="删除岗位成功")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Query
|
from fastapi import APIRouter, Body, Depends, Query
|
||||||
from fastapi.responses import JSONResponse, StreamingResponse
|
from fastapi.responses import JSONResponse, StreamingResponse
|
||||||
|
|
||||||
from app.common.response import StreamResponse, SuccessResponse
|
from app.common.response import StreamResponse, SuccessResponse
|
||||||
@@ -68,10 +68,10 @@ async def update_obj_controller(
|
|||||||
|
|
||||||
@router.delete("/delete", summary="删除角色", description="删除角色")
|
@router.delete("/delete", summary="删除角色", description="删除角色")
|
||||||
async def delete_obj_controller(
|
async def delete_obj_controller(
|
||||||
id: int = Query(..., description="角色ID"),
|
ids: list[int] = Body(..., description="ID列表"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:role:delete"])),
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:role:delete"])),
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
await RoleService.delete_role_service(id=id, auth=auth)
|
await RoleService.delete_role_service(ids=ids, auth=auth)
|
||||||
logger.info(f"删除角色成功: {id}")
|
logger.info(f"删除角色成功: {id}")
|
||||||
return SuccessResponse(msg="删除角色成功")
|
return SuccessResponse(msg="删除角色成功")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Query, UploadFile, Request
|
from fastapi import APIRouter, Body, Depends, Query, UploadFile, Request
|
||||||
from fastapi.responses import JSONResponse, StreamingResponse
|
from fastapi.responses import JSONResponse, StreamingResponse
|
||||||
from sqlalchemy.ext.asyncio import AsyncSession
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
@@ -133,10 +133,10 @@ async def update_obj_controller(
|
|||||||
|
|
||||||
@router.delete("/delete", summary="删除用户", description="删除用户")
|
@router.delete("/delete", summary="删除用户", description="删除用户")
|
||||||
async def delete_obj_controller(
|
async def delete_obj_controller(
|
||||||
id: int = Query(..., description="用户ID"),
|
ids: list[int] = Body(..., description="ID列表"),
|
||||||
auth: AuthSchema = Depends(AuthPermission(permissions=["system:user:delete"])),
|
auth: AuthSchema = Depends(AuthPermission(permissions=["system:user:delete"])),
|
||||||
) -> JSONResponse:
|
) -> JSONResponse:
|
||||||
await UserService.delete_user_service(id=id, auth=auth)
|
await UserService.delete_user_service(ids=ids, auth=auth)
|
||||||
logger.info(f"删除用户成功: {id}")
|
logger.info(f"删除用户成功: {id}")
|
||||||
return SuccessResponse(msg="删除用户成功")
|
return SuccessResponse(msg="删除用户成功")
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,17 @@ class OnlineService:
|
|||||||
logger.info(f"强制下线用户会话: {session_id}")
|
logger.info(f"强制下线用户会话: {session_id}")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
async def clear_online_service(cls, redis: Redis) -> bool:
|
||||||
|
"""强制下线在线用户"""
|
||||||
|
# 删除 token
|
||||||
|
await RedisCURD(redis).delete(f"{RedisInitKeyConfig.ACCESS_TOKEN.key}:*")
|
||||||
|
await RedisCURD(redis).delete(f"{RedisInitKeyConfig.REFRESH_TOKEN.key}:*")
|
||||||
|
|
||||||
|
logger.info(f"清除所有在线用户会话成功")
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _match_search_conditions(online_info: Dict, search: Optional[OnlineQueryParams]) -> bool:
|
def _match_search_conditions(online_info: Dict, search: Optional[OnlineQueryParams]) -> bool:
|
||||||
"""检查是否匹配搜索条件"""
|
"""检查是否匹配搜索条件"""
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from app.common.enums import RedisInitKeyConfig
|
|||||||
from app.core.redis_crud import RedisCURD
|
from app.core.redis_crud import RedisCURD
|
||||||
from app.utils.excel_util import ExcelUtil
|
from app.utils.excel_util import ExcelUtil
|
||||||
from app.utils.upload_util import UploadUtil
|
from app.utils.upload_util import UploadUtil
|
||||||
from app.core.base_schema import UploadResponseSchema
|
from app.core.base_schema import DeleteIdsSchema, UploadResponseSchema
|
||||||
from app.core.exceptions import CustomException
|
from app.core.exceptions import CustomException
|
||||||
from app.config.setting import settings
|
from app.config.setting import settings
|
||||||
from app.core.logger import logger
|
from app.core.logger import logger
|
||||||
@@ -100,16 +100,19 @@ class ConfigService:
|
|||||||
return new_obj_dict
|
return new_obj_dict
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def delete_obj_service(cls, auth: AuthSchema, redis: Redis, id: int) -> None:
|
async def delete_obj_service(cls, auth: AuthSchema, redis: Redis, ids: list[int]) -> None:
|
||||||
|
if len(ids) < 1:
|
||||||
|
raise CustomException(msg='删除失败,删除对象不能为空')
|
||||||
|
for id in ids:
|
||||||
exist_obj = await ConfigCRUD(auth).get_obj_by_id_crud(id=id)
|
exist_obj = await ConfigCRUD(auth).get_obj_by_id_crud(id=id)
|
||||||
if not exist_obj:
|
if not exist_obj:
|
||||||
raise CustomException(msg='删除失败,该数据字典类型不存在')
|
raise CustomException(msg='删除失败,该数据字典类型不存在')
|
||||||
# 检查是否是否初始化类型
|
# 检查是否是否初始化类型
|
||||||
if exist_obj.config_type:
|
if exist_obj.config_type:
|
||||||
# 如果有字典数据,不能删除
|
# 如果有字典数据,不能删除
|
||||||
raise CustomException(msg='删除失败,系统初始化配置不可以删除')
|
raise CustomException(msg=f'{exist_obj.config_name} 删除失败,系统初始化配置不可以删除')
|
||||||
|
|
||||||
await ConfigCRUD(auth).delete_obj_crud(ids=[id])
|
await ConfigCRUD(auth).delete_obj_crud(ids=ids)
|
||||||
# 同步删除Redis缓存
|
# 同步删除Redis缓存
|
||||||
redis_key = f"{RedisInitKeyConfig.SYSTEM_CONFIG.key}:{exist_obj.config_key}"
|
redis_key = f"{RedisInitKeyConfig.SYSTEM_CONFIG.key}:{exist_obj.config_key}"
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -92,17 +92,20 @@ class DeptService:
|
|||||||
return DeptOutSchema.model_validate(dept).model_dump()
|
return DeptOutSchema.model_validate(dept).model_dump()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def delete_dept_service(cls, auth: AuthSchema, id: int) -> None:
|
async def delete_dept_service(cls, auth: AuthSchema, ids: list[int]) -> None:
|
||||||
"""
|
"""
|
||||||
删除部门service
|
删除部门service
|
||||||
|
|
||||||
:param auth: 认证对象
|
:param auth: 认证对象
|
||||||
:param id: 部门ID
|
:param id: 部门ID
|
||||||
"""
|
"""
|
||||||
|
if len(ids) < 1:
|
||||||
|
raise CustomException(msg='删除失败,删除对象不能为空')
|
||||||
|
for id in ids:
|
||||||
dept = await DeptCRUD(auth).get_by_id_crud(id=id)
|
dept = await DeptCRUD(auth).get_by_id_crud(id=id)
|
||||||
if not dept:
|
if not dept:
|
||||||
raise CustomException(msg='删除失败,该部门不存在')
|
raise CustomException(msg='删除失败,该部门不存在')
|
||||||
await DeptCRUD(auth).delete(ids=[id])
|
await DeptCRUD(auth).delete(ids=ids)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def batch_set_available_service(cls, auth: AuthSchema, data: BatchSetAvailable) -> None:
|
async def batch_set_available_service(cls, auth: AuthSchema, data: BatchSetAvailable) -> None:
|
||||||
|
|||||||
@@ -115,7 +115,10 @@ class DictTypeService:
|
|||||||
return new_obj_dict
|
return new_obj_dict
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def delete_obj_service(cls, auth: AuthSchema, redis: Redis, id: int) -> None:
|
async def delete_obj_service(cls, auth: AuthSchema, redis: Redis, ids: list[int]) -> None:
|
||||||
|
if len(ids) < 1:
|
||||||
|
raise CustomException(msg='删除失败,删除对象不能为空')
|
||||||
|
for id in ids:
|
||||||
exist_obj = await DictTypeCRUD(auth).get_obj_by_id_crud(id=id)
|
exist_obj = await DictTypeCRUD(auth).get_obj_by_id_crud(id=id)
|
||||||
if not exist_obj:
|
if not exist_obj:
|
||||||
raise CustomException(msg='删除失败,该数据字典类型不存在')
|
raise CustomException(msg='删除失败,该数据字典类型不存在')
|
||||||
@@ -124,7 +127,6 @@ class DictTypeService:
|
|||||||
if len(exist_obj_type_list) > 0:
|
if len(exist_obj_type_list) > 0:
|
||||||
# 如果有字典数据,不能删除
|
# 如果有字典数据,不能删除
|
||||||
raise CustomException(msg='删除失败,该数据字典类型下存在字典数据')
|
raise CustomException(msg='删除失败,该数据字典类型下存在字典数据')
|
||||||
await DictTypeCRUD(auth).delete_obj_crud(ids=[id])
|
|
||||||
# 删除Redis缓存
|
# 删除Redis缓存
|
||||||
redis_key = f"{RedisInitKeyConfig.SYSTEM_DICT.key}:{exist_obj.dict_type}"
|
redis_key = f"{RedisInitKeyConfig.SYSTEM_DICT.key}:{exist_obj.dict_type}"
|
||||||
try:
|
try:
|
||||||
@@ -133,6 +135,8 @@ class DictTypeService:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"删除字典类型失败: {e}")
|
logger.error(f"删除字典类型失败: {e}")
|
||||||
raise CustomException(msg=f"删除字典类型失败")
|
raise CustomException(msg=f"删除字典类型失败")
|
||||||
|
await DictTypeCRUD(auth).delete_obj_crud(ids=ids)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def export_obj_service(cls, data_list: List[Dict[str, Any]]) -> bytes:
|
async def export_obj_service(cls, data_list: List[Dict[str, Any]]) -> bytes:
|
||||||
@@ -294,11 +298,13 @@ class DictDataService:
|
|||||||
return DictDataOutSchema.model_validate(obj).model_dump()
|
return DictDataOutSchema.model_validate(obj).model_dump()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def delete_obj_service(cls, auth: AuthSchema, redis: Redis, id: int) -> None:
|
async def delete_obj_service(cls, auth: AuthSchema, redis: Redis, ids: list[int]) -> None:
|
||||||
|
|
||||||
|
for id in ids:
|
||||||
|
|
||||||
exist_obj = await DictDataCRUD(auth).get_obj_by_id_crud(id=id)
|
exist_obj = await DictDataCRUD(auth).get_obj_by_id_crud(id=id)
|
||||||
if not exist_obj:
|
if not exist_obj:
|
||||||
raise CustomException(msg='删除失败,该字典数据不存在')
|
raise CustomException(msg=f'{id} 删除失败,该字典数据不存在')
|
||||||
await DictDataCRUD(auth).delete_obj_crud(ids=[id])
|
|
||||||
# 删除Redis缓存
|
# 删除Redis缓存
|
||||||
redis_key = f"{RedisInitKeyConfig.SYSTEM_DICT.key}:{exist_obj.dict_type}"
|
redis_key = f"{RedisInitKeyConfig.SYSTEM_DICT.key}:{exist_obj.dict_type}"
|
||||||
try:
|
try:
|
||||||
@@ -308,6 +314,7 @@ class DictDataService:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"删除字典数据失败: {e}")
|
logger.error(f"删除字典数据失败: {e}")
|
||||||
raise CustomException(msg=f"删除字典数据失败 {e}")
|
raise CustomException(msg=f"删除字典数据失败 {e}")
|
||||||
|
await DictDataCRUD(auth).delete_obj_crud(ids=ids)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def export_obj_service(cls, data_list: List[Dict[str, Any]]) -> bytes:
|
async def export_obj_service(cls, data_list: List[Dict[str, Any]]) -> bytes:
|
||||||
|
|||||||
@@ -53,12 +53,16 @@ class JobService:
|
|||||||
return JobOutSchema.model_validate(obj).model_dump()
|
return JobOutSchema.model_validate(obj).model_dump()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def delete_job_service(cls, auth: AuthSchema, id: int) -> None:
|
async def delete_job_service(cls, auth: AuthSchema, ids: list[int]) -> None:
|
||||||
|
if len(ids) < 1:
|
||||||
|
raise CustomException(msg='删除失败,删除对象不能为空')
|
||||||
|
for id in ids:
|
||||||
exist_obj = await JobCRUD(auth).get_obj_by_id_crud(id=id)
|
exist_obj = await JobCRUD(auth).get_obj_by_id_crud(id=id)
|
||||||
if not exist_obj:
|
if not exist_obj:
|
||||||
raise CustomException(msg='删除失败,该数据定时任务不存在')
|
raise CustomException(msg='删除失败,该数据定时任务不存在')
|
||||||
await JobCRUD(auth).delete_obj_crud(ids=[id])
|
|
||||||
SchedulerUtil.remove_job(job_id=id)
|
SchedulerUtil.remove_job(job_id=id)
|
||||||
|
await JobCRUD(auth).delete_obj_crud(ids=ids)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def clear_job_service(cls, auth: AuthSchema) -> None:
|
async def clear_job_service(cls, auth: AuthSchema) -> None:
|
||||||
|
|||||||
@@ -92,11 +92,14 @@ class MenuService:
|
|||||||
return new_menu_dict
|
return new_menu_dict
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def delete_menu_service(cls, auth: AuthSchema, id: int) -> None:
|
async def delete_menu_service(cls, auth: AuthSchema, ids: list[int]) -> None:
|
||||||
|
if len(ids) < 1:
|
||||||
|
raise CustomException(msg='删除失败,删除对象不能为空')
|
||||||
|
for id in ids:
|
||||||
menu = await MenuCRUD(auth).get_by_id_crud(id=id)
|
menu = await MenuCRUD(auth).get_by_id_crud(id=id)
|
||||||
if not menu:
|
if not menu:
|
||||||
raise CustomException(msg='删除失败,该菜单不存在')
|
raise CustomException(msg='删除失败,该菜单不存在')
|
||||||
await MenuCRUD(auth).delete(ids=[id])
|
await MenuCRUD(auth).delete(ids=ids)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def set_menu_available_service(cls, auth: AuthSchema, data: BatchSetAvailable) -> None:
|
async def set_menu_available_service(cls, auth: AuthSchema, data: BatchSetAvailable) -> None:
|
||||||
|
|||||||
@@ -53,11 +53,14 @@ class NoticeService:
|
|||||||
return NoticeOutSchema.model_validate(config_obj).model_dump()
|
return NoticeOutSchema.model_validate(config_obj).model_dump()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def delete_notice_service(cls, auth: AuthSchema, id: int) -> None:
|
async def delete_notice_service(cls, auth: AuthSchema, ids: list[int]) -> None:
|
||||||
|
if len(ids) < 1:
|
||||||
|
raise CustomException(msg='删除失败,删除对象不能为空')
|
||||||
|
for id in ids:
|
||||||
config = await NoticeCRUD(auth).get_by_id_crud(id=id)
|
config = await NoticeCRUD(auth).get_by_id_crud(id=id)
|
||||||
if not config:
|
if not config:
|
||||||
raise CustomException(msg='删除失败,该公告通知不存在')
|
raise CustomException(msg='删除失败,该公告通知不存在')
|
||||||
await NoticeCRUD(auth).delete_crud(ids=[id])
|
await NoticeCRUD(auth).delete_crud(ids=ids)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def set_notice_available_service(cls, auth: AuthSchema, data: BatchSetAvailable) -> None:
|
async def set_notice_available_service(cls, auth: AuthSchema, data: BatchSetAvailable) -> None:
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from app.api.v1.schemas.system.operation_log_schema import (
|
|||||||
OperationLogCreateSchema,
|
OperationLogCreateSchema,
|
||||||
OperationLogOutSchema
|
OperationLogOutSchema
|
||||||
)
|
)
|
||||||
|
from app.core.exceptions import CustomException
|
||||||
from app.utils.excel_util import ExcelUtil
|
from app.utils.excel_util import ExcelUtil
|
||||||
from app.api.v1.params.system.operation_log_param import OperationLogQueryParams
|
from app.api.v1.params.system.operation_log_param import OperationLogQueryParams
|
||||||
|
|
||||||
@@ -44,9 +45,11 @@ class OperationLogService:
|
|||||||
return new_log_dict
|
return new_log_dict
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def delete_log_service(cls, auth: AuthSchema, id: int) -> None:
|
async def delete_log_service(cls, auth: AuthSchema, ids: list[int]) -> None:
|
||||||
"""删除日志"""
|
"""删除日志"""
|
||||||
await OperationLogCRUD(auth).delete(ids=[id])
|
if len(ids) < 1:
|
||||||
|
raise CustomException(msg='删除失败,删除对象不能为空')
|
||||||
|
await OperationLogCRUD(auth).delete(ids=ids)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def export_log_list_service(cls, operation_log_list: List[Dict[str, Any]]) -> bytes:
|
async def export_log_list_service(cls, operation_log_list: List[Dict[str, Any]]) -> bytes:
|
||||||
|
|||||||
@@ -55,12 +55,15 @@ class PositionService:
|
|||||||
return PositionOutSchema.model_validate(updated_position).model_dump()
|
return PositionOutSchema.model_validate(updated_position).model_dump()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def delete_position_service(cls, auth: AuthSchema, id: int) -> None:
|
async def delete_position_service(cls, auth: AuthSchema, ids: list[int]) -> None:
|
||||||
"""删除岗位"""
|
"""删除岗位"""
|
||||||
|
if len(ids) < 1:
|
||||||
|
raise CustomException(msg='删除失败,删除对象不能为空')
|
||||||
|
for id in ids:
|
||||||
position = await PositionCRUD(auth).get_by_id_crud(id=id)
|
position = await PositionCRUD(auth).get_by_id_crud(id=id)
|
||||||
if not position:
|
if not position:
|
||||||
raise CustomException(msg='删除失败,该岗位不存在')
|
raise CustomException(msg='删除失败,该岗位不存在')
|
||||||
await PositionCRUD(auth).delete(ids=[id])
|
await PositionCRUD(auth).delete(ids=ids)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def set_position_available_service(cls, auth: AuthSchema, data: BatchSetAvailable) -> None:
|
async def set_position_available_service(cls, auth: AuthSchema, data: BatchSetAvailable) -> None:
|
||||||
|
|||||||
@@ -57,12 +57,15 @@ class RoleService:
|
|||||||
return RoleOutSchema.model_validate(updated_role).model_dump()
|
return RoleOutSchema.model_validate(updated_role).model_dump()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def delete_role_service(cls, auth: AuthSchema, id: int) -> None:
|
async def delete_role_service(cls, auth: AuthSchema, ids: list[id]) -> None:
|
||||||
"""删除角色"""
|
"""删除角色"""
|
||||||
|
if len(ids) < 1:
|
||||||
|
raise CustomException(msg='删除失败,删除对象不能为空')
|
||||||
|
for id in ids:
|
||||||
role = await RoleCRUD(auth).get_by_id_crud(id=id)
|
role = await RoleCRUD(auth).get_by_id_crud(id=id)
|
||||||
if not role:
|
if not role:
|
||||||
raise CustomException(msg='删除失败,该角色不存在')
|
raise CustomException(msg='删除失败,该角色不存在')
|
||||||
await RoleCRUD(auth).delete(ids=[id])
|
await RoleCRUD(auth).delete(ids=ids)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def set_role_permission_service(cls, auth: AuthSchema, data: RolePermissionSettingSchema) -> None:
|
async def set_role_permission_service(cls, auth: AuthSchema, data: RolePermissionSettingSchema) -> None:
|
||||||
|
|||||||
@@ -143,8 +143,11 @@ class UserService:
|
|||||||
return user_dict
|
return user_dict
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def delete_user_service(cls, auth: AuthSchema, id: int) -> None:
|
async def delete_user_service(cls, auth: AuthSchema, ids: list[int]) -> None:
|
||||||
"""删除用户"""
|
"""删除用户"""
|
||||||
|
if len(ids) < 1:
|
||||||
|
raise CustomException(msg='删除失败,删除对象不能为空')
|
||||||
|
for id in ids:
|
||||||
user = await UserCRUD(auth).get_by_id_crud(id=id)
|
user = await UserCRUD(auth).get_by_id_crud(id=id)
|
||||||
if not user:
|
if not user:
|
||||||
raise CustomException(msg="用户不存在")
|
raise CustomException(msg="用户不存在")
|
||||||
@@ -155,13 +158,13 @@ class UserService:
|
|||||||
if auth.user.id == id:
|
if auth.user.id == id:
|
||||||
raise CustomException(msg="不能删除当前登陆用户")
|
raise CustomException(msg="不能删除当前登陆用户")
|
||||||
# 删除用户角色关联数据
|
# 删除用户角色关联数据
|
||||||
await UserCRUD(auth).set_user_roles_crud(user_ids=[id], role_ids=[])
|
await UserCRUD(auth).set_user_roles_crud(user_ids=ids, role_ids=[])
|
||||||
|
|
||||||
# 删除用户岗位关联数据
|
# 删除用户岗位关联数据
|
||||||
await UserCRUD(auth).set_user_positions_crud(user_ids=[id], position_ids=[])
|
await UserCRUD(auth).set_user_positions_crud(user_ids=ids, position_ids=[])
|
||||||
|
|
||||||
# 删除用户
|
# 删除用户
|
||||||
await UserCRUD(auth).delete(ids=[id])
|
await UserCRUD(auth).delete(ids=ids)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def get_current_user_info_service(cls, auth: AuthSchema) -> Dict:
|
async def get_current_user_info_service(cls, auth: AuthSchema) -> Dict:
|
||||||
|
|||||||
@@ -11,11 +11,19 @@ const OnlineAPI = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 强退用户
|
// 强退用户
|
||||||
deleteOnline(body: any) {
|
deleteOnline(session_id: string) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/monitor/online/delete`,
|
url: `/monitor/online/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
data: body,
|
data: session_id,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 强退用户
|
||||||
|
clearOnline() {
|
||||||
|
return request<ApiResponse>({
|
||||||
|
url: `/monitor/online/clear`,
|
||||||
|
method: "delete",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const AuthAPI = {
|
|||||||
getCaptcha() {
|
getCaptcha() {
|
||||||
return request<ApiResponse<CaptchaInfo>>({
|
return request<ApiResponse<CaptchaInfo>>({
|
||||||
url: `/system/auth/captcha/get`,
|
url: `/system/auth/captcha/get`,
|
||||||
method: "post",
|
method: "get",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ const ConfigAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getConfigDetail(query: any) {
|
getConfigDetail(id: number) {
|
||||||
return request<ApiResponse<ConfigTable>>({
|
return request<ApiResponse<ConfigTable>>({
|
||||||
url: `/system/config/detail`,
|
url: `/system/config/detail`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -49,15 +49,15 @@ const ConfigAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteConfig(query: any) {
|
deleteConfig(body: DeleteType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/config/delete`,
|
url: `/system/config/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
params: query,
|
data: body,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
exportConfig(body: any) {
|
exportConfig(body: any[]) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/config/export`,
|
url: `/system/config/export`,
|
||||||
method: "post",
|
method: "post",
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ const DeptAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getDeptDetail(query: any) {
|
getDeptDetail(id: number) {
|
||||||
return request<ApiResponse<DeptTable>>({
|
return request<ApiResponse<DeptTable>>({
|
||||||
url: `/system/dept/detail`,
|
url: `/system/dept/detail`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ const DeptAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteDept(query: any) {
|
deleteDept(query: DeleteType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/dept/delete`,
|
url: `/system/dept/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
@@ -41,7 +41,7 @@ const DeptAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
batchAvailableDept(body: any) {
|
batchAvailableDept(body: BatchType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/dept/available/setting`,
|
url: `/system/dept/available/setting`,
|
||||||
method: "patch",
|
method: "patch",
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ const DictAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getDictTypeDetail(query: any) {
|
getDictTypeDetail(id: number) {
|
||||||
return request<ApiResponse<DictTable>>({
|
return request<ApiResponse<DictTable>>({
|
||||||
url: `/system/dict/type/detail`,
|
url: `/system/dict/type/detail`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ const DictAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteDictType(query: any) {
|
deleteDictType(query: DeleteType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/dict/type/delete`,
|
url: `/system/dict/type/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
@@ -65,11 +65,11 @@ const DictAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getDictDataDetail(query: any) {
|
getDictDataDetail(id: number) {
|
||||||
return request<ApiResponse<DictDataTable>>({
|
return request<ApiResponse<DictDataTable>>({
|
||||||
url: `/system/dict/data/detail`,
|
url: `/system/dict/data/detail`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ const DictAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteDictData(query: any) {
|
deleteDictData(query: DeleteType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/dict/data/delete`,
|
url: `/system/dict/data/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
@@ -97,7 +97,7 @@ const DictAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
exportDictData(body: any) {
|
exportDictData(body: any[]) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/dict/data/export`,
|
url: `/system/dict/data/export`,
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -106,9 +106,9 @@ const DictAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitDict(query: any) {
|
getInitDict(dict_type: string) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/dict/data/info/${query}`,
|
url: `/system/dict/data/info/${dict_type}`,
|
||||||
method: "get",
|
method: "get",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
|
||||||
const JobAPI = {
|
const JobAPI = {
|
||||||
getJobList(query: any) {
|
getJobList(query: JobPageQuery) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse<PageResult<JobTable>>>({
|
||||||
url: `/system/job/list`,
|
url: `/system/job/list`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: query,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getJobDetail(query: any) {
|
getJobDetail(id: number) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse<JobTable>>({
|
||||||
url: `/system/job/detail`,
|
url: `/system/job/detail`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
createJob(body: any) {
|
createJob(body: JobForm) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/job/create`,
|
url: `/system/job/create`,
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -25,7 +25,7 @@ const JobAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
updateJob(body: any) {
|
updateJob(body: JobForm) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/job/update`,
|
url: `/system/job/update`,
|
||||||
method: "put",
|
method: "put",
|
||||||
@@ -33,7 +33,7 @@ const JobAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteJob(query: any) {
|
deleteJob(query: DeleteType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/job/delete`,
|
url: `/system/job/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
@@ -41,7 +41,7 @@ const JobAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
exportJob(body: any) {
|
exportJob(body: any[]) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/job/export`,
|
url: `/system/job/export`,
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -57,7 +57,7 @@ const JobAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
OptionJob(params: any) {
|
OptionJob(params: JobPageQuery) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/job/option`,
|
url: `/system/job/option`,
|
||||||
method: "put",
|
method: "put",
|
||||||
@@ -77,6 +77,11 @@ export interface JobPageQuery extends PageQuery {
|
|||||||
end_time?: string;
|
end_time?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface JobPageQuery extends PageQuery {
|
||||||
|
id?: number;
|
||||||
|
option?: number; //操作类型 1: 暂停 2: 恢复 3: 重启
|
||||||
|
}
|
||||||
|
|
||||||
export interface JobTable {
|
export interface JobTable {
|
||||||
index?: number;
|
index?: number;
|
||||||
id?: number;
|
id?: number;
|
||||||
|
|||||||
@@ -9,15 +9,15 @@ const LogAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getLogDetail(query: any) {
|
getLogDetail(id: number) {
|
||||||
return request<ApiResponse<LogTable>>({
|
return request<ApiResponse<LogTable>>({
|
||||||
url: `/system/log/detail`,
|
url: `/system/log/detail`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteLog(query: any) {
|
deleteLog(query: DeleteType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/log/delete`,
|
url: `/system/log/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
@@ -25,7 +25,7 @@ const LogAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
exportLog(query: any) {
|
exportLog(query: any[]) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/log/export`,
|
url: `/system/log/export`,
|
||||||
method: "post",
|
method: "post",
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ const MenuAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getMenuDetail(query: any) {
|
getMenuDetail(id: number) {
|
||||||
return request<ApiResponse<MenuTable>>({
|
return request<ApiResponse<MenuTable>>({
|
||||||
url: `/system/menu/detail`,
|
url: `/system/menu/detail`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ const MenuAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteMenu(query: any) {
|
deleteMenu(query: DeleteType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/menu/delete`,
|
url: `/system/menu/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
@@ -41,7 +41,7 @@ const MenuAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
batchAvailableMenu(body: any) {
|
batchAvailableMenu(body: BatchType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/menu/available/setting`,
|
url: `/system/menu/available/setting`,
|
||||||
method: "patch",
|
method: "patch",
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ const NoticeAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getNoticeDetail(query: any) {
|
getNoticeDetail(id: number) {
|
||||||
return request<ApiResponse<NoticeTable>>({
|
return request<ApiResponse<NoticeTable>>({
|
||||||
url: `/system/notice/detail`,
|
url: `/system/notice/detail`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ const NoticeAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteNotice(query: any) {
|
deleteNotice(query: DeleteType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/notice/delete`,
|
url: `/system/notice/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
@@ -48,7 +48,7 @@ const NoticeAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
batchAvailableNotice(body: any) {
|
batchAvailableNotice(body: BatchType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/notice/available/setting`,
|
url: `/system/notice/available/setting`,
|
||||||
method: "patch",
|
method: "patch",
|
||||||
@@ -56,7 +56,7 @@ const NoticeAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
exportNotice(body: any) {
|
exportNotice(body: any[]) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/notice/export`,
|
url: `/system/notice/export`,
|
||||||
method: "post",
|
method: "post",
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ const PositionAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getPositionDetail(query: any) {
|
getPositionDetail(id: number) {
|
||||||
return request<ApiResponse<PositionTable>>({
|
return request<ApiResponse<PositionTable>>({
|
||||||
url: `/system/position/detail`,
|
url: `/system/position/detail`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ const PositionAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deletePosition(query: any) {
|
deletePosition(query: DeleteType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/position/delete`,
|
url: `/system/position/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
@@ -41,7 +41,7 @@ const PositionAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
batchAvailablePosition(body: any) {
|
batchAvailablePosition(body: BatchType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/position/available/setting`,
|
url: `/system/position/available/setting`,
|
||||||
method: "patch",
|
method: "patch",
|
||||||
@@ -49,7 +49,7 @@ const PositionAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
exportPosition(body: any) {
|
exportPosition(body: any[]) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/position/export`,
|
url: `/system/position/export`,
|
||||||
method: "post",
|
method: "post",
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ const RoleAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getRoleDetail(query: any) {
|
getRoleDetail(id: number) {
|
||||||
return request<ApiResponse<RoleTable>>({
|
return request<ApiResponse<RoleTable>>({
|
||||||
url: `/system/role/detail`,
|
url: `/system/role/detail`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ const RoleAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteRole(query: any) {
|
deleteRole(query: DeleteType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/role/delete`,
|
url: `/system/role/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
@@ -41,7 +41,7 @@ const RoleAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
batchAvailableRole(body: any) {
|
batchAvailableRole(body: BatchType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/role/available/setting`,
|
url: `/system/role/available/setting`,
|
||||||
method: "patch",
|
method: "patch",
|
||||||
@@ -57,7 +57,7 @@ const RoleAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
exportRole(body: any) {
|
exportRole(body: any[]) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/role/export`,
|
url: `/system/role/export`,
|
||||||
method: "post",
|
method: "post",
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export const UserAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
updateCurrentUserInfo(body: any) {
|
updateCurrentUserInfo(body: InfoFormState) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/user/current/info/update`,
|
url: `/system/user/current/info/update`,
|
||||||
method: "put",
|
method: "put",
|
||||||
@@ -26,7 +26,7 @@ export const UserAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
changeCurrentUserPassword(body: any) {
|
changeCurrentUserPassword(body: PasswordFormState) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/user/current/password/change`,
|
url: `/system/user/current/password/change`,
|
||||||
method: "put",
|
method: "put",
|
||||||
@@ -50,23 +50,23 @@ export const UserAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getUserList(query: any) {
|
getUserList(query: UserPageQuery) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse<PageResult<UserInfo[]>>>({
|
||||||
url: `/system/user/list`,
|
url: `/system/user/list`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: query,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getUserDetail(query: any) {
|
getUserDetail(id: number) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/user/detail`,
|
url: `/system/user/detail`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: query,
|
params: id,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
createUser(body: any) {
|
createUser(body: InfoFormState) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/user/create`,
|
url: `/system/user/create`,
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -74,7 +74,7 @@ export const UserAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
updateUser(body: any) {
|
updateUser(body: InfoFormState) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/user/update`,
|
url: `/system/user/update`,
|
||||||
method: "put",
|
method: "put",
|
||||||
@@ -82,7 +82,7 @@ export const UserAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteUser(query: any) {
|
deleteUser(query: DeleteType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/user/delete`,
|
url: `/system/user/delete`,
|
||||||
method: "delete",
|
method: "delete",
|
||||||
@@ -90,7 +90,7 @@ export const UserAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
batchAvailableUser(body: any) {
|
batchAvailableUser(body: BatchType) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/user/available/setting`,
|
url: `/system/user/available/setting`,
|
||||||
method: "patch",
|
method: "patch",
|
||||||
@@ -98,7 +98,7 @@ export const UserAPI = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
exportUser(query: any) {
|
exportUser(query: any[]) {
|
||||||
return request<ApiResponse>({
|
return request<ApiResponse>({
|
||||||
url: `/system/user/export`,
|
url: `/system/user/export`,
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -208,6 +208,7 @@ export interface positionSelectorType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface InfoFormState {
|
export interface InfoFormState {
|
||||||
|
id?: number;
|
||||||
name: string;
|
name: string;
|
||||||
gender: number;
|
gender: number;
|
||||||
mobile: string;
|
mobile: string;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { setupStore } from "@/store";
|
|||||||
import { setupElIcons } from "./icons";
|
import { setupElIcons } from "./icons";
|
||||||
import { setupPermission } from "./permission";
|
import { setupPermission } from "./permission";
|
||||||
import { InstallCodeMirror } from "codemirror-editor-vue3";
|
import { InstallCodeMirror } from "codemirror-editor-vue3";
|
||||||
import { setupVxeTable } from "./vxeTable";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install(app: App<Element>) {
|
install(app: App<Element>) {
|
||||||
@@ -20,8 +19,6 @@ export default {
|
|||||||
setupElIcons(app);
|
setupElIcons(app);
|
||||||
// 路由守卫
|
// 路由守卫
|
||||||
setupPermission();
|
setupPermission();
|
||||||
// vxe-table
|
|
||||||
setupVxeTable(app);
|
|
||||||
// 注册 CodeMirror
|
// 注册 CodeMirror
|
||||||
app.use(InstallCodeMirror);
|
app.use(InstallCodeMirror);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
import type { App } from "vue";
|
|
||||||
import VXETable from "vxe-table"; // https://vxetable.cn/v4.6/#/table/start/install
|
|
||||||
|
|
||||||
// 全局默认参数
|
|
||||||
VXETable.setConfig({
|
|
||||||
// 全局尺寸
|
|
||||||
size: "medium",
|
|
||||||
// 全局 zIndex 起始值,如果项目的的 z-index 样式值过大时就需要跟随设置更大,避免被遮挡
|
|
||||||
zIndex: 9999,
|
|
||||||
// 版本号,对于某些带数据缓存的功能有用到,上升版本号可以用于重置数据
|
|
||||||
version: 0,
|
|
||||||
// 全局 loading 提示内容,如果为 null 则不显示文本
|
|
||||||
loadingText: null,
|
|
||||||
table: {
|
|
||||||
showHeader: true,
|
|
||||||
showOverflow: "tooltip",
|
|
||||||
showHeaderOverflow: "tooltip",
|
|
||||||
autoResize: true,
|
|
||||||
// stripe: false,
|
|
||||||
border: "inner",
|
|
||||||
// round: false,
|
|
||||||
emptyText: "暂无数据",
|
|
||||||
rowConfig: {
|
|
||||||
isHover: true,
|
|
||||||
isCurrent: true,
|
|
||||||
// 行数据的唯一主键字段名
|
|
||||||
keyField: "_VXE_ID",
|
|
||||||
},
|
|
||||||
columnConfig: {
|
|
||||||
resizable: false,
|
|
||||||
},
|
|
||||||
align: "center",
|
|
||||||
headerAlign: "center",
|
|
||||||
},
|
|
||||||
pager: {
|
|
||||||
// size: "medium",
|
|
||||||
// 配套的样式
|
|
||||||
perfect: false,
|
|
||||||
pageSize: 10,
|
|
||||||
pagerCount: 7,
|
|
||||||
pageSizes: [10, 20, 50],
|
|
||||||
layouts: [
|
|
||||||
"Total",
|
|
||||||
"PrevJump",
|
|
||||||
"PrevPage",
|
|
||||||
"Number",
|
|
||||||
"NextPage",
|
|
||||||
"NextJump",
|
|
||||||
"Sizes",
|
|
||||||
"FullJump",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
modal: {
|
|
||||||
minWidth: 500,
|
|
||||||
minHeight: 400,
|
|
||||||
lockView: true,
|
|
||||||
mask: true,
|
|
||||||
// duration: 3000,
|
|
||||||
// marginSize: 20,
|
|
||||||
dblclickZoom: false,
|
|
||||||
showTitleOverflow: true,
|
|
||||||
transfer: true,
|
|
||||||
draggable: false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export function setupVxeTable(app: App) {
|
|
||||||
// Vxe Table 组件完整引入
|
|
||||||
app.use(VXETable);
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
|
// tags缓存
|
||||||
export const useTagsViewStore = defineStore("tagsView", () => {
|
export const useTagsViewStore = defineStore("tagsView", () => {
|
||||||
|
|
||||||
const visitedViews = ref<TagView[]>([]);
|
const visitedViews = ref<TagView[]>([]);
|
||||||
const cachedViews = ref<string[]>([]);
|
const cachedViews = ref<string[]>([]);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -98,9 +98,9 @@ export const useUserStore = defineStore("user", {
|
|||||||
|
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
AuthAPI.refreshToken({refresh_token: refreshToken})
|
AuthAPI.refreshToken({refresh_token: refreshToken})
|
||||||
.then((data) => {
|
.then((response) => {
|
||||||
// 更新令牌,保持当前记住我状态
|
// 更新令牌,保持当前记住我状态
|
||||||
Auth.setTokens(data.access_token, data.refresh_token, Auth.getRememberMe());
|
Auth.setTokens(response.data.data.access_token, response.data.data.refresh_token, Auth.getRememberMe());
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
Vendored
+15
@@ -130,5 +130,20 @@ declare global {
|
|||||||
origin_name: string;
|
origin_name: string;
|
||||||
file_url: string;
|
file_url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*/
|
||||||
|
export interface DeleteType {
|
||||||
|
ids?: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量启用、停用
|
||||||
|
*/
|
||||||
|
export interface BatchType {
|
||||||
|
ids?: number[];
|
||||||
|
status?: boolean;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
@@ -37,8 +37,7 @@
|
|||||||
<!-- 功能区域 -->
|
<!-- 功能区域 -->
|
||||||
<div class="data-table__toolbar">
|
<div class="data-table__toolbar">
|
||||||
<div class="data-table__toolbar--actions">
|
<div class="data-table__toolbar--actions">
|
||||||
<el-button :disabled="selectIds.length === 0" type="danger" icon="delete"
|
<el-button type="danger" icon="delete" @click="handleClear()">强退所有</el-button>
|
||||||
@click="handleSubmit()">批量强退</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="data-table__toolbar--tools">
|
<div class="data-table__toolbar--tools">
|
||||||
<el-tooltip content="刷新">
|
<el-tooltip content="刷新">
|
||||||
@@ -209,6 +208,22 @@ async function handleSubmit(id?: number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 强退所有
|
||||||
|
async function handleClear() {
|
||||||
|
ElMessageBox.confirm("确认强制退出所有用户?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}).then(async () => {
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
await OnlineAPI.clearOnline();
|
||||||
|
handleResetQuery();
|
||||||
|
} catch (error: any) {
|
||||||
|
ElMessage.error(error.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadingData();
|
loadingData();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user