Process.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. MWF.xApplication.Selector = MWF.xApplication.Selector || {};
  2. MWF.xDesktop.requireApp("Organization", "Actions.RestActions", null, false);
  3. MWF.xDesktop.requireApp("Organization", "Selector.Department", null, false);
  4. MWF.xApplication.Selector.Process = new Class({
  5. Extends: MWF.xApplication.Selector.Department,
  6. options: {
  7. "style": "default",
  8. "count": 0,
  9. "title": "Select Process",
  10. "values": [],
  11. "names": [],
  12. "expand": false
  13. },
  14. loadSelectItems: function(addToNext){
  15. this.action.listApplicationsProcess(function(json){
  16. if (json.data.length){
  17. json.data.each(function(data){
  18. var category = this._newItemCategory(data, this, this.itemAreaNode);
  19. }.bind(this));
  20. }
  21. }.bind(this));
  22. },
  23. _scrollEvent: function(y){
  24. return true;
  25. },
  26. _getChildrenItemIds: function(){
  27. return null;
  28. },
  29. _newItemCategory: function(data, selector, item, level){
  30. return new MWF.xApplication.Selector.Process.ItemCategory(data, selector, item, level)
  31. },
  32. _listItemByKey: function(callback, failure, key){
  33. return false;
  34. },
  35. _getItem: function(callback, failure, id, async){
  36. //this.action.getDepartment(function(json){
  37. // if (callback) callback.apply(this, [json]);
  38. //}.bind(this), failure, id, async);
  39. },
  40. _newItemSelected: function(data, selector, item){
  41. return new MWF.xApplication.Selector.Process.ItemSelected(data, selector, item)
  42. },
  43. _listItemByPinyin: function(callback, failure, key){
  44. return false;
  45. },
  46. _newItem: function(data, selector, container, level){
  47. return new MWF.xApplication.Selector.Process.Item(data, selector, container, level);
  48. }
  49. });
  50. MWF.xApplication.Selector.Process.Item = new Class({
  51. Extends: MWF.xApplication.Selector.Person.Item,
  52. _getShowName: function(){
  53. return this.data.name;
  54. },
  55. _setIcon: function(){
  56. this.iconNode.setStyle("background-image", "url("+"/x_component_Organization/Selector/$Selector/default/icon/processicon.png)");
  57. },
  58. loadSubItem: function(){
  59. return false;
  60. // this.children = new Element("div", {
  61. // "styles": this.selector.css.selectorItemCategoryChildrenNode
  62. // }).inject(this.node, "after");
  63. // this.children.setStyle("display", "block");
  64. //// if (!this.selector.options.expand) this.children.setStyle("display", "none");
  65. //
  66. // this.selector.action.listProcess(function(subJson){
  67. // subJson.data.each(function(subData){
  68. // var category = this.selector._newItem(subData, this.selector, this.children, this.level+1);
  69. // }.bind(this));
  70. // }.bind(this), null, this.data.id);
  71. }
  72. });
  73. MWF.xApplication.Selector.Process.ItemSelected = new Class({
  74. Extends: MWF.xApplication.Selector.Person.ItemSelected,
  75. _getShowName: function(){
  76. return this.data.name;
  77. },
  78. _setIcon: function(){
  79. this.iconNode.setStyle("background-image", "url("+"/x_component_Organization/Selector/$Selector/default/icon/processicon.png)");
  80. }
  81. });
  82. MWF.xApplication.Selector.Process.ItemCategory = new Class({
  83. Extends: MWF.xApplication.Selector.Identity.ItemCompanyCategory,
  84. _setIcon: function(){
  85. this.iconNode.setStyle("background-image", "url("+"/x_component_Organization/Selector/$Selector/default/icon/applicationicon.png)");
  86. },
  87. loadSub: function(callback){
  88. if (!this.loaded){
  89. this.selector.action.listProcess(function(subJson){
  90. subJson.data.each(function(subData){
  91. subData.applicationName = this.data.name;
  92. subData.application = this.data.id;
  93. var category = this.selector._newItem(subData, this.selector, this.children, this.level+1);
  94. }.bind(this));
  95. this.loaded = true;
  96. if (callback) callback();
  97. }.bind(this), null, this.data.id);
  98. }else{
  99. if (callback) callback();
  100. }
  101. },
  102. _hasChild: function(){
  103. return (this.data.processList && this.data.processList.length);
  104. }
  105. });