/// <summary> /// 展开节点事件 /// </summary> /// <param name="isExpand"></param> /// <param name="nodeRender"></param> private void nodeTree_ExpandRectClick(bool isExpand, XAPTreeNodeRender nodeRender) { if (isExpand) { loadNodes(nodeRender); } }
/// <summary> /// 一级节点的互斥操作 /// </summary> /// <param name="node"></param> //private void noeLevelNodeReact(XAPTreeNodeRender node) //{ // if (node == null) return; // if (oneLevelTreeList.Contains(node)) // { // foreach (XAPTreeNodeRender oneNode in oneLevelTreeList) // { // if (oneNode != node) // { // oneNode.IsExpanded = false; // } // } // } //} /// <summary> /// 加载模板明细 /// </summary> private void loadModelItm(FArrayList list, XAPTreeNodeRender node) { foreach (NewOrderTemplateDTO templateDTO in list) { OrderExtAssist render = new OrderExtAssist(); render.NowTreeNodeRender = node; render.OrderDto = templateDTO; render.DoubleClick += new EventHandler(render_DoubleClick); render.OrderNodeClick += render_OrderNodeClick; render.LoadData(); } }
/// <summary> /// 模板节点加载明细节点 /// </summary> /// <param name="templDTOs"></param> /// <param name="node"></param> private void loadTmplItemNodes(FArrayList templDTOs, XAPTreeNodeRender node) { foreach (NewOrderTemplateDTO templDTO in templDTOs) { OrderExtAssist render = new OrderExtAssist(); render.NowTreeNodeRender = node; render.OrderDto = templDTO; render.DoubleClick += new EventHandler(render_DoubleClick); render.OrderNodeClick += new EventHandler(render_OrderNodeClick); render.LoadData(); } }
/// <summary> /// 复选框选中事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void oTree1_TreeItemCheckChanged(object sender, TreeItemEventArgs e) { XAPTreeNodeRender nodeTree = e.Node as XAPTreeNodeRender; if (nodeTree.NodeData != null) { object nodeObj = (nodeTree.NodeData as BizNode).UserObject; if (nodeObj is OrTmplDTO) { OrTmplDTO ortmplDO = nodeObj as OrTmplDTO; //获得选中服务或模板下所有的模板id FArrayList ids_Ortmpl = this.model.getAllChildOrTmplDTO(ortmplDO, this.modeltype); if (nodeTree.Checked && ids_Ortmpl != null) { if (this.parentFrame.cacheModelItem != null) { for (int i = ids_Ortmpl.Count - 1; i >= 0; i--) { if (this.parentFrame.cacheModelItem.ContainsKey(ids_Ortmpl[i] as string)) { FArrayList list = this.parentFrame.cacheModelItem[ids_Ortmpl[i] as string] as FArrayList; //获得可以保存的模板明细 getCanSaveItmToSelectList(list); } } } } else {//选中取消,将已选的模板明细移除 for (int i = ids_Ortmpl.Count - 1; i >= 0; i--) { for (int j = this.selectList.Count - 1; j >= 0; j--) { if (selectList[j].Id_ortmpl == ids_Ortmpl[i] as string) { selectList.RemoveAt(j); } } } } } } else { //模板明细的选中事件 modelItmChecked(sender, e); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void oTree1_TreeItemCheckChanged(object sender, TreeItemEventArgs e) { XAPTreeNodeRender nodeTree = e.Node as XAPTreeNodeRender; loadNodes(nodeTree); if (nodeTree.NodeData != null) { object nodeObj = (nodeTree.NodeData as BizNode).UserObject; if ((nodeObj is OrTmplDTO) || (nodeObj is OrTmplCaDO)) { //获得选中服务或模板下所有的模板id List <String> idortmpls = this.getAllChildIdOrTmpls(nodeTree.NodeData as BizNode); for (int i = idortmpls.Count - 1; i >= 0; i--) { if (nodeTree.Checked) { FArrayList list = new FArrayList();; if (this.viewModel.DicOrTplNItm.ContainsKey(idortmpls[i])) { list = this.viewModel.DicOrTplNItm[idortmpls[i]] as FArrayList; } foreach (NewOrderTemplateDTO templateDTO in list) { FArrayList itmdolist = templateDTO.Itemlist; foreach (OrTplNItmDO itmdo in itmdolist) { if (!lstOrTplNItmDOs.Contains(itmdo)) { lstOrTplNItmDOs.Add(itmdo); } } } } else { for (int j = this.lstOrTplNItmDOs.Count - 1; j >= 0; j--) { if (lstOrTplNItmDOs[j].Id_ortmpl == idortmpls[i]) { lstOrTplNItmDOs.RemoveAt(j); } } } } } } //模板明细的选中事件 modelItmChecked(sender, e); }
private void loadNodes(XAPTreeNodeRender nodeTree) { object userObj = oTree1.GetUserObject(nodeTree); if (userObj is OrTmplDTO) { OrTmplDTO focusObj = userObj as OrTmplDTO; String id_ortmpl = focusObj.Id_ortmpl; String id_ortmplca = focusObj.Id_ortmplca; if (this.lstIdortmpls.Contains(id_ortmplca + id_ortmpl)) { return; } else { this.lstIdortmpls.Add(id_ortmplca + id_ortmpl); } List <String> lst = new List <string>(); lst.Add(id_ortmpl); this.viewModel.LoadOrTplNItmDOs(lst);//查询医嘱模板明细数据 FArrayList modelList = new FArrayList(); if (this.viewModel.DicOrTplNItm.ContainsKey(id_ortmpl)) { modelList = this.viewModel.DicOrTplNItm[id_ortmpl] as FArrayList; } if (modelList != null) { this.loadTmplItemNodes(modelList, nodeTree); } if (nodeTree.ChildrenCount > 1) { if (nodeTree.FirstChild is XAPTreeNodeRender) { nodeTree.FirstChild.Remove(); } } else { nodeTree.FirstChild.Text = "(空)"; nodeTree.FirstChild.Enabled = false; } nodeTree.ExpandAll(); } }
public void clearTreeChecked() { this.oTree1.TreeItemCheckChanged -= new TreeItemEventHandler(oTree1_TreeItemCheckChanged); oTree1.TraverseNodes(node1 => { XAPTreeNodeRender tempNode = node1 as XAPTreeNodeRender; if (tempNode.Checked) { tempNode.Checked = false; } }); foreach (XAPTreeNodeRender node in selectTreeList) { node.Checked = false; } this.selectList.Clear(); selectTreeList.Clear(); this.oTree1.TreeItemCheckChanged += new TreeItemEventHandler(oTree1_TreeItemCheckChanged); }
public void clearTreeChecked() { this.oTree1.TreeItemCheckChanged -= new TreeItemEventHandler(oTree1_TreeItemCheckChanged); this.oTree1.TraverseNodes(node1 => { XAPTreeNodeRender tempNode = node1 as XAPTreeNodeRender; if (tempNode.Checked) { tempNode.Checked = false; } }); foreach (XAPTreeNodeRender node in lstTreeNodes) { node.Checked = false; } this.lstOrTplNItmDOs.Clear(); this.lstTreeNodes.Clear(); this.oTree1.TreeItemCheckChanged += new TreeItemEventHandler(oTree1_TreeItemCheckChanged); }
/// <summary> /// 选中节点事件,加载模板明细 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void oTree1_TreeItemSelected(object sender, TreeItemEventArgs e) { XAPTreeNodeRender nodeTree = e.Node as XAPTreeNodeRender; loadNodes(nodeTree); }