#include <wobject/xstring.hpp>
|
#include <xcontrol/xtreeview.hpp>
|
#include <xcontrol/xdwgrid.hpp>
|
#include <wobject/xdouble.hpp>
|
#include <xcontrol/xlayersheet.hpp>
|
|
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
|
#include "viewobject/view.base.hpp"
|
|
using xml = KXMLDOMDocument;
|
class __declspec(dllexport) HrOrgChart : public xwin
|
{
|
public:
|
xtreeview tv_org;
|
xdwtable dw_parent;
|
int m_bCanDestroy;
|
|
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(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 )
|
{
|
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;
|
}
|
|
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;*/
|
return 1;
|
}
|
|
//½¹µã¼¤»î´¦Àíº¯Êý
|
int OnSetFocus(TEvent* evt, LPARAM param)
|
{
|
return 1;
|
}
|
|
int OnOK(xstring comdid)
|
{
|
xaserverarg arg;
|
|
arg = GetArg();
|
arg.AddArg(L"comdid", comdid);
|
HTREEITEM hitem = tv_org.GetSelectedItem();
|
if (!hitem )
|
{
|
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 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 OnXCommand(TEvent* evt, LPARAM param)
|
{
|
return OnCmdDispatch(evt->xcommand.pStrID);
|
}
|
|
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);
|
|
//AttachEvent(L"WM_ACTIVATE",OnActive);
|
return 1;
|
}
|
|
int OnInitial()
|
{
|
OnAttachEvent();
|
|
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;
|
}
|
};
|