index.tsx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import { PageContainer } from '@ant-design/pro-layout';
  2. import BaseService from '@/utils/BaseService';
  3. import type { GatewayItem } from '@/pages/link/Gateway/typings';
  4. import { useRef } from 'react';
  5. import type { ActionType, ProColumns } from '@jetlinks/pro-table';
  6. import { Tooltip } from 'antd';
  7. import {
  8. ArrowDownOutlined,
  9. BarsOutlined,
  10. BugOutlined,
  11. EditOutlined,
  12. MinusOutlined,
  13. } from '@ant-design/icons';
  14. import BaseCrud from '@/components/BaseCrud';
  15. import { useIntl } from '@@/plugin-locale/localeExports';
  16. export const service = new BaseService<GatewayItem>('network/config');
  17. const Gateway = () => {
  18. const intl = useIntl();
  19. const actionRef = useRef<ActionType>();
  20. const columns: ProColumns<GatewayItem>[] = [
  21. {
  22. dataIndex: 'index',
  23. valueType: 'indexBorder',
  24. width: 48,
  25. },
  26. {
  27. dataIndex: 'name',
  28. title: intl.formatMessage({
  29. id: 'pages.table.name',
  30. defaultMessage: '名称',
  31. }),
  32. },
  33. {
  34. dataIndex: 'type',
  35. title: intl.formatMessage({
  36. id: 'pages.link.type',
  37. defaultMessage: '类型',
  38. }),
  39. },
  40. {
  41. dataIndex: 'state',
  42. title: intl.formatMessage({
  43. id: 'pages.searchTable.titleStatus',
  44. defaultMessage: '状态',
  45. }),
  46. render: (text, record) => record.state.value,
  47. },
  48. {
  49. title: intl.formatMessage({
  50. id: 'pages.data.option',
  51. defaultMessage: '操作',
  52. }),
  53. valueType: 'option',
  54. align: 'center',
  55. width: 200,
  56. render: (text, record) => [
  57. <a onClick={() => console.log(record)}>
  58. <Tooltip
  59. title={intl.formatMessage({
  60. id: 'pages.data.option.edit',
  61. defaultMessage: '编辑',
  62. })}
  63. >
  64. <EditOutlined />
  65. </Tooltip>
  66. </a>,
  67. <a>
  68. <Tooltip
  69. title={intl.formatMessage({
  70. id: 'pages.data.option.remove',
  71. defaultMessage: '删除',
  72. })}
  73. >
  74. <MinusOutlined />
  75. </Tooltip>
  76. </a>,
  77. <a>
  78. <Tooltip
  79. title={intl.formatMessage({
  80. id: 'pages.data.option.download',
  81. defaultMessage: '下载配置',
  82. })}
  83. >
  84. <ArrowDownOutlined />
  85. </Tooltip>
  86. </a>,
  87. <a>
  88. <Tooltip
  89. title={intl.formatMessage({
  90. id: 'pages.notice.option.debug',
  91. defaultMessage: '调试',
  92. })}
  93. >
  94. <BugOutlined />
  95. </Tooltip>
  96. </a>,
  97. <a>
  98. <Tooltip
  99. title={intl.formatMessage({
  100. id: 'pages.data.option.record',
  101. defaultMessage: '通知记录',
  102. })}
  103. >
  104. <BarsOutlined />
  105. </Tooltip>
  106. </a>,
  107. ],
  108. },
  109. ];
  110. const schema = {};
  111. return (
  112. <PageContainer>
  113. <BaseCrud
  114. columns={columns}
  115. service={service}
  116. title={intl.formatMessage({
  117. id: 'pages.link.gateway',
  118. defaultMessage: '设备网关',
  119. })}
  120. schema={schema}
  121. actionRef={actionRef}
  122. />
  123. </PageContainer>
  124. );
  125. };
  126. export default Gateway;