| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- Ext.define('erp.view.oa.doc.OrgTreePanel', {
- extend: 'Ext.tree.Panel',
- xtype: 'erpOrgTreePanel',
- id:'orgtree',
- lines:true,
- rootVisible: false,
- containerScroll : true,
- autoScroll: false,
- useArrows: true,
- split:true,
- closeAction:'destroy',
- border : false,
- enableDD : false,
- FormUtil:Ext.create('erp.util.FormUtil'),
- store: Ext.create('Ext.data.TreeStore', {
- root : {
- text: 'root',
- id: 'root',
- expanded: true
- }
- }),
- initComponent : function(){
- this.callParent(arguments);
- this.getTreeRootNode(this);
- },
- listeners:{
- itemmousedown: function(selModel, record){
- var tree=selModel.ownerCt;
- if(! tree.itemselector) tree.itemselector=Ext.getCmp('itemselector-field');
- var data=new Array();
- data.push({
- text:'<font color="#D52B2B">[组织]</font>'+record.data.text,
- value:'org#'+record.data.id
- });
- Ext.Array.each(record.raw.otherInfo,function(item){
- data.push({
- text:'<font color="#C4C43C">[岗位]</font>'+item.jo_name,
- value:'job#'+item.jo_id
- })
- });
- Ext.Array.each(record.raw.data,function(item){
- data.push({
- text:'<font color="#4DB34D">[个人]</font>'+item.em_name,
- value:'employee#'+item.em_id
- })
- });
- tree.itemselector.fromField.store.loadData(data);
- }
- },
- getTreeRootNode: function(treepanel){
- treepanel.setLoading(true);
- treepanel.store.removeAll(true);
- Ext.Ajax.request({//拿到tree数据
- url : basePath + 'hr/employee/getHrOrgsTreeAndEmployees.action',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- treepanel.setLoading(false);
- if(res.tree){
- var tree = res.tree;
- treepanel.store.setRootNode({
- text: 'root',
- id: 'root',
- expanded: true,
- children: tree
- });
- } else if(res.exceptionInfo){
- showError(res.exceptionInfo);
- }
- }
- });
- },
- });
|