import React, { useState } from 'react'; import type { DeviceInstance } from '@/pages/device/Instance/typings'; import { StatusColorEnum } from '@/components/BadgeStatus'; import { TableCard, Ellipsis } from '@/components'; import '@/style/common.less'; import '../index.less'; import { CheckOutlined } from '@ant-design/icons'; export interface DeviceCardProps extends Partial { detail?: React.ReactNode; actions?: React.ReactNode[]; avatarSize?: number; className?: string; content?: React.ReactNode[]; onClick?: () => void; grantedPermissions?: string[]; onUnBind?: (e: any) => void; showBindBtn?: boolean; cardType?: 'bind' | 'unbind'; showTool?: boolean; } const defaultImage = require('/public/images/device-type-3-big.png'); export const PermissionsMap = { read: '查看', save: '编辑', delete: '删除', }; export const handlePermissionsMap = (permissions?: string[]) => { return permissions && permissions.length ? permissions.map((item) => PermissionsMap[item]).toString() : ''; }; export const ExtraDeviceCard = (props: DeviceCardProps) => { const [imgUrl, setImgUrl] = useState(props.photoUrl || defaultImage); return (
{''} { setImgUrl(defaultImage); }} />
{/*
*/} {/* {props.id || ''}*/} {/*
*/}
{props.cardType === 'bind' ? (
{/**/} {/*
{props.describe}
*/} {/*
*/}
) : (
{/*
*/} {/* */} {/* {handlePermissionsMap(props.grantedPermissions)}*/} {/* */} {/*
*/}
)}
); }; export default (props: DeviceCardProps) => { return (
{''}
{/*
{props.deviceType ? props.deviceType.text : ''}
*/}
{/*
{props.productName || ''}
*/}
); };