xieyonghong hace 3 años
padre
commit
59e09235f7

+ 129 - 110
src/pages/notice/Config/SyncUser/index.tsx

@@ -1,4 +1,16 @@
-import { Badge, Button, Col, Input, message, Modal, Popconfirm, Row, Tooltip, Tree } from 'antd';
+import {
+  Badge,
+  Button,
+  Col,
+  Input,
+  message,
+  Modal,
+  Popconfirm,
+  Row,
+  Spin,
+  Tooltip,
+  Tree,
+} from 'antd';
 import { observer } from '@formily/react';
 import { service, state } from '..';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
@@ -88,27 +100,32 @@ const SyncUser = observer(() => {
 
   const [treeData, setTreeData] = useState([]);
 
+  const [loading, setLoading] = useState<boolean>(true);
   /**
    * 获取部门列表
    */
   const getDepartment = async () => {
     if (state.current?.id) {
       if (id === 'dingTalk') {
-        service.syncUser.dingTalkDept(state.current?.id).then((resp) => {
-          if (resp.status === 200) {
-            setTreeData(resp.result);
-            setDept(resp.result[0].id);
-            // console.log(resp.result[0].id, 'id');
-          }
-        });
+        service.syncUser
+          .dingTalkDept(state.current?.id)
+          .then((resp) => {
+            if (resp.status === 200) {
+              setTreeData(resp.result);
+              setDept(resp.result[0].id);
+            }
+          })
+          .finally(() => setLoading(false));
       } else if (id === 'weixin') {
-        service.syncUser.wechatDept(state.current?.id).then((resp) => {
-          if (resp.status === 200) {
-            setTreeData(resp.result);
-            setDept(resp.result[0].id);
-            // console.log(resp.result[0].id, 'id~~');
-          }
-        });
+        service.syncUser
+          .wechatDept(state.current?.id)
+          .then((resp) => {
+            if (resp.status === 200) {
+              setTreeData(resp.result);
+              setDept(resp.result[0].id);
+            }
+          })
+          .finally(() => setLoading(false));
       }
     }
   };
@@ -128,104 +145,106 @@ const SyncUser = observer(() => {
       onCancel={() => (state.syncUser = false)}
       width="80vw"
     >
-      <Row>
-        <Col span={4}>
-          <div style={{ borderRight: 'lightgray 1px solid', padding: '2px', height: '600px' }}>
-            <Input.Search style={{ marginBottom: 8 }} placeholder="请输入部门名称" />
-            <Tree
-              fieldNames={{
-                title: 'name',
-                key: 'id',
-              }}
-              selectedKeys={[dept || '']}
-              onSelect={(key) => {
-                setDept(key[0] as string);
-              }}
-              treeData={treeData}
-            />
-          </div>
-        </Col>
-        <Col span={20}>
-          {dept && (
-            <ProTable
-              rowKey="thirdPartyUserId"
-              actionRef={actionRef}
-              search={false}
-              columns={columns}
-              params={{ dept: dept }}
-              request={(params) =>
-                service
-                  .queryZipSyncUser(
-                    {
-                      dingTalk: 'dingtalk',
-                      weixin: 'wechat',
-                    }[id],
-                    id,
-                    state.current?.provider || '',
-                    state.current?.id || '',
-                    params.dept || '',
-                  )
-                  .then((resp: any) => {
-                    setList(resp);
-                    return {
-                      code: '',
-                      result: {
-                        data: resp || [],
-                        pageIndex: 0,
-                        pageSize: 0,
-                        total: 0,
-                      },
-                      status: 200,
-                    };
-                  })
-              }
-              headerTitle={
-                <Popconfirm
-                  title="确认保存"
-                  onConfirm={async () => {
-                    const arr = list
-                      .filter((item) => item.status === 0)
-                      .map((i) => {
-                        return {
-                          userId: i.userId,
-                          providerName: i.userName,
-                          thirdPartyUserId: i.thirdPartyUserId,
-                        };
-                      });
-                    const resp = await service.syncUser.bindUser(
+      <Spin spinning={loading}>
+        <Row>
+          <Col span={4}>
+            <div style={{ borderRight: 'lightgray 1px solid', padding: '2px', height: '600px' }}>
+              <Input.Search style={{ marginBottom: 8 }} placeholder="请输入部门名称" />
+              <Tree
+                fieldNames={{
+                  title: 'name',
+                  key: 'id',
+                }}
+                selectedKeys={[dept || '']}
+                onSelect={(key) => {
+                  setDept(key[0] as string);
+                }}
+                treeData={treeData}
+              />
+            </div>
+          </Col>
+          <Col span={20}>
+            {dept && (
+              <ProTable
+                rowKey="thirdPartyUserId"
+                actionRef={actionRef}
+                search={false}
+                columns={columns}
+                params={{ dept: dept }}
+                request={(params) =>
+                  service
+                    .queryZipSyncUser(
+                      {
+                        dingTalk: 'dingtalk',
+                        weixin: 'wechat',
+                      }[id],
                       id,
                       state.current?.provider || '',
                       state.current?.id || '',
-                      [...arr],
-                    );
-                    if (resp.status === 200) {
-                      message.success('操作成功!');
-                      actionRef.current?.reload();
-                    }
-                  }}
-                >
-                  <Button type="primary">保存</Button>
-                </Popconfirm>
-              }
-            />
-          )}
-        </Col>
-      </Row>
-      {visible && (
-        <BindUser
-          id={id}
-          close={() => {
-            setCurrent({});
-            setVisible(false);
-          }}
-          data={current}
-          reload={() => {
-            setCurrent({});
-            setVisible(false);
-            actionRef.current?.reload();
-          }}
-        />
-      )}
+                      params.dept || '',
+                    )
+                    .then((resp: any) => {
+                      setList(resp);
+                      return {
+                        code: '',
+                        result: {
+                          data: resp || [],
+                          pageIndex: 0,
+                          pageSize: 0,
+                          total: 0,
+                        },
+                        status: 200,
+                      };
+                    })
+                }
+                headerTitle={
+                  <Popconfirm
+                    title="确认保存"
+                    onConfirm={async () => {
+                      const arr = list
+                        .filter((item) => item.status === 0)
+                        .map((i) => {
+                          return {
+                            userId: i.userId,
+                            providerName: i.userName,
+                            thirdPartyUserId: i.thirdPartyUserId,
+                          };
+                        });
+                      const resp = await service.syncUser.bindUser(
+                        id,
+                        state.current?.provider || '',
+                        state.current?.id || '',
+                        [...arr],
+                      );
+                      if (resp.status === 200) {
+                        message.success('操作成功!');
+                        actionRef.current?.reload();
+                      }
+                    }}
+                  >
+                    <Button type="primary">保存</Button>
+                  </Popconfirm>
+                }
+              />
+            )}
+          </Col>
+        </Row>
+        {visible && (
+          <BindUser
+            id={id}
+            close={() => {
+              setCurrent({});
+              setVisible(false);
+            }}
+            data={current}
+            reload={() => {
+              setCurrent({});
+              setVisible(false);
+              actionRef.current?.reload();
+            }}
+          />
+        )}
+      </Spin>
     </Modal>
   );
 });

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

@@ -296,7 +296,7 @@ const Config = observer(() => {
               </div>
             }
             actions={[
-              (id === 'dingTalk' || id === 'weixin') && (
+              (record.provider === 'dingTalkMessage' || record.provider === 'corpMessage') && (
                 <PermissionButton
                   key="syncUser"
                   isPermission={true}

+ 2 - 2
src/pages/rule-engine/Alarm/Configuration/Save/index.tsx

@@ -190,7 +190,7 @@ const Save = (props: Props) => {
           ),
         },
         'x-component-props': {
-          placeholder: '请输入名称',
+          placeholder: '请选择关联触发场景',
         },
       },
       description: {
@@ -201,7 +201,7 @@ const Save = (props: Props) => {
           gridSpan: 1,
         },
         'x-component-props': {
-          placeholder: '请输入描述信息',
+          placeholder: '请输入说明',
         },
       },
     },

+ 1 - 0
src/pages/rule-engine/Scene/Save/components/ItemGroup/index.less

@@ -11,6 +11,7 @@
 
   &.compact {
     gap: 0;
+
     > * {
       &:not(:last-child) {
         margin-right: -1px;

+ 1 - 1
src/pages/rule-engine/Scene/Save/index.tsx

@@ -11,7 +11,7 @@ import {
   Switch,
   Tooltip,
 } from 'antd';
-import { useLocation, useIntl } from 'umi';
+import { useIntl, useLocation } from 'umi';
 import { useEffect, useRef, useState } from 'react';
 import { PermissionButton, TitleComponent } from '@/components';
 import ActionItems from './action/action';