DocumentTreePanel.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. Ext.define('erp.view.oa.doc.DocumentTreePanel', {
  2. extend: 'Ext.tree.Panel',
  3. xtype: 'erpDocumentTreePanel',
  4. /* title: '文档管理',*/
  5. cls: 'doclist',
  6. id:'doctree',
  7. lines:false,
  8. rootVisible: false,
  9. containerScroll : true,
  10. //collapsible : true,
  11. autoScroll: false,
  12. useArrows: true,
  13. store: Ext.create('Ext.data.TreeStore', {
  14. root: {
  15. expanded: true,
  16. children: [{
  17. text: '公共文档',
  18. expanded: false,
  19. iconCls:'x-tree-icon-topFolder',
  20. url:"/公共文档",
  21. id:0
  22. },
  23. {
  24. text: '我的文档',
  25. url:"/我的文档",
  26. expanded: false,
  27. iconCls:'x-tree-icon-myFolder',
  28. id:1
  29. },
  30. {
  31. text: '我的常用文档',
  32. url:"/我的常用文档",
  33. expanded: false,
  34. leaf:true,
  35. iconCls:'x-tree-icon-myfav',
  36. id:2
  37. },
  38. {
  39. text: '借给我的文档',
  40. url:"/借给我的文档",
  41. expanded: false,
  42. leaf:true,
  43. iconCls:'x-tree-icon-mylendings',
  44. id:3
  45. },
  46. {
  47. text: '我借出的文档',
  48. url:"/我借出的文档",
  49. expanded: false,
  50. leaf:true,
  51. iconCls:'x-tree-icon-mylends' ,
  52. id:4
  53. },{
  54. text: '回收站',
  55. url:"/回收站",
  56. expanded: false,
  57. leaf:true,
  58. iconCls:'x-tree-icon-trash',
  59. id:5
  60. }
  61. ]
  62. }
  63. }),
  64. refreshNodeByParentId:function (parentId,tree,record){
  65. var condition = tree.baseCondition;
  66. var record=record||tree.getSelectionModel().getSelection()[0];
  67. record.removeAll(true);
  68. var me = this;
  69. Ext.Ajax.request({//拿到tree数据
  70. url : basePath + 'oa/documetlist/loadDir.action',
  71. params: {
  72. parentId: parentId,
  73. condition: condition
  74. },
  75. callback : function(options,success,response){
  76. tree.setLoading(false);
  77. var res = new Ext.decode(response.responseText);
  78. if(res.tree){
  79. if(!record.get('level')) {
  80. record.set('level', 0);
  81. }
  82. Ext.each(res.tree, function(n){
  83. if(n.showMode == 2){//openBlank
  84. n.text = "<a href='" + basePath + me.parseUrl(n.url) + "' target='_blank'>" + n.text + "</a>";
  85. }
  86. if(!n.leaf) {
  87. n.level = record.get('level') + 1;
  88. n.iconCls = 'x-tree-icon-level-' + n.level;
  89. }
  90. });
  91. record.appendChild(res.tree);
  92. record.expand(false,true);//展开
  93. me.flag = true;
  94. } else if(res.exceptionInfo){
  95. showError(res.exceptionInfo);
  96. me.flag = true;
  97. }
  98. }
  99. });
  100. }
  101. });