1. /**
  2. * 根据V5的业务需求,提供了选人组件<br>
  3. * 由于移动端选人组件的展示的性能考虑,选人组件不会每次都重新实例化,选人组件是一款比较灵活复杂的组件,主要功能是根据V5业务进行设计的<br>
  4. * 开发者可以根据配置,实例化一个组件,进行各种业务的选人操作<br>
  5. * 注:选人组件分为流程选人和轻表单选人组织机构<br>
  6. * <strong>
  7. * 页面需要导入的文件
  8. * <ul>
  9. * <li>cmp-listView.js</li>
  10. * <li>cmp-imgCache.js</li>
  11. * <li>cmp-selectOrg.js</li>
  12. * <li>cmp-listView.css</li>
  13. * <li>cmp-selectOrg.css</li>
  14. * </ul>
  15. * </strong>
  16. * @module selectOrg
  17. * @subtitle 选人组件
  18. */
  19.  
  20.  
  21. /**
  22. * 流程选人<br>
  23. * 流程选人是一组可以进行部门,人员,岗位,职务级别,组,外部人员选择的组件,根据配置参数,可以设置
  24. * @class selectOrg1
  25. * @namespace cmp
  26. * @constructor
  27. * @param {String} id 选人组件唯一标识,如果该id对应页面上的控件的id,则选人组件会主动给该控件绑定点击事件,点击后进行选人业务
  28. * @param {Object} options 配置参数
  29. * @param {Number} options.type 组件的类型<br>
  30. * <ul>
  31. * <li>1:流程选人</li>
  32. * </ul>
  33. * @param {Number} [options.flowType] 专为流程选人定义的一个参数,用于同一个选人组件,选择条件改变的情况;具体值的含义:<br>
  34. * <ul>
  35. * <li>1:改变成单选(及进行替换操作)</li>
  36. * <li>2:多选模式(多选操作)</li>
  37. * <li>3:默认模式</li>
  38. * </ul>
  39. * @param {Number} [options.minSize] 最少选人的数量,默认-1不受限制
  40. * @param {Boolean} [options.flowOptsChange] 是否进行流程选人配置参数的重置(由于业务改变才需要设置该值,只对流程选人有效),默认:false
  41. * @param {Array} [options.label] 按需导入首页页签,默认:["dept","org","post","team","extP"],其中:<br>
  42. * <ul>
  43. * <li>dep:【本部门】</li>
  44. * <li>org:【组织机构】</li>
  45. * <li>post:【岗位】</li>
  46. * <li>team:【组】</li>
  47. * <li>level:【职务级别】</li>
  48. * <li>extP:【编外人员】</li>
  49. * <li>vjOrg:【外部机构】</li>
  50. * </ul>
  51. * @param {Boolean} [options.permission] 流程选人时,整体选部门,选岗位、选组是否受当前登录人员权限控制(默认流程选人要受权限控制)默认:true
  52. * @param {Boolean} [options.directDepartment] 流程选人中是否直选部门(即不进行是否包含子部门的提示)默认:false
  53. * @param {Array} [options.fillBackData] 回填值格式,其中<br>
  54. * <ul>
  55. * <li>人员数据:[{id:181818,name:"杨海",type:"member"}]</li>
  56. * <li>部门数据:[{id:"-155555",name:"天龙八部",type:"department"}]</li>
  57. * <li>单位(account)、职务(level)、岗位(post)只是type不一样</li>
  58. * </ul>
  59. * @param {Array} [options.excludeData] 被排除的不能选择的数据,格式同fillBackData一样,其中<br>默认是被排除的人员是被选中的,如果想要被排除的数据不被默认选中,需要在数据上传属性disable:true 如:[{id:181818,name:"杨海",type:"member",disable:true}]
  60. * @param {Boolean} [options.seeExtAccount] 是否能查看外单位,即是否能进行外单位切换
  61. * @param {Boolean} [options.notSelectAccount] 是否所有的【本单位】页签都不能选择,默认:false
  62. * @param {String} [options.server] 对于跨域请求rest接口的时候,需要开发者自定义服务器地址 如:http://192.168.10.55:8080
  63. * @param {Function} options.callback 回调函数 根据组件类型返回的值有数据类型标识:<br>
  64. * <ul>
  65. * <li>concurrent:流程并联类型数据</li>
  66. * <li>sequence:流程串联类型数据</li>
  67. * </ul>
  68. * @param {Function} [options.closeCallback] 关闭组件的回调函数
  69. * @param {Array} [options.choosableType] 可选的数据类型 ["department","account","member","post","team","level"],默认是可以选人员、部门、单位、岗位、组、职务级别
  70. * @example
  71. * ```
  72. * <script>
  73. * cmp.selectOrg("flowID",{
  74. * type:1,
  75. * flowType:3,
  76. * fillBackData:[],
  77. * minSize:-1,
  78. * fillback: null,
  79. * excludeData:[{id:181818,name:"杨海",type:"member",disable:true}],
  80. * directDepartment:false,
  81. * label:["dept","org","post","team","extP"],
  82. * flowOptsChange:false,
  83. * permission:true,
  84. * callback:function(result){
  85. * result = cmp.parseJSON(result);
  86. * for(var i = 0;i< result.length; i ++){
  87. * console.log(cmp.parseJSON(result[i]));
  88. * }
  89. * },
  90. * closeCallback:function(){
  91. * //TODO
  92. * }
  93. * });
  94. * </script>
  95. * ```
  96. * @returns {Object} 选人组件对象
  97. */
  98.  
  99.  
  100. /**
  101. * 轻表单选择<br>
  102. * @class selectOrg2
  103. * @namespace cmp
  104. * @constructor
  105. * @param {String} id 选人组件唯一标识,如果该id对应页面上的控件的id,则选人组件会主动给该控件绑定点击事件,点击后进行选人业务
  106. * @param {Object} options 配置参数
  107. * @param {String} [options.title] 组件界面显示的标题:<br>
  108. * <ul>
  109. * <li>默认显示【单选】/【多选】加具体选择类型,如:【单选人员】</li>
  110. * </ul>
  111. * @param {Number} options.type 组件的类型<br>
  112. * <ul>
  113. * <li>2:轻表单选组织机构</li>
  114. * </ul>
  115. * @param {String} options.selectType 选择类型(流程选人不用配置此)<br>
  116. * <ul>
  117. * <li>member:选人</li>
  118. * <li>department:选部门</li>
  119. * <li>post:选岗位</li>
  120. * <li>account:选单位</li>
  121. * <li>level:选职务级别</li>
  122. * <li>department_vj1:vj机构</li>
  123. * <li>department_vj2:vj单位</li>
  124. * </ul>
  125. * @param {Boolean} [options.lightOptsChange] 是否进行轻表单选人配置参数的重置(由于业务改变才需要设置该值,只对轻表单选人有效),默认:false
  126. * @param {Number} [options.maxSize] 选中的最多数量,默认:-1,不受数量限制,如果设置成1,则为单选模式;(如果是流程选人,会忽略此参数,一概认定是多选)
  127. * @param {Number} [options.minSize] 选中的最少数量,默认:-1,不受数量限制
  128. * @param {Array} [options.label] 按需导入首页页签(此参数在轻表单选人生效),默认:["dept","org","post","team","extP"],其中:<br>
  129. * <ul>
  130. * <li>dep:【本部门】</li>
  131. * <li>org:【组织机构】</li>
  132. * <li>post:【岗位】</li>
  133. * <li>team:【组】</li>
  134. * <li>extP:【编外人员】</li>
  135. * <li>level:【职务】</li>
  136. * <li>vjOrg:【外部机构】</li>
  137. * </ul>
  138. * @param {Boolean} [options.multitype] 是否进行多类型选择(用于轻表单选人中可进行部门选择,如果还有其他情况以后再进行扩展,默认是可以进行多类型选择的)默认:false
  139. * @param {Array} [options.fillBackData] 回填值格式,其中<br>
  140. * <ul>
  141. * <li>人员数据:[{id:181818,name:"杨海",type:"member"}]</li>
  142. * <li>部门数据:[{id:"-155555",name:"天龙八部",type:"department"}]</li>
  143. * <li>单位(account)、职务(level)、岗位(post)只是type不一样</li>
  144. * </ul>
  145. * @param {Array} [options.excludeData] 被排除的不能选择的数据,格式同fillBackData一样
  146. * @param {String} [options.server] 对于跨域请求rest接口的时候,需要开发者自定义服务器地址 如:http://192.168.10.55:8080
  147. * @param {Function} options.callback 回调函数 根据组件类型返回的值有数据类型标识:<br>
  148. * <ul>
  149. * <li>light:轻表单类型数据</li>
  150. * </ul>
  151. * @param {Function} [options.closeCallback] 关闭组件的回调函数
  152. * @param {Boolean} [options.vj] 是否是以vj插件的方式进行轻表单控件选择,默认false <br>
  153. * true:选人 = 选外部人员;选部门 = 选外部机构 选单位 = 选外部单位 选岗位 = 选外部单位
  154. * @example
  155. * ```
  156. * <script>
  157. * //======================轻表单选人====================================//
  158. * cmp.selectOrg("memberID",{
  159. * type:2,
  160. * fillBackData:[],
  161. * minSize:-1,
  162. * maxSize:-1,
  163. * selectType:"member",
  164. * multitype:false,
  165. * lightOptsChange:false, *
  166. * fillback: null,
  167. * excludeData:[{id:181818,name:"杨海",type:"member",disable:true}],
  168. * label:["dept","org","post","team","extP"],
  169. * vj:false,
  170. * callback:function(result){
  171. * result = cmp.parseJSON(result);
  172. * for(var i = 0;i< result.length; i ++){
  173. * console.log(cmp.parseJSON(result[i]));
  174. * }
  175. * },
  176. * closeCallback:function(){
  177. * //TODO
  178. * }
  179. * });
  180. * //===================================轻表单选部门===========================================//
  181. * cmp.selectOrg("departmentID",{
  182. * type:2,
  183. * fillBackData:[],
  184. * minSize:-1,
  185. * maxSize:-1,
  186. * selectType:"department",
  187. * lightOptsChange:false,
  188. * fillback: null,
  189. * excludeData:[{id:181818,name:"测试部",type:"department",disable:true}],
  190. * callback:function(result){
  191. * result = cmp.parseJSON(result);
  192. * for(var i = 0;i< result.length; i ++){
  193. * console.log(cmp.parseJSON(result[i]));
  194. * }
  195. * },
  196. * closeCallback:function(){
  197. * //TODO
  198. * }
  199. * });
  200. * //===================================轻表单选单位===========================================//
  201. * cmp.selectOrg("accountID",{
  202. * type:2,
  203. * fillBackData:[],
  204. * minSize:-1,
  205. * maxSize:-1,
  206. * selectType:"account",
  207. * lightOptsChange:false,
  208. * fillback: null,
  209. * excludeData:[{id:181818,name:"致远成都分公司",type:"account",disable:true}],
  210. * callback:function(result){
  211. * result = cmp.parseJSON(result);
  212. * for(var i = 0;i< result.length; i ++){
  213. * console.log(cmp.parseJSON(result[i]));
  214. * }
  215. * },
  216. * closeCallback:function(){
  217. * //TODO
  218. * }
  219. * });
  220. * //===================================轻表单选职务===========================================//
  221. * cmp.selectOrg("levelID",{
  222. * type:2,
  223. * fillBackData:[],
  224. * minSize:-1,
  225. * maxSize:-1,
  226. * selectType:"level",
  227. * lightOptsChange:false,
  228. * fillback: null,
  229. * excludeData:[{id:181818,name:"高手",type:"level",disable:true}],
  230. * callback:function(result){
  231. * result = cmp.parseJSON(result);
  232. * for(var i = 0;i< result.length; i ++){
  233. * console.log(cmp.parseJSON(result[i]));
  234. * }
  235. * },
  236. * closeCallback:function(){
  237. * //TODO
  238. * }
  239. * });
  240. * //===================================轻表单选岗位===========================================//
  241. * cmp.selectOrg("postID",{
  242. * type:2,
  243. * fillBackData:[],
  244. * minSize:-1,
  245. * maxSize:-1,
  246. * selectType:"post",
  247. * lightOptsChange:false,
  248. * fillback: null,
  249. * excludeData:[{id:181818,name:"测试岗",type:"post",disable:true}],
  250. * callback:function(result){
  251. * result = cmp.parseJSON(result);
  252. * for(var i = 0;i< result.length; i ++){
  253. * console.log(cmp.parseJSON(result[i]));
  254. * }
  255. * },
  256. * closeCallback:function(){
  257. * //TODO
  258. * }
  259. * });
  260. * </script>
  261. * ```
  262. * @returns {Object} 选人组件对象
  263. */
  264.  
  265.  
  266. /**
  267. * 选人组件-销毁
  268. * @class selectOrgDestory
  269. * @namespace cmp
  270. * @constructor
  271. * @param {String} id 对应的创建的选人组件id
  272. * @example
  273. * ```
  274. * <script>
  275. * cmp.selectOrgDestory(id);
  276. * </script>
  277. * ```
  278. * @returns {Object} 选人组件对象
  279. *
  280. */
  281.  
  282.  
  283.  
  284.  
Top