Browse Source

feat(notice): add Config/Template component

Lind 4 years ago
parent
commit
c8b1b66faa
2 changed files with 151 additions and 2 deletions
  1. 82 1
      src/pages/notice/Config/index.tsx
  2. 69 1
      src/pages/notice/Template/index.tsx

+ 82 - 1
src/pages/notice/Config/index.tsx

@@ -1,6 +1,87 @@
 import { PageContainer } from '@ant-design/pro-layout';
+import BaseService from '@/utils/BaseService';
+import type { ActionType, ProColumns } from '@jetlinks/pro-table';
+import {
+  ArrowDownOutlined,
+  BarsOutlined,
+  BugOutlined,
+  EditOutlined,
+  MinusOutlined,
+} from '@ant-design/icons';
+import { Tooltip } from 'antd';
+import { useRef } from 'react';
+import BaseCrud from '@/components/BaseCrud';
+
+export const service = new BaseService<ConfigItem>('notifier/config');
 
 const Config = () => {
-  return <PageContainer>Config</PageContainer>;
+  const actionRef = useRef<ActionType>();
+
+  const columns: ProColumns<ConfigItem>[] = [
+    {
+      dataIndex: 'index',
+      valueType: 'indexBorder',
+      width: 48,
+    },
+    {
+      dataIndex: 'name',
+      title: '名称',
+    },
+    {
+      dataIndex: 'type',
+      title: '通知类型',
+    },
+    {
+      dataIndex: 'provider',
+      title: '服务商',
+    },
+    {
+      title: '操作',
+      valueType: 'option',
+      align: 'center',
+      width: 200,
+      render: (text, record) => [
+        <a onClick={() => console.log(record)}>
+          <Tooltip title="编辑">
+            <EditOutlined />
+          </Tooltip>
+        </a>,
+        <a>
+          <Tooltip title="删除">
+            <MinusOutlined />
+          </Tooltip>
+        </a>,
+        <a>
+          <Tooltip title="下载配置">
+            <ArrowDownOutlined />
+          </Tooltip>
+        </a>,
+        <a>
+          <Tooltip title="调试">
+            <BugOutlined />
+          </Tooltip>
+        </a>,
+        <a>
+          <Tooltip title="通知记录">
+            <BarsOutlined />
+          </Tooltip>
+        </a>,
+      ],
+    },
+  ];
+
+  const schema = {};
+
+  return (
+    <PageContainer>
+      <BaseCrud
+        columns={columns}
+        service={service}
+        title="通知配置"
+        schema={schema}
+        actionRef={actionRef}
+      />
+    </PageContainer>
+  );
 };
 export default Config;

+ 69 - 1
src/pages/notice/Template/index.tsx

@@ -1,6 +1,74 @@
 import { PageContainer } from '@ant-design/pro-layout';
+import BaseService from '@/utils/BaseService';
+import { useRef } from 'react';
+import type { ActionType, ProColumns } from '@jetlinks/pro-table';
+import BaseCrud from '@/components/BaseCrud';
+import { ArrowDownOutlined, BugOutlined, EditOutlined, MinusOutlined } from '@ant-design/icons';
+import { Tooltip } from 'antd';
 
+export const service = new BaseService<TemplateItem>('notifier/template');
 const Template = () => {
-  return <PageContainer>Template</PageContainer>;
+  const actionRef = useRef<ActionType>();
+
+  const columns: ProColumns<TemplateItem>[] = [
+    {
+      dataIndex: 'index',
+      valueType: 'indexBorder',
+      width: 48,
+    },
+    {
+      dataIndex: 'name',
+      title: '名称',
+    },
+    {
+      dataIndex: 'type',
+      title: '通知类型',
+    },
+    {
+      dataIndex: 'provider',
+      title: '服务商',
+    },
+    {
+      title: '操作',
+      valueType: 'option',
+      align: 'center',
+      width: 200,
+      render: (text, record) => [
+        <a onClick={() => console.log(record)}>
+          <Tooltip title="编辑">
+            <EditOutlined />
+          </Tooltip>
+        </a>,
+        <a>
+          <Tooltip title="删除">
+            <MinusOutlined />
+          </Tooltip>
+        </a>,
+        <a>
+          <Tooltip title="下载配置">
+            <ArrowDownOutlined />
+          </Tooltip>
+        </a>,
+        <a>
+          <Tooltip title="调试">
+            <BugOutlined />
+          </Tooltip>
+        </a>,
+      ],
+    },
+  ];
+
+  const schema = {};
+  return (
+    <PageContainer>
+      <BaseCrud
+        columns={columns}
+        service={service}
+        title="通知模版"
+        schema={schema}
+        actionRef={actionRef}
+      />
+    </PageContainer>
+  );
 };
 export default Template;