| | |
| | | #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) Deduction : public xframe |
| | | class __declspec(dllexport) HrOrg : public xwin |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xtreeview tv_org; |
| | | xstring sOrgID; |
| | | xstring sOrgName; |
| | | |
| | | xstring sRootOrgID; |
| | | xstring sRootOrgName; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | public: |
| | | HrOrg(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static HrOrg* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xstring EntityID; |
| | | xstring InvoiceNo; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | Deduction(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static Deduction* CreateInstance(void* implPtr, void* hWnd) |
| | | HrOrg* pWin = new HrOrg(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | Deduction* pWin = new Deduction(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | int SetAgent() |
| | | else |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | else |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | HCURSOR hIcon = xutil::SetCursorWait(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"guid", sOrgID); |
| | | if (xurl::get(L"OrganizationStruct/list.HrOrg", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | xutil::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | //OnRetrieve(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sguid, HTREEITEM parentitem) |
| | | { |
| | | //int wid = ; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sguid", sguid); |
| | | if (xurl::post(L"/sale/data/OrganizationStruct/tree.child.OrgChart", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.xml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | auto list = x.selectNodes(L"//Org"); |
| | | int i = 0, s = list.length(); |
| | | KXMLDOMElement xitem; |
| | | xstring sname; |
| | | //xstring sguid; |
| | | if (s > 0) |
| | | { |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | xitem = list.item(s - i - 1); |
| | | sname = xitem.selectSingleNode(L"OrgName").text(); |
| | | sguid = xitem.selectSingleNode(L"@guid").text(); |
| | | HTREEITEM curItem = tv_org.InsertChildItemEx(parentitem, sname, xitem, 15, 4); |
| | | OnCreateTree(sguid, curItem); |
| | | /*xstring id = xitem.selectSingleNode(L"ModuleID").text(); |
| | | xstring Name=L""; |
| | | if(xitem.selectSingleNode(L"ModuleName")) Name=xitem.selectSingleNode(L"ModuleName").text(); |
| | | xstring image = 15; |
| | | if(xitem.selectSingleNode(L"ModuelImage")) image=xitem.selectSingleNode(L"ModuelImage").text(); |
| | | int curItem=tv_org.InsertItem(tv_menu.GetId(), parentItem,0,Name,id,image.toInt()); |
| | | xstring child=xitem.selectSingleNode(L"@child").text();//item.getAttribute(L"HasChild"); |
| | | if (child != L"0") |
| | | tv_org.SetItemChild1(tv_menu.GetId(), curItem,1);*/ |
| | | } |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeExpanding(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM sitem = nmtv.itemNew.hItem; |
| | | |
| | | return 1; |
| | | |
| | | xstring id = tv_org.GetItemData(sitem); |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnCreateTree(id, sitem); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | //树点击事件 |
| | | int OnTreeSelecded(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | int wid = 0; |
| | | HTREEITEM hitem = tv_org.GetSelectedItem(); |
| | | KXMLDOMElement ele = tv_org.GetItemData(hitem); |
| | | |
| | | HTREEITEM hroot = tv_org.GetParentItem(hitem); |
| | | HTREEITEM hparent = tv_org.GetParentItem(hroot); |
| | | if (!hparent) |
| | | { |
| | | hparent = hroot; |
| | | hroot = hitem; |
| | | } |
| | | bool found = false; |
| | | if (hparent) found = true; |
| | | while (tv_org.GetParentItem(hparent)) |
| | | { |
| | | hroot = hparent; |
| | | hparent = tv_org.GetParentItem(hroot); |
| | | } |
| | | if (found) |
| | | { |
| | | KXMLDOMElement ele1 = tv_org.GetItemData(hroot); |
| | | //trace(ele1.xml); |
| | | //sRootOrgID = ele1.selectSingleNode(L"CompanyID").text(); |
| | | //sRootOrgName = ele1.selectSingleNode(L"CompanyID/@_displaystring").text(); |
| | | } |
| | | |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | string str = ele.xml(); |
| | | if(ele.selectSingleNode(L"@guid")) |
| | | sOrgID = ele.selectSingleNode(L"@guid").text(); |
| | | if(ele.selectSingleNode(L"OrgName")) |
| | | sOrgName = ele.selectSingleNode(L"OrgName").text(); |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeMoveNode(TEvent* evt, int p) |
| | | { |
| | | TVNNMHDR& nmtv = *(TVNNMHDR*)evt->notify.pnmh; |
| | | HTREEITEM xfrom = nmtv.FromItem; |
| | | HTREEITEM xto = nmtv.ToItem; |
| | | |
| | | int ret = MessageBox(GetHWND(), L"确定移动组织节点?", L"提示:", 1); |
| | | //trace(ret); |
| | | int wid = 0; |
| | | if (ret == 2) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | SetAgent(); |
| | | return 1; |
| | | tv_org.DeleteItem(xto); |
| | | return -1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | //xstring fid = tv_org.GetItemData(wid, xfrom); |
| | | //xstring tid = tv_org.GetItemData(wid, xto); |
| | | HTREEITEM xtop = tv_org.GetParentItem(xto); |
| | | KXMLDOMElement ef = tv_org.GetItemData(xfrom); |
| | | KXMLDOMElement et = tv_org.GetItemData(xtop); |
| | | xstring fid = ef.selectSingleNode(L"@guid").text();//ef.xml; |
| | | xstring tid = et.selectSingleNode(L"@guid").text();//et.xml; |
| | | xml x; |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"from", fid); |
| | | arg.AddArg(L"to", tid); |
| | | //trace(et.xml); |
| | | //return 1; |
| | | if (xurl::post(L"OrganizationStruct/move.update.HrOrg", arg.GetString(), x) != 1) |
| | | { |
| | | if (comdid == L"xmSave") |
| | | { |
| | | OnSave(); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmSearch") |
| | | { |
| | | OnRetrieve(InvoiceNo, EntityID); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | trace(L"error:" + (xstring)x.xml()); |
| | | alert(L"移动组织节点出错!"); |
| | | tv_org.DeleteItem(xto); |
| | | return 0; |
| | | } |
| | | tv_org.DeleteItem(xfrom); |
| | | return 1; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | xstring GetGuid() |
| | | { |
| | | return publiccode::GetGuid(); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | trace(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update/ARDeduction", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert(L"保存成功!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"保存失败!"); |
| | | } |
| | | //xgridex双击 |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if (row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | } |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sguid = e.selectSingleNode(L"@guid").text(); |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | int OnItemChanged(TEvent* evt, LPARAM p) |
| | | arg.AddArg(L"operate", L"modify"); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"tvOrgID", sOrgID); |
| | | arg.AddArg(L"tvOrgName", sOrgName); |
| | | arg.AddArg(L"tvRootOrgID", sRootOrgID); |
| | | arg.AddArg(L"tvRootOrgName", sRootOrgName); |
| | | //trace(row.toString()); |
| | | //win::OpenWindow(L"dev:xpage[HrOrgMaint.xpage]",arg); |
| | | openUrl(L"组织架构.vface/xpage/HrOrg/maint", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | int AddRow() |
| | | { |
| | | /*int wid = ; |
| | | int hitem=tv_org.GetSelectedItem(wid); |
| | | int root=tv_org.GetRootItem(wid); |
| | | if (hitem == root) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | int row = hdr.row; |
| | | xstring dwname = L"dw_list"; |
| | | if (colname == L"DeductionAmount") |
| | | win32::MessageBox(GetHWND(),L"根组织!",L"提示",0); |
| | | return -1; |
| | | }*/ |
| | | //int row = dw_list.GetNextSelectRow(1); |
| | | //IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | //xstring sguid = e.getAttribute(L"guid"); |
| | | |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"operate", L"new0"); |
| | | arg.AddArg(L"guid", L""); |
| | | arg.AddArg(L"tvOrgID", sOrgID); |
| | | arg.AddArg(L"tvOrgName", sOrgName); |
| | | arg.AddArg(L"tvRootOrgID", sRootOrgID); |
| | | arg.AddArg(L"tvRootOrgName", sRootOrgName); |
| | | openUrl(L"组织架构.vface/xpage/HrOrg/maint", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | int ModifyRow() |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | dw_list.SetItemString(row, L"SettlementAdjustID", EntityID); |
| | | xstring id = publiccode::GetGuid(); |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | ele.setAttribute(L"guid", id); |
| | | //dw_list.SetGuid(row,id); |
| | | //alert(ele.xml); |
| | | //alert(dw_list.GetGuid(row)); |
| | | } |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&Deduction::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&Deduction::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&Deduction::OnRowChanged); |
| | | AttachEvent(L"dw_list", L"DWV_ITEMCHANGED", (FEvent)&Deduction::OnItemChanged); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRetrieve(xstring InvoiceNo, xstring EntityID) |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"InvoiceNo", InvoiceNo); |
| | | arg.AddArg(L"InvoiceNoEx", xcontrol(GetControl(L"search")).GetText()); |
| | | arg.AddArg(L"EntityID", EntityID); |
| | | |
| | | //trace(GetControl(L"search").GetText()); |
| | | if (getUrl(L"/sale/data/AR/DeductionList", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | MessageBox(GetHWND(), L"请选中要修改的组织数据行!", L"提示", 0); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | dw_list.SetSelectionMode(1); |
| | | return 1; |
| | | } |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sguid = e.selectSingleNode(L"@guid").text(); |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | int onload() |
| | | arg.AddArg(L"operate", L"modify"); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"tvOrgID", sOrgID); |
| | | arg.AddArg(L"tvOrgName", sOrgName); |
| | | arg.AddArg(L"tvRootOrgID", sRootOrgID); |
| | | arg.AddArg(L"tvRootOrgName", sRootOrgName); |
| | | openUrl(L"组织架构.vface/xpage/HrOrg/maint", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteItem(xstring sguid) |
| | | { |
| | | int wid = 0; |
| | | HTREEITEM hitem = tv_org.GetSelectedItem(); |
| | | HTREEITEM ditem = tv_org.GetChildItem(hitem); |
| | | KXMLDOMElement e = tv_org.GetItemData(ditem); |
| | | if (e) |
| | | { |
| | | SetArg(); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AR/template/Deduction"); |
| | | |
| | | dw_list.SetColumnState(L"ID", false); |
| | | dw_list.SetColumnState(L"GDNLineID", false); |
| | | dw_list.SetColumnState(L"SettlementAdjustID", false); |
| | | |
| | | |
| | | if (GetWinParam()) |
| | | xstring dguid = e.selectSingleNode(L"@guid").text(); |
| | | while (dguid != sguid) |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | EntityID = arg.GetArgString(L"EntityID"); |
| | | InvoiceNo = arg.GetArgString(L"InvoiceNo"); |
| | | ditem = tv_org.GetNextItem(ditem); |
| | | e = tv_org.GetItemData(ditem); |
| | | dguid = e.selectSingleNode(L"@guid").text(); |
| | | } |
| | | trace(InvoiceNo); |
| | | OnRetrieve(InvoiceNo, EntityID); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | tv_org.DeleteItem(ditem); |
| | | } |
| | | |
| | | int onloaded() |
| | | return 1; |
| | | } |
| | | int DeleteRow() |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的组织数据行!",L"提示",0); |
| | | return -1; |
| | | } |
| | | } |
| | | }; |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sguid = e.selectSingleNode(L"@guid").text(); |
| | | xstring sName = e.selectSingleNode(L"OrgName").text(); |
| | | sName += L""; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"guid", sguid); |
| | | if (xurl::get(L"OrganizationStruct/child.OrgNums", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement ele = x.documentElement(); |
| | | xstring snums = ele.selectSingleNode(L"@num").text(); |
| | | int num = snums.toInt(); |
| | | if (num != 0) |
| | | { |
| | | MessageBox(GetHWND(), L"组织 " + sName + L" 存在下级组织单元,禁止删除!", L"提示", 0); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBox(GetHWND(), L"确认要删除组织 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | arg.AddArg(L"guid", sguid); |
| | | //trace(sguid); |
| | | xml x1; |
| | | |
| | | if (xurl::post(L"/sale/data/OrganizationStruct/delete.HrOrg", arg.GetString(), x1) != 1) |
| | | { |
| | | xstring error = x1.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | //win32::MessageBox(GetHWND(),L"删除成功!",L"提示",0); |
| | | dw_list.DeleteRow(row); |
| | | OnDeleteItem(sguid); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int Productlinemaint() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"id", L"产品线"); |
| | | openUrl(L"公共设置.vface/worknode/quickcode/config", &arg); |
| | | //openUrl(L"下拉窗口.vface/xpage/hremployee/select", arg); |
| | | |
| | | return 1; |
| | | } |
| | | int setTree() |
| | | { |
| | | xstring str = L"<vbox name='tree' >"; |
| | | str += L"<xtree name='tv_org' imagelist='0' drag='true'>"; |
| | | str += L"<treeitem src='xquery:[OrgChart.hr.xq]' src1='xquery:[OrgStructureRetrieve.xq]' xcaption='OrgName' xroot='/root' xpath='Org' xchildpath='Org' image='15' loop='yes' xdata='.'/>"; |
| | | str += L"</xtree></vbox>"; |
| | | xstring xfNodeAgentArea = L"tree"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | SetAgentNode(anode, str); |
| | | tv_org = GetControl(L"tv_org"); |
| | | AttachEvent(L"tv_org", L"TVN_SELCHANGED", (FEvent)&HrOrg::OnTreeSelecded); |
| | | HTREEITEM root = tv_org.GetRootItem(); |
| | | if (!root) |
| | | { |
| | | tv_org.ExpandItemEx(root); |
| | | } |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"AddRow") { return AddRow(); } |
| | | else if (comdid == L"ModifyRow") { return ModifyRow(); } |
| | | else if (comdid == L"DeleteRow") { return DeleteRow(); } |
| | | else if (comdid == L"OrgType") |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"id", L"组织类型"); |
| | | openUrl(L"公共设置.vface/worknode/quickcode/config", &arg); |
| | | //openUrl(L"组织架构.vface/xpage/HrOrg/type"); |
| | | } |
| | | else if (comdid == L"Refresh") |
| | | { |
| | | OnRetrieve(); |
| | | setTree(); |
| | | AttachEvent(L"tv_org", L"TVN_ENDDRAG", (FEvent)&HrOrg::OnTreeMoveNode); |
| | | } |
| | | else if (comdid == L"Productlinemaint") |
| | | { |
| | | Productlinemaint(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&HrOrg::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrOrg::OnSetFocus); |
| | | //获得树的点击事件 |
| | | AttachEvent(L"tv_org", L"TVN_SELCHANGED", (FEvent)&HrOrg::OnTreeSelecded); |
| | | //AttachEvent(L"tv_org", L"TVN_ITEMEXPANDING", (FEvent)&HrOrg::OnTreeExpanding); |
| | | AttachEvent(L"tv_org", L"TVN_ENDDRAG", (FEvent)&HrOrg::OnTreeMoveNode); |
| | | //双击 |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&HrOrg::OnDoubleClicked); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = GetControl(L"tv_org"); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"组织架构.vface/template/HrOrg/list"); |
| | | dw_list.SetSelectionMode(1); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetColumnState(L"OrgPlat", false); |
| | | dw_list.SetColumnState(L"OrgComLeader", false); |
| | | dw_list.SetColumnState(L"OrgSupLeader", false); |
| | | dw_list.SetColumnState(L"OrgProLine", false); |
| | | |
| | | |
| | | OnInitial(); |
| | | |
| | | //OnCreateTree(L"00000000-0000-0000-0000-000000000000", 0); |
| | | HTREEITEM root = tv_org.GetRootItem(); |
| | | if (root) |
| | | { |
| | | tv_org.ExpandItemEx(root); |
| | | KXMLDOMElement ele = tv_org.GetItemData(root); |
| | | if (ele) |
| | | { |
| | | if(ele.selectSingleNode(L"@guid")) |
| | | sOrgID = ele.selectSingleNode(L"@guid").text(); |
| | | if(ele.selectSingleNode(L"OrgName")) |
| | | sOrgName = ele.selectSingleNode(L"OrgName").text(); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | }; |