NavigationPanel.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. Ext.define('erp.view.opensys.default.NavigationPanel', {
  2. extend: 'Ext.panel.Panel',
  3. alias: 'widget.navigationpanel',
  4. region:'west',
  5. /*border: false,
  6. bodyBorder:false,*/
  7. id:'app-as-navigation',
  8. bodyCls:'cus-leftbg',
  9. initComponent: function() {
  10. var me = this;
  11. //this.items=me.loadIconNavigation();
  12. Ext.applyIf(this,{
  13. width: 200,
  14. minWidth: 150,
  15. maxWidth: 400,
  16. split: false,
  17. collapsible: false,
  18. items: this.createView(),
  19. layout:{
  20. type: 'accordion',
  21. animate: true
  22. }
  23. });
  24. this.callParent(arguments);
  25. },
  26. createView:function(parentId){
  27. var accordItems=new Array(),me=this;
  28. Ext.Ajax.request({
  29. url : basePath + 'opensys/getCurSysnavigation.action',
  30. method:'post',
  31. async:false,
  32. callback : function(options, success, response){
  33. var res = new Ext.decode(response.responseText);
  34. Ext.Array.each(res.data,function(item){
  35. var o=new Object(),data;
  36. o.title=item.cn_title;
  37. o.bodyCls='cus-leftbg';
  38. if(item.children){
  39. data=new Array();
  40. Ext.Array.each(item.children,function(child){
  41. data.push({
  42. title:child.cn_title,
  43. url:child.cn_url,
  44. sign:child.cn_id,
  45. icon:basePath+'resource/images/customer/'+child.cn_icon
  46. });
  47. });
  48. o.items=[Ext.create('widget.dataview',{
  49. autoScroll: true,
  50. tpl:[ '<tpl for=".">',
  51. '<div class="ux-shortcut">',
  52. '<div class="ux-shortcut-icon">',
  53. '<img src="{icon}" title="{title}">',
  54. '</div>',
  55. '<span class="ux-shortcut-text">{title}</span>',
  56. '</div>',
  57. '</tpl>',
  58. '<div class="x-clear"></div>'],
  59. itemSelector:'div.ux-shortcut',
  60. trackOver: true,
  61. /*selModel: {
  62. mode: 'SINGLE',
  63. listeners: {
  64. scope:me,
  65. selectionchange: me.onSelectionChange,
  66. itemclick: me.onItemclick,
  67. itemmousedown :me.onItemclick
  68. }
  69. },*/
  70. listeners: {
  71. scope:me,
  72. itemclick: me.onItemclick,
  73. },
  74. store: Ext.create('Ext.data.Store', {
  75. fields: [{name: 'title' },
  76. {name:'url' },
  77. {name:'icon' },
  78. {name:'sign'}],
  79. data:data
  80. }),
  81. })];
  82. }
  83. accordItems.push(o);
  84. });
  85. }
  86. });
  87. return accordItems;
  88. },
  89. /* formatData:function(data){
  90. var formatData=new Array(),o=null;
  91. Ext.Array.each(data,function(item){
  92. o=new Object();
  93. o.title=item.cn_title;
  94. o.leaf=item.cn_isleaf==1;
  95. if(item.children.length>0){
  96. Ext.Array.each(item.children,)
  97. }
  98. });
  99. return formatData;
  100. },*/
  101. onSelectionChange: function(view,selects){
  102. var tabPanel=this.ownerCt.down('centerTabPanel');
  103. tabPanel.loadTab(selects[0]);
  104. },
  105. onItemclick:function(view,record){
  106. var tabPanel=this.ownerCt.down('centerTabPanel');
  107. tabPanel.loadTab(record);
  108. }
  109. });