lind пре 4 година
родитељ
комит
195b0365d9
2 измењених фајлова са 131 додато и 46 уклоњено
  1. 51 0
      src/pages/notice/Config/SyncUser/index.tsx
  2. 80 46
      src/pages/notice/Config/index.tsx

+ 51 - 0
src/pages/notice/Config/SyncUser/index.tsx

@@ -0,0 +1,51 @@
+import { Button, Col, Input, Modal, Row, Tree } from 'antd';
+import { observer } from '@formily/react';
+import { state } from '..';
+import ProTable, { ActionType, ProColumns } from '@jetlinks/pro-table';
+import { useRef } from 'react';
+
+const SyncUser = observer(() => {
+  const columns: ProColumns<any>[] = [
+    {
+      dataIndex: 'name',
+      title: '微信用户名',
+    },
+    {
+      dataIndex: 'name',
+      title: '用户',
+    },
+    {
+      dataIndex: 'name',
+      title: '绑定状态',
+    },
+  ];
+  const actionRef = useRef<ActionType>();
+
+  return (
+    <Modal title="同步用户" visible={true} onCancel={() => (state.syncUser = false)} width="80vw">
+      <Row>
+        <Col span={4}>
+          <Input.Search style={{ marginBottom: 8 }} placeholder="Search" onChange={() => {}} />
+          <Tree
+            onExpand={() => {}}
+            // expandedKeys={expandedKeys}
+            // autoExpandParent={autoExpandParent}
+            // treeData={loop(gData)}
+          />
+          这是一颗没有数据的树
+        </Col>
+        <Col span={20}>
+          <ProTable
+            rowKey="id"
+            actionRef={actionRef}
+            search={false}
+            columns={columns}
+            headerTitle={<Button>保存</Button>}
+          />
+        </Col>
+      </Row>
+    </Modal>
+  );
+});
+
+export default SyncUser;

+ 80 - 46
src/pages/notice/Config/index.tsx

@@ -8,9 +8,10 @@ import {
   EditOutlined,
   EditOutlined,
   EyeOutlined,
   EyeOutlined,
   PlusOutlined,
   PlusOutlined,
+  TeamOutlined,
   UnorderedListOutlined,
   UnorderedListOutlined,
 } from '@ant-design/icons';
 } from '@ant-design/icons';
-import { message, Popconfirm, Space, Tooltip, Upload } from 'antd';
+import { message, Space, Tooltip, Upload } from 'antd';
 import { useRef, useState } from 'react';
 import { useRef, useState } from 'react';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import { downloadObject } from '@/utils/util';
 import { downloadObject } from '@/utils/util';
@@ -27,6 +28,7 @@ import Debug from '@/pages/notice/Config/Debug';
 import Log from '@/pages/notice/Config/Log';
 import Log from '@/pages/notice/Config/Log';
 import { typeList } from '@/components/ProTableCard/CardItems/noticeTemplate';
 import { typeList } from '@/components/ProTableCard/CardItems/noticeTemplate';
 import usePermissions from '@/hooks/permission';
 import usePermissions from '@/hooks/permission';
+import SyncUser from '@/pages/notice/Config/SyncUser';
 
 
 export const service = new Service('notifier/config');
 export const service = new Service('notifier/config');
 
 
@@ -34,9 +36,11 @@ export const state = model<{
   current?: ConfigItem;
   current?: ConfigItem;
   debug?: boolean;
   debug?: boolean;
   log?: boolean;
   log?: boolean;
+  syncUser: boolean;
 }>({
 }>({
   debug: false,
   debug: false,
   log: false,
   log: false,
+  syncUser: false,
 });
 });
 const Config = observer(() => {
 const Config = observer(() => {
   const intl = useIntl();
   const intl = useIntl();
@@ -69,24 +73,39 @@ const Config = observer(() => {
       align: 'center',
       align: 'center',
       width: 200,
       width: 200,
       render: (text, record) => [
       render: (text, record) => [
-        <a
+        <PermissionButton
+          tooltip={{
+            title: '同步用户',
+          }}
+          type="link"
+          onClick={() => {
+            state.syncUser = true;
+            state.current = record;
+          }}
+        >
+          <TeamOutlined />
+        </PermissionButton>,
+        <PermissionButton
           key="edit"
           key="edit"
+          type="link"
+          isPermission={configPermission.update}
           onClick={async () => {
           onClick={async () => {
             // setLoading(true);
             // setLoading(true);
             state.current = record;
             state.current = record;
             history.push(getMenuPathByParams(MENUS_CODE['notice/Config/Detail'], id));
             history.push(getMenuPathByParams(MENUS_CODE['notice/Config/Detail'], id));
           }}
           }}
-        >
-          <Tooltip
-            title={intl.formatMessage({
+          tooltip={{
+            title: intl.formatMessage({
               id: 'pages.data.option.edit',
               id: 'pages.data.option.edit',
               defaultMessage: '编辑',
               defaultMessage: '编辑',
-            })}
-          >
-            <EditOutlined />
-          </Tooltip>
-        </a>,
-        <a
+            }),
+          }}
+        >
+          <EditOutlined />
+        </PermissionButton>,
+        <PermissionButton
+          type="link"
+          isPermission={configPermission.export}
           onClick={() =>
           onClick={() =>
             downloadObject(
             downloadObject(
               record,
               record,
@@ -94,17 +113,18 @@ const Config = observer(() => {
             )
             )
           }
           }
           key="download"
           key="download"
-        >
-          <Tooltip
-            title={intl.formatMessage({
+          tooltip={{
+            title: intl.formatMessage({
               id: 'pages.data.option.download',
               id: 'pages.data.option.download',
               defaultMessage: '下载配置',
               defaultMessage: '下载配置',
-            })}
-          >
-            <ArrowDownOutlined />
-          </Tooltip>
-        </a>,
-        <a
+            }),
+          }}
+        >
+          <ArrowDownOutlined />
+        </PermissionButton>,
+        <PermissionButton
+          type="link"
+          isPermission={configPermission.debug}
           key="debug"
           key="debug"
           onClick={() => {
           onClick={() => {
             state.debug = true;
             state.debug = true;
@@ -119,25 +139,27 @@ const Config = observer(() => {
           >
           >
             <BugOutlined />
             <BugOutlined />
           </Tooltip>
           </Tooltip>
-        </a>,
-        <a
+        </PermissionButton>,
+        <PermissionButton
+          type="link"
+          isPermission={configPermission.log}
           key="record"
           key="record"
           onClick={() => {
           onClick={() => {
             state.log = true;
             state.log = true;
           }}
           }}
-        >
-          <Tooltip
-            title={intl.formatMessage({
+          tooltip={{
+            title: intl.formatMessage({
               id: 'pages.data.option.record',
               id: 'pages.data.option.record',
               defaultMessage: '通知记录',
               defaultMessage: '通知记录',
-            })}
-          >
-            <BarsOutlined />
-          </Tooltip>
-        </a>,
-        <a key="remove">
-          <Popconfirm
-            onConfirm={async () => {
+            }),
+          }}
+        >
+          <BarsOutlined />
+        </PermissionButton>,
+        <PermissionButton
+          type="link"
+          popConfirm={{
+            onConfirm: async () => {
               await service.remove(record.id);
               await service.remove(record.id);
               message.success(
               message.success(
                 intl.formatMessage({
                 intl.formatMessage({
@@ -146,19 +168,19 @@ const Config = observer(() => {
                 }),
                 }),
               );
               );
               actionRef.current?.reload();
               actionRef.current?.reload();
-            }}
-            title="确认删除?"
-          >
-            <Tooltip
-              title={intl.formatMessage({
-                id: 'pages.data.option.remove',
-                defaultMessage: '删除',
-              })}
-            >
-              <DeleteOutlined />
-            </Tooltip>
-          </Popconfirm>
-        </a>,
+            },
+            title: '确认删除',
+          }}
+          tooltip={{
+            title: intl.formatMessage({
+              id: 'pages.data.option.remove',
+              defaultMessage: '删除',
+            }),
+          }}
+          key="remove"
+        >
+          <DeleteOutlined />
+        </PermissionButton>,
       ],
       ],
     },
     },
   ];
   ];
@@ -268,6 +290,17 @@ const Config = observer(() => {
             }
             }
             actions={[
             actions={[
               <PermissionButton
               <PermissionButton
+                key="syncUser"
+                isPermission={true}
+                onClick={() => {
+                  state.syncUser = true;
+                  state.current = record;
+                }}
+              >
+                <TeamOutlined />
+                同步用户
+              </PermissionButton>,
+              <PermissionButton
                 isPermission={configPermission.update}
                 isPermission={configPermission.update}
                 type={'link'}
                 type={'link'}
                 key="edit"
                 key="edit"
@@ -338,6 +371,7 @@ const Config = observer(() => {
       />
       />
       <Debug />
       <Debug />
       {state.log && <Log />}
       {state.log && <Log />}
+      {state.syncUser && <SyncUser />}
     </PageContainer>
     </PageContainer>
   );
   );
 });
 });