PDAPower.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. Ext.define('erp.view.ma.PDAPower', {
  2. extend : 'Ext.Viewport',
  3. layout : 'border',
  4. hideBorders : true,
  5. initComponent : function() {
  6. var me = this;
  7. Ext.apply(me, {
  8. items : [ {
  9. region : 'west',
  10. width : '24%',
  11. height : '100%',
  12. xtype : 'treepanel',
  13. singleExpand: true,
  14. id : 'powertree',
  15. rootVisible : false,
  16. useArrows : true,
  17. enableDD : false,
  18. split: true,
  19. containerScroll : true,
  20. collapsible : true,
  21. tbar:Ext.create('Ext.Toolbar',{
  22. items: [{
  23. width:215,
  24. xtype: 'searchfield',
  25. id: 'searchField',
  26. isPDA:true
  27. }, '->',{
  28. iconCls: 'tree-back',
  29. cls: 'x-btn-tb',
  30. width: 16,
  31. tooltip: $I18N.common.main.treeBack,
  32. hidden: false,
  33. handler: function(){
  34. Ext.getCmp('powertree').getTreeRootNode(0);
  35. Ext.getCmp('searchField').setValue(null);
  36. }
  37. },'->']}),
  38. getTreeRootNode: function(parentId){
  39. Ext.Ajax.request({//拿到tree数据
  40. url : basePath + 'ma/PDAlazyTree.action',
  41. params: {
  42. parentId: parentId,
  43. condition:'sn_limit=1'
  44. },
  45. callback : function(options,success,response){
  46. var res = new Ext.decode(response.responseText);
  47. if(res.tree){
  48. Ext.getCmp('powertree').store.setRootNode({
  49. text: 'root',
  50. id: 'root',
  51. expanded: true,
  52. children: res.tree
  53. });
  54. } else if(res.exceptionInfo){
  55. showError(res.exceptionInfo);
  56. }
  57. }
  58. });
  59. },
  60. store : Ext.create('Ext.data.TreeStore', {
  61. root : {
  62. text : 'root',
  63. id : 'root',
  64. expanded : true
  65. }
  66. })
  67. }, {
  68. region : 'center',
  69. height : '100%',
  70. xtype : 'grouppower'
  71. } ]
  72. });
  73. me.callParent(arguments);
  74. }
  75. });