index.md
2.79 KB
选人组件
/**
* debug: true
*/
import React from 'react';
import { QxUserSelector } from '@qx/common';
// import request from 'umi-request';
// request.interceptors.request.use((url, options) => {
// if (url.startsWith('/api/')) {
// return { url, options };
// }
// const headers = { Authorization: 'dev_session:ZGuqjkCF3GMzorijXw7' };
// // headers['SERVER-IP'] = '192.168.181.112';
//
// const fullUrl = url.startsWith('http') ? url : `http://10.9.1.180/qx-api${url}`;
// return {
// url: fullUrl,
// options: {
// ...options,
// ...{
// headers: { ...headers, ...(options.customHeaders || {}) },
// isInternal: true,
// timeout: 30000,
// },
// },
// };
// });
// request.interceptors.response.use(async (response, options) => {
// if (response.status !== 200) {
// return Promise.reject(response);
// }
//
// if (!response.headers.get('content-type')?.includes('application/json')) {
// return response.blob();
// }
//
// const body = await response.clone().json();
//
// // 按正常逻辑处理"文件上传"系列接口
// const fsUploadApis = ['/file/checkFile', '/file/uploadByExist', '/fss/file/'];
// const isFsUploadApis = fsUploadApis.filter((api: string) => options.url.indexOf(api) !== -1);
// if (isFsUploadApis.length > 0) {
// return Promise.resolve(body || null);
// }
//
// if (body.success) {
// return Promise.resolve(body.data || null);
// }
//
// console.error('网络请求出错:', body.msg);
//
// return Promise.reject(body);
// });
export default () => {
return (
<div>
<QxUserSelector
// request={request}
params={{
org: [{ relType: 'APPOINT_ORG', relIds: [''] }],
pos: null,
range: ['ORG:MubDrwZm8IMxuLDU9FM', 'ORG:a0WZVI96GAdoI5g9IwX', 'ORG:QPLEku2yJU8hmbpLTtg'],
}}
/>
<br />
<QxUserSelector />
<br />
<QxUserSelector
readOnly
value={['1212']}
defaultData={[{ id: '1212', name: '邢晴晴' }]}
// request={request}
/>
</div>
);
};
API
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
onChange | 选的人变化时的回调 | function(value) | - |
defaultValue | 默认值 | string[] | - |
disabled | 禁用 | bool | - |
multiple | 是否多选 | bool | - |
max | 最多选几个,ps:没有控制 | number | - |
readOnly | 只读 | bool | - |
value | string[] \ | string |