|
...
|
...
|
@@ -6,77 +6,26 @@ |
|
6
|
6
|
*/
|
|
7
|
7
|
import { QxUserSelector } from '@qx/common';
|
|
8
|
8
|
import React from 'react';
|
|
9
|
|
-import request from 'umi-request';
|
|
10
|
|
-
|
|
11
|
|
-request.interceptors.request.use((url, options) => {
|
|
12
|
|
- if (url.startsWith('/api/')) {
|
|
13
|
|
- return { url, options };
|
|
14
|
|
- }
|
|
15
|
|
- const headers = { Authorization: 'dev_session:ZGuqjkCF3GMzorijXw7' };
|
|
16
|
|
- // headers['SERVER-IP'] = '192.168.181.112';
|
|
17
|
|
-
|
|
18
|
|
- const fullUrl = url.startsWith('http')
|
|
19
|
|
- ? url
|
|
20
|
|
- : `http://10.9.1.180/qx-api${url}`;
|
|
21
|
|
- return {
|
|
22
|
|
- url: fullUrl,
|
|
23
|
|
- options: {
|
|
24
|
|
- ...options,
|
|
25
|
|
- ...{
|
|
26
|
|
- headers: { ...headers, ...(options.customHeaders || {}) },
|
|
27
|
|
- isInternal: true,
|
|
28
|
|
- timeout: 30000,
|
|
29
|
|
- },
|
|
30
|
|
- },
|
|
31
|
|
- };
|
|
32
|
|
-});
|
|
33
|
|
-
|
|
34
|
|
-request.interceptors.response.use(async (response, options) => {
|
|
35
|
|
- if (response.status !== 200) {
|
|
36
|
|
- return Promise.reject(response);
|
|
37
|
|
- }
|
|
38
|
|
-
|
|
39
|
|
- if (!response.headers.get('content-type')?.includes('application/json')) {
|
|
40
|
|
- return response.blob();
|
|
41
|
|
- }
|
|
42
|
|
-
|
|
43
|
|
- const body = await response.clone().json();
|
|
44
|
|
-
|
|
45
|
|
- // 按正常逻辑处理"文件上传"系列接口
|
|
46
|
|
- const fsUploadApis = ['/file/checkFile', '/file/uploadByExist', '/fss/file/'];
|
|
47
|
|
- const isFsUploadApis = fsUploadApis.filter(
|
|
48
|
|
- (api: string) => options.url.indexOf(api) !== -1,
|
|
49
|
|
- );
|
|
50
|
|
- if (isFsUploadApis.length > 0) {
|
|
51
|
|
- return Promise.resolve(body || null);
|
|
52
|
|
- }
|
|
53
|
|
-
|
|
54
|
|
- if (body.success) {
|
|
55
|
|
- return Promise.resolve(body.data || null);
|
|
56
|
|
- }
|
|
57
|
|
-
|
|
58
|
|
- console.error('网络请求出错:', body.msg);
|
|
59
|
|
-
|
|
60
|
|
- return Promise.reject(body);
|
|
61
|
|
-});
|
|
|
9
|
+import { request } from '@qx/common';
|
|
62
|
10
|
|
|
63
|
11
|
export default () => {
|
|
64
|
12
|
return (
|
|
65
|
13
|
<div>
|
|
66
|
|
- <QxUserSelector
|
|
67
|
|
- request={request}
|
|
68
|
|
- params={{
|
|
69
|
|
- org: [{ relType: 'APPOINT_ORG', relIds: [''] }],
|
|
70
|
|
- pos: null,
|
|
71
|
|
- range: [
|
|
72
|
|
- 'ORG:MubDrwZm8IMxuLDU9FM',
|
|
73
|
|
- 'ORG:a0WZVI96GAdoI5g9IwX',
|
|
74
|
|
- 'ORG:QPLEku2yJU8hmbpLTtg',
|
|
75
|
|
- ],
|
|
76
|
|
- }}
|
|
77
|
|
- />
|
|
|
14
|
+ <QxUserSelector request={request} />
|
|
|
15
|
+
|
|
78
|
16
|
<br />
|
|
79
|
|
- <QxUserSelector request={request} />
|
|
|
17
|
+ <QxUserSelector
|
|
|
18
|
+ request={request}
|
|
|
19
|
+ params={{
|
|
|
20
|
+ org: [{ relType: 'APPOINT_ORG', relIds: [''] }],
|
|
|
21
|
+ pos: null,
|
|
|
22
|
+ range: [
|
|
|
23
|
+ 'ORG:MubDrwZm8IMxuLDU9FM',
|
|
|
24
|
+ 'ORG:a0WZVI96GAdoI5g9IwX',
|
|
|
25
|
+ 'ORG:QPLEku2yJU8hmbpLTtg',
|
|
|
26
|
+ ],
|
|
|
27
|
+ }}
|
|
|
28
|
+ />
|
|
80
|
29
|
<br />
|
|
81
|
30
|
<QxUserSelector
|
|
82
|
31
|
readOnly
|
|
...
|
...
|
@@ -89,6 +38,38 @@ export default () => { |
|
89
|
38
|
};
|
|
90
|
39
|
```
|
|
91
|
40
|
|
|
|
41
|
+### 弹框
|
|
|
42
|
+
|
|
|
43
|
+```tsx
|
|
|
44
|
+/**
|
|
|
45
|
+ * debug: true
|
|
|
46
|
+ */
|
|
|
47
|
+import {QxUserSelector} from '@qx/common';
|
|
|
48
|
+import React, {useState} from 'react';
|
|
|
49
|
+import {request} from '@qx/common';
|
|
|
50
|
+
|
|
|
51
|
+export default () => {
|
|
|
52
|
+ const [visible, setVisible] = useState(false)
|
|
|
53
|
+ return (
|
|
|
54
|
+ <div>
|
|
|
55
|
+ <div onClick={()=> setVisible(true)}>点一下</div>
|
|
|
56
|
+ <QxUserSelector.Dialog
|
|
|
57
|
+ request={request}
|
|
|
58
|
+ title={'添加人员'}
|
|
|
59
|
+ visible={visible}
|
|
|
60
|
+ multiple={true}
|
|
|
61
|
+ onOk={(userIds: any) => {
|
|
|
62
|
+ console.log(userIds,'lllll')
|
|
|
63
|
+ }}
|
|
|
64
|
+ onCancel={() => {
|
|
|
65
|
+ setVisible(false);
|
|
|
66
|
+ }}
|
|
|
67
|
+ />
|
|
|
68
|
+ </div>
|
|
|
69
|
+ );
|
|
|
70
|
+};
|
|
|
71
|
+```
|
|
|
72
|
+
|
|
92
|
73
|
## API
|
|
93
|
74
|
|
|
94
|
75
|
| 参数 | 说明 | 类型 | 默认值 |
|
...
|
...
|
|