DeskPortal.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. Ext.define('erp.view.common.DeskTop.DeskPortal', {
  2. extend: 'Ext.panel.Panel',
  3. alias: 'widget.deskportal',
  4. requires: [
  5. 'Ext.layout.component.Body','erp.view.common.DeskTop.DropZone'
  6. ],
  7. cls: 'x-portal',
  8. bodyCls: 'x-portal-body',
  9. defaultType: 'portalcolumn',
  10. componentLayout: 'body',
  11. id:'deskportal',
  12. scrollOffset:18,
  13. autoScroll: true,
  14. initComponent : function() {
  15. var me = this;
  16. this.layout = {
  17. type : 'column'
  18. };
  19. Ext.apply(this,{
  20. items:me.getOwnerSet()
  21. });
  22. this.callParent();
  23. this.addEvents({
  24. validatedrop: true,
  25. beforedragover: true,
  26. dragover: true,
  27. datarefresh: true,
  28. beforedrop: true,
  29. drop: true
  30. });
  31. this.on('drop', this.doLayout, this);
  32. },
  33. initEvents : function(){
  34. this.callParent();
  35. this.dd = Ext.create('erp.view.common.DeskTop.DropZone', this, this.dropConfig);
  36. },
  37. listeners :{
  38. datarefresh:function(com ,type){
  39. com.refresh(type);
  40. }
  41. },
  42. beforeDestroy : function() {
  43. if (this.dd) {
  44. this.dd.unreg();
  45. }
  46. Ext.app.PortalPanel.superclass.beforeDestroy.call(this);
  47. },
  48. getOwnerSet:function(){
  49. var arr=new Array();
  50. Ext.Ajax.request({
  51. url : basePath + 'common/desktop/getOwner.action',
  52. method : 'get',
  53. async:false,
  54. callback : function(options, success, response){
  55. var res = new Ext.decode(response.responseText);
  56. var left_={
  57. columnWidth:0.6,
  58. items:[]
  59. },right_={
  60. columnWidth:0.4,
  61. items:[]
  62. };
  63. if(res.length>0){
  64. Ext.Array.each(res,function(item,index){
  65. var detno_=item.detno_;
  66. if(detno_%2>0){
  67. left_.items.push({xtype:item.xtype_,pageCount:item.count_});
  68. }else right_.items.push({xtype:item.xtype_,pageCount:item.count_});
  69. });
  70. }
  71. arr.push(left_);
  72. arr.push(right_);
  73. }
  74. });
  75. return arr;
  76. },
  77. refresh:function(type){
  78. var me=this;
  79. Ext.Array.each(me.items.items,function(item){
  80. Ext.Array.each(item.items.items,function(c){
  81. if(c[type]){
  82. c._dorefresh(c);
  83. }
  84. });
  85. });
  86. }
  87. });