|
@@ -1,62 +1,54 @@
|
|
|
-import { Avatar, Card } from 'antd';
|
|
|
|
|
import React from 'react';
|
|
import React from 'react';
|
|
|
import type { ProductItem } from '@/pages/device/Product/typings';
|
|
import type { ProductItem } from '@/pages/device/Product/typings';
|
|
|
-import { BadgeStatus } from '@/components';
|
|
|
|
|
import { StatusColorEnum } from '@/components/BadgeStatus';
|
|
import { StatusColorEnum } from '@/components/BadgeStatus';
|
|
|
-import { getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
|
|
|
|
|
-import { ModelEnum } from '@/pages/device/Product/Detail';
|
|
|
|
|
-import { Link, useIntl } from 'umi';
|
|
|
|
|
|
|
+import { useIntl } from 'umi';
|
|
|
|
|
+import { TableCard } from '@/components';
|
|
|
|
|
+import '@/style/common.less';
|
|
|
import '../index.less';
|
|
import '../index.less';
|
|
|
|
|
|
|
|
export interface ProductCardProps extends ProductItem {
|
|
export interface ProductCardProps extends ProductItem {
|
|
|
|
|
+ detail?: React.ReactNode;
|
|
|
actions?: React.ReactNode[];
|
|
actions?: React.ReactNode[];
|
|
|
avatarSize?: number;
|
|
avatarSize?: number;
|
|
|
}
|
|
}
|
|
|
|
|
+const defaultImage = require('/public/images/device-type-3-big.png');
|
|
|
|
|
|
|
|
export default (props: ProductCardProps) => {
|
|
export default (props: ProductCardProps) => {
|
|
|
const intl = useIntl();
|
|
const intl = useIntl();
|
|
|
-
|
|
|
|
|
return (
|
|
return (
|
|
|
- <Card style={{ width: '100%' }} cover={null} actions={props.actions}>
|
|
|
|
|
|
|
+ <TableCard
|
|
|
|
|
+ detail={props.detail}
|
|
|
|
|
+ actions={props.actions}
|
|
|
|
|
+ status={props.state}
|
|
|
|
|
+ statusText={intl.formatMessage({
|
|
|
|
|
+ id: `pages.system.tenant.assetInformation.${props.state ? 'published' : 'unpublished'}`,
|
|
|
|
|
+ defaultMessage: '已发布',
|
|
|
|
|
+ })}
|
|
|
|
|
+ statusNames={{
|
|
|
|
|
+ 0: StatusColorEnum.error,
|
|
|
|
|
+ 1: StatusColorEnum.processing,
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
<div className={'pro-table-card-item'}>
|
|
<div className={'pro-table-card-item'}>
|
|
|
<div className={'card-item-avatar'}>
|
|
<div className={'card-item-avatar'}>
|
|
|
- <Avatar size={props.avatarSize || 64} src={props.photoUrl} />
|
|
|
|
|
|
|
+ <img width={88} height={88} src={props.photoUrl || defaultImage} alt={''} />
|
|
|
</div>
|
|
</div>
|
|
|
<div className={'card-item-body'}>
|
|
<div className={'card-item-body'}>
|
|
|
<div className={'card-item-header'}>
|
|
<div className={'card-item-header'}>
|
|
|
<span className={'card-item-header-name ellipsis'}>{props.name}</span>
|
|
<span className={'card-item-header-name ellipsis'}>{props.name}</span>
|
|
|
- <BadgeStatus
|
|
|
|
|
- status={props.state}
|
|
|
|
|
- text={intl.formatMessage({
|
|
|
|
|
- id: `pages.system.tenant.assetInformation.${
|
|
|
|
|
- props.state ? 'published' : 'unpublished'
|
|
|
|
|
- }`,
|
|
|
|
|
- defaultMessage: '已发布',
|
|
|
|
|
- })}
|
|
|
|
|
- statusNames={{
|
|
|
|
|
- 0: StatusColorEnum.error,
|
|
|
|
|
- 1: StatusColorEnum.processing,
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
- <div className={'card-item-content'}>
|
|
|
|
|
- <label>设备类型:</label>
|
|
|
|
|
- <span className={'ellipsis'}>{props.deviceType ? props.deviceType.text : '--'}</span>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
<div className={'card-item-content'}>
|
|
<div className={'card-item-content'}>
|
|
|
- <label>接入方式:</label>
|
|
|
|
|
- <span className={'ellipsis'}>
|
|
|
|
|
- <Link
|
|
|
|
|
- to={`${getMenuPathByParams(MENUS_CODE['device/Product/Detail'], props.id)}?type=${
|
|
|
|
|
- ModelEnum.access
|
|
|
|
|
- }`}
|
|
|
|
|
- >
|
|
|
|
|
- {props.transportProtocol || '--'}
|
|
|
|
|
- </Link>
|
|
|
|
|
- </span>
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <label>设备类型</label>
|
|
|
|
|
+ <div className={'ellipsis'}>{props.deviceType ? props.deviceType.text : '--'}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <label>接入方式</label>
|
|
|
|
|
+ <div className={'ellipsis'}>{props.transportProtocol || '--'}</div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- </Card>
|
|
|
|
|
|
|
+ </TableCard>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|