AlarmConfig.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import React from 'react';
  2. import { TableCard } from '@/components';
  3. import '@/style/common.less';
  4. import '../index.less';
  5. import { StatusColorEnum } from '@/components/BadgeStatus';
  6. import { Tooltip } from 'antd';
  7. import { Store } from 'jetlinks-store';
  8. export interface AlarmConfigProps extends ConfigurationItem {
  9. detail?: React.ReactNode;
  10. actions?: React.ReactNode[];
  11. avatarSize?: number;
  12. }
  13. export const aliyunSms = require('/public/images/alarm/alarm-config.png');
  14. export default (props: AlarmConfigProps) => {
  15. return (
  16. <TableCard
  17. actions={props.actions}
  18. detail={props.detail}
  19. status={props.state?.value}
  20. statusText={props.state?.text}
  21. statusNames={{
  22. enabled: StatusColorEnum.success,
  23. disabled: StatusColorEnum.error,
  24. }}
  25. showMask={false}
  26. >
  27. <div className={'pro-table-card-item'}>
  28. <div className={'card-item-avatar'}>
  29. <img width={88} height={88} src={aliyunSms} alt={''} />
  30. </div>
  31. <div className={'card-item-body'}>
  32. <div className={'card-item-header'}>
  33. <span className={'card-item-header-name ellipsis'}>{props?.name}</span>
  34. </div>
  35. <div className={'card-item-content'}>
  36. <div>
  37. <label>关联场景联动</label>
  38. <div className={'ellipsis'}>
  39. <Tooltip title={props?.sceneName || ''}>{props?.sceneName || ''}</Tooltip>
  40. </div>
  41. </div>
  42. <div>
  43. <label>告警级别</label>
  44. <div className={'ellipsis'}>
  45. <Tooltip
  46. title={
  47. (Store.get('default-level') || []).find(
  48. (item: any) => item?.level === props?.level,
  49. )?.title || props?.level
  50. }
  51. >
  52. {(Store.get('default-level') || []).find(
  53. (item: any) => item?.level === props?.level,
  54. )?.title || props?.level}
  55. </Tooltip>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </TableCard>
  62. );
  63. };