Person.js 48 KB

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