SmartBI.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  2. /** @class SmartBI 统计图表组件。
  3. * @o2cn 统计图表组件
  4. * @example
  5. * //可以在脚本中获取该组件
  6. * //方法1:
  7. * var div = this.form.get("name"); //获取组件
  8. * //方法2
  9. * var div = this.target; //在组件事件脚本中获取
  10. * @extends MWF.xApplication.process.Xform.$Module
  11. * @o2category FormComponents
  12. * @o2range {Process|CMS|Portal}
  13. * @hideconstructor
  14. */
  15. MWF.xApplication.process.Xform.SmartBI = MWF.APPSmartBI = new Class({
  16. Extends: MWF.APP$Module,
  17. _loadUserInterface: function(){
  18. if (!this.json.smartbiresource || this.json.smartbiresource==="none") this.node.destroy();
  19. else{
  20. var url;
  21. var value = this.json.smartbiresource;
  22. var SmartBIAction = o2.Actions.load("x_custom_smartbi_assemble_control");
  23. var addressUri = SmartBIAction.ResourceAction.address;
  24. if(addressUri){
  25. SmartBIAction.ResourceAction.address(value,function(json){
  26. if(json.data.value !==""){
  27. url = json.data.value;
  28. url = url +"&showtoolbar="+this.json.smartbidisplaytoolbar+"&showLeftTree="+this.json.smartbidisplaylefttree;
  29. }
  30. }.bind(this),null,false)
  31. }else{
  32. var address = SmartBIAction.ResourceAction.action.getAddress();
  33. var uri = SmartBIAction.ResourceAction.action.actions.open.uri;
  34. var url = uri.replace("{id}", encodeURIComponent(value));
  35. url = url +"?showtoolbar="+this.json.smartbidisplaytoolbar+"&showLeftTree="+this.json.smartbidisplaylefttree;
  36. url = o2.filterUrl(address+url);
  37. }
  38. this.iframe = new Element("iframe",{
  39. src:url,
  40. frameborder:"0",
  41. scrolling:"auto"
  42. }).inject(this.node,"after");
  43. var _properties = this.json.properties||{};
  44. this.node.destroy();
  45. this.node = this.iframe.setStyles({
  46. "width":"100%",
  47. "height":"100%",
  48. "min-height":"300px",
  49. "min-width":"300px"
  50. });
  51. this.node.set(_properties)
  52. }
  53. }
  54. });