diff --git a/nkebao/src/components/DeviceSelection/data.ts b/nkebao/src/components/DeviceSelection/data.ts index e8a09b5f..f493e071 100644 --- a/nkebao/src/components/DeviceSelection/data.ts +++ b/nkebao/src/components/DeviceSelection/data.ts @@ -1,6 +1,6 @@ // 设备选择项接口 export interface DeviceSelectionItem { - id: string; + id: number; name: string; imei: string; wechatId: string; @@ -12,8 +12,8 @@ export interface DeviceSelectionItem { // 组件属性接口 export interface DeviceSelectionProps { - selectedOptions: string[]; - onSelect: (devices: string[]) => void; + selectedOptions: DeviceSelectionItem[]; + onSelect: (devices: DeviceSelectionItem[]) => void; placeholder?: string; className?: string; mode?: "input" | "dialog"; // 新增,默认input diff --git a/nkebao/src/components/DeviceSelection/index.tsx b/nkebao/src/components/DeviceSelection/index.tsx index c358e0ff..d3f9bfc5 100644 --- a/nkebao/src/components/DeviceSelection/index.tsx +++ b/nkebao/src/components/DeviceSelection/index.tsx @@ -41,9 +41,9 @@ const DeviceSelection: React.FC = ({ }; // 删除已选设备 - const handleRemoveDevice = (id: string) => { + const handleRemoveDevice = (id: number) => { if (readonly) return; - onSelect(selectedOptions.filter(d => d !== id)); + onSelect(selectedOptions.filter(v => v.id !== id)); }; return ( @@ -79,9 +79,9 @@ const DeviceSelection: React.FC = ({ background: "#fff", }} > - {selectedOptions.map(deviceId => ( + {selectedOptions.map(device => (
= ({ textOverflow: "ellipsis", }} > - {deviceId} + 【 {device.name}】 - {device.wechatId}
{!readonly && (