chore: cleanup old frontend code and update project configs

This commit removes the deprecated frontend/web-old directory, updates various project configuration files including tsconfig, vite config, environment variables, and backend data models. It also fixes several API paths, adds tenant awareness to multiple models, and makes minor UI adjustments.
This commit is contained in:
zhangtao
2026-05-27 01:12:03 +08:00
parent eb18d85327
commit 53d2a9d13e
581 changed files with 14751 additions and 55305 deletions
@@ -230,3 +230,16 @@ async def get_obj_list_available_controller(
result_dict = await NoticeService.get_notice_available_page_service(auth=auth)
log.info("查询已启用公告列表成功")
return SuccessResponse(data=result_dict, msg="查询已启用公告列表成功")
@NoticeRouter.get(
"/panel",
summary="通知面板数据(铃铛)",
description="返回通知铃铛所需的全部数据:通知、消息、待办",
)
async def get_notification_panel_controller(
auth: Annotated[AuthSchema, Depends(get_current_user)],
) -> JSONResponse:
"""通知面板聚合接口,返回通知、消息、待办三个列表。"""
result = await NoticeService.get_panel_data_service(auth=auth)
return SuccessResponse(data=result, msg="获取面板数据成功")
@@ -1,10 +1,10 @@
from sqlalchemy import String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.core.base_model import ModelMixin, UserMixin
from app.core.base_model import ModelMixin, TenantMixin, UserMixin
class NoticeModel(ModelMixin, UserMixin):
class NoticeModel(ModelMixin, TenantMixin, UserMixin):
"""
通知公告表
"""
@@ -1,6 +1,7 @@
from app.api.v1.module_system.auth.schema import AuthSchema
from app.core.base_schema import BatchSetAvailable
from app.core.exceptions import CustomException
from app.core.logger import log
from app.utils.excel_util import ExcelUtil
from .crud import NoticeCRUD
@@ -251,3 +252,61 @@ class NoticeService:
)
return ExcelUtil.export_list2excel(list_data=data, mapping_dict=mapping_dict)
@classmethod
async def get_latest_notices_service(cls, auth: AuthSchema, limit: int = 5) -> list[dict]:
"""获取最新 N 条已启用公告"""
from sqlalchemy import select, desc
from .model import NoticeModel
from .schema import NoticeOutSchema
stmt = (
select(NoticeModel)
.where(NoticeModel.status == "0")
.order_by(desc(NoticeModel.created_time))
.limit(limit)
)
result = await auth.db.execute(stmt)
notices = result.scalars().all()
return [NoticeOutSchema.model_validate(n).model_dump() for n in notices]
@classmethod
async def get_panel_data_service(cls, auth: AuthSchema) -> dict:
"""聚合通知面板数据:通知 + 消息 + 待办"""
from sqlalchemy import select, desc
# 1. 通知:最新 5 条已启用公告
notices = await cls.get_latest_notices_service(auth, limit=5)
# 2. 消息:最近的操作日志(作为系统消息)
messages = []
try:
from app.api.v1.module_system.log.model import OperationLogModel
stmt = (
select(OperationLogModel)
.order_by(desc(OperationLogModel.created_time))
.limit(5)
)
result = await auth.db.execute(stmt)
logs = result.scalars().all()
for log_entry in logs:
messages.append({
"id": log_entry.id,
"title": log_entry.oper_param or "系统操作",
"content": f"{log_entry.oper_user_name or '系统'} 执行了 {log_entry.title or '操作'}",
"time": log_entry.created_time.strftime("%Y-%m-%d %H:%M") if log_entry.created_time else "",
"type": "system",
})
except Exception:
log.warning("获取面板消息数据失败(操作日志表可能不存在),已跳过")
# 3. 待办:暂无数据源,返回空列表
pendings: list[dict] = []
return {
"notices": notices,
"messages": messages,
"pendings": pendings,
}