¶Ô±ÈÐÂÎļþ |
| | |
| | | #pragma once |
| | | |
| | | #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) SysUser : public xwin |
| | | { |
| | | public: |
| | | xtreeview tv_usergroup; |
| | | xdwgrid dw_user; |
| | | xnode m_agentNode; |
| | | xstring strJobID; |
| | | public: |
| | | SysUser(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static SysUser* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | SysUser* pWin = new SysUser(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(param p) |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | xstring str = m_QueryTxt; |
| | | //trace(ele.xml); |
| | | //alert(str); |
| | | arg.AddArg(L"guid", str); |
| | | //trace(strJobID); |
| | | if (xaserver::ExecXQuery(L"", L"[list.SysUser.xq]", arg.GetString(), x) == 1) |
| | | { |
| | | dw_user.AcceptText(); |
| | | dw_user.Retrieve(x); |
| | | dw_user.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | |
| | | //int wid = tv_usergroup.GetId(); |
| | | HTREEITEM hitem = tv_usergroup.GetSelectedItem(); |
| | | HTREEITEM rootItem = tv_usergroup.GetRootItem(); |
| | | //if (hItem <=0 || hItem == rootItem) |
| | | // return 0; |
| | | KXMLDOMElement ele = tv_usergroup.GetItemData(hitem); |
| | | //trace(L"ok"); |
| | | if (ele) |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | strJobID = ele.selectSingleNode(L"@JobID").text(); |
| | | //trace(ele.xml); |
| | | //alert(strJobID); |
| | | arg.AddArg(L"guid", strJobID); |
| | | //trace(strJobID); |
| | | if (xaserver::ExecXQuery(L"", L"[list.SysUser.xq]", arg.GetString(), x) == 1) |
| | | { |
| | | dw_user.AcceptText(); |
| | | dw_user.Retrieve(x); |
| | | dw_user.Redraw(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int xmImport() |
| | | { |
| | | |
| | | //int wid = tv_usergroup.GetId(); |
| | | HTREEITEM hitem = tv_usergroup.GetSelectedItem(); |
| | | if (!hitem) |
| | | { |
| | | alert(L"è¯·éæ©èä½ï¼"); |
| | | return 0; |
| | | } |
| | | OpenWindow(L"dev:xpage[UserImport.vx]"); |
| | | //openUrl(L"ç³»ç»ç¨æ·.vface/xpage/SysUser/UserImport", this); |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | xml x; |
| | | |
| | | dw_user.DwUpdateAllToEx(x); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | arg.AddArg(L"dbmap", L"SysUser.dbmap"); |
| | | if (getUrl(L"/sale/data/SysUser/SysUser", arg.GetString(), x) != 1) |
| | | { |
| | | //trace(L"error:"+x.xml()); |
| | | alert(L"ä¿å失败"); |
| | | } |
| | | else { |
| | | if (x.selectSingleNode(L"erroe")) |
| | | { |
| | | alert(L"ä¿ååºé2! "); |
| | | return 0; |
| | | } |
| | | //trace(x.xml()); |
| | | dw_user.ResetUpdateStatus(); |
| | | MessageBox(GetHWND(), L"ä¿åæåï¼", L"æç¤º", 0); |
| | | } |
| | | |
| | | /* arg.AddArg(L"xdata",x.xml()); |
| | | //arg.AddArg(L"jobguid",strJobID); |
| | | //trace(x.xml()); |
| | | //trace(strJobID); |
| | | //if (getUrl(L"/sale/data/SysUser/SysUser",arg.GetString(),x) != 1) |
| | | //trace(xaserver::ExecXAction(GetServerUrl(),L"[SysUser.xa]",arg.GetString(),x)); |
| | | if (xaserver::ExecXAction(GetServerUrl(),L"[SysUser.xa]",arg.GetString(),x)!=1) |
| | | { |
| | | //trace(L"error:"+x.xml()); |
| | | alert(L"ä¿å失败"); |
| | | } |
| | | else{ |
| | | if(x.selectSingleNode(L"ERROR")) |
| | | { |
| | | alert(L"ä¿ååºé2! "); |
| | | return 0; |
| | | } |
| | | MessageBox(GetHWND(),L"ä¿åæåï¼",L"æç¤º",0); |
| | | }*/ |
| | | return 1; |
| | | } |
| | | int OnAddRow() |
| | | { |
| | | //int wid = tv_usergroup.GetId(); |
| | | HTREEITEM hitem = tv_usergroup.GetSelectedItem(); |
| | | if (hitem == 0) |
| | | { |
| | | alert(L"请å
éæ©èä½ç±»åï¼"); |
| | | } |
| | | else |
| | | { |
| | | int row = dw_user.InsertRow(0); |
| | | dw_user.SetItemString(row, L"Status", L"Y"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | //int wid = tv_usergroup.GetId(); |
| | | HTREEITEM hitem = tv_usergroup.GetSelectedItem(); |
| | | if (hitem == 0) |
| | | { |
| | | alert(L"请å
éæ©èä½ç±»åï¼"); |
| | | } |
| | | else |
| | | { |
| | | int crow = dw_user.GetRow(); |
| | | int row = dw_user.InsertRow(crow); |
| | | dw_user.SetItemString(row, L"Status", L"Y"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = dw_user.GetRow(); |
| | | dw_user.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | |
| | | int OnJobType() |
| | | { |
| | | openUrl(L"ç»ç»æ¶æ.vface/worknode/Hr/HrJob"); |
| | | return 1; |
| | | } |
| | | |
| | | int OnClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | int col = hdr.col; |
| | | xstring colname = dw_user.GetColumnName(col); |
| | | KXMLDOMElement xrow = dw_user.GetRowElement(row); |
| | | xstring BindComputer = xrow.selectSingleNode(L"BindComputer").text(); |
| | | xaserverarg arg; |
| | | |
| | | if (BindComputer != L"") |
| | | { |
| | | arg.AddArg(L"BindComputer", BindComputer); |
| | | } |
| | | |
| | | xstring comdid; |
| | | if (colname == L"BindComputer") |
| | | { |
| | | openUrl(L"ç³»ç»ç¨æ·.vface/xpage/SysUser/BindComputer/dialog", arg); |
| | | comdid = arg.GetArgString(L"comdid"); |
| | | if (comdid == L"ok") |
| | | { |
| | | xstring strxml = arg.GetArgString(L"xml"); |
| | | dw_user.SetItemDisplayString(row, colname, strxml); |
| | | dw_user.SetItemString(row, colname, strxml); |
| | | dw_user.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnResetPass() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | |
| | | int row = dw_user.GetRow(); |
| | | if (row < 1) return 1; |
| | | arg.AddArg(L"user", dw_user.GetItemString(row, L"EmployeeNo")); |
| | | |
| | | OpenWindow(L"dev:xpage[ResetUserPassDlg.vx]", arg); |
| | | return 1; |
| | | } |
| | | |
| | | int Onlog() |
| | | { |
| | | openUrl(L"/sale/view/SysUser/xpage/SysUser/SysLoginRecord"); |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"Save") OnSave(); |
| | | else if (comdid == L"AddRow") OnAddRow(); |
| | | else if (comdid == L"InsertRow") OnInsertRow(); |
| | | else if (comdid == L"DeleteRow") OnDeleteRow(); |
| | | else if (comdid == L"JobType") OnJobType(); |
| | | else if (comdid == L"xmImport") xmImport(); |
| | | else if (comdid == L"xmLog") Onlog(); |
| | | else if (comdid == L"_cb_grid_search") return GridSearchEx(); |
| | | else if (comdid == L"xmResetPass") return OnResetPass(); |
| | | else if (comdid == L"xmResetPassEx") OpenWindow(L"dev:xpage[SysForcePassward.vx]"); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&SysUser::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&SysUser::OnSetFocus); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent(L"tv_usergroup", L"TVN_SELCHANGED", (FEvent)&SysUser::OnTreeSelChanged); |
| | | //AttachEvent(L"dw_user",L"DWV_ITEMBEINGEDIT",OnClicked); |
| | | AttachEvent(L"dw_user", L"DWV_DOUBLECLICKED", (FEvent)&SysUser::OnClicked); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_agentNode = new xnode; |
| | | |
| | | tv_usergroup = new treeview; |
| | | tv_usergroup.setNativePointer(GetControl(L"tv_usergroup")); |
| | | dw_user = new xdwgrid; |
| | | dw_user.setNativePointer(GetControl(L"dw_user")); |
| | | dw_user.SetDataObject(GetServerUrl(), L"dev:sheet[SysUser.tpl/UserList]"); |
| | | dw_user.SetReadOnly(true); |
| | | dw_user.SetSelectionMode(1); |
| | | |
| | | OnInitial(); |
| | | //int wid = tv_usergroup.GetId(); |
| | | HTREEITEM root = tv_usergroup.GetRootItem(); |
| | | tv_usergroup.ExpandItem( root); |
| | | |
| | | xml x; |
| | | |
| | | x.loadXML(L"<Config/>"); |
| | | m_configDoc = x; |
| | | rowSearch(L"ç³»ç»ç¨æ·.vface/template/SysUser/list"); |
| | | GridSearchEx(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |