fix(Inventory): 修復庫存列表批號欄位與新增庫存頁面儲位欄位遺失問題,並還原批號輸入佈局

This commit is contained in:
2026-02-06 17:35:50 +08:00
parent e018b75783
commit f22df90e01
8 changed files with 48 additions and 8 deletions

View File

@@ -162,7 +162,7 @@ export default function InventoryImportDialog({ open, onOpenChange, warehouseId
<div className="text-sm text-gray-600 space-y-2 pb-2 pl-6">
<ul className="list-disc space-y-1">
<li><span className="font-medium text-gray-700"></span>使</li>
<li><span className="font-medium text-gray-700"></span> Excel <span className="underline"></span></li>
<li><span className="font-medium text-gray-700"></span> Excel ()</li>
<li><span className="font-medium text-gray-700"></span>2026/12/31</li>
<li><span className="font-medium text-gray-700"></span>使</li>
</ul>

View File

@@ -42,7 +42,11 @@ export default function InventoryTable({
onView,
onDelete,
onViewProduct,
}: InventoryTableProps) {
warehouse,
}: InventoryTableProps & { warehouse: any }) {
// 判斷是否為販賣機倉庫
const isVending = warehouse?.type === "vending";
// 每個商品的展開/折疊狀態
const [expandedProducts, setExpandedProducts] = useState<Set<string>>(new Set());
@@ -197,7 +201,8 @@ export default function InventoryTable({
<TableHeader>
<TableRow>
<TableHead className="w-[5%]">#</TableHead>
<TableHead className="w-[12%]"></TableHead>
<TableHead className="w-[15%]"></TableHead>
<TableHead className="w-[10%]">{isVending ? "貨道" : "儲位"}</TableHead>
<TableHead className="w-[10%]"></TableHead>
<Can permission="inventory.view_cost">
<TableHead className="w-[10%]"></TableHead>
@@ -215,6 +220,7 @@ export default function InventoryTable({
<TableRow key={batch.id}>
<TableCell className="text-grey-2">{index + 1}</TableCell>
<TableCell>{batch.batchNumber || "-"}</TableCell>
<TableCell>{batch.location || "-"}</TableCell>
<TableCell>
<span>{batch.quantity} {batch.unit}</span>
</TableCell>

View File

@@ -510,6 +510,9 @@ export default function AddInventoryPage({ warehouse, products }: Props) {
<span className="text-red-500">*</span>
</TableHead>
<TableHead className="w-[90px]"></TableHead>
<TableHead className="w-[120px]">
{warehouse.type === 'vending' ? '貨道' : '儲位'}
</TableHead>
<TableHead className="w-[50px]"></TableHead>
</TableRow>
</TableHeader>
@@ -714,6 +717,16 @@ export default function AddInventoryPage({ warehouse, products }: Props) {
)}
</TableCell>
{/* 儲位/貨道 */}
<TableCell>
<Input
value={item.location || ""}
onChange={(e) => handleUpdateItem(item.tempId, { location: e.target.value })}
className="border-gray-300"
placeholder={warehouse.type === 'vending' ? "貨道 (如: A1)" : "儲位 (選填)"}
/>
</TableCell>
{/* 刪除按鈕 */}
<TableCell>
<Button

View File

@@ -201,6 +201,7 @@ export default function WarehouseInventoryPage({
onView={handleView}
onDelete={confirmDelete}
onViewProduct={handleViewProduct}
warehouse={warehouse}
/>
</div>
<AlertDialog open={!!deleteId} onOpenChange={(open) => !open && setDeleteId(null)}>

View File

@@ -47,6 +47,7 @@ export interface WarehouseInventory {
safetyStock: number | null;
status?: '正常' | '低於'; // 後端可能回傳的狀態
batchNumber: string; // 批號 (Mock for now)
location?: string; // 儲位/貨道
expiryDate: string;
lastInboundDate: string | null;
lastOutboundDate: string | null;
@@ -177,6 +178,7 @@ export interface InboundItem {
batchMode?: 'existing' | 'new' | 'none'; // 批號模式
inventoryId?: string; // 選擇現有批號時的 ID
batchNumber?: string;
location?: string; // 儲位/貨道
originCountry?: string; // 新增產地
expiryDate?: string;
}