InvokeExplorer.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. MWF.xDesktop.requireApp("process.ProcessManager", "Explorer", null, false);
  2. MWF.xApplication.service.ServiceManager.InvokeExplorer = new Class({
  3. Extends: MWF.xApplication.process.ProcessManager.Explorer,
  4. Implements: [Options, Events],
  5. options: {
  6. "style": "default",
  7. "tooltip": {
  8. "create": MWF.xApplication.service.ServiceManager.LP.invoke.create,
  9. "search": MWF.xApplication.service.ServiceManager.LP.invoke.search,
  10. "searchText": MWF.xApplication.service.ServiceManager.LP.invoke.searchText,
  11. "noElement": MWF.xApplication.service.ServiceManager.LP.invoke.noInvokeNoticeText
  12. }
  13. },
  14. createTitleElementNode: function() {
  15. this.titleElementNode = new Element("div", {
  16. "styles": this.css.titleElementNode,
  17. "text": "接口配置"
  18. }).inject(this.toolbarNode);
  19. },
  20. _createElement: function(e){
  21. var _self = this;
  22. var options = {
  23. "onQueryLoad": function(){
  24. this.actions = _self.app.restActions;
  25. this.application = _self.app.options.application;
  26. this.explorer = _self;
  27. }
  28. };
  29. this.app.desktop.openApplication(e, "service.InvokeDesigner", options);
  30. },
  31. _loadItemDataList: function(callback){
  32. this.app.restActions.listInvoke(callback);
  33. },
  34. _getItemObject: function(item){
  35. return new MWF.xApplication.service.ServiceManager.InvokeExplorer.Invoke(this, item)
  36. },
  37. deleteItems: function(){
  38. this.hideDeleteAction();
  39. while (this.deleteMarkItems.length){
  40. var item = this.deleteMarkItems.shift();
  41. if (this.deleteMarkItems.length){
  42. item.deleteInvoke();
  43. }else{
  44. item.deleteInvoke(function(){
  45. // this.reloadItems();
  46. //this.hideDeleteAction();
  47. }.bind(this));
  48. }
  49. }
  50. }
  51. });
  52. MWF.xApplication.service.ServiceManager.InvokeExplorer.Invoke= new Class({
  53. Extends: MWF.xApplication.process.ProcessManager.Explorer.Item,
  54. createTextNodes: function(){
  55. var titleNode = new Element("div", {
  56. "styles": this.css.itemTextTitleNode,
  57. "text": ( this.data.enable ? "" : "(禁用)" ) + this.data.name ,
  58. "title": this.data.name,
  59. "events": {
  60. "click": function(e){this._open(e);}.bind(this)
  61. }
  62. }).inject(this.node);
  63. if( !this.data.enable ){
  64. titleNode.setStyle("color","#999");
  65. }
  66. new Element("div", {
  67. "styles": this.css.itemTextDescriptionNode,
  68. "text": this.data.description || "",
  69. "title": this.data.description || ""
  70. }).inject(this.node);
  71. new Element("div", {
  72. "styles": this.css.itemTextDateNode,
  73. "text": (this.data.updateTime || "")
  74. }).inject(this.node);
  75. },
  76. _open: function(e){
  77. var _self = this;
  78. var options = {
  79. "onQueryLoad": function(){
  80. this.actions = _self.explorer.actions;
  81. this.category = _self;
  82. this.options.id = _self.data.id;
  83. }
  84. };
  85. this.explorer.app.desktop.openApplication(e, "service.InvokeDesigner", options);
  86. },
  87. _getIcon: function(){
  88. var x = (Math.random()*49).toInt();
  89. return "process_icon_"+x+".png";
  90. },
  91. _getLnkPar: function(){
  92. return {
  93. "icon": this.explorer.path+this.explorer.options.style+"/processIcon/lnk.png",
  94. "title": this.data.name,
  95. "par": "service.InvokeDesigner#{\"id\": \""+this.data.id+"\"}"
  96. };
  97. },
  98. // deleteItem: function(e){
  99. // var _self = this;
  100. // this.explorer.app.confirm("info", e, this.explorer.app.lp.process.deleteProcessTitle, this.explorer.app.lp.process.deleteProcess, 320, 110, function(){
  101. // _self.deleteProcess();
  102. // this.close();
  103. // },function(){
  104. // this.close();
  105. // });
  106. // },
  107. deleteInvoke: function(callback){
  108. this.explorer.actions.deleteInvoke(this.data.id, function(){
  109. this.node.destroy();
  110. if (callback) callback();
  111. }.bind(this));
  112. }
  113. });