TeammemberTreePanel.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. Ext.define('erp.view.plm.task.TeammemberTreePanel',{
  2. extend: 'Ext.tree.Panel',
  3. alias: 'widget.erpTeammemberTreePanel',
  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. layout : 'fit',
  23. id: 'teammembertree',
  24. emptyText : $I18N.common.grid.emptyText,
  25. rootVisible: false,
  26. singleExpand: false,
  27. containerScroll : true,
  28. collapsible : true,
  29. autoScroll: false,
  30. useArrows: true,
  31. select:null,
  32. bodyStyle:'background-color:#f1f1f1;',
  33. store: Ext.create('Ext.data.TreeStore', {
  34. root : {
  35. text: 'root',
  36. id: 'root',
  37. expanded: true,
  38. }
  39. }),
  40. tools: [{
  41. id: 'gear',
  42. type: 'gear',
  43. tooltip: '修改设置',
  44. handler: function(){
  45. }
  46. } , {
  47. id: 'refresh',
  48. type: 'refresh',
  49. tooltip: '刷新',
  50. handler: function(){
  51. }
  52. } , {
  53. id: 'search',
  54. type: 'search',
  55. tooltip: '查找',
  56. handler: function(){
  57. }
  58. }],
  59. initComponent : function(){
  60. this.getTreeRootNode(this);
  61. this.callParent(arguments);
  62. },
  63. getTreeRootNode: function(panel){
  64. var id=condition.split('=')[1];
  65. /*Ext.Ajax.request({
  66. url : basePath + 'plm/task/GetTeammember.action',
  67. params:{
  68. id:id,
  69. },
  70. callback : function(options,success,response){
  71. var res = new Ext.decode(response.responseText);
  72. if(res.tree){
  73. var tree = res.tree;
  74. panel.store.setRootNode({
  75. text: 'root',
  76. id: 'root',
  77. expanded: true,
  78. children: tree
  79. });
  80. } else if(res.exceptionInfo){
  81. showError(res.exceptionInfo);
  82. }
  83. }
  84. });*/
  85. var me=panel;
  86. var id=condition.split('=')[1];
  87. Ext.Ajax.request({
  88. url : basePath + 'plm/task/GetTeammember.action',
  89. async: false,
  90. params:{
  91. id:id,
  92. },
  93. callback : function(options,success,response){
  94. var res = new Ext.decode(response.responseText);
  95. if(res.tree){
  96. var tree = res.tree;
  97. Ext.Array.each(tree, function(tr) {
  98. tr.cls="x-tree-cls-node";
  99. });
  100. me.store.setRootNode({
  101. text: 'root',
  102. id: 'root',
  103. expanded: true,
  104. children: tree
  105. });
  106. } else if(res.exceptionInfo){
  107. showError(res.exceptionInfo);
  108. }
  109. }
  110. });
  111. },
  112. listeners: {
  113. scrollershow: function(scroller) {
  114. if (scroller && scroller.scrollEl) {
  115. scroller.clearManagedListeners();
  116. scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
  117. }
  118. }
  119. }
  120. });