dst.defineClass("com.dst.slms.base.marketaccount.marketAccountList", dst.framework.List, {
	initalizeDOM:function(){
		com.dst.slms.base.marketaccount.marketAccountList.superClass.initalizeDOM.call(this);
		
		var zTree = $.fn.zTree.getZTreeObj("accountTree");            
	    var nodeList = zTree.getNodes();　　　　　　
	    zTree.expandNode(nodeList[0], true);　
	},
	enableAction:function(index){
		this.changeEnable(index,'启用');
	},
	disEnableAction:function(index){
		this.changeEnable(index,'禁用');
	},
	changeEnable:function(index,state){
		var _self = this;
		var id = $(this.gridId).datagrid('getRows')[index].id;
		dst.showConfirm('您确认要'+state+'此记录吗？', function(){
			dst.remoteCall({
				method : "changeEnable",
				async:false,  
				url: _self.uipk,
				param : {id :id,isEnable:(state=='禁用'?0:1)},
				success : function(data, textStatus) {
					_self.refreshAction();
		 		}
			});
		});
	},
	
	/**
	 * 标准功能增加打开参数，查询
	 */
	uiPutContext:function(actionName){
		if(actionName=='addNewAction'){
			var treeObj = $.fn.zTree.getZTreeObj("accountTree");
			var nodes = treeObj.getSelectedNodes();
			var parms = {};
			if(nodes.length>0){
				parms.selectTreeId=nodes[0].value;
			}else{
				return false;
			}
			return parms;
		}else{
			return {};
		}
	},
	
	clickTreeAction:function(event, treeId, treeNode){
		var _self = this;
		debugger;
		var id = treeNode.value;
		var filter = _self.getDefaultFilterItems();
		filter['selectTreeId']= id;
		$(_self.gridId).datagrid('reload');
	},
	refreshAction:function(){
		var filter = this.getDefaultFilterItems();
		filter['showNoEnable'] = this.select;
		$(this.gridId).datagrid('reload');
		
		//下面这一段代码是刷新左边的树顺带刷新后自动定位到原先选中的那个节点
		var zTree = $.fn.zTree.getZTreeObj("orgTree");            
		var selId=(zTree.getSelectedNodes().length==0)?undefined:zTree.getSelectedNodes()[0].value;
		initTreeorgTree("/marketAccountController/getAccountTreeData");//刷新树
	    
		if(selId==undefined){
			var zTreex = $.fn.zTree.getZTreeObj("accountTree")
			var nodeList = zTreex.getNodes();　　　　　　
			zTreex.expandNode(nodeList[0], true);　
		}else{
			var node = zTree.getNodeByParam("value",selId );  
			zTree.selectNode(node,true);//指定选中ID的节点  
			zTree.expandNode(node, true);　
		}
	},
});