@beisen-cmps/platform-user-selector

平台选人组件,绑定平台元数据

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@beisen-cmps/platform-user-selector
Minified + gzip package size for @beisen-cmps/platform-user-selector in KB

Readme

组件使用、扩展文档

提交

  1. 修改package.json中的devDependencies里依赖版本, @beisen/gulp-lib -> 0.1.1; @beisen/storybook-lib -> 0.3.0
  2. npm install
  3. 修改代码后执行 npm run lib进行编译
  4. 更新package.json中的 version版本号
  5. push代码
  6. 在cmp.beisen.io站点,头部导航的《服务》中查看编译是否通过

人员组件 接口自定义配置

{
    //获取常用联系人接口
    "getUserUrl" : {
        "url": ""
        ,"method": "GET"
    },
    //获取下属接口
    "getStaffUrl" : {
        "url": ""
        ,"method": "GET"
    },
    //获取部门详细信息
    "getDeptUrl" : {
        "url": ""
        ,"method": "GET"
    },
    //获取部门下人员列表
    "getDeptUserUrl" : {
        "url": ""
        ,"method": "GET"
    },
    //搜索人员接口
    "getSearchUserUrl" : {
        "url": ""
        ,"method": "GET"
    }
    
}

可以配置部分参数,如果参数为空则请求系统默认接口

   const config = {
        titaHost: getBSGlobal('apiPath'),
        tenantId: getBSGlobal('tenantInfo').Id,
        userId: getBSGlobal('loginUserInfo').Id,
        application: getBSGlobal('application'),
        cloudHost: getBSGlobal('cloudHost') || '',// || '//cloud.italent.link',
    }

表单组件请求url添加 formState参数

使用参数

{
    text: this.props.text || '',
    value: this.props.value || '',
    "avatars":{
        "222":{ //头像,key要和value里对应
            "hasAvatar":false,
            "color":"#f0c75a"
        }
    },
    "cmp_id": "c569ca1e-e58b-4a54-8a82-274ebc654162",
    "cmp_name": "Onwer",
    "cmp_type": "BC_UserSelect",
    "cmp_label": "所有者",
    "cmp_data": {
        "AllowSearchNull": "1",
        "title": "所有者",
        "field_name": "BeisenCloudDemo.searchshengji.Onwer",
        "metaObjectName":"BeisenCloudDemo.searchshengji",
        "required": false,
        "cmp_state": "create",
        "cmp_status": "editable",
        "editdisplaystate": "editable",
        "createdisplaystate": "editable",
        "showdisplaystate": "readonly",
        "datasourcename": "BCStaffDataSource",
        "IsShowHeadPic": true,
        "dataType": "Text",
        "singleSelect": false,   //单选or多选
        "datasourceurl":{
            //获取常用联系人接口
            "getUserUrl" : {
                "url": ""
                ,"method": "GET"
            },
            //获取下属接口
            "getStaffUrl" : {
                "url": ""
                ,"method": "GET"
            },
            //获取部门详细信息
            "getDeptUrl" : {
                "url": ""
                ,"method": "GET"
            },
            //获取部门下人员列表
            "getDeptUserUrl" : {
                "url": ""
                ,"method": "GET"
            },
            //搜索人员接口
            "getSearchUserUrl" : {
                "url": ""
                ,"method": "GET"
            }
            
        }
    },
    "search_data": {
        metaFieldRelationIDPath: null,
        metaobjectname: "BeisenCloudDemo.searchshengji",
        opeartor: "eq",
        seperator: "-"
    },
    "biz_data": { "text": "" },
    "validators": {},
    "singleSelect": false   //单选or多选
    "usersDataFromProps": true //  true or false,审批参数
    styleTitle: 'rightFlush',        // "upAndDown" , "rightFlush",  "leftFlush", label的位置上下还是左右
    onChange: (value) => {}  //回调事件
}

组件使用

  1. npm install @beisen-cmps/platform-user-selector
  2. 该组件有两种使用方式, 第一种会走组件内部的获取数据方式,数据会存在state里,第二种会走外部传入的action
  3. import XXX from '@beisen-cmps/platform-user-selector'
  4. import {UserSelector} from '@beisen-cmps/platform-user-selector'
render() {
  return <UserSelector {...this.props}/>;
}

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.