Socket
Socket
Sign inDemoInstall

react-contacts

Package Overview
Dependencies
86
Maintainers
3
Versions
80
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-contacts

## ⛔️⛔️⛔️ 相关代码已经同步到了 GitLab 里面,这个库以后不保证为最新内容。⛔️⛔️⛔️ ##


Version published
Weekly downloads
18
decreased by-88.31%
Maintainers
3
Install size
88.0 MB
Created
Weekly downloads
 

Readme

Source

⛔️⛔️⛔️ 请访问 https://gitlab.rd.virsical.cn/virsical/h5/component/react-contacts 进行维护 ⛔️⛔️⛔️

⛔️⛔️⛔️ 相关代码已经同步到了 GitLab 里面,这个库以后不保证为最新内容。⛔️⛔️⛔️

react-contacts

contacts & department select

中文文档

威发微服务选人组件/Wafer microservice selection component

GitHub license npm NPM downloads

Example

Example

How to use

install

yarn add react-contacts

React

import Contacts from 'react-contacts'

<Contacts {...props}/>

PropertiesDescriptionTypeDefault Values
deptTreeDepartment of Tree([Department Data](###Department Data))array[]
usersUser data ([User & Search Result Data](###User & Search Result Data))object{ records: []}
loadingLoading statusboolfalse
searchResultQuery user data return results ([User & Search Result Data](###User & Search Result Data))object{ records: []}
handleSearchUserHandle search user functionfuncfunction(page,nameKey,depId)
deptSearchShow department search inputbooltree
updateSelectUsersUpdate user list when select userfuncfunction(userSelected)
updateSelectDeptUpdate dept list when select deptfuncfunction(deptSelected)
deptCheckBoxShow department checkboxbooltrue
searchDeptPlaceholdersearch department placeholderstring'请输入搜索部门'
searchUserPlaceholdersearch department placeholderstring'请输入搜索姓名'
defaultUserSelecteddefault user selectedarray[{userId:'abc',username:'CCC'}]
defaultDeptSelecteddefault user selected ([Note](###Department tree initialization data))array[{id:1,name:'ABC'}]
numberColortotal number colorsring#1B9AFF
selectAllTextselect all textstring全选
totalShowTexttotalShowTextstring共选择了$个
userNameKeyfetch user name and selected keystring'username'
deptNameKeyTake the department tree and select the name of the keystring'name'
radioshow radio on user selectedboolfalse
radioShowTextwhen user selected on radio, show tip text.string'已经选择'
checkStrictlyCheck treeNode precisely; parent treeNode and children treeNodes are not associatedboolfalse
showAllDeptTagsWhether Tags show all nodesboolfalse
returnReducedNodeDepartment tree data reduction mode ([Department tree initialization data](###Department tree initialization data))boolfalse
showLeftshow Left Panelbooltrue
loadDataLoad data asynchronouslyfunction(node) ([Dynamically load the department tree](###Dynamically load the department tree))false
enNameKeyEnglish name keystringfalse
disableUsersThe user ID cannot be selectedarray[]
disableDeptThe department ID cannot be selectedarray[]

Department Data

[
      {
        id: 1,
        parentId: 0,
        children: [
          {
            id: 3,
            parentId: 1,
            children: [
              {
                id: 4,
                parentId: 3,
                children: [
                  {
                    id: 5,
                    parentId: 4,
                    children: [],
                    name: '院校农信',
                  },
                ],
                name: '高新农信',
              },
            ],
            name: '潍坊农信',
          },
        ],
        name: '山东农信',
      },
  ]

User & Search Result Data


 {
      records: [
        {
          userId: 1,
          username: 'admin',
          password: '$2a$10$QOfWxxFyAMmEEmnuw9UI/..1s4B4eF/u9PzE2ZaGO.ij9YfmcUy.u',
          salt: null,
          wxOpenid: 'o_0FT0uyg_H1vVy2H0JpSwlVGhWQ',
          qqOpenid: null,
          createTime: '2018-04-20 07:15:18',
          updateTime: '2019-03-12 16:04:42',
          mail: 'a@a.com',
          delFlag: '0',
          lockFlag: '0',
          phone: '17034642888',
          avatar: 'lengleng-0d2a7b025da14d8d93f595b3fa082d82.jpg',
          deptId: 1,
          tenantId: 1,
          deptName: '真理部',
          roleList: [
            {
              roleId: 1,
              roleName: '管理员',
              roleCode: 'ROLE_ADMIN',
              roleDesc: '管理员',
              dsType: 2,
              dsScope: '2',
              createTime: '2017-10-29 15:45:51',
              updateTime: '2018-12-26 14:09:11',
              delFlag: '0',
            },
          ],
        },
	   ......
      ],
      total: 11,
      size: 10,
      current: 1,
      searchCount: true,
      pages: 1,
    },

###Department tree initialization data

returnReducedNode controls the data format of the department tree, true for simplified mode, false (default) for full data.

###Dynamically load the department tree

          loadData={({deptId, children})=>{
            return new Promise(resolve => {
              if (children) {
                resolve();
                return;
              }
              setTimeout(() => {
              // 通过 deptId 查询下层数据,返回后合并到树的数据源上
                resolve();
              }, 1000);
            });
          }}

####Lean mode If a node on the tree, its child nodes are all selected, the returned data only contains the parent node but not the child nodes

####Full mode If a node on the tree, its child nodes are all selected, the returned data will contain the parent node and child nodes

####Initialize the department tree If the initial data cannot contain the relationship between parent and child nodes, the department tree will appear out of sync when deleting with tag. Solution:

  1. When saving data, please save the complete data, do not delete the content in children.

  2. The use of reduced mode data may affect the background calculation.

Choose one of the above methods.

Development

$ git clone https://github.com/wafersystems/react-contacts.git
$ yarn
$ yarn start

Keywords

FAQs

Last updated on 19 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc