SysCheckTree.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. Ext.define('erp.view.ma.SysCheckTree',{
  2. extend: 'Ext.tree.Panel',
  3. alias: 'widget.erpSysCheckTreePanel',
  4. BaseUtil: Ext.create('erp.util.BaseUtil'),
  5. id: 'tree-panel',
  6. margins : '0 0 -1 1',
  7. autoScroll : true,
  8. split: true,
  9. layout:'fit',
  10. region: 'west',
  11. title: "<font color=#a1a1a1; size=2>员工</font>",
  12. tpl:new Ext.XTemplate('<tpl for="."><div style="height:100' + 'px;"><div id="' + this.id+ '"></div></div></tpl>'),
  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: true,
  24. containerScroll : true,
  25. collapsible : true,
  26. autoScroll: true,
  27. bodyStyle:'background-color:#f1f1f1;',
  28. store: Ext.create('Ext.data.TreeStore', {
  29. root : {
  30. text: 'root',
  31. id: 'root',
  32. expanded: true
  33. }
  34. }),
  35. tools: [{
  36. id: 'gear',
  37. type: 'gear',
  38. tooltip: '修改设置',
  39. handler: function(){
  40. }
  41. } , {
  42. id: 'refresh',
  43. type: 'refresh',
  44. tooltip: '刷新',
  45. handler: function(){
  46. }
  47. } , {
  48. id: 'search',
  49. type: 'search',
  50. tooltip: '查找',
  51. handler: function(){
  52. }
  53. }],
  54. initComponent : function(){
  55. this.getTreeRootNode();
  56. this.callParent(arguments);
  57. },
  58. getTreeRootNode: function(parentId){
  59. Ext.Ajax.request({
  60. url : basePath + 'ma/SysCheck/getAllHrTree.action',
  61. params:{
  62. },
  63. callback : function(options,success,response){
  64. var res = new Ext.decode(response.responseText);
  65. if(res.tree){
  66. var tree = res.tree;
  67. Ext.getCmp('tree-panel').store.setRootNode({
  68. text: 'root',
  69. id: 'root',
  70. expanded: true,
  71. children: tree
  72. });
  73. } else if(res.exceptionInfo){
  74. showError(res.exceptionInfo);
  75. }
  76. }
  77. });
  78. },
  79. listeners: {
  80. scrollershow: function(scroller) {
  81. if (scroller && scroller.scrollEl) {
  82. scroller.clearManagedListeners();
  83. scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
  84. }
  85. }
  86. }
  87. });