From e4e47fea3b41c9a6aabc2721d7ec761a41ac0f04 Mon Sep 17 00:00:00 2001 From: shunli Date: Wed, 6 May 2026 00:30:28 +0800 Subject: [PATCH] =?UTF-8?q?R94=20A2/A3/A4=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8D=A1=E7=89=87=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/pages/AssetRegistryPage.tsx | 90 +++++++++- client/src/pages/NotificationsPage.tsx | 54 +++++- client/src/pages/PurchaseRequestsPage.tsx | 198 +++++++++++++++++++++- 3 files changed, 323 insertions(+), 19 deletions(-) diff --git a/client/src/pages/AssetRegistryPage.tsx b/client/src/pages/AssetRegistryPage.tsx index b33a2e48..6287fd25 100644 --- a/client/src/pages/AssetRegistryPage.tsx +++ b/client/src/pages/AssetRegistryPage.tsx @@ -570,6 +570,13 @@ export function AssetRegistryPage() { return items; }, [approvedPurchasesQuery.data?.items, currentAsset?.purchaseRequest]); + const categoryItems = categoriesQuery.data?.items ?? []; + const assetItems = assetsQuery.data?.items ?? []; + const selectAsset = (assetId: string) => { + setIsCreatingAsset(false); + setSelectedAssetId(assetId); + }; + return (
{resolveError(categoriesQuery.error)}

) : null} {!categoriesQuery.isLoading && !categoriesQuery.isError ? ( -
+ <> +
+ {categoryItems.length ? ( + categoryItems.map((item) => ( + + )) + ) : ( +
暂无资产分类
+ )} +
+
@@ -646,7 +679,7 @@ export function AssetRegistryPage() { - {(categoriesQuery.data?.items ?? []).map((item) => ( + {categoryItems.map((item) => ( resetCategoryEditor(item)} className="cursor-pointer"> {item.code} @@ -658,7 +691,8 @@ export function AssetRegistryPage() { ))}
-
+
+ ) : null}
@@ -724,7 +758,45 @@ export function AssetRegistryPage() {

{resolveError(assetsQuery.error)}

) : null} {!assetsQuery.isLoading && !assetsQuery.isError ? ( -
+ <> +
+ {assetItems.length ? ( + assetItems.map((item) => ( + + )) + ) : ( +
暂无资产卡片
+ )} +
+
@@ -735,11 +807,10 @@ export function AssetRegistryPage() { - {(assetsQuery.data?.items ?? []).length ? ( - assetsQuery.data?.items.map((item) => ( + {assetItems.length ? ( + assetItems.map((item) => ( { - setIsCreatingAsset(false); - setSelectedAssetId(item.id); + selectAsset(item.id); }} className={item.id === selectedAssetId && !isCreatingAsset ? "bg-zinc-50" : "cursor-pointer"}>
{item.assetNo}
@@ -759,7 +830,8 @@ export function AssetRegistryPage() { )}
-
+
+ ) : null} diff --git a/client/src/pages/NotificationsPage.tsx b/client/src/pages/NotificationsPage.tsx index 56f53e0a..be0c93cb 100644 --- a/client/src/pages/NotificationsPage.tsx +++ b/client/src/pages/NotificationsPage.tsx @@ -83,6 +83,7 @@ export function NotificationsPage() { }); const totalPages = Math.max(1, Math.ceil((listQuery.data?.total ?? 0) / PAGE_SIZE)); + const notificationItems = listQuery.data?.items ?? []; return (
@@ -172,7 +173,51 @@ export function NotificationsPage() { ) : null} {!listQuery.isLoading && !listQuery.isError ? ( -
+ <> +
+ {notificationItems.length ? ( + notificationItems.map((item) => { + const targetLink = resolveNotificationTargetLink(item); + return ( +
+
+
+
{item.title}
+ {item.body ?
{item.body}
: null} +
+ + {item.readAt ? "已读" : "未读"} + +
+
{item.createdAt.slice(0, 19).replace("T", " ")}
+
+ {targetLink ? ( + + ) : null} + + {!item.readAt ? ( + + ) : null} +
+
+ ); + }) + ) : ( +
暂无通知
+ )} +
+
@@ -183,8 +228,8 @@ export function NotificationsPage() { - {(listQuery.data?.items ?? []).length ? ( - listQuery.data?.items.map((item) => { + {notificationItems.length ? ( + notificationItems.map((item) => { const targetLink = resolveNotificationTargetLink(item); return ( @@ -234,7 +279,8 @@ export function NotificationsPage() { )}
-
+
+ ) : null} items.reduce((sum, item) => sum + Number(moneyPreview(item.quantity, item.unitPrice)), 0).toFixed(2), [items], @@ -833,7 +834,48 @@ export function PurchaseRequestsPage() { ) : null} {!listQuery.isLoading && !listQuery.isError ? ( -
+ <> +
+ {purchaseItems.length ? ( + purchaseItems.map((item) => ( + + )) + ) : ( +
暂无采购申请
+ )} +
+
@@ -844,8 +886,8 @@ export function PurchaseRequestsPage() { - {(listQuery.data?.items ?? []).length ? ( - listQuery.data?.items.map((item) => ( + {purchaseItems.length ? ( + purchaseItems.map((item) => (
-
+
+ ) : null}
-
+
+ {items.length ? ( + items.map((item, index) => ( +
+
+
明细 {index + 1}
+
{moneyPreview(item.quantity, item.unitPrice)}
+
+
+
+ + + setItems((current) => + current.map((entry) => + entry.id === item.id ? { ...entry, description: event.target.value } : entry, + ), + ) + } + /> +
+
+ + + setItems((current) => + current.map((entry) => + entry.id === item.id ? { ...entry, specification: event.target.value } : entry, + ), + ) + } + /> +
+
+
+ + + setItems((current) => + current.map((entry) => + entry.id === item.id ? { ...entry, quantity: event.target.value } : entry, + ), + ) + } + /> +
+
+ + + setItems((current) => + current.map((entry) => + entry.id === item.id ? { ...entry, unitPrice: event.target.value } : entry, + ), + ) + } + /> +
+
+
+ + +
+
+
+ )) + ) : ( +
+ 暂无明细,请先新增至少一条采购项。 +
+ )} +
+
@@ -1154,7 +1302,45 @@ export function PurchaseRequestsPage() { }} /> -
+
+ {detail.attachments.length ? ( + detail.attachments.map((attachment) => ( +
+
{attachment.originalName}
+
{attachment.mimeType} / {attachment.fileSize} bytes
+
+
+
上传人
+
{attachment.uploader?.name ?? "-"}
+
+
+
时间
+
+ {attachment.createdAt ? new Date(attachment.createdAt).toLocaleString() : "-"} +
+
+
+
+ + +
+
+ )) + ) : ( +
暂无附件
+ )} +
+