From 49cbf228546207d35ce0c36b5ad871c869060b52 Mon Sep 17 00:00:00 2001 From: duxingchen Date: Wed, 12 Aug 2026 15:05:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dor=5F=E5=B1=80?= =?UTF-8?q?=E9=83=A8=E5=AF=BC=E5=85=A5=E9=81=AE=E8=94=BD=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=BA=A7=E5=AF=BC=E5=85=A5=E5=AF=BC=E8=87=B4UnboundLocalError?= =?UTF-8?q?=20+=20Drawer=E6=94=B9=E7=94=A8size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. product_service.py: 删除函数内两处 from sqlalchemy import or_ Python解析器看到函数内的import就把or_当局部变量, 在赋值前使用就报UnboundLocalError 模块顶部已有 import or_, 函数内无需重复导入 2. AdminDashboard.tsx: Drawer width→size (Antd v6 deprecation) --- backend/app/services/product_service.py | 3 +-- frontend/src/pages/admin/AdminDashboard.tsx | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/app/services/product_service.py b/backend/app/services/product_service.py index 71207d3..b371a87 100644 --- a/backend/app/services/product_service.py +++ b/backend/app/services/product_service.py @@ -289,7 +289,6 @@ async def update_overall_status( # SUPER_ADMIN 直接放行 if user_role != "SUPER_ADMIN": # 检查当前用户是否是该产品主线任务的负责人 - from sqlalchemy import or_ main_task_result = await db.execute( select(Task).where( Task.product_id == product.id, @@ -416,7 +415,7 @@ async def get_all_products( overall_names: dict[uuid.UUID, str] = {} main_assignees: dict[uuid.UUID, str] = {} if product_ids: - from sqlalchemy import and_, or_, func as sa_func, case as sa_case + from sqlalchemy import and_, func as sa_func, case as sa_case main_where = and_( Task.product_id.in_(product_ids), or_( diff --git a/frontend/src/pages/admin/AdminDashboard.tsx b/frontend/src/pages/admin/AdminDashboard.tsx index baf3986..4d5b96e 100644 --- a/frontend/src/pages/admin/AdminDashboard.tsx +++ b/frontend/src/pages/admin/AdminDashboard.tsx @@ -412,7 +412,7 @@ export default function AdminDashboard() { title={💬 协同留言板 全厂 · {msgTotal} 条} open={msgDrawerOpen} onClose={() => setMsgDrawerOpen(false)} - width={560} + size="large" styles={{ body: { padding: 16, background: "#f8fafc" } }} >