SpecialTreePanel.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. Ext.define('erp.view.plm.record.SpecialTreePanel',{
  2. extend: 'Ext.tree.Panel',
  3. alias: 'widget.erpSpecialTreePanel',
  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. width : '20%',
  11. region: 'east',
  12. title: "<font color=#a1a1a1; size=2>任务日报详情</font>",
  13. toggleCollapse: function() {
  14. if (this.collapsed) {
  15. this.expand(this.animCollapse);
  16. } else {
  17. this.title = "任务日报详情";
  18. this.collapse(this.collapseDirection, this.animCollapse);
  19. }
  20. return this;
  21. },
  22. rootVisible: false,
  23. singleExpand: false,
  24. containerScroll : true,
  25. collapsible : true,
  26. autoScroll: false,
  27. useArrows: true,
  28. bodyStyle:'background-color:#f1f1f1;',
  29. store: Ext.create('Ext.data.TreeStore', {
  30. root : {
  31. text: 'root',
  32. id: 'root',
  33. expanded: true
  34. }
  35. }),
  36. initComponent : function(){
  37. this.getTreeRootNode();
  38. this.callParent(arguments);
  39. },
  40. getTreeRootNode: function(){
  41. var urlCondition = this.BaseUtil.getUrlParam('gridCondition');
  42. Ext.Ajax.request({
  43. url : basePath + 'plm/record/GetRecordTree.action',
  44. params:{
  45. condition:urlCondition,
  46. },
  47. callback : function(options,success,response){
  48. var res = new Ext.decode(response.responseText);
  49. if(res.tree){
  50. var tree = res.tree;
  51. Ext.getCmp('tree-panel').store.setRootNode({
  52. text: 'root',
  53. id: 'root',
  54. expanded: true,
  55. children: tree
  56. });
  57. } else if(res.exceptionInfo){
  58. showError(res.exceptionInfo);
  59. }
  60. }
  61. });
  62. },
  63. listeners: {
  64. scrollershow: function(scroller) {
  65. if (scroller && scroller.scrollEl) {
  66. scroller.clearManagedListeners();
  67. scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
  68. }
  69. }
  70. }
  71. });