fix: Grid回退grid-cols-12精确对齐+分组标题按device/order切换+宏观状态receive/transfer只主线

This commit is contained in:
2026-08-10 10:58:33 +08:00
parent 26dc05cc2f
commit 2880ea6df7
2 changed files with 26 additions and 47 deletions

View File

@ -546,8 +546,10 @@ async def receive_task(
if product: if product:
if task.assignee_id: if task.assignee_id:
product.current_location_id = task.assignee_id product.current_location_id = task.assignee_id
if task_name: if task_name and (
product.overall_status = task_name not task.parent_task_id or task.task_type in ("TRANSFER", "RECOVERY")
):
product.overall_status = task_name # 只主线任务同步宏观状态
await db.commit() await db.commit()
await db.refresh(task) await db.refresh(task)
@ -818,7 +820,8 @@ async def transfer_task(
product.overall_status = "在库" product.overall_status = "在库"
elif real_branches: elif real_branches:
product.current_location_id = real_branches[0][1] product.current_location_id = real_branches[0][1]
product.overall_status = real_branches[0][0] if not task.parent_task_id or task.task_type in ("TRANSFER", "RECOVERY"):
product.overall_status = real_branches[0][0]
# 🔧 位置回溯:如果有新任务创建,优先新任务负责人;否则回溯到父任务 # 🔧 位置回溯:如果有新任务创建,优先新任务负责人;否则回溯到父任务
if not real_branches and not has_warehouse: if not real_branches and not has_warehouse:

View File

@ -326,9 +326,11 @@ export default function AdminTasksPage() {
<div className="flex-1 min-w-0"> <div className="flex-1 min-w-0">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="text-sm font-semibold text-gray-800"> <span className="text-sm font-semibold text-gray-800">
{group.orderNo === "未绑定订单" {group.orderNo === "未绑定订单" || group.orderNo === "未命名设备"
? "📋 未绑定订单" ? "📋 未分类"
: `📦 订单: ${group.orderNo}`} : groupBy === "device"
? `⚙️ 设备: ${group.orderNo}`
: `📦 订单: ${group.orderNo}`}
</span> </span>
<span className="text-xs text-gray-400"> <span className="text-xs text-gray-400">
{group.products.length} {group.products.length}
@ -351,15 +353,15 @@ export default function AdminTasksPage() {
{isOpen && ( {isOpen && (
<div className="border-t border-gray-100"> <div className="border-t border-gray-100">
{/* 表头 */} {/* 表头 */}
<div className="grid gap-2 bg-gray-50 px-5 py-2 text-xs font-medium text-gray-500" style={{ gridTemplateColumns: "2fr 1fr 2fr 1fr 1fr 2fr 2fr 2fr" }}> <div className="grid grid-cols-12 gap-2 bg-gray-50 px-5 py-2 text-xs font-medium text-gray-500">
<div className=""></div> <div className="col-span-2"></div>
<div className="col-span-1"></div> <div className="col-span-1"></div>
<div className=""></div> <div className="col-span-2"></div>
<div className="col-span-1"></div> <div className="col-span-1"></div>
<div className="col-span-1"></div> <div className="col-span-1"></div>
<div className=""></div> <div className="col-span-1"></div>
<div className=""></div> <div className="col-span-2"></div>
<div className=""></div> <div className="col-span-2"></div>
</div> </div>
{/* 产品行 */} {/* 产品行 */}
@ -374,41 +376,15 @@ export default function AdminTasksPage() {
return ( return (
<div key={p.id}> <div key={p.id}>
<div className="grid gap-2 border-t border-gray-50 px-5 py-3 items-center text-sm hover:bg-gray-50/50" style={{ gridTemplateColumns: "2fr 1fr 2fr 1fr 1fr 2fr 2fr 2fr" }}> <div className="grid grid-cols-12 gap-2 border-t border-gray-50 px-5 py-3 items-center text-sm hover:bg-gray-50/50">
<div className="col-span-2 font-mono text-xs font-semibold text-gray-800 tracking-wider"> <div className="col-span-2 font-mono text-xs font-semibold text-gray-800 tracking-wider">{p.serial_number}</div>
{p.serial_number} <div className="col-span-1 font-mono text-xs text-gray-600 truncate">{p.external_serial || "—"}</div>
</div> <div className="col-span-2 text-xs text-gray-500 truncate">{p.spec_model || p.material_name || p.material_id || "—"}</div>
<div className="col-span-1 font-mono text-xs text-gray-600 truncate"> <div className="col-span-1"><span className="text-xs font-medium text-gray-700">{p.overall_status || "—"}</span></div>
{p.external_serial || "—"} <div className="col-span-1"><span className={`inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium ${statusCfg.bg} ${statusCfg.text}`}>{statusCfg.label}</span></div>
</div> <div className="col-span-1 text-xs text-gray-500 truncate">{p.current_location_id === "virtual_warehouse" ? (<span className="inline-flex items-center gap-1 text-purple-600">🏭 </span>) : (p.current_location_name || p.current_location_id || "—")}</div>
<div className="col-span-2 text-xs text-gray-500 truncate"> <div className="col-span-2 text-xs text-gray-400">{new Date(p.created_at).toLocaleDateString("zh-CN")}</div>
{p.spec_model || p.material_name || p.material_id || "—"} <div className="col-span-2">
</div>
<div className="col-span-1">
<span className="text-xs font-medium text-gray-700">
{p.overall_status || "—"}
</span>
</div>
<div className="col-span-1">
<span
className={`inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium ${statusCfg.bg} ${statusCfg.text}`}
>
{statusCfg.label}
</span>
</div>
<div className="col-span-2 text-xs text-gray-500 truncate">
{p.current_location_id === "virtual_warehouse" ? (
<span className="inline-flex items-center gap-1 text-purple-600">
🏭
</span>
) : (
p.current_location_name || p.current_location_id || "—"
)}
</div>
<div className="col-span-2 text-xs text-gray-400">
{new Date(p.created_at).toLocaleDateString("zh-CN")}
</div>
<div className="">
<button <button
onClick={() => toggleProductTree(p.serial_number)} onClick={() => toggleProductTree(p.serial_number)}
className="flex items-center gap-1 rounded border border-blue-200 px-2.5 py-1 text-xs font-medium text-blue-600 hover:bg-blue-50 transition-colors" className="flex items-center gap-1 rounded border border-blue-200 px-2.5 py-1 text-xs font-medium text-blue-600 hover:bg-blue-50 transition-colors"