enterprise-saa-s-dashboard-.../src/app/pages/ScrapManagement.tsx

273 lines
11 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Info, Download, Upload, Link as LinkIcon } from "lucide-react";
interface ScrapDevice {
sn: string;
model: string;
scrapDate: string;
status: "待审批" | "已审批" | "已回收";
sourceOrder: string;
reason: string;
}
export default function ScrapManagement() {
const scrapDevices: ScrapDevice[] = [
{
sn: "GD30-2023-001234",
model: "GD30 地质探测仪",
scrapDate: "2024-03-01",
status: "已回收",
sourceOrder: "WO-2024-0001",
reason: "主板损坏无法修复",
},
{
sn: "GT20-2023-000567",
model: "GT20 物探仪",
scrapDate: "2024-03-05",
status: "已审批",
sourceOrder: "WO-2024-0025",
reason: "多个核心部件损坏",
},
{
sn: "GTXD-2023-000890",
model: "GTXD 探测仪",
scrapDate: "2024-03-08",
status: "待审批",
sourceOrder: "WO-2024-0048",
reason: "维修成本超过设备价值",
},
];
const getStatusStyle = (status: ScrapDevice["status"]) => {
switch (status) {
case "已回收":
return {
backgroundColor: '#F6FFED',
color: '#52C41A',
border: '1px solid #B7EB8F'
};
case "已审批":
return {
backgroundColor: '#E6F7FF',
color: '#1890FF',
border: '1px solid #91D5FF'
};
case "待审批":
return {
backgroundColor: '#FFFBE6',
color: '#FAAD14',
border: '1px solid #FFE58F'
};
}
};
return (
<div className="p-6">
{/* Page Header */}
<div className="mb-6">
<div className="flex items-center justify-between mb-2">
<h2 className="text-2xl font-semibold"></h2>
<div className="flex items-center gap-3">
<button
className="px-4 py-2 rounded flex items-center gap-2"
style={{ border: '1px solid #D9D9D9', color: 'rgba(0, 0, 0, 0.85)' }}
>
<Upload size={16} />
</button>
<button
className="px-4 py-2 rounded flex items-center gap-2"
style={{ border: '1px solid #D9D9D9', color: 'rgba(0, 0, 0, 0.85)' }}
>
<Download size={16} />
</button>
</div>
</div>
<p className="text-sm" style={{ color: 'rgba(0, 0, 0, 0.45)' }}></p>
</div>
{/* Info Banner */}
<div
className="mb-6 p-4 rounded-lg flex items-start gap-3"
style={{ backgroundColor: '#E6F7FF', border: '1px solid #91D5FF' }}
>
<Info size={20} style={{ color: '#1890FF', flexShrink: 0, marginTop: 2 }} />
<div style={{ color: '#0050B3' }}>
<div className="font-medium mb-1"></div>
<div className="text-sm">
</div>
</div>
</div>
{/* Stat Cards */}
<div className="grid grid-cols-4 gap-6 mb-6">
<div className="bg-white p-6 rounded-lg" style={{ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.05)' }}>
<div className="text-sm mb-2" style={{ color: 'rgba(0, 0, 0, 0.45)' }}></div>
<div className="text-3xl font-semibold" style={{ color: 'rgba(0, 0, 0, 0.85)' }}>156</div>
</div>
<div className="bg-white p-6 rounded-lg" style={{ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.05)' }}>
<div className="text-sm mb-2" style={{ color: 'rgba(0, 0, 0, 0.45)' }}></div>
<div className="text-3xl font-semibold" style={{ color: '#FAAD14' }}>12</div>
</div>
<div className="bg-white p-6 rounded-lg" style={{ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.05)' }}>
<div className="text-sm mb-2" style={{ color: 'rgba(0, 0, 0, 0.45)' }}></div>
<div className="text-3xl font-semibold" style={{ color: '#1890FF' }}>8</div>
</div>
<div className="bg-white p-6 rounded-lg" style={{ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.05)' }}>
<div className="text-sm mb-2" style={{ color: 'rgba(0, 0, 0, 0.45)' }}></div>
<div className="text-3xl font-semibold" style={{ color: '#52C41A' }}>136</div>
</div>
</div>
{/* Filter Card */}
<div className="bg-white p-6 rounded-lg mb-6" style={{ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.05)' }}>
<div className="grid grid-cols-4 gap-4">
<div>
<label className="block text-sm mb-2" style={{ color: 'rgba(0, 0, 0, 0.65)' }}>
SN号
</label>
<input
type="text"
className="w-full px-3 py-2 border rounded"
style={{ borderColor: '#D9D9D9' }}
placeholder="输入设备SN号搜索"
/>
</div>
<div>
<label className="block text-sm mb-2" style={{ color: 'rgba(0, 0, 0, 0.65)' }}>
</label>
<select
className="w-full px-3 py-2 border rounded"
style={{ borderColor: '#D9D9D9', backgroundColor: '#fff' }}
>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
</div>
<div>
<label className="block text-sm mb-2" style={{ color: 'rgba(0, 0, 0, 0.65)' }}>
</label>
<input
type="date"
className="w-full px-3 py-2 border rounded"
style={{ borderColor: '#D9D9D9' }}
/>
</div>
<div className="flex items-end">
<button
className="w-full px-4 py-2 rounded text-white"
style={{ backgroundColor: '#1890FF' }}
>
</button>
</div>
</div>
</div>
{/* Scrap Device List */}
<div className="bg-white rounded-lg mb-6" style={{ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.05)' }}>
<div className="p-6 border-b" style={{ borderColor: '#F0F0F0' }}>
<h3 className="text-lg font-semibold"></h3>
</div>
<div className="overflow-x-auto">
<table className="w-full">
<thead style={{ backgroundColor: '#FAFAFA' }}>
<tr>
<th className="px-6 py-3 text-left text-sm font-medium" style={{ color: 'rgba(0, 0, 0, 0.85)' }}>SN号</th>
<th className="px-6 py-3 text-left text-sm font-medium" style={{ color: 'rgba(0, 0, 0, 0.85)' }}></th>
<th className="px-6 py-3 text-left text-sm font-medium" style={{ color: 'rgba(0, 0, 0, 0.85)' }}></th>
<th className="px-6 py-3 text-left text-sm font-medium" style={{ color: 'rgba(0, 0, 0, 0.85)' }}></th>
<th className="px-6 py-3 text-left text-sm font-medium" style={{ color: 'rgba(0, 0, 0, 0.85)' }}></th>
<th className="px-6 py-3 text-left text-sm font-medium" style={{ color: 'rgba(0, 0, 0, 0.85)' }}></th>
<th className="px-6 py-3 text-left text-sm font-medium" style={{ color: 'rgba(0, 0, 0, 0.85)' }}></th>
</tr>
</thead>
<tbody>
{scrapDevices.map((device, index) => (
<tr
key={index}
className="border-b"
style={{ borderColor: '#F0F0F0' }}
>
<td className="px-6 py-4">{device.sn}</td>
<td className="px-6 py-4" style={{ color: 'rgba(0, 0, 0, 0.65)' }}>{device.model}</td>
<td className="px-6 py-4" style={{ color: 'rgba(0, 0, 0, 0.65)' }}>{device.scrapDate}</td>
<td className="px-6 py-4" style={{ color: 'rgba(0, 0, 0, 0.65)' }}>{device.reason}</td>
<td className="px-6 py-4">
<span
className="px-2 py-1 rounded text-xs"
style={getStatusStyle(device.status)}
>
{device.status}
</span>
</td>
<td className="px-6 py-4">
<button className="text-sm flex items-center gap-1" style={{ color: '#1890FF' }}>
<LinkIcon size={14} />
{device.sourceOrder}
</button>
</td>
<td className="px-6 py-4">
<div className="flex items-center gap-3">
<button className="text-sm" style={{ color: '#1890FF' }}></button>
<button className="text-sm" style={{ color: '#1890FF' }}></button>
{device.status === "已审批" && (
<button className="text-sm" style={{ color: '#52C41A' }}></button>
)}
</div>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
{/* Pagination */}
<div className="bg-white p-4 rounded-lg flex items-center justify-between" style={{ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.05)' }}>
<div className="text-sm" style={{ color: 'rgba(0, 0, 0, 0.65)' }}>
1-10 / 156
</div>
<div className="flex items-center gap-2">
<button
className="px-3 py-1 rounded border"
style={{ borderColor: '#D9D9D9', color: 'rgba(0, 0, 0, 0.45)' }}
disabled
>
</button>
<button
className="px-3 py-1 rounded"
style={{ backgroundColor: '#1890FF', color: '#fff' }}
>
1
</button>
<button
className="px-3 py-1 rounded border"
style={{ borderColor: '#D9D9D9', color: 'rgba(0, 0, 0, 0.85)' }}
>
2
</button>
<button
className="px-3 py-1 rounded border"
style={{ borderColor: '#D9D9D9', color: 'rgba(0, 0, 0, 0.85)' }}
>
3
</button>
<button
className="px-3 py-1 rounded border"
style={{ borderColor: '#D9D9D9', color: 'rgba(0, 0, 0, 0.85)' }}
>
</button>
</div>
</div>
</div>
);
}