AttentionMainTreePanel.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. Ext.define('erp.view.oa.attention.AttentionMainTreePanel',{
  2. extend: 'Ext.tree.Panel',
  3. alias: 'widget.AttentionMainTreePanel',
  4. BaseUtil: Ext.create('erp.util.BaseUtil'),
  5. id: 'attentionTree',
  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=3;weight= bold;>所有下属</font>",
  13. toggleCollapse: function() {
  14. if (this.collapsed) {
  15. this.title=title;
  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: false,
  25. containerScroll : true,
  26. collapsible : true,
  27. autoScroll: false,
  28. useArrows: true,
  29. select:null,
  30. //bodyStyle:'background-color:#f0f0f0;',
  31. store: Ext.create('Ext.data.TreeStore', {
  32. root : {
  33. text: 'root',
  34. id: 'root',
  35. expanded: true,
  36. }
  37. }),
  38. initComponent : function(){
  39. this.getTreeRootNode(this);
  40. this.callParent(arguments);
  41. },
  42. getTreeRootNode: function(treepanel){
  43. var me=treepanel;
  44. Ext.Ajax.request({
  45. url : basePath + 'oa/attention/getEmployees.action',
  46. async: false,
  47. params:{
  48. emid:emid
  49. },
  50. callback : function(options,success,response){
  51. var res = new Ext.decode(response.responseText);
  52. if(res.tree){
  53. var tree = res.tree;
  54. me.store.setRootNode({
  55. text: 'root',
  56. id: 'root',
  57. expanded: true,
  58. children: tree
  59. });
  60. } else if(res.exceptionInfo){
  61. showError(res.exceptionInfo);
  62. }
  63. }
  64. });
  65. },
  66. listeners: {
  67. scrollershow: function(scroller) {
  68. if (scroller && scroller.scrollEl) {
  69. scroller.clearManagedListeners();
  70. scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
  71. }
  72. }
  73. }
  74. });