Person.js 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260
  1. MWF.xApplication.Selector = MWF.xApplication.Selector || {};
  2. MWF.xDesktop.requireApp("Selector", "lp."+MWF.language, null, false);
  3. //MWF.xDesktop.requireApp("Selector", "Actions.RestActions", null, false);
  4. MWF.xApplication.Selector.Person = new Class({
  5. Extends: MWF.widget.Common,
  6. Implements: [Options, Events],
  7. options: {
  8. "style": "default",
  9. "count": 0,
  10. "title": MWF.xApplication.Selector.LP.selectPerson,
  11. "groups": [],
  12. "roles": [],
  13. "values": [],
  14. "exclude" : [],
  15. "zIndex": 1000,
  16. "expand": true
  17. },
  18. initialize: function(container, options){
  19. this.setOptions(options);
  20. this.path = "/x_component_Selector/$Selector/";
  21. this.cssPath = "/x_component_Selector/$Selector/"+this.options.style+"/css.wcss";
  22. this._loadCss(true);
  23. this.container = $(container);
  24. this.orgAction = MWF.Actions.get("x_organization_assemble_control");
  25. this.processAction = MWF.Actions.get("x_processplatform_assemble_surface");
  26. this.designerAction = MWF.Actions.get("x_processplatform_assemble_designer");
  27. this.portalAction = MWF.Actions.get("x_portal_assemble_surface");
  28. this.portalDesignerAction = MWF.Actions.get("x_portal_assemble_designer");
  29. this.cmsAction = MWF.Actions.get("x_cms_assemble_control");
  30. this.queryAction = MWF.Actions.get("x_query_assemble_designer");
  31. //this.action = new MWF.xApplication.Selector.Actions.RestActions();
  32. this.lastPeople = "";
  33. this.pageCount = "13";
  34. this.selectedItems = [];
  35. this.items = [];
  36. },
  37. load: function(){
  38. if (layout.mobile){
  39. this.loadMobile();
  40. }else{
  41. this.loadPc();
  42. }
  43. this.fireEvent("load");
  44. },
  45. loadMobile: function(){
  46. this.container.mask({
  47. "destroyOnHide": true,
  48. "style": this.css.maskNode
  49. });
  50. this.node = new Element("div", {"styles": this.css.containerNodeMobile});
  51. this.node.setStyle("z-index", this.options.zIndex.toInt()+1);
  52. this.titleNode = new Element("div", {
  53. "styles": this.css.titleNodeMobile
  54. }).inject(this.node);
  55. this.titleCancelActionNode = new Element("div", {
  56. "styles": this.css.titleCancelActionNodeMobile,
  57. "text": MWF.SelectorLP.back
  58. }).inject(this.titleNode);
  59. this.titleOkActionNode = new Element("div", {
  60. "styles": this.css.titleOkActionNodeMobile,
  61. "text": MWF.SelectorLP.ok
  62. }).inject(this.titleNode);
  63. this.titleTextNode = new Element("div", {
  64. "styles": this.css.titleTextNodeMobile,
  65. "text": this.options.title
  66. }).inject(this.titleNode);
  67. this.contentNode = new Element("div", {
  68. "styles": this.css.contentNode
  69. }).inject(this.node);
  70. var size = this.container.getSize();
  71. var height = size.y-40;
  72. this.contentNode.setStyle("height", ""+height+"px");
  73. this.loadContent();
  74. this.node.inject(this.container);
  75. this.node.setStyles({
  76. "top": "0px",
  77. "left": "0px"
  78. });
  79. this.setEvent();
  80. },
  81. setMaskResize: function(){
  82. var size = this.container.getSize();
  83. this.mask.resize();
  84. this.maskInterval = window.setInterval(function(){
  85. var resize = this.container.getSize();
  86. if ((size.x!==resize.x) || (size.y!==resize.y)){
  87. this.mask.position();
  88. this.mask.resize();
  89. size.x = resize.x;
  90. size.y = resize.y;
  91. }
  92. }.bind(this), 66);
  93. },
  94. loadPc: function(){
  95. debugger;
  96. this.css.maskNode["z-index"] = this.options.zIndex;
  97. var position = this.container.getPosition(this.container.getOffsetParent());
  98. this.mask = new Mask(this.container, {
  99. "destroyOnHide": true,
  100. "style": this.css.maskNode,
  101. "useIframeShim": true,
  102. "iframeShimOptions": {"browsers": true},
  103. "onShow": function(){
  104. this.shim.shim.setStyles({
  105. "opacity": 0,
  106. "top": ""+position.y+"px",
  107. "left": ""+position.x+"px"
  108. });
  109. }
  110. //
  111. // "destroyOnHide": true,
  112. // "style": this.css.maskNode,
  113. // "useIframeShim": true,
  114. // "iframeShimOptions": {"browsers": true},
  115. // "onShow": function(){
  116. // this.shim.shim.setStyles({
  117. // "opacity": 0,
  118. // "top": ""+position.y+"px",
  119. // "left": ""+position.x+"px"
  120. // });
  121. // }
  122. });
  123. this.mask.show();
  124. this.setMaskResize();
  125. // this.container.setStyle("z-index", this.options.zIndex);
  126. this.node = new Element("div", {
  127. "styles": (this.options.count.toInt()===1) ? this.css.containerNodeSingle : this.css.containerNode,
  128. "events": {
  129. "click": function(e){e.stopPropagation();},
  130. "mousedown": function(e){e.stopPropagation();},
  131. "mouseover": function(e){e.stopPropagation();},
  132. "mouseout": function(e){e.stopPropagation();},
  133. "keydown": function(e){e.stopPropagation();}
  134. }
  135. });
  136. this.node.setStyle("z-index", this.options.zIndex.toInt()+1);
  137. this.titleNode = new Element("div", {
  138. "styles": this.css.titleNode
  139. }).inject(this.node);
  140. this.titleActionNode = new Element("div", {
  141. "styles": this.css.titleActionNode
  142. }).inject(this.titleNode);
  143. this.titleTextNode = new Element("div", {
  144. "styles": this.css.titleTextNode,
  145. "text": this.options.title
  146. }).inject(this.titleNode);
  147. this.contentNode = new Element("div", {
  148. "styles": this.css.contentNode
  149. }).inject(this.node);
  150. this.loadContent();
  151. this.actionNode = new Element("div", {
  152. "styles": this.css.actionNode
  153. }).inject(this.node);
  154. if (this.options.count.toInt()===1) this.actionNode.setStyle("text-align", "center");
  155. this.loadAction();
  156. this.node.inject(this.container);
  157. this.node.position({
  158. relativeTo: this.container,
  159. position: "center",
  160. edge: "center"
  161. });
  162. var size = this.container.getSize();
  163. var nodeSize = this.node.getSize();
  164. this.node.makeDraggable({
  165. "handle": this.titleNode,
  166. "limit": {
  167. "x": [0, size.x-nodeSize.x],
  168. "y": [0, size.y-nodeSize.y]
  169. }
  170. });
  171. this.setEvent();
  172. },
  173. setEvent: function(){
  174. if (this.titleActionNode){
  175. this.titleActionNode.addEvent("click", function(){
  176. this.fireEvent("cancel");
  177. this.close();
  178. }.bind(this));
  179. }
  180. if (this.titleCancelActionNode){
  181. this.titleCancelActionNode.addEvent("click", function(){
  182. this.fireEvent("cancel");
  183. this.close();
  184. }.bind(this));
  185. }
  186. if (this.titleOkActionNode){
  187. this.titleOkActionNode.addEvent("click", function(){
  188. this.fireEvent("complete", [this.selectedItems]);
  189. this.close();
  190. }.bind(this));
  191. }
  192. },
  193. close: function(){
  194. this.fireEvent("close");
  195. this.node.destroy();
  196. //if (this.mask) this.mask.hide();
  197. this.container.unmask();
  198. if (this.maskInterval){
  199. window.clearInterval(this.maskInterval);
  200. this.maskInterval = null;
  201. }
  202. MWF.release(this);
  203. delete this;
  204. },
  205. loadAction: function(){
  206. this.okActionNode = new Element("button", {
  207. "styles": this.css.okActionNode,
  208. "text": MWF.SelectorLP.ok
  209. }).inject(this.actionNode);
  210. this.cancelActionNode = new Element("button", {
  211. "styles": this.css.cancelActionNode,
  212. "text": MWF.SelectorLP.cancel
  213. }).inject(this.actionNode);
  214. this.okActionNode.addEvent("click", function(){
  215. this.fireEvent("complete", [this.selectedItems]);
  216. this.close();
  217. }.bind(this));
  218. this.cancelActionNode.addEvent("click", function(){this.fireEvent("cancel"); this.close();}.bind(this));
  219. },
  220. loadContent: function( contentNode ){
  221. if( contentNode )this.contentNode = contentNode;
  222. if (layout.mobile){
  223. if (this.options.count.toInt()!==1) this.loadSelectedNodeMobile();
  224. this.loadSelectNodeMobile();
  225. }else{
  226. this.loadSelectNode();
  227. if (this.options.count.toInt()!==1) this.loadSelectedNode();
  228. }
  229. },
  230. loadSelectNodeMobile: function(){
  231. this.selectNode = new Element("div", {
  232. "styles": this.css.selectNodeMobile
  233. }).inject(this.contentNode);
  234. var size = this.container.getSize();
  235. var height = size.y-40-20-6;
  236. this.selectNode.setStyle("height", ""+height+"px");
  237. this.searchInputDiv = new Element("div", {
  238. "styles": this.css.searchInputDiv
  239. }).inject(this.selectNode);
  240. this.searchInput = new Element("input", {
  241. "styles": (this.options.count.toInt()===1) ? this.css.searchInputSingle : this.css.searchInput,
  242. "type": "text"
  243. }).inject(this.searchInputDiv);
  244. var width = size.x-20-18;
  245. this.searchInput.setStyle("width", ""+width+"px");
  246. this.searchInput.setStyle("height", "20px");
  247. this.initSearchInput();
  248. this.letterAreaNode = new Element("div", {
  249. "styles": this.css.letterAreaMobileNode
  250. }).inject(this.selectNode);
  251. width = size.x-18;
  252. this.letterAreaNode.setStyle("width", ""+width+"px");
  253. this.loadLetters();
  254. this.itemAreaScrollNode = new Element("div", {
  255. "styles": this.css.itemAreaScrollNode
  256. }).inject(this.selectNode);
  257. height = size.y-40-20-78;
  258. this.itemAreaScrollNode.setStyle("height", ""+height+"px");
  259. this.itemAreaScrollNode.setStyle("overflow", "auto");
  260. this.itemAreaNode = new Element("div", {
  261. "styles": this.css.itemAreaNode
  262. }).inject(this.itemAreaScrollNode);
  263. this.itemSearchAreaNode = new Element("div", {
  264. "styles": this.css.itemAreaNode
  265. }).inject(this.itemAreaScrollNode);
  266. this.itemSearchAreaNode.setStyle("display", "none");
  267. //MWF.require("MWF.widget.ScrollBar", function(){
  268. // var _self = this;
  269. // new MWF.widget.ScrollBar(this.itemAreaScrollNode, {
  270. // "style":"xApp_Organization_Explorer",
  271. // "where": "before",
  272. // "distance": 30,
  273. // "friction": 4,
  274. // "axis": {"x": false, "y": true},
  275. // "onScroll": function(y){
  276. // _self._scrollEvent(y);
  277. // }
  278. // });
  279. //}.bind(this));
  280. this.initLoadSelectItems();
  281. this.checkLoadSelectItems();
  282. },
  283. checkLoadSelectItems: function(){
  284. if (!this.options.groups.length && !this.options.roles.length){
  285. this.loadSelectItems();
  286. }else{
  287. this.loadSelectItemsByCondition();
  288. }
  289. },
  290. loadSelectNode: function(){
  291. this.selectNode = new Element("div", {
  292. "styles": (this.options.count.toInt()===1) ? this.css.selectNodeSingle : this.css.selectNode
  293. }).inject(this.contentNode);
  294. this.searchInputDiv = new Element("div", {
  295. "styles": this.css.searchInputDiv
  296. }).inject(this.selectNode);
  297. this.searchInput = new Element("input", {
  298. "styles": (this.options.count.toInt()===1) ? this.css.searchInputSingle : this.css.searchInput,
  299. "type": "text"
  300. }).inject(this.searchInputDiv);
  301. this.initSearchInput();
  302. this.letterAreaNode = new Element("div", {
  303. "styles": this.css.letterAreaNode
  304. }).inject(this.selectNode);
  305. this.loadLetters();
  306. this.itemAreaScrollNode = new Element("div", {
  307. "styles": this.css.itemAreaScrollNode
  308. }).inject(this.selectNode);
  309. this.itemAreaNode = new Element("div", {
  310. "styles": this.css.itemAreaNode
  311. }).inject(this.itemAreaScrollNode);
  312. this.itemSearchAreaNode = new Element("div", {
  313. "styles": this.css.itemAreaNode
  314. }).inject(this.itemAreaScrollNode);
  315. this.itemSearchAreaNode.setStyle("display", "none");
  316. this.loadSelectNodeScroll();
  317. this.initLoadSelectItems();
  318. this.checkLoadSelectItems();
  319. },
  320. loadSelectNodeScroll: function(){
  321. MWF.require("MWF.widget.ScrollBar", function(){
  322. var _self = this;
  323. new MWF.widget.ScrollBar(this.itemAreaScrollNode, {
  324. "style":"xApp_Organization_Explorer",
  325. "where": "before",
  326. "distance": 30,
  327. "friction": 4,
  328. "axis": {"x": false, "y": true},
  329. "onScroll": function(y){
  330. _self._scrollEvent(y);
  331. }
  332. });
  333. }.bind(this));
  334. },
  335. initSearchInput: function(){
  336. this.searchInput.addEvents({
  337. "keydown": function(e){
  338. var iTimerID = this.searchInput.retrieve("searchTimer", null);
  339. if (iTimerID){
  340. window.clearTimeout(iTimerID);
  341. this.searchInput.eliminate("searchTimer");
  342. }
  343. iTimerID = window.setTimeout(function(){
  344. this.search();
  345. }.bind(this), 800);
  346. this.searchInput.store("searchTimer", iTimerID);
  347. }.bind(this),
  348. "change": function(e){
  349. var key = this.searchInput.get("value");
  350. if (!key) this.initSearchArea(false);
  351. }.bind(this),
  352. "blur": function(){
  353. var key = this.searchInput.get("value");
  354. if (!key) this.initSearchArea(false);
  355. }.bind(this)
  356. });
  357. },
  358. initSearchArea: function(flag){
  359. if (flag){
  360. this.itemSearchAreaNode.empty();
  361. this.itemAreaNode.setStyle("display", "none");
  362. this.itemSearchAreaNode.setStyle("display", "block");
  363. }else{
  364. this.itemAreaNode.setStyle("display", "block");
  365. this.itemSearchAreaNode.setStyle("display", "none");
  366. }
  367. },
  368. search: function(){
  369. if (!this.options.groups.length && !this.options.roles.length){
  370. var key = this.searchInput.get("value");
  371. if (key){
  372. this._listItemByKey(function(json){
  373. this.initSearchArea(true);
  374. json.data.each(function(data){
  375. this._newItemSearch(data, this, this.itemSearchAreaNode);
  376. //this._newItem(data, this, this.itemSearchAreaNode);
  377. }.bind(this));
  378. }.bind(this), null, key);
  379. }else{
  380. this.initSearchArea(false);
  381. }
  382. }else{
  383. var key = this.searchInput.get("value");
  384. if (key){
  385. this.initSearchArea(true);
  386. this.searchInItems(key);
  387. }else{
  388. this.initSearchArea(false);
  389. }
  390. }
  391. },
  392. searchInItems: function(key){
  393. this.createItemsSearchData(function(){
  394. var word = key.toLowerCase();
  395. var createdId = [];
  396. this.itemsSearchData.each(function(obj){
  397. var text = obj.text+"#"+obj.pinyin+"#"+obj.firstPY;
  398. if (text.indexOf(word)!==-1){
  399. if (createdId.indexOf(obj.data.distinguishedName)===-1){
  400. this._newItem(obj.data, this, this.itemSearchAreaNode);
  401. createdId.push(obj.data.distinguishedName);
  402. }
  403. }
  404. }.bind(this));
  405. //this.searchItemsData(this.itemsSearchData.name, word, createdId);
  406. //this.searchItemsData(this.itemsSearchData.pinyin, word, createdId);
  407. //this.searchItemsData(this.itemsSearchData.firstPY, word, createdId);
  408. delete createdId;
  409. }.bind(this));
  410. },
  411. createItemsSearchData: function(callback){
  412. if (!this.itemsSearchData){
  413. this.itemsSearchData = [];
  414. MWF.require("MWF.widget.PinYin", function(){
  415. var initIds = [];
  416. this.items.each(function(item){
  417. if (initIds.indexOf(item.data.distinguishedName)==-1){
  418. var text = item._getShowName().toLowerCase();
  419. var pinyin = text.toPY().toLowerCase();
  420. var firstPY = text.toPYFirst().toLowerCase();
  421. this.itemsSearchData.push({
  422. "text": text,
  423. "pinyin": pinyin,
  424. "firstPY": firstPY,
  425. "data": item.data
  426. });
  427. initIds.push(item.data.distinguishedName);
  428. }
  429. }.bind(this));
  430. delete initIds;
  431. if (callback) callback();
  432. }.bind(this));
  433. }else{
  434. if (callback) callback();
  435. }
  436. },
  437. loadSelectedNode: function(){
  438. this.selectedContainerNode = new Element("div", {
  439. "styles": this.css.selectedContainerNode
  440. }).inject(this.contentNode);
  441. this.selectedScrollNode = new Element("div", {
  442. "styles": this.css.selectedScrollNode
  443. }).inject(this.selectedContainerNode);
  444. this.selectedNode = new Element("div", {
  445. "styles": this.css.selectedNode
  446. }).inject(this.selectedScrollNode);
  447. this.setSelectedItem();
  448. this.loadSelectedNodeScroll();
  449. },
  450. loadSelectedNodeScroll: function(){
  451. MWF.require("MWF.widget.ScrollBar", function(){
  452. var _self = this;
  453. new MWF.widget.ScrollBar(this.selectedScrollNode, {
  454. "style":"xApp_Organization_Explorer", "where": "before", "distance": 100, "friction": 4,"axis": {"x": false, "y": true}
  455. });
  456. }.bind(this));
  457. },
  458. loadSelectedNodeMobile: function(){
  459. this.selectedScrollNode = new Element("div", {
  460. "styles": this.css.selectedScrollNode
  461. }).inject(this.contentNode);
  462. this.selectedNode = new Element("div", {
  463. "styles": this.css.selectedNode
  464. }).inject(this.selectedScrollNode);
  465. this.setSelectedItem();
  466. MWF.require("MWF.widget.ScrollBar", function(){
  467. var _self = this;
  468. new MWF.widget.ScrollBar(this.selectedScrollNode, {
  469. "style":"xApp_Organization_Explorer", "where": "before", "distance": 100, "friction": 4,"axis": {"x": false, "y": true}
  470. });
  471. }.bind(this));
  472. this.selectedScrollNode.setStyle("display", "none");
  473. },
  474. setSelectedItem: function(){
  475. if (this.options.values.length){
  476. this.options.values.each(function(v, i){
  477. if (typeOf(v)==="object"){
  478. this.selectedItems.push(this._newItemSelected(v, this, null));
  479. }else{
  480. this._getItem(function(json){
  481. this.options.values[i] = json.data;
  482. this.selectedItems.push(this._newItemSelected(json.data, this, null));
  483. }.bind(this), null, v, false);
  484. }
  485. // this._getItem(function(json){
  486. // this.selectedItems.push(this._newItemSelected(json.data, this, null));
  487. // }.bind(this), null, v, false);
  488. }.bind(this));
  489. }
  490. },
  491. loadLetters: function(){
  492. var _self = this;
  493. letters = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
  494. if (layout.mobile){
  495. var size = this.container.getSize();
  496. var w = (layout.mobile) ? (size.x-18)/13 : (size.x-20-4-18)/13;
  497. //letterNode.setStyle("width", ""+w+"px");
  498. this.css.letterNode.width = ""+w+"px";
  499. this.css.letterNode_over.width = ""+w+"px";
  500. }
  501. letters.each(function(l){
  502. var letterNode = new Element("div", {
  503. "styles": this.css.letterNode,
  504. "text": l
  505. }).inject(this.letterAreaNode);
  506. if (layout.mobile){
  507. letterNode.addEvents({
  508. "click": function(){
  509. _self.listPersonByPinyin(this);
  510. }
  511. });
  512. }else{
  513. letterNode.addEvents({
  514. "mouseover": function(e){
  515. e.target.setStyles(this.css.letterNode_over);
  516. var showNode = new Element("div", {
  517. "styles": this.css.letterShowNode,
  518. "text": e.target.get("text")
  519. }).inject(this.selectNode);
  520. showNode.position({
  521. relativeTo: this.itemAreaScrollNode,
  522. position: "center",
  523. edge: "center"
  524. });
  525. e.target.store("showNode", showNode);
  526. }.bind(this),
  527. "mouseout": function(e){
  528. var showNode = e.target.retrieve("showNode");
  529. showNode.destroy();
  530. e.target.setStyles(this.css.letterNode);
  531. }.bind(this),
  532. "click": function(){
  533. _self.listPersonByPinyin(this);
  534. }
  535. });
  536. }
  537. }.bind(this));
  538. },
  539. listPersonByPinyin: function(node){
  540. this.searchInput.focus();
  541. var pinyin = this.searchInput.get("value");
  542. pinyin = pinyin+node.get("text");
  543. this.searchInput.set("value", pinyin);
  544. if (!this.options.groups.length && !this.options.roles.length){
  545. if (pinyin){
  546. this._listItemByPinyin(function(json){
  547. this.initSearchArea(true);
  548. json.data.each(function(data){
  549. // var flag = true;
  550. // if (this.options.departments){
  551. // if (this.options.departments.length){
  552. // if (this.options.departments.indexOf(data.departmentName)==-1) flag = false;
  553. // }
  554. // }
  555. // if (this.options.companys){
  556. // if (this.options.companys.length){
  557. // if (this.options.companys.indexOf(data.company)==-1) flag = false;
  558. // }
  559. // }
  560. if( !this.isExcluded( data ) ) {
  561. this._newItemSearch(data, this, this.itemSearchAreaNode);
  562. }
  563. //this._newItem(data, this, this.itemSearchAreaNode);
  564. //this._newItem(data, this, this.itemSearchAreaNode);
  565. }.bind(this));
  566. }.bind(this), null, pinyin.toLowerCase());
  567. }
  568. }else{
  569. if (pinyin){
  570. this.initSearchArea(true);
  571. this.searchInItems(pinyin);
  572. }else{
  573. this.initSearchArea(false);
  574. }
  575. }
  576. },
  577. initLoadSelectItems: function(){
  578. this.loaddingItems = false;
  579. this.isItemLoaded = false;
  580. this.loadItemsQueue = 0;
  581. this.initSearchArea(false);
  582. },
  583. //loadSelectItems: function(addToNext){
  584. // if (!this.isItemLoaded){
  585. // if (!this.loaddingItems){
  586. // this.loaddingItems = true;
  587. // var count = 20;
  588. // this._listItemNext(this.getLastLoadedItemId(), count, function(json){
  589. // if (json.data.length){
  590. // json.data.each(function(data){
  591. // var item = this._newItem(data, this, this.itemAreaNode);
  592. // this.items.push(item);
  593. // }.bind(this));
  594. // this.loaddingItems = false;
  595. //
  596. // if (json.data.length<count){
  597. // this.isItemLoaded = true;
  598. // }else{
  599. // if (this.loadItemsQueue>0){
  600. // this.loadItemsQueue--;
  601. // this.loadSelectItems();
  602. // }
  603. // }
  604. // }else{
  605. // this.isItemLoaded = true;
  606. // this.loaddingItems = false;
  607. // }
  608. // }.bind(this));
  609. // }else{
  610. // if (addToNext) this.loadItemsQueue++;
  611. // }
  612. // }
  613. //},
  614. loadSelectItems: function(addToNext, lastExcludeCount ){
  615. //lastExcludeCount 参数:表示本次加载是为了补足上次load的时候被排除的数量
  616. if (!this.isItemLoaded){
  617. if (!this.loaddingItems){
  618. this.loaddingItems = true;
  619. var count = 20;
  620. this._listItemNext(this.getLastLoadedItemId(), count, function(json){
  621. if (json.data.length){
  622. var excludedCount = 0;
  623. json.data.each(function(data, i){
  624. if( this.isExcluded( data ) ){
  625. excludedCount++;
  626. if( i+1 === count )this.tailExcludeItemId = data.distinguishedName
  627. }else{
  628. var item = this._newItem(data, this, this.itemAreaNode);
  629. this.items.push(item);
  630. if( i+1 === count )this.tailExcludeItemId = null;
  631. }
  632. }.bind(this));
  633. this.loaddingItems = false;
  634. if( lastExcludeCount ){ //如果是因为上次load的时候被排除而加载的
  635. if( count - lastExcludeCount - excludedCount < 0 ){ //如果本次load的数量还不够补足排除的数量,需要再次load
  636. excludedCount = lastExcludeCount + excludedCount - count; //把不足的数量作为再次load的参数
  637. this.loadItemsQueue++
  638. }
  639. }else if( excludedCount > 0 ){ //把排除的数量作为再次load的参数
  640. this.loadItemsQueue++
  641. }
  642. if (json.data.length<count){
  643. this.isItemLoaded = true;
  644. }else{
  645. if (this.loadItemsQueue>0){
  646. this.loadItemsQueue--;
  647. this.loadSelectItems( addToNext, excludedCount );
  648. }
  649. }
  650. }else{
  651. this.isItemLoaded = true;
  652. this.loaddingItems = false;
  653. }
  654. }.bind(this));
  655. }else{
  656. if (addToNext) this.loadItemsQueue++;
  657. }
  658. }
  659. },
  660. getLastLoadedItemId: function(){
  661. if( this.tailExcludeItemId )return this.tailExcludeItemId;
  662. return (this.items.length) ? this.items[this.items.length-1].data.distinguishedName : "(0)";
  663. },
  664. //loadSelectItemsByCondition: function(){
  665. // this.options.groups.each(function(group){
  666. //
  667. // this.orgAction.listGroupByKey(function(json){
  668. // if (json.data.length){
  669. // var groupData = json.data[0];
  670. // var category = this._newItemCategory("ItemGroupCategory", groupData, this, this.itemAreaNode);
  671. // this._getChildrenItemIds(groupData).each(function(id){
  672. // this._getItem(function(json){
  673. // var item = this._newItem(json.data, this, category.children);
  674. // this.items.push(item);
  675. // }.bind(this), null, id);
  676. // }.bind(this));
  677. // }
  678. // }.bind(this), null, group);
  679. // }.bind(this));
  680. //
  681. // this.options.roles.each(function(role){
  682. // this.orgAction.listRoleByKey(function(json){
  683. // if (json.data.length){
  684. // var roleData = json.data[0];
  685. // var category = this._newItemCategory("ItemRoleCategory", roleData, this, this.itemAreaNode);
  686. // this._getChildrenItemIds(roleData).each(function(id){
  687. // this._getItem(function(json){
  688. // var item = this._newItem(json.data, this, category.children);
  689. // this.items.push(item);
  690. // }.bind(this), null, id)
  691. // }.bind(this));
  692. // }
  693. // }.bind(this), null, role);
  694. // }.bind(this));
  695. //},
  696. loadSelectItemsByCondition: function(){
  697. this.options.groups.each(function(group){
  698. this.orgAction.listGroupByKey(function(json){
  699. if (json.data.length){
  700. var groupData = json.data[0];
  701. var category = this._newItemCategory("ItemGroupCategory", groupData, this, this.itemAreaNode);
  702. this._getChildrenItemIds(groupData).each(function(id){
  703. this._getItem(function(json){
  704. if( !this.isExcluded( json.data ) ) {
  705. var item = this._newItem(json.data, this, category.children);
  706. this.items.push(item);
  707. }
  708. }.bind(this), null, id);
  709. }.bind(this));
  710. }
  711. }.bind(this), null, group);
  712. }.bind(this));
  713. this.options.roles.each(function(role){
  714. this.orgAction.listRoleByKey(function(json){
  715. if (json.data.length){
  716. var roleData = json.data[0];
  717. var category = this._newItemCategory("ItemRoleCategory", roleData, this, this.itemAreaNode);
  718. this._getChildrenItemIds(roleData).each(function(id){
  719. this._getItem(function(json){
  720. if( !this.isExcluded( json.data ) ) {
  721. var item = this._newItem(json.data, this, category.children);
  722. this.items.push(item);
  723. }
  724. }.bind(this), null, id)
  725. }.bind(this));
  726. }
  727. }.bind(this), null, role);
  728. }.bind(this));
  729. },
  730. isExcluded : function( d ){
  731. if( this.options.exclude.length === 0 )return false;
  732. if( !this.excludeFlagMap ){
  733. this.excludeFlagMap = {};
  734. this.options.exclude.each( function( e ){
  735. if( !e )return;
  736. this.excludeFlagMap[ typeOf( e ) === "string" ? e : ( e.distinguishedName || e.id || e.unique || e.employee || e.levelName) ] = true;
  737. }.bind(this));
  738. }
  739. var map = this.excludeFlagMap;
  740. return ( d.distinguishedName && map[ d.distinguishedName ] ) ||
  741. ( d.id && map[ d.id ] ) ||
  742. ( d.unique && map[ d.unique ] ) ||
  743. ( d.employee && map[ d.employee ] ) ||
  744. ( d.levelName && map[ d.levelName ] );
  745. },
  746. _getChildrenItemIds: function(data){
  747. return data.personList;
  748. },
  749. _newItemCategory: function(type, data, selector, item){
  750. return new MWF.xApplication.Selector.Person[type](data, selector, item)
  751. },
  752. _listItemByKey: function(callback, failure, key){
  753. this.orgAction.listPersonByKey(function(json){
  754. if (callback) callback.apply(this, [json]);
  755. }.bind(this), failure, key);
  756. },
  757. _getItem: function(callback, failure, id, async){
  758. this.orgAction.getPerson(function(json){
  759. if (callback) callback.apply(this, [json]);
  760. }.bind(this), failure, ((typeOf(id)==="string") ? id : id.distinguishedName), async);
  761. },
  762. _newItemSelected: function(data, selector, item){
  763. return new MWF.xApplication.Selector.Person.ItemSelected(data, selector, item)
  764. },
  765. _listItemByPinyin: function(callback, failure, key){
  766. this.orgAction.listPersonByPinyin(function(json){
  767. if (callback) callback.apply(this, [json]);
  768. }.bind(this), failure, key);
  769. },
  770. _newItem: function(data, selector, container){
  771. return new MWF.xApplication.Selector.Person.Item(data, selector, container);
  772. },
  773. _newItemSearch: function(data, selector, container){
  774. return this._newItem(data, selector, container);
  775. },
  776. _listItemNext: function(last, count, callback){
  777. this.orgAction.listPersonNext(last, count, function(json){
  778. if (callback) callback.apply(this, [json]);
  779. }.bind(this));
  780. },
  781. _scrollEvent: function(y){
  782. if (!this.options.groups.length && !this.options.roles.length){
  783. var scrollSize = this.itemAreaScrollNode.getScrollSize();
  784. var clientSize = this.itemAreaScrollNode.getSize();
  785. var scrollHeight = scrollSize.y-clientSize.y;
  786. if (y+30>scrollHeight) {
  787. if (!this.isItemLoaded) this.loadSelectItems();
  788. }
  789. }
  790. }
  791. });
  792. MWF.xApplication.Selector.Person.Item = new Class({
  793. initialize: function(data, selector, container, level){
  794. this.data = data;
  795. this.selector = selector;
  796. this.container = container;
  797. this.isSelected = false;
  798. this.level = (level) ? level.toInt() : 1;
  799. this.load();
  800. },
  801. _getShowName: function(){
  802. return this.data.name+"("+this.data.employee+")";
  803. },
  804. _getTtiteText: function(){
  805. return this.data.name+"("+this.data.employee+")";
  806. },
  807. _setIcon: function(){
  808. this.iconNode.setStyle("background-image", "url("+"/x_component_Selector/$Selector/default/icon/personicon.png)");
  809. },
  810. load: function(){
  811. this.node = new Element("div", {
  812. "styles": this.selector.css.selectorItem
  813. }).inject(this.container);
  814. this.levelNode = new Element("div", {
  815. "styles": this.selector.css.selectorItemLevelNode
  816. }).inject(this.node);
  817. var indent = this.level*10;
  818. this.levelNode.setStyle("width", ""+indent+"px");
  819. this.iconNode = new Element("div", {
  820. "styles": this.selector.css.selectorItemIconNode
  821. }).inject(this.node);
  822. this._setIcon();
  823. this.actionNode = new Element("div", {
  824. "styles": this.selector.css.selectorItemActionNode
  825. }).inject(this.node);
  826. this.textNode = new Element("div", {
  827. "styles": this.selector.css.selectorItemTextNode,
  828. "text": this._getShowName(),
  829. "title": this._getTtiteText()
  830. }).inject(this.node);
  831. var m = this.textNode.getStyle("margin-left").toFloat()+indent;
  832. this.textNode.setStyle("margin-left", ""+m+"px");
  833. this.loadSubItem();
  834. this.setEvent();
  835. this.check();
  836. },
  837. loadSubItem: function(){},
  838. check: function(){
  839. if (this.selector.options.count.toInt()===1){
  840. this.checkSelectedSingle();
  841. }else{
  842. this.checkSelected();
  843. }
  844. },
  845. checkSelectedSingle: function(){
  846. var selectedItem = this.selector.options.values.filter(function(item, index){
  847. if (typeOf(item)==="object") return this.data.distinguishedName === item.distinguishedName;
  848. if (typeOf(item)==="string") return this.data.distinguishedName === item;
  849. return false;
  850. }.bind(this));
  851. if (selectedItem.length){
  852. this.selectedSingle();
  853. }
  854. },
  855. checkSelected: function(){
  856. var selectedItem = this.selector.selectedItems.filter(function(item, index){
  857. return item.data.distinguishedName === this.data.distinguishedName;
  858. }.bind(this));
  859. if (selectedItem.length){
  860. //selectedItem[0].item = this;
  861. selectedItem[0].addItem(this);
  862. this.selectedItem = selectedItem[0];
  863. this.setSelected();
  864. }
  865. },
  866. setSelected: function(){
  867. this.isSelected = true;
  868. this.node.setStyles(this.selector.css.selectorItem_selected);
  869. this.textNode.setStyles(this.selector.css.selectorItemTextNode_selected);
  870. this.actionNode.setStyles(this.selector.css.selectorItemActionNode_selected);
  871. },
  872. setEvent: function(){
  873. this.node.addEvents({
  874. "mouseover": function(){
  875. this.overItem();
  876. }.bind(this),
  877. "mouseout": function(){
  878. this.outItem();
  879. }.bind(this),
  880. "click": function(){
  881. this.clickItem();
  882. }.bind(this)
  883. });
  884. },
  885. clickItem: function(){
  886. if (this.selector.options.count.toInt()===1){
  887. this.selectedSingle();
  888. }else{
  889. if (this.isSelected){
  890. this.unSelected();
  891. }else{
  892. this.selected();
  893. }
  894. }
  895. },
  896. overItem: function(){
  897. if (!this.isSelected){
  898. this.node.setStyles(this.selector.css.selectorItem_over);
  899. this.actionNode.setStyles(this.selector.css.selectorItemActionNode_over);
  900. }
  901. },
  902. outItem: function(){
  903. if (!this.isSelected){
  904. this.node.setStyles(this.selector.css.selectorItem);
  905. this.actionNode.setStyles(this.selector.css.selectorItemActionNode);
  906. }
  907. },
  908. selectedSingle: function(){
  909. if (!this.isSelected){
  910. if (this.selector.currentItem) this.selector.currentItem.unSelectedSingle();
  911. this.getData(function(){
  912. this.selector.currentItem = this;
  913. this.isSelected = true;
  914. this.selector.selectedItems.push(this);
  915. this.node.setStyles(this.selector.css.selectorItem_selected);
  916. this.textNode.setStyles(this.selector.css.selectorItemTextNode_selected);
  917. this.actionNode.setStyles(this.selector.css.selectorItemActionNode_selected);
  918. }.bind(this));
  919. }else {
  920. this.unSelectedSingle();
  921. }
  922. },
  923. getData: function(callback){
  924. if (callback) callback();
  925. },
  926. unSelectedSingle: function(){
  927. this.selector.currentItem = null;
  928. this.isSelected = false;
  929. this.selector.selectedItems.erase(this);
  930. this.node.setStyles(this.selector.css.selectorItem);
  931. this.textNode.setStyles(this.selector.css.selectorItemTextNode);
  932. this.actionNode.setStyles(this.selector.css.selectorItemActionNode);
  933. },
  934. selected: function(){
  935. var count = this.selector.options.maxCount || this.selector.options.count;
  936. if (!count) count = 0;
  937. if ((count.toInt()===0) || (this.selector.selectedItems.length+1)<=count){
  938. this.isSelected = true;
  939. this.node.setStyles(this.selector.css.selectorItem_selected);
  940. this.textNode.setStyles(this.selector.css.selectorItemTextNode_selected);
  941. this.actionNode.setStyles(this.selector.css.selectorItemActionNode_selected);
  942. this.selectedItem = this.selector._newItemSelected(this.data, this.selector, this);
  943. this.selectedItem.check();
  944. this.selector.selectedItems.push(this.selectedItem);
  945. }else{
  946. MWF.xDesktop.notice("error", {x: "right", y:"top"}, "最多可选择"+count+"个选项", this.node);
  947. }
  948. },
  949. unSelected: function(){
  950. this.isSelected = false;
  951. this.node.setStyles(this.selector.css.selectorItem);
  952. this.textNode.setStyles(this.selector.css.selectorItemTextNode);
  953. this.actionNode.setStyles(this.selector.css.selectorItemActionNode);
  954. if (this.selectedItem){
  955. this.selector.selectedItems.erase(this.selectedItem);
  956. this.selectedItem.items.each(function(item){
  957. if (item != this){
  958. item.isSelected = false;
  959. item.node.setStyles(this.selector.css.selectorItem);
  960. item.textNode.setStyles(this.selector.css.selectorItemTextNode);
  961. item.actionNode.setStyles(this.selector.css.selectorItemActionNode);
  962. }
  963. }.bind(this));
  964. this.selectedItem.destroy();
  965. this.selectedItem = null;
  966. }
  967. }
  968. });
  969. MWF.xApplication.Selector.Person.ItemSelected = new Class({
  970. Extends: MWF.xApplication.Selector.Person.Item,
  971. initialize: function(data, selector, item){
  972. this.data = data;
  973. this.selector = selector;
  974. this.container = this.selector.selectedNode;
  975. this.isSelected = false;
  976. this.items = [];
  977. if (item) this.items.push(item);
  978. this.level = 0;
  979. this.getData(function(){
  980. this.load();
  981. }.bind(this));
  982. },
  983. getData: function(callback){
  984. if (callback) callback();
  985. },
  986. clickItem: function(){
  987. if (this.items.length){
  988. this.items.each(function(item){
  989. item.unSelected();
  990. });
  991. }else{
  992. //this.item.selectedItem = null;
  993. //this.item.isSelected = false;
  994. this.destroy();
  995. this.selector.selectedItems.erase(this);
  996. }
  997. },
  998. overItem: function(){
  999. if (!this.isSelected){
  1000. this.node.setStyles(this.selector.css.selectorItem_over);
  1001. this.actionNode.setStyles(this.selector.css.selectorItemActionNode_selected_over);
  1002. }
  1003. },
  1004. addItem: function(item){
  1005. if (this.items.indexOf(item)===-1) this.items.push(item);
  1006. },
  1007. check: function(){
  1008. if (this.selector.items.length){
  1009. var items = this.selector.items.filter(function(item, index){
  1010. return item.data.distinguishedName === this.data.distinguishedName;
  1011. }.bind(this));
  1012. this.items = items;
  1013. if (items.length){
  1014. items.each(function(item){
  1015. item.selectedItem = this;
  1016. item.setSelected();
  1017. }.bind(this));
  1018. }
  1019. }
  1020. },
  1021. destroy: function(){
  1022. this.node.destroy();
  1023. delete this;
  1024. }
  1025. });
  1026. MWF.xApplication.Selector.Person.ItemCategory = new Class({
  1027. Extends: MWF.xApplication.Selector.Person.Item,
  1028. initialize: function(data, selector, container, level){
  1029. this.data = data;
  1030. this.selector = selector;
  1031. this.container = container;
  1032. this.isSelected = false;
  1033. this.level = (level) ? level.toInt() : 1;
  1034. this.load();
  1035. },
  1036. createNode: function(){
  1037. this.node = new Element("div", {
  1038. "styles": this.selector.css.selectorItemCategory
  1039. }).inject(this.container);
  1040. },
  1041. load: function(){
  1042. this.createNode();
  1043. this.levelNode = new Element("div", {
  1044. "styles": this.selector.css.selectorItemLevelNode
  1045. }).inject(this.node);
  1046. var indent = this.level*10;
  1047. this.levelNode.setStyle("width", ""+indent+"px");
  1048. this.iconNode = new Element("div", {
  1049. "styles": this.selector.css.selectorItemIconNode
  1050. }).inject(this.node);
  1051. this._setIcon();
  1052. this.actionNode = new Element("div", {
  1053. "styles": (this.selector.options.expand) ? this.selector.css.selectorItemCategoryActionNode_expand : this.selector.css.selectorItemCategoryActionNode_collapse
  1054. }).inject(this.node);
  1055. this.textNode = new Element("div", {
  1056. "styles": this.selector.css.selectorItemCategoryTextNode,
  1057. "text": this._getShowName()
  1058. }).inject(this.node);
  1059. var m = this.textNode.getStyle("margin-left").toFloat()+indent;
  1060. this.textNode.setStyle("margin-left", ""+m+"px");
  1061. this.children = new Element("div", {
  1062. "styles": this.selector.css.selectorItemCategoryChildrenNode
  1063. }).inject(this.node, "after");
  1064. if (!this.selector.options.expand) this.children.setStyle("display", "none");
  1065. var subIdList = this.selector._getChildrenItemIds(this.data);
  1066. if (subIdList){
  1067. var count = subIdList.length;
  1068. this.childrenHeight = count*29;
  1069. this.children.setStyle("height", ""+this.childrenHeight+"px");
  1070. }
  1071. if (!this._hasChild()){
  1072. this.actionNode.setStyle("background", "transparent");
  1073. this.textNode.setStyle("color", "#777");
  1074. }
  1075. this.setEvent();
  1076. this.check();
  1077. this.afterLoad();
  1078. },
  1079. afterLoad: function(){
  1080. if (this.level===1) this.clickItem();
  1081. },
  1082. clickItem: function(){
  1083. if (this._hasChild()){
  1084. if (!this.fx){
  1085. this.fx = new Fx.Tween(this.children, {
  1086. "duration": 200
  1087. // "transition": Fx.Transitions.Cubic.easeIn
  1088. });
  1089. };
  1090. if (!this.fx.isRunning()){
  1091. var display = this.children.getStyle("display");
  1092. if (display === "none"){
  1093. this.children.setStyles({
  1094. "display": "block",
  1095. "height": "0px"
  1096. });
  1097. this.fx.start("height", "0px", ""+this.childrenHeight+"px");
  1098. this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_expand);
  1099. }else{
  1100. if (!this.childrenHeight) this.childrenHeight = this.children.getStyle("height").toFloat();
  1101. this.fx.start("height", ""+this.childrenHeight+"px", "0px").chain(function(){
  1102. this.children.setStyles({
  1103. "display": "none",
  1104. "height": "0px"
  1105. });
  1106. }.bind(this));
  1107. this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_collapse);
  1108. }
  1109. }
  1110. }
  1111. },
  1112. overItem: function(){
  1113. //if (!this.isSelected){
  1114. // this.node.setStyles(this.selector.css.selectorItem_over);
  1115. // this.actionNode.setStyles(this.selector.css.selectorItemActionNode_over);
  1116. //}
  1117. },
  1118. outItem: function(){
  1119. //if (!this.isSelected){
  1120. // this.node.setStyles(this.selector.css.selectorItem);
  1121. // this.actionNode.setStyles(this.selector.css.selectorItemActionNode);
  1122. //}
  1123. },
  1124. _hasChild: function(){
  1125. var subIdList = this.selector._getChildrenItemIds(this.data);
  1126. if (subIdList) if (subIdList.length) return true;
  1127. return false;
  1128. }
  1129. });
  1130. MWF.xApplication.Selector.Person.ItemGroupCategory = new Class({
  1131. Extends: MWF.xApplication.Selector.Person.ItemCategory,
  1132. _getShowName: function(){
  1133. return this.data.name;
  1134. },
  1135. _setIcon: function(){
  1136. this.iconNode.setStyle("background-image", "url("+"/x_component_Selector/$Selector/default/icon/groupicon.png)");
  1137. }
  1138. });
  1139. MWF.xApplication.Selector.Person.ItemRoleCategory = new Class({
  1140. Extends: MWF.xApplication.Selector.Person.ItemCategory,
  1141. _getShowName: function(){
  1142. return this.data.name;
  1143. },
  1144. _setIcon: function(){
  1145. this.iconNode.setStyle("background-image", "url("+"/x_component_Selector/$Selector/default/icon/roleicon.png)");
  1146. }
  1147. });
  1148. MWF.xApplication.Selector.Person.Filter = new Class({
  1149. Implements: [Options, Events],
  1150. options: {
  1151. "style": "default",
  1152. "groups": [],
  1153. "roles": [],
  1154. },
  1155. initialize: function(value, options){
  1156. this.setOptions(options);
  1157. this.value = value;
  1158. this.orgAction = MWF.Actions.get("x_organization_assemble_control");
  1159. },
  1160. filter: function(value, callback){
  1161. this.value = value;
  1162. var key = this.value;
  1163. if (this.options.groups.length || this.options.roles.length) key = {"key": key, "groupList": this.options.groupList, "roleList": this.options.roleList};
  1164. this.orgAction.listPersonByKey(function(json){
  1165. data = json.data;
  1166. if (callback) callback(data)
  1167. }.bind(this), null, key);
  1168. }
  1169. });