| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrOrgChart is extend win__; |
| | | about HrOrgChart |
| | | [ |
| | | control: |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | method: |
| | | [ |
| | | treeview__ tv_org; |
| | | xdwtable__ dw_parent; |
| | | int m_bCanDestroy; |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) HrOrgChart : public xwin |
| | | { |
| | | public: |
| | | xtreeview tv_org; |
| | | xdwtable dw_parent; |
| | | int m_bCanDestroy; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | public: |
| | | HrOrgChart(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static HrOrgChart* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrOrgChart* pWin = new HrOrgChart(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hitem = nmtv.itemNew.hItem; |
| | | if (hitem == 0) |
| | | hitem = treeview__::GetRootItem(tv_org.GetId()); |
| | | string label = treeview__::GetItemLabel(tv_org.GetId(), hitem); |
| | | string pUnit; |
| | | pUnit = treeview__::GetItemLabel(tv_org.GetId(), hitem) + "\\"; |
| | | int pitem = treeview__::GetParentItem(tv_org.GetId(), hitem); |
| | | while (pitem > 0) |
| | | { |
| | | pUnit = treeview__::GetItemLabel(tv_org.GetId(), pitem) + "\\" + pUnit; |
| | | pitem = treeview__::GetParentItem(tv_org.GetId(), pitem); |
| | | } |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(), hitem); |
| | | string guid = ele.SelectSingleNode("@guid").text; |
| | | int OnTreeSelChanged(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hitem = nmtv.itemNew.hItem; |
| | | if (hitem == 0) |
| | | hitem = tv_org.GetRootItem(); |
| | | xstring label = tv_org.GetItemLabel(hitem); |
| | | xstring pUnit; |
| | | pUnit = tv_org.GetItemLabel(hitem) + L"\\"; |
| | | HTREEITEM pitem = tv_org.GetParentItem(hitem); |
| | | while (pitem > 0) |
| | | { |
| | | pUnit = tv_org.GetItemLabel(pitem) + L"\\" + pUnit; |
| | | pitem = tv_org.GetParentItem(pitem); |
| | | } |
| | | KXMLDOMElement ele = tv_org.GetItemData(hitem); |
| | | xstring guid = ele.selectSingleNode(L"@guid").text(); |
| | | |
| | | //CloseWindow(); |
| | | return 1; |
| | | } |
| | | //CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnActive(ref TEvent evt, int p) |
| | | { |
| | | /*int WA_INACTIVE = 0; |
| | | int WA_ACTIVE = 1; |
| | | int WA_CLICKACTIVE = 2; |
| | | int lw = evt.wParam & 0xffff; |
| | | if( lw ==WA_INACTIVE && m_bCanDestroy==1 ) |
| | | { |
| | | win__::CloseWindow(); |
| | | return 1; |
| | | } |
| | | if(lw !=WA_INACTIVE)m_bCanDestroy = 1; |
| | | return 1;*/ |
| | | } |
| | | int OnActive(TEvent* evt, int p) |
| | | { |
| | | /*int WA_INACTIVE = 0; |
| | | int WA_ACTIVE = 1; |
| | | int WA_CLICKACTIVE = 2; |
| | | int lw = evt.wParam & 0xffff; |
| | | if( lw ==WA_INACTIVE && m_bCanDestroy==1 ) |
| | | { |
| | | win::CloseWindow(); |
| | | return 1; |
| | | } |
| | | if(lw !=WA_INACTIVE)m_bCanDestroy = 1; |
| | | return 1;*/ |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK(string comdid) |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = win__::GetParam(); |
| | | arg.AddArg("comdid", comdid); |
| | | int hitem = treeview__::GetSelectedItem(tv_org.GetId()); |
| | | if (hitem > 0) |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(), hitem); |
| | | string guid = ele.SelectSingleNode("@guid").text; |
| | | string label = ele.selectSingleNode("OrgName").text; |
| | | arg.AddArg("OrgName", label); |
| | | arg.AddArg("OrgId", guid); |
| | | win__::CloseWindow(); |
| | | } |
| | | else |
| | | win__::MessageBox(GetHWND(), "请选择组织!", "提示", 0); |
| | | return 1; |
| | | } |
| | | int OnOK(xstring comdid) |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | if (comdid == "xmOk") |
| | | OnOK(comdid); |
| | | else if (comdid == "xmCancel") |
| | | CloseWindow(); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | arg = GetArg(); |
| | | arg.AddArg(L"comdid", comdid); |
| | | HTREEITEM hitem = tv_org.GetSelectedItem(); |
| | | if (hitem > 0) |
| | | { |
| | | KXMLDOMElement ele = tv_org.GetItemData( hitem); |
| | | xstring guid = ele.selectSingleNode(L"@guid").text(); |
| | | xstring label = ele.selectSingleNode(L"OrgName").text(); |
| | | arg.AddArg(L"OrgName", label); |
| | | arg.AddArg(L"OrgId", guid); |
| | | CloseWindow(); |
| | | } |
| | | else |
| | | MessageBox(GetHWND(), L"请选择组织!", L"提示", 0); |
| | | return 1; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | if (comdid == L"xmOk") |
| | | OnOK(comdid); |
| | | else if (comdid == L"xmCancel") |
| | | CloseWindow(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | //AttachEvent("WM_ACTIVATE",OnActive); |
| | | } |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | OnAttachEvent(); |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&HrOrgChart::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrOrgChart::OnSetFocus); |
| | | AttachEvent(L"tv_org", L"TVN_SELCHANGED", (FEvent)&HrOrgChart::OnTreeSelChanged); |
| | | |
| | | return 1; |
| | | } |
| | | //AttachEvent(L"WM_ACTIVATE",OnActive); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_bCanDestroy = 1; |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | OnInitial(); |
| | | int OnInitial() |
| | | { |
| | | OnAttachEvent(); |
| | | |
| | | int root = treeview__::GetRootItem(tv_org.GetId()); |
| | | treeview__::ExpandItemEx(tv_org.GetId(), root); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | SetArg(); |
| | | m_bCanDestroy = 1; |
| | | tv_org = new xtreeview; |
| | | tv_org.setNativePointer(GetControl(L"tv_org")); |
| | | OnInitial(); |
| | | |
| | | HTREEITEM root = tv_org.GetRootItem(); |
| | | tv_org.ExpandItemEx( root); |
| | | |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | return 1; |
| | | } |
| | | }; |