Parcourir la source

fix(search): search dept

lind il y a 3 ans
Parent
commit
0a4976f81d

+ 2 - 2
src/pages/notice/Config/Detail/index.tsx

@@ -385,7 +385,7 @@ const Detail = observer(() => {
                     'x-component': 'NumberPicker',
                     'x-decorator': 'FormItem',
                     'x-reactions': {
-                      dependencies: ['.enableSSL'],
+                      dependencies: ['.ssl'],
                       when: '{{$deps[0]}}',
                       fulfill: {
                         state: {
@@ -399,7 +399,7 @@ const Detail = observer(() => {
                       },
                     },
                   },
-                  enableSSL: {
+                  ssl: {
                     // title: '开启SSL',
                     type: 'boolean',
                     'x-component': 'Checkbox',

+ 20 - 4
src/pages/notice/Config/SyncUser/index.tsx

@@ -104,14 +104,20 @@ const SyncUser = observer(() => {
   /**
    * 获取部门列表
    */
-  const getDepartment = async () => {
+  const getDepartment = async (name?: string) => {
     if (state.current?.id) {
       if (id === 'dingTalk') {
         service.syncUser
           .dingTalkDept(state.current?.id)
           .then((resp) => {
             if (resp.status === 200) {
-              setTreeData(resp.result);
+              let _data = resp.result;
+              if (name) {
+                _data = resp.result?.filter(
+                  (item: { id: string; name: string }) => item.name.indexOf(name) > -1,
+                );
+              }
+              setTreeData(_data);
               setDept(resp.result[0].id);
             }
           })
@@ -121,7 +127,13 @@ const SyncUser = observer(() => {
           .wechatDept(state.current?.id)
           .then((resp) => {
             if (resp.status === 200) {
-              setTreeData(resp.result);
+              let __data = resp.result;
+              if (name) {
+                __data = resp.result?.filter(
+                  (item: { id: string; name: string }) => item.name.indexOf(name) > -1,
+                );
+              }
+              setTreeData(__data);
               setDept(resp.result[0].id);
             }
           })
@@ -149,7 +161,11 @@ const SyncUser = observer(() => {
         <Row>
           <Col span={4}>
             <div style={{ borderRight: 'lightgray 1px solid', padding: '2px', height: '600px' }}>
-              <Input.Search style={{ marginBottom: 8 }} placeholder="请输入部门名称" />
+              <Input.Search
+                onSearch={(value) => getDepartment(value)}
+                style={{ marginBottom: 8 }}
+                placeholder="请输入部门名称"
+              />
               <Tree
                 fieldNames={{
                   title: 'name',