addressBook

Method

论坛示例

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

概述

本插件封装了级联组织架构展示UI

插件概述

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

插件接口

open

打开文档预览

open({params},callback(ret))

params

data:

-类型:JSON

-描述:组织架构数据

js { "data" : { "id" : 1, "cname" : "易捷科技", "departmentList" : [ { "id" : 181008, "deptName" : "技术部门", "pid" : null, "cid" : 1, "cname" : null, "creator" : 24, "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:"岗位"} ], "childDepartment" : [ { "id" : 181001, "deptName" : "研发部", "pid" : 181008, "cid" : 1, "cname" : null, "creator" : 2, "childDepartment" : null, "listUser" : [{id:"5125555",name:"周仁发",avatar:"",position:"岗位"}, {id:"6658466",name:"周润发",avatar:"",position:"岗位"} ] }] }, { "id" : 181019, "deptName" : "销售部", "pid" : null, "cid" : 1, "cname" : null, "creator" : 4, "listUser" : [{id:"5949494555",name:"成龙",avatar:"",position:"岗位"}, {id:"684748846",name:"周星驰",avatar:"",position:"岗位"}], "childDepartment" : [ { "id" : 181020, "deptName" : "南方销售部", "pid" : 181019, "cid" : 1, "cname" : null, "creator" : 2, "childDepartment" : null, "listUser" : [{id:"555333",name:"黄晓明",avatar:"",position:"岗位"}, {id:"666444",name:"赵薇",avatar:"",position:"岗位"}] }] }] } };

topBarColor:

-类型:字符串

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

waterMark:

-类型:字符串

-描述:背景水印

isShowUser:

-类型:布尔型

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

callback(ret)

ret:

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

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

result部门数据格式

js { "id" : 181019, "deptName" : "销售部", "pid" : null, "cid" : 1, "cname" : null, "creator" : 4, "listUser" : [{id:"5949494555",name:"成龙",avatar:"",position:"岗位"}, {id:"684748846",name:"周星驰",avatar:"",position:"岗位"}], "childDepartment" : [ { "id" : 181020, "deptName" : "南方销售部", "pid" : 181019, "cid" : 1, "cname" : null, "creator" : 2, "childDepartment" : null, "listUser" : [{id:"555333",name:"黄晓明",avatar:"",position:"岗位"}, {id:"666444",name:"赵薇",avatar:"",position:"岗位"}] }] } result人员数据格式

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

示例代码

js var addressBook = api.require('addressBook'); addressBook.open({ data : data, topBarColor : '#3394EC', waterMark : '易捷科技', isShowUser : false },function(ret) { if (ret.code==0) { alert(JSON.stringify(ret.result)); }else if(ret.code==1){ alert(JSON.stringify(ret.result)); }else if(ret.code==-1){ alert(ret.msg); } });

可用性

Android,ios系统

可提供的1.0.0

是否仍需要帮助? 请保持联络!
最后更新于 2024/11/18