addressBook

立即使用

Method

open

论坛示例

为帮助用户更好更快的使用模块,论坛维护了一个示例,示例中包含示例代码、知识点讲解、注意事项等,供您参考。

概述

本模块封装了级联组织架构展示UI

模块概述

本模块封装了级联组织架构展示UI,可以展示公司组织,员工,职务 仿钉钉选部门,选人

模块接口

open

打开文档预览

open({params},callback(ret))

params

data:

-类型:JSON

-描述:组织架构数据

  1. {
  2. "data" : {
  3. "id" : 1,
  4. "cname" : "易捷科技",
  5. "departmentList" : [
  6. {
  7. "id" : 181008,
  8. "deptName" : "技术部门",
  9. "pid" : null,
  10. "cid" : 1,
  11. "cname" : null,
  12. "creator" : 24,
  13. "listUser" : [{id:"55654634555",name:"向华强",avatar:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1570865528602&di=e235d46333a8c8c211c55f25f3c2c29f&imgtype=0&src=http%3A%2F%2Fb.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F32fa828ba61ea8d3fcd2e9ce9e0a304e241f5803.jpg",position:"总经理"}, {id:"666354466",name:"甄子丹",avatar:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1570866084038&di=9048343bb5a8cb9e1f13795b704a732c&imgtype=0&src=http%3A%2F%2Fa.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2Ff603918fa0ec08fa3139e00153ee3d6d55fbda5f.jpg",position:"岗位"} ],
  14. "childDepartment" : [
  15. {
  16. "id" : 181001,
  17. "deptName" : "研发部",
  18. "pid" : 181008,
  19. "cid" : 1,
  20. "cname" : null,
  21. "creator" : 2,
  22. "childDepartment" : null,
  23. "listUser" : [{id:"5125555",name:"周仁发",avatar:"",position:"岗位"}, {id:"6658466",name:"周润发",avatar:"",position:"岗位"} ]
  24. }]
  25. },
  26. {
  27. "id" : 181019,
  28. "deptName" : "销售部",
  29. "pid" : null,
  30. "cid" : 1,
  31. "cname" : null,
  32. "creator" : 4,
  33. "listUser" : [{id:"5949494555",name:"成龙",avatar:"",position:"岗位"}, {id:"684748846",name:"周星驰",avatar:"",position:"岗位"}],
  34. "childDepartment" : [ {
  35. "id" : 181020,
  36. "deptName" : "南方销售部",
  37. "pid" : 181019,
  38. "cid" : 1,
  39. "cname" : null,
  40. "creator" : 2,
  41. "childDepartment" : null,
  42. "listUser" : [{id:"555333",name:"黄晓明",avatar:"",position:"岗位"}, {id:"666444",name:"赵薇",avatar:"",position:"岗位"}]
  43. }]
  44. }]
  45. }
  46. };

topBarColor:

-类型:字符串

-描述:顶部烂颜色 默认#3394EC

waterMark:

-类型:字符串

-描述:背景水印

isShowUser:

-类型:布尔型

-描述:是否显示员工 默认true

callback(ret)

ret:

  • 类型:JSON 对象
  • 内部字段:

{ code: 0|1|-1, //数字类型 0(返回部门信息,包括员工)1(返回员工信息) -1错误信息 msg:’’, //返回信息提示 result:{} //返回json数据 }

result部门数据格式

  1. { "id" : 181019,
  2. "deptName" : "销售部",
  3. "pid" : null,
  4. "cid" : 1,
  5. "cname" : null,
  6. "creator" : 4,
  7. "listUser" : [{id:"5949494555",name:"成龙",avatar:"",position:"岗位"}, {id:"684748846",name:"周星驰",avatar:"",position:"岗位"}],
  8. "childDepartment" : [ {
  9. "id" : 181020,
  10. "deptName" : "南方销售部",
  11. "pid" : 181019,
  12. "cid" : 1,
  13. "cname" : null,
  14. "creator" : 2,
  15. "childDepartment" : null,
  16. "listUser" : [{id:"555333",name:"黄晓明",avatar:"",position:"岗位"}, {id:"666444",name:"赵薇",avatar:"",position:"岗位"}]
  17. }]
  18. }

result人员数据格式

  1. {id:"555333",name:"黄晓明",avatar:"",position:"岗位"}

示例代码

  1. var addressBook = api.require('addressBook');
  2. addressBook.open({
  3. data : data,
  4. topBarColor : '#3394EC',
  5. waterMark : '易捷科技',
  6. isShowUser : false
  7. },function(ret) {
  8. if (ret.code==0) {
  9. alert(JSON.stringify(ret.result));
  10. }else if(ret.code==1){
  11. alert(JSON.stringify(ret.result));
  12. }else if(ret.code==-1){
  13. alert(ret.msg);
  14. }
  15. });

可用性

Android,ios系统

可提供的1.0.0