ProjectTreePanel.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. Ext.define('erp.view.plm.project.ProjectTreePanel',{
  2. extend: 'Ext.tree.Panel',
  3. alias: 'widget.erpProjectTreePanel',
  4. BaseUtil: Ext.create('erp.util.BaseUtil'),
  5. id: 'tree-panel',
  6. margins : '0 0 -1 1',
  7. border : false,
  8. enableDD : false,
  9. split: true,
  10. layout:'fit',
  11. height:'65%',
  12. region: 'west',
  13. title: "<font color=#a1a1a1; size=2>项目</font>",
  14. toggleCollapse: function() {
  15. if (this.collapsed) {
  16. this.expand(this.animCollapse);
  17. } else {
  18. this.title = "项目列表";
  19. this.collapse(this.collapseDirection, this.animCollapse);
  20. }
  21. return this;
  22. },
  23. rootVisible: false,
  24. singleExpand: true,
  25. containerScroll : true,
  26. collapsible : true,
  27. autoScroll: false,
  28. useArrows: true,
  29. expanded: true,
  30. bodyStyle:'background-color:#f1f1f1;',
  31. store: Ext.create('Ext.data.TreeStore', {
  32. root : {
  33. text: 'root',
  34. id: 'root',
  35. expanded: true
  36. }
  37. }),
  38. tools: [{
  39. id: 'gear',
  40. type: 'gear',
  41. tooltip: '修改设置',
  42. handler: function(){
  43. }
  44. } , {
  45. id: 'refresh',
  46. type: 'refresh',
  47. tooltip: '刷新',
  48. handler: function(){
  49. }
  50. } , {
  51. id: 'search',
  52. type: 'search',
  53. tooltip: '查找',
  54. handler: function(){
  55. }
  56. }],
  57. initComponent : function(){
  58. this.getTreeRootNode();
  59. this.callParent(arguments);
  60. },
  61. getTreeRootNode: function(parentId){
  62. Ext.Ajax.request({
  63. url : basePath + 'plm/projectplan/GetProjectPlan.action',
  64. params:{
  65. condition:condition
  66. },
  67. callback : function(options,success,response){
  68. var res = new Ext.decode(response.responseText);
  69. if(res.tree){
  70. var tree = res.tree;
  71. Ext.getCmp('tree-panel').store.setRootNode({
  72. text: 'root',
  73. id: 'root',
  74. expanded: true,
  75. children: tree
  76. });
  77. } else if(res.exceptionInfo){
  78. showError(res.exceptionInfo);
  79. }
  80. }
  81. });
  82. },
  83. listeners: {
  84. scrollershow: function(scroller) {
  85. if (scroller && scroller.scrollEl) {
  86. scroller.clearManagedListeners();
  87. scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
  88. }
  89. }
  90. }
  91. });