index.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import { PageContainer } from '@ant-design/pro-layout';
  2. import BaseService from '@/utils/BaseService';
  3. import type { ProtocolItem } from '@/pages/link/Protocol/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<ProtocolItem>('protocol');
  17. const Protocol = () => {
  18. const intl = useIntl();
  19. const actionRef = useRef<ActionType>();
  20. const columns: ProColumns<ProtocolItem>[] = [
  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: 'provider',
  42. title: intl.formatMessage({
  43. id: 'pages.table.provider',
  44. defaultMessage: '服务商',
  45. }),
  46. },
  47. {
  48. title: intl.formatMessage({
  49. id: 'pages.data.option',
  50. defaultMessage: '操作',
  51. }),
  52. valueType: 'option',
  53. align: 'center',
  54. width: 200,
  55. render: (text, record) => [
  56. <a onClick={() => console.log(record)}>
  57. <Tooltip
  58. title={intl.formatMessage({
  59. id: 'pages.data.option.edit',
  60. defaultMessage: '编辑',
  61. })}
  62. >
  63. <EditOutlined />
  64. </Tooltip>
  65. </a>,
  66. <a>
  67. <Tooltip
  68. title={intl.formatMessage({
  69. id: 'pages.data.option.remove',
  70. defaultMessage: '删除',
  71. })}
  72. >
  73. <MinusOutlined />
  74. </Tooltip>
  75. </a>,
  76. <a>
  77. <Tooltip
  78. title={intl.formatMessage({
  79. id: 'pages.data.option.download',
  80. defaultMessage: '下载配置',
  81. })}
  82. >
  83. <ArrowDownOutlined />
  84. </Tooltip>
  85. </a>,
  86. <a>
  87. <Tooltip
  88. title={intl.formatMessage({
  89. id: 'pages.notice.option.debug',
  90. defaultMessage: '调试',
  91. })}
  92. >
  93. <BugOutlined />
  94. </Tooltip>
  95. </a>,
  96. <a>
  97. <Tooltip
  98. title={intl.formatMessage({
  99. id: 'pages.data.option.record',
  100. defaultMessage: '通知记录',
  101. })}
  102. >
  103. <BarsOutlined />
  104. </Tooltip>
  105. </a>,
  106. ],
  107. },
  108. ];
  109. const schema = {};
  110. return (
  111. <PageContainer>
  112. <BaseCrud
  113. columns={columns}
  114. service={service}
  115. title={intl.formatMessage({
  116. id: 'pages.link.protocol',
  117. defaultMessage: '协议管理',
  118. })}
  119. schema={schema}
  120. actionRef={actionRef}
  121. />
  122. </PageContainer>
  123. );
  124. };
  125. export default Protocol;