| | |
| | | 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]" |
| | | use "dev:code[pa.tpp]" |
| | | use "dev:vm[control.vm]" |
| | | #include "dev:xpage[SysUser.vx]" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | unit vbusiness.xpage tpp |
| | | [ |
| | | class pa |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | //use "dev:xpage[SysUser.vx]" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) AddUser : public xwin |
| | | { |
| | | |
| | | public: |
| | | |
| | | xstring note; |
| | | int hitem; |
| | | int row; |
| | | int wid; |
| | | xtreeview tv; |
| | | xdwgrid dw; |
| | | xwin pwin; |
| | | pa p; |
| | | public: |
| | | AddUser(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static AddUser* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | string note; |
| | | int hitem; |
| | | int row; |
| | | int wid; |
| | | treeview__ tv; |
| | | xdwgrid__ dw; |
| | | win__ pwin; |
| | | AddUser* pWin = new AddUser(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | ] |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | AddUser is extend win__; |
| | | about AddUser |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | pa p; |
| | | |
| | | int SetAgent() |
| | | { |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | int SetAgent(); |
| | | int SetAgent() |
| | | { |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | int SetAgent(); |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | int AppendItem(xml__ x,msxml::IXMLDOMElement r,string item){ |
| | | var e = x.GetXmlDoc().createElement(item); |
| | | //xcontrol xc = GetControl(item); |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl(item)); |
| | | e.text = xc.GetText(); |
| | | r.appendChild(e); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | control__ xc = new control__; |
| | | /*xc=GetControl("EmployeeNo"); |
| | | if (xc.GetText()=="") |
| | | { |
| | | alert("用户代码不能为空!"); |
| | | return 0; |
| | | }*/ |
| | | xc=GetControl("UserName"); |
| | | if (xc.GetText()=="") |
| | | { |
| | | alert("用户名称不能为空!"); |
| | | return 0; |
| | | } |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | x.LoadXml("<SysUser/>"); |
| | | var r = x.GetXmlDoc().documentElement; |
| | | string guid; |
| | | string guid1; |
| | | if (p.note=="修改") |
| | | { |
| | | msxml::IXMLDOMElement ele=xdwgrid__::GetRowElement(p.row); |
| | | guid = ele.selectSingleNode("UserID").text; |
| | | //guid=ele.getAttribute("guid"); |
| | | //if (ele.selectSingleNode("empid")) |
| | | // r.appendChild(ele.selectSingleNode("empid")); |
| | | } |
| | | else |
| | | guid=win__::GetGuid(); |
| | | //guid1=win32::GetGuid(); |
| | | r.setAttribute("guid",guid); |
| | | //r.setAttribute("guid1",guid1); |
| | | //AppendItem(x,r,"EmployeeNo"); |
| | | AppendItem(x,r,"UserName"); |
| | | AppendItem(x,r,"PassWord"); |
| | | AppendItem(x,r,"Status"); |
| | | //trace(x.GetXml()); |
| | | //return 1; |
| | | arg.AddArg("content",x.GetXml()); |
| | | int ls_item = treeview__::GetSelectedItem(p.wid); |
| | | msxml::IXMLDOMElement e=treeview__::GetItemData(p.wid,ls_item); |
| | | string gpguid=e.selectSingleNode("@guid").text; |
| | | arg.AddArg("gpguid",gpguid); |
| | | if (xaserver__::ExecXAction(GetServerUrl(),"[update.User.xa]",arg.GetString())==1) |
| | | { |
| | | alert("ok"); |
| | | if (p.note=="修改") |
| | | { |
| | | xdwgrid__ dw = new xdwgrid__; |
| | | //dw.setNativePointer(p.dw_user); |
| | | int row = dw.GetNextSelectRow(0); |
| | | //dw.SetItemString(row,"UserName",""); |
| | | msxml::IXMLDOMElement e; |
| | | e = x.GetXmlDoc().documentElement; |
| | | string ls_pass = e.selectSingleNode("PassWord").text; |
| | | string ls_status = e.selectSingleNode("Status").text; |
| | | dw.SetItemString(row,"PassWord",ls_pass); |
| | | dw.SetItemString(row,"Status",ls_status); |
| | | dw.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | //---------- |
| | | //p.pwin.OnTreeSelChanged(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | alert("保存出错!"); |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ClearItem(string item) |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(GetControl(item)); |
| | | xc.SetText(""); |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="cb_cancel") |
| | | CloseWindow(); |
| | | else if(comdid=="cb_ok") |
| | | { |
| | | int r=OnSave(); |
| | | if (r==1) |
| | | CloseWindow(); |
| | | } |
| | | else if(comdid=="cb_save") |
| | | { |
| | | OnSave(); |
| | | p.note="新增"; |
| | | win__::SetWindowText(GetHWND(),p.note+"用户"); |
| | | ClearItem("userno"); |
| | | ClearItem("username"); |
| | | ClearItem("pwd"); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | int AppendItem(xml x, KXMLDOMElement r, xstring item) { |
| | | var e = x.createElement(item); |
| | | //xcontrol xc = GetControl(item); |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(item)); |
| | | e.text() = xc.GetText(); |
| | | r.appendChild(e); |
| | | return 1; |
| | | } |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int SetItem(string value,string item){ |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(GetControl(item)); |
| | | xc.SetText(value); |
| | | return 1; |
| | | } |
| | | int onload() |
| | | int OnSave() |
| | | { |
| | | control xc = new control; |
| | | /*xc=GetControl(L"EmployeeNo"); |
| | | if (xc.GetText()==L"") |
| | | { |
| | | alert(L"用户代码不能为空!"); |
| | | return 0; |
| | | }*/ |
| | | xc = GetControl(L"UserName"); |
| | | if (xc.GetText() == L"") |
| | | { |
| | | alert(L"用户名称不能为空!"); |
| | | return 0; |
| | | } |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | x.loadXML(L"<SysUser/>"); |
| | | var r = x.documentElement(); |
| | | xstring guid; |
| | | xstring guid1; |
| | | if (p.note == L"修改") |
| | | { |
| | | KXMLDOMElement ele = xdwgrid::GetRowElement(p.row); |
| | | guid = ele.selectSingleNode(L"UserID").text(); |
| | | //guid=ele.getAttribute(L"guid"); |
| | | //if (ele.selectSingleNode(L"empid")) |
| | | // r.appendChild(ele.selectSingleNode(L"empid")); |
| | | } |
| | | else |
| | | guid = GetGuid(); |
| | | //guid1=win32::GetGuid(); |
| | | r.setAttribute(L"guid", guid); |
| | | //r.setAttribute(L"guid1",guid1); |
| | | //AppendItem(x,r,L"EmployeeNo"); |
| | | AppendItem(x, r, L"UserName"); |
| | | AppendItem(x, r, L"PassWord"); |
| | | AppendItem(x, r, L"Status"); |
| | | //trace(x.xml()); |
| | | //return 1; |
| | | arg.AddArg(L"content", x.xml()); |
| | | int ls_item = treeview::GetSelectedItem(p.wid); |
| | | KXMLDOMElement e = treeview::GetItemData(p.wid, ls_item); |
| | | xstring gpguid = e.selectSingleNode(L"@guid").text(); |
| | | arg.AddArg(L"gpguid", gpguid); |
| | | if (xaserver::ExecXAction(GetServerUrl(), L"[update.User.xa]", arg.GetString()) == 1) |
| | | { |
| | | alert(L"ok"); |
| | | if (p.note == L"修改") |
| | | { |
| | | OnInitial(); |
| | | p = new pa; |
| | | |
| | | if(this.GetParam()) |
| | | { |
| | | p=GetParam(); |
| | | win__::SetWindowText(GetHWND(),p.note+"用户"); |
| | | if (p.note=="修改") |
| | | { |
| | | xdwgrid__ dw = new xdwgrid__; |
| | | dw.setNativePointer(p.dw); |
| | | msxml::IXMLDOMElement ele=dw.GetRowElement(p.row); |
| | | //if(ele.selectSingleNode("EmployeeNo")) |
| | | //SetItem(ele.selectSingleNode("EmployeeNo").text,"EmployeeNo"); |
| | | if(ele.selectSingleNode("UserName")) |
| | | SetItem(ele.selectSingleNode("UserName").text,"UserName"); |
| | | if(ele.selectSingleNode("PassWord")) |
| | | SetItem(ele.selectSingleNode("PassWord").text,"PassWord"); |
| | | if(ele.selectSingleNode("Status")) |
| | | SetItem(ele.selectSingleNode("Status").text,"Status"); |
| | | trace("Aa"); |
| | | return 1; |
| | | } |
| | | } |
| | | xdwgrid dw = new xdwgrid; |
| | | //dw.setNativePointer(p.dw_user); |
| | | int row = dw.GetNextSelectRow(0); |
| | | //dw.SetItemString(row,L"UserName",L""); |
| | | KXMLDOMElement e; |
| | | e = x.documentElement(); |
| | | xstring ls_pass = e.selectSingleNode(L"PassWord").text(); |
| | | xstring ls_status = e.selectSingleNode(L"Status").text(); |
| | | dw.SetItemString(row, L"PassWord", ls_pass); |
| | | dw.SetItemString(row, L"Status", ls_status); |
| | | dw.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | //---------- |
| | | //p.pwin.OnTreeSelChanged(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | alert(L"保存出错!"); |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ClearItem(xstring item) |
| | | { |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(item)); |
| | | xc.SetText(L""); |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"cb_cancel") |
| | | CloseWindow(); |
| | | else if (comdid == L"cb_ok") |
| | | { |
| | | int r = OnSave(); |
| | | if (r == 1) |
| | | CloseWindow(); |
| | | } |
| | | else if (comdid == L"cb_save") |
| | | { |
| | | OnSave(); |
| | | p.note = L"新增"; |
| | | SetWindowText(GetHWND(), p.note + L"用户"); |
| | | ClearItem(L"userno"); |
| | | ClearItem(L"username"); |
| | | ClearItem(L"pwd"); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&AddUser::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&AddUser::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int SetItem(xstring value, xstring item) { |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(item)); |
| | | xc.SetText(value); |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | SetArg(); |
| | | OnInitial(); |
| | | p = new pa; |
| | | |
| | | if (GetWinParam()) |
| | | { |
| | | p = GetArg(); |
| | | SetWindowText(GetHWND(), p.note + L"用户"); |
| | | if (p.note == L"修改") |
| | | { |
| | | xdwgrid dw = new xdwgrid; |
| | | dw.setNativePointer(p.dw); |
| | | KXMLDOMElement ele = dw.GetRowElement(p.row); |
| | | //if(ele.selectSingleNode(L"EmployeeNo")) |
| | | //SetItem(ele.selectSingleNode(L"EmployeeNo").text(),L"EmployeeNo"); |
| | | if (ele.selectSingleNode(L"UserName")) |
| | | SetItem(ele.selectSingleNode(L"UserName").text(), L"UserName"); |
| | | if (ele.selectSingleNode(L"PassWord")) |
| | | SetItem(ele.selectSingleNode(L"PassWord").text(), L"PassWord"); |
| | | if (ele.selectSingleNode(L"Status")) |
| | | SetItem(ele.selectSingleNode(L"Status").text(), L"Status"); |
| | | trace(L"Aa"); |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | } |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | 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]" |
| | | use "dev:code[pa.tpp]" |
| | | use "dev:vm[control.vm]" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | unit vbusiness.xpage tpp |
| | | [ |
| | | class pa |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) AddUserGroup : public xwin |
| | | { |
| | | |
| | | public: |
| | | xstring note; |
| | | int hitem; |
| | | int row; |
| | | int wid; |
| | | xtreeview tv; |
| | | xdwgrid dw; |
| | | xwin pwin; |
| | | |
| | | public: |
| | | AddUserGroup(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static AddUserGroup* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | string note; |
| | | int hitem; |
| | | int row; |
| | | int wid; |
| | | treeview__ tv; |
| | | xdwgrid__ dw; |
| | | win__ pwin; |
| | | AddUserGroup* pWin = new AddUserGroup(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | ] |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | int SetAgent() |
| | | { |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | int SetAgent(); |
| | | |
| | | AddUserGroup is extend win__; |
| | | about AddUserGroup |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | pa p; |
| | | |
| | | int SetAgent() |
| | | { |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | { |
| | | int SetAgent(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | int AppendItem(xml x, KXMLDOMElement r, xstring item) { |
| | | var e = x.createElement(item); |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(item)); |
| | | e.text() = xc.GetText(); |
| | | r.appendChild(e); |
| | | return 1; |
| | | } |
| | | int AppendAttrib(xml x, KXMLDOMElement r, xstring item) { |
| | | var e = x.createElement(item); |
| | | //xcontrol xc = GetControl(item); |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(item)); |
| | | e.text() = xc.GetText(); |
| | | r.setAttribute(item, xc.GetText()); |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"cb_cancel") |
| | | CloseWindow(); |
| | | else if (comdid == L"cb_ok") |
| | | { |
| | | int wid = p.wid; |
| | | xml x; |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | int AppendItem(xml__ x,msxml::IXMLDOMElement r,string item){ |
| | | var e = x.GetXmlDoc().createElement(item); |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl(item)); |
| | | e.text = xc.GetText(); |
| | | r.appendChild(e); |
| | | return 1; |
| | | } |
| | | int AppendAttrib(xml__ x,msxml::IXMLDOMElement r,string item){ |
| | | var e = x.GetXmlDoc().createElement(item); |
| | | //xcontrol xc = GetControl(item); |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl(item)); |
| | | e.text = xc.GetText(); |
| | | r.setAttribute(item,xc.GetText()); |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | xaserverarg arg; |
| | | |
| | | x.loadXML(L"<row/>"); |
| | | var r = x.documentElement(); |
| | | xstring gpguid; |
| | | if (p.note == L"修改") |
| | | { |
| | | if (comdid=="cb_cancel") |
| | | CloseWindow(); |
| | | else if(comdid=="cb_ok") |
| | | KXMLDOMElement ele = treeview::GetItemData(wid, p.hitem); |
| | | gpguid = ele.selectSingleNode(L"@JobID").text(); |
| | | } |
| | | else |
| | | gpguid = GetGuid(); |
| | | r.setAttribute(L"JobID", gpguid); |
| | | AppendAttrib(x, r, L"JobName"); |
| | | AppendAttrib(x, r, L"JobType"); |
| | | //AppendItem(x,r,L"JobName"); |
| | | //AppendItem(x,r,L"JobType"); |
| | | //trace(x.xml()); |
| | | //return 1; |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (xaserver::ExecXAction(GetServerUrl(), L"[update.Usergroup.xa]", arg.GetString()) == 1) |
| | | { |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(L"JobName")); |
| | | //p.tv.Redraw(); |
| | | if (p.note == L"修改") |
| | | { |
| | | int wid = p.wid; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | x.LoadXml("<row/>"); |
| | | var r = x.GetXmlDoc().documentElement; |
| | | string gpguid; |
| | | if (p.note=="修改") |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid,p.hitem); |
| | | gpguid=ele.selectSingleNode("@JobID").text; |
| | | } |
| | | else |
| | | gpguid=win__::GetGuid(); |
| | | r.setAttribute("JobID",gpguid); |
| | | AppendAttrib(x,r,"JobName"); |
| | | AppendAttrib(x,r,"JobType"); |
| | | //AppendItem(x,r,"JobName"); |
| | | //AppendItem(x,r,"JobType"); |
| | | //trace(x.GetXml()); |
| | | //return 1; |
| | | arg.AddArg("content",x.GetXml()); |
| | | if (xaserver__::ExecXAction(GetServerUrl(),"[update.Usergroup.xa]",arg.GetString())==1) |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("JobName")); |
| | | //p.tv.Redraw(); |
| | | if (p.note=="修改") |
| | | { |
| | | treeview__::SetItemData(wid,p.hitem,r); |
| | | treeview__::SetItemLabel(wid,p.hitem,xc.GetText()); |
| | | } |
| | | else |
| | | { |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::InsertChildItem(wid,root,xc.GetText(),r,15); |
| | | } |
| | | CloseWindow(); |
| | | } |
| | | else |
| | | { |
| | | alert("保存出错!"); |
| | | } |
| | | treeview::SetItemData(wid, p.hitem, r); |
| | | treeview::SetItemLabel(wid, p.hitem, xc.GetText()); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int SetItem(string value,string item){ |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(GetControl(item)); |
| | | xc.SetText(value); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | OnInitial(); |
| | | p = new pa; |
| | | |
| | | if(this.GetParam()) |
| | | else |
| | | { |
| | | p=GetParam(); |
| | | win__::SetWindowText(GetHWND(),p.note+"用户组"); |
| | | if (p.note=="修改") |
| | | { |
| | | int wid = p.wid; |
| | | msxml::IXMLDOMElement ele=treeview__::GetItemData(wid,p.hitem); |
| | | //trace(ele.xml); |
| | | //SetItem(ele.selectSingleNode("gpno").text,"gpno"); |
| | | //SetItem(ele.selectSingleNode("gpname").text,"gpname"); |
| | | string ls_guid = ele.selectSingleNode("@JobID").text; |
| | | string ls_name = ele.selectSingleNode("@JobName").text; |
| | | string ls_type = ele.selectSingleNode("@JobType").text; |
| | | SetItem(ls_guid,"JobID"); |
| | | SetItem(ls_name,"JobName"); |
| | | SetItem(ls_type,"JobType"); |
| | | } |
| | | int root = treeview::GetRootItem(wid); |
| | | treeview::InsertChildItem(wid, root, xc.GetText(), r, 15); |
| | | } |
| | | |
| | | return 1; |
| | | CloseWindow(); |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | else |
| | | { |
| | | alert(L"保存出错!"); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&AddUserGroup::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&AddUserGroup::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int SetItem(xstring value, xstring item) { |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(item)); |
| | | xc.SetText(value); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | OnInitial(); |
| | | p = new pa; |
| | | |
| | | if (GetWinParam()) |
| | | { |
| | | p = GetArg(); |
| | | SetWindowText(GetHWND(), p.note + L"用户组"); |
| | | if (p.note == L"修改") |
| | | { |
| | | int wid = p.wid; |
| | | KXMLDOMElement ele = treeview::GetItemData(wid, p.hitem); |
| | | //trace(ele.xml); |
| | | //SetItem(ele.selectSingleNode(L"gpno").text(),L"gpno"); |
| | | //SetItem(ele.selectSingleNode(L"gpname").text(),L"gpname"); |
| | | xstring ls_guid = ele.selectSingleNode(L"@JobID").text(); |
| | | xstring ls_name = ele.selectSingleNode(L"@JobName").text(); |
| | | xstring ls_type = ele.selectSingleNode(L"@JobType").text(); |
| | | SetItem(ls_guid, L"JobID"); |
| | | SetItem(ls_name, L"JobName"); |
| | | SetItem(ls_type, L"JobType"); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | use"lang.vl" |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | unit vbusiness.vpage |
| | | [ |
| | | BindComputerDlgNew is extend win__; |
| | | about BindComputerDlgNew |
| | | [ |
| | | field: |
| | | |
| | | method: |
| | | [ |
| | | xdwgrid__ dw_list; |
| | | int OnRetrieve() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) BindComputerDlgNew : public xwin |
| | | { |
| | | |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = this.GetParam(); |
| | | if(arg.GetArgString("BindComputer")) |
| | | { |
| | | string sbys= arg.GetArgString("BindComputer"); |
| | | //alert(sbys); |
| | | x.LoadXml(sbys); |
| | | |
| | | } |
| | | else |
| | | { |
| | | public: |
| | | |
| | | x.LoadXml("<args></args>"); |
| | | } |
| | | xdwgrid dw_list; |
| | | public: |
| | | BindComputerDlgNew(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static BindComputerDlgNew* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | BindComputerDlgNew* pWin = new BindComputerDlgNew(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | dw_list.Retrieve(x.GetXmlDoc().selectSingleNode("args")); |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int OnAddRow(xdwgrid__ dw) |
| | | { |
| | | dw.InsertRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDelRow(xdwgrid__ dw) |
| | | { |
| | | int row = dw.GetRow(); |
| | | if(row<1 || row > dw.GetRowCount()) return -1; |
| | | dw.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | dw_list.AcceptText(); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = win__::GetParam(); |
| | | arg.AddArg("comdid",comdid); |
| | | if (comdid=="ok") |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_list.DwUpdateAllTo(x.GetXmlDoc()); |
| | | arg.AddArg("xml",x.GetXml()); |
| | | CloseWindow(); |
| | | } |
| | | else if(comdid=="close") |
| | | CloseWindow(); |
| | | else if(comdid == "add") |
| | | OnAddRow(dw_list); |
| | | else if(comdid == "del") |
| | | OnDelRow(dw_list); |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | } |
| | | int onload() |
| | | { |
| | | OnAttachEvent(); |
| | | |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(GetControl("dw_list")); |
| | | dw_list.SetDataObject(GetServerUrl(),"dev:sheet[SysUser.tpl/BindComputer]"); |
| | | dw_list.SetReadOnly(true); |
| | | if(this.GetParam()) |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg = GetArg(); |
| | | if (arg.GetArgString(L"BindComputer")) |
| | | { |
| | | xstring sbys = arg.GetArgString(L"BindComputer"); |
| | | //alert(sbys); |
| | | x.loadXML(sbys); |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | x.loadXML(L"<args></args>"); |
| | | } |
| | | |
| | | dw_list.Retrieve(x.selectSingleNode(L"args")); |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int OnAddRow(xdwgrid dw) |
| | | { |
| | | dw.InsertRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDelRow(xdwgrid dw) |
| | | { |
| | | int row = dw.GetRow(); |
| | | if (row<1 || row > dw.GetRowCount()) return -1; |
| | | dw.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | dw_list.AcceptText(); |
| | | xaserverarg arg; |
| | | |
| | | arg = GetArg(); |
| | | arg.AddArg(L"comdid", comdid); |
| | | if (comdid == L"ok") |
| | | { |
| | | xml x; |
| | | |
| | | dw_list.DwUpdateAllTo(x); |
| | | arg.AddArg(L"xml", x.xml()); |
| | | CloseWindow(); |
| | | } |
| | | else if (comdid == L"close") |
| | | CloseWindow(); |
| | | else if (comdid == L"add") |
| | | OnAddRow(dw_list); |
| | | else if (comdid == L"del") |
| | | OnDelRow(dw_list); |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&BindComputerDlgNew::OnXCommand); |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | SetArg(); |
| | | OnAttachEvent(); |
| | | |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.SetDataObject(GetServerUrl(), L"dev:sheet[SysUser.tpl/BindComputer]"); |
| | | dw_list.SetReadOnly(true); |
| | | if (GetWinParam()) |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | use "lang.vl" |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xutil.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[combobox.vm]" |
| | | use "frame.vl" |
| | | use "file.vl" |
| | | use "dev:vm[xlayersheet.vm]" |
| | | use "publiccode.vl" |
| | | #include <wobject/xstring.hpp> |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | unit vbusiness.vpage |
| | | [ |
| | | DataConfig is extend frame; |
| | | about DataConfig |
| | | [ |
| | | field: |
| | | |
| | | method: |
| | | [ |
| | | treeview__ dw_tree; |
| | | xdwgrid__ dw_list; |
| | | xdwgrid__ dw_role; |
| | | combobox__ dw_ddlb; |
| | | xlayersheet__ m_sheet; |
| | | |
| | | int alert(string str) |
| | | { |
| | | TApp::alert(this,str,3); |
| | | return 0; |
| | | } |
| | | int createTree(msxml::IXMLDOMElement e, int parentItem) |
| | | { |
| | | if(treeview__::GetChildItem(dw_tree.GetId(), parentItem) > 0) return 0; |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | var list=e.selectNodes("item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(s - i - 1); |
| | | string Name=xitem.selectSingleNode("name").text; |
| | | string image = xitem.selectSingleNode("image").text; |
| | | int curItem=treeview__::InsertItem(dw_tree.GetId(), parentItem,0,Name,xitem,image.toInt()); |
| | | string child=xitem.selectSingleNode("child").text; |
| | | if (child != "0") |
| | | treeview__::SetItemChild1(dw_tree.GetId(), curItem,1); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeExpanding(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | |
| | | int i = combobox__::GetCurSel(dw_ddlb.GetId()); |
| | | msxml::IXMLDOMElement e = treeview__::GetItemData(dw_tree.GetId(), sitem); |
| | | string id = e.selectSingleNode("id").text; |
| | | string xid = e.selectSingleNode("tree").text; |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("pid",id); |
| | | arg.AddArg("tree",xid); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[selectRoleInt.xq]",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/user/select",arg.GetString(),x)!=1) |
| | | { |
| | | trace("错误返回="+x.GetXml()); |
| | | return -1; |
| | | } |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) DataConfig : public xframe |
| | | { |
| | | |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; |
| | | createTree(ele, sitem); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string id) |
| | | { |
| | | int hIcon= xutil__::SetCursorWait(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id",id); |
| | | trace(id); |
| | | arg.AddArg("flag","-1"); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[selectRoleInt.xq]",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/maint/data",arg.GetString(),x)!=1) |
| | | { |
| | | trace("错误返回1="+x.GetXml()); |
| | | return -1; |
| | | } |
| | | public: |
| | | xtreeview dw_tree; |
| | | xdwgrid dw_list; |
| | | xdwgrid dw_role; |
| | | combobox dw_ddlb; |
| | | xlayersheet m_sheet; |
| | | public: |
| | | DataConfig(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static DataConfig* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | DataConfig* pWin = new DataConfig(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int alert(xstring str) |
| | | { |
| | | TApp::alert(this, str, 3); |
| | | return 0; |
| | | } |
| | | int createTree(KXMLDOMElement e, HTREEITEM parentItem) |
| | | { |
| | | if (dw_tree.GetChildItem(parentItem) > 0) return 0; |
| | | |
| | | if(x.GetXml() == "") |
| | | x.LoadXml("<root><items/><roles/></root>"); |
| | | |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(xml__ ::CreateInstance()); |
| | | if(x.GetXmlDoc().selectSingleNode("root/items")) |
| | | { |
| | | dw_list.Retrieve(x.GetXmlDoc().selectSingleNode("root/items")); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | x1.LoadXml("<items/>"); |
| | | dw_list.Retrieve(x1); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.Redraw(); |
| | | } |
| | | if(x.GetXmlDoc().selectSingleNode("root/roles")) |
| | | { |
| | | dw_role.Retrieve(x.GetXmlDoc().selectSingleNode("root/roles")); |
| | | dw_role.SetReadOnly(true); |
| | | dw_role.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | x1.LoadXml("<roles/>"); |
| | | dw_role.Retrieve(x1); |
| | | dw_role.SetReadOnly(true); |
| | | dw_role.Redraw(); |
| | | } |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | var list = e.selectNodes(L"item"); |
| | | int i = 0, s = list.length; |
| | | KXMLDOMElement xitem; |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | xitem = list.item(s - i - 1); |
| | | xstring Name = xitem.selectSingleNode(L"name").text(); |
| | | xstring image = xitem.selectSingleNode(L"image").text(); |
| | | HTREEITEM curItem = dw_tree.InsertItem(parentItem, 0, Name, xitem, image.toInt()); |
| | | xstring child = xitem.selectSingleNode(L"child").text(); |
| | | if (child != L"0") |
| | | dw_tree.SetItemChild1(curItem, 1); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelecded( ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | int wid = dw_tree.GetId(); |
| | | msxml::IXMLDOMElement ele =treeview__::GetItemData(wid,hItem); |
| | | |
| | | string id = ele.SelectSingleNode("id").text; |
| | | OnRetrieve(id); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSelect() |
| | | { |
| | | int nIndex = combobox__::GetCurSel(dw_ddlb.GetId()); |
| | | int OnTreeExpanding(TEvent* evt, LPARAM p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | |
| | | combobox__ dw_ddlbdata = new combobox__; |
| | | dw_ddlbdata.setNativePointer(this.GetControl("dw_ddlbdata")); |
| | | int h = combobox__::FindString(dw_ddlbdata.GetId(), nIndex.toString()); |
| | | param p; |
| | | xnode__ bnode; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode("tree")); |
| | | if(h < 0) |
| | | { |
| | | string str = "<vbox><xtree name='dw_tree"+nIndex.toString()+"' imagelist='0'/></vbox>"; |
| | | bnode = new xnode__; |
| | | bnode.setNativePointer(SetAgentNodeContent(anode,str)); |
| | | |
| | | p = combobox__::GetItemData(dw_ddlb.GetId(), nIndex); |
| | | msxml::IXMLDOMElement ele = p; |
| | | |
| | | dw_tree = new treeview__; |
| | | dw_tree.setNativePointer(this.GetControl("dw_tree"+nIndex.toString())); |
| | | |
| | | createTree(ele, 0); |
| | | AttachEvent("dw_tree"+nIndex.toString(), "TVN_ITEMEXPANDING",OnTreeExpanding); |
| | | AttachEvent("dw_tree"+nIndex.toString(), "TVN_SELCHANGED",OnTreeSelecded); |
| | | |
| | | int sk = combobox__::AddItem(dw_ddlbdata.GetId(), nIndex.toString()); |
| | | p = bnode; |
| | | combobox__::SetItemData(dw_ddlbdata.GetId(), sk, p); |
| | | } |
| | | else |
| | | { |
| | | p = combobox__::GetItemData(dw_ddlbdata.GetId(), h); |
| | | bnode = p; |
| | | SetAgentNodeContent(anode,bnode); |
| | | |
| | | dw_tree = new treeview__; |
| | | dw_tree.setNativePointer(this.GetControl("dw_tree"+nIndex.toString())); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | int m = treeview__::GetSelectedItem(dw_tree.GetId()); |
| | | if(m == 0) return 0; |
| | | |
| | | int wid = dw_tree.GetId(); |
| | | int hItem=treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele =treeview__::GetItemData(wid,hItem); |
| | | string id = ele.SelectSingleNode("id").text; |
| | | string tpy = ele.SelectSingleNode("type").text; |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | e.SetAttribute("id", id); |
| | | e.SetAttribute("type", tpy); |
| | | |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_role.DwUpdateAllToEx(x1.GetXmlDoc()); |
| | | msxml::IXMLDOMElement e1 = x1.GetXmlDoc().documentElement; |
| | | e.AppendChild(e1); |
| | | |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content", e.xml); |
| | | arg.AddArg("dbmap", "Data.config.dbmap"); |
| | | //if(xaserver__::ExecXAction(GetServerUrl(),"[onSave.xa]",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/save",arg.GetString(),x)!=1) |
| | | //if(url::get("/workflow/action/datarole.resource/bill.update",arg.GetString(),x)!=1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("保存出错!"); |
| | | return 0; |
| | | } |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("保存出错2!"); |
| | | return 0; |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_role.ResetUpdateStatus(); |
| | | alert("保存成功!"); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSelectDdlb(ref TNotifyEvent evt,int p) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | if(e) |
| | | { |
| | | var list = e.SelectNodes("//*[@update.new='1' or @update.modify='1' or @update.delete='1']"); |
| | | int s = list.length; |
| | | if(s>0) |
| | | { |
| | | int ret = win__::MessageBox(this.GetHWND(), "当前修改记录未保存,是否保存?","提示",4); |
| | | if(ret == 6) |
| | | OnSave(); |
| | | } |
| | | } |
| | | |
| | | OnSelect(); |
| | | HTREEITEM sitem = nmtv.itemNew.hItem; |
| | | |
| | | int m = treeview__::GetSelectedItem(dw_tree.GetId()); |
| | | string id; |
| | | if(m == 0) |
| | | { |
| | | id = ""; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele =treeview__::GetItemData(dw_tree.GetId(),m); |
| | | id = ele.SelectSingleNode("id").text; |
| | | } |
| | | OnRetrieve(id); |
| | | int i = dw_ddlb.GetCurSel(); |
| | | KXMLDOMElement e = dw_tree.GetItemData(sitem); |
| | | xstring id = e.selectSingleNode(L"id").text(); |
| | | xstring xid = e.selectSingleNode(L"tree").text(); |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | xml x; |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int createTreeRoot() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("pid",""); |
| | | arg.AddArg("tree","0"); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[selectRoleInt.xq]",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/user/select",arg.GetString(),x)!=1) |
| | | { |
| | | trace("错误返回="+x.GetXml()); |
| | | return -1; |
| | | } |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | var list = e.SelectNodes("*"); |
| | | int i; |
| | | int len = list.length; |
| | | msxml::IXMLDOMElement ele; |
| | | for(i=0; i<len; i++) |
| | | { |
| | | ele= list.item(i); |
| | | string name = ele.selectSingleNode("@tree").text; |
| | | int sk = combobox__::AddItem(dw_ddlb.GetId(), name); |
| | | param p = ele; |
| | | combobox__::SetItemData(dw_ddlb.GetId(), sk, p); |
| | | } |
| | | if(len > 0) |
| | | { |
| | | combobox__::SetCurSel(dw_ddlb.GetId(), 0); |
| | | OnSelect(); |
| | | } |
| | | OnRetrieve(""); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | { |
| | | SetAgent("data"); |
| | | return 1; |
| | | } |
| | | |
| | | string GetPath() |
| | | { |
| | | int h = treeview__::GetSelectedItem(dw_tree.GetId()); |
| | | if(h == 0) return 0; |
| | | |
| | | int tv = dw_tree.GetId(); |
| | | string str = treeview__::GetItemLabel(tv, h); |
| | | int k = treeview__::GetParentItem(tv, h); |
| | | while(k > 0) |
| | | { |
| | | string tmp = treeview__::GetItemLabel(tv, k); |
| | | str = tmp+"\\" + str; |
| | | k = treeview__::GetParentItem(tv, k); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | int OnAddRole() |
| | | { |
| | | int m = treeview__::GetSelectedItem(dw_tree.GetId()); |
| | | if(m == 0) return -1; |
| | | msxml::IXMLDOMElement ele =treeview__::GetItemData(dw_tree.GetId(),m); |
| | | string tpy=""+ele.selectSingleNode("type").text; |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("dataUrl","/sale/data/Role.config/pref/model/select"); |
| | | openUrl("/sale/view/Role.config/xpage/role/select/user", arg); |
| | | string str = arg.GetArgString("item"); |
| | | if(str == "") return -1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | x.LoadXml(str); |
| | | var list=x.GetXmlDoc().selectNodes("items/item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | int row = dw_role.GetRowCount() + 1; |
| | | string treepath = GetPath(); |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(i); |
| | | string id = ""+xitem.selectSingleNode("@id").text; |
| | | string name=""+xitem.selectSingleNode("@name").text; |
| | | //string tpy=""+xitem.selectSingleNode("@type").text; |
| | | dw_role.InsertRow(0); |
| | | dw_role.SetItemString(row + i, "id", id); |
| | | dw_role.SetItemString(row + i, "name", ""+treepath); |
| | | dw_role.SetItemDisplayString(row + i, "name", name); |
| | | dw_role.SetItemString(row + i, "type", tpy); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | int m = treeview__::GetSelectedItem(dw_tree.GetId()); |
| | | if(m == 0) return 0; |
| | | |
| | | int k = m_sheet.GetSheetIndex(); |
| | | if(k == 0) |
| | | //openUrl("/sale/view/role.config/xpage/data/select/resource", dw_list); |
| | | OpenWindow("dev:xpage[Resource.select.data.config.vx]", dw_list); |
| | | else |
| | | OnAddRole(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnDelRow() |
| | | { |
| | | int k = m_sheet.GetSheetIndex(); |
| | | int row; |
| | | string hr_type; |
| | | msxml::IXMLDOMElement e; |
| | | if(k == 0) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if(row<1 || row > dw_list.GetRowCount()) return -1; |
| | | e = dw_list.GetRowElement(row); |
| | | if(e.selectSingleNode("fromparent")) |
| | | { |
| | | hr_type = e.selectSingleNode("fromparent").text; |
| | | if(hr_type != "") |
| | | { |
| | | alert("继承的权限无权删除!"); |
| | | return 0; |
| | | } |
| | | } |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | else |
| | | { |
| | | row = dw_role.GetRow(); |
| | | if(row<1 || row > dw_role.GetRowCount()) return -1; |
| | | e = dw_role.GetRowElement(row); |
| | | if(e.selectSingleNode("fromparent")) |
| | | { |
| | | hr_type = e.selectSingleNode("fromparent").text; |
| | | if(hr_type != "") |
| | | { |
| | | alert("继承的权限无权删除!"); |
| | | return 0; |
| | | } |
| | | } |
| | | dw_role.DeleteRow(row); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetCopy(xdwgrid__ dw, msxml::IXMLDOMElement e, string name) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | msxml::IXMLDOMElement ele; |
| | | bool f = false; |
| | | |
| | | int count = dw.GetRowCount(); |
| | | if(count == 0) |
| | | { |
| | | x.LoadXml("<" + name + "s/>"); |
| | | ele = x.GetXmlDoc().documentElement; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement e1 = dw.GetRowElement(1); |
| | | ele = e1.parentNode; |
| | | } |
| | | var li = e.SelectNodes(name); |
| | | int i; |
| | | int len = li.length; |
| | | string treepath = GetPath(); |
| | | for(i=0; i<len; i++) |
| | | { |
| | | msxml::IXMLDOMElement ele1= li.item(i); |
| | | if(ele1.selectSingleNode("fromparent")) |
| | | { |
| | | string str = ele1.selectSingleNode("fromparent").text; |
| | | if(str != "") continue; |
| | | } |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(xml__::CreateInstance()); |
| | | x1.LoadXml(ele1.xml); |
| | | msxml::IXMLDOMElement ele2 = x1.GetXmlDoc().documentElement; |
| | | ele2.setAttribute("update.new","1"); |
| | | ele2.setAttribute("update.modify","1"); |
| | | ele2.setAttribute("guid",publiccode::GetGuid()); |
| | | if(ele2.selectSingleNode("name")) |
| | | ele2.selectSingleNode("name").text = treepath; |
| | | //ele1.selectSingleNode("@guid").text = publiccode::GetGuid(); |
| | | //ele1.selectSingleNode("@update.new").text = "1"; |
| | | //ele1.selectSingleNode("@update.modify").text = "1"; |
| | | ele.appendChild(ele2); |
| | | } |
| | | dw.Retrieve(ele); |
| | | dw.SetReadOnly(true); |
| | | dw.Redraw(); |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"pid", id); |
| | | arg.AddArg(L"tree", xid); |
| | | //if(xaserver::ExecXQuery(GetServerUrl(),L"[selectRoleInt.xq]",arg.GetString(),x)!=1) |
| | | if (xurl::get(L"/sale/data/Role.config/pref/user/select", arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"错误返回=L" + (xstring)x.xml()); |
| | | return -1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnCopy() |
| | | { |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | int p = arg.__nativept; |
| | | OpenWindow("dev:xpage[Data.config.copy.vx]", p); |
| | | string id = arg.GetArgString("id"); |
| | | string f = arg.GetArgString("flag"); |
| | | if(id == "") return 1; |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | if(url::get("/sale/data/Role.config/pref/maint/data",arg.GetString(),x)!=1) |
| | | { |
| | | trace("错误返回="+x.GetXml()); |
| | | return -1; |
| | | } |
| | | KXMLDOMElement ele = x.documentElement(); |
| | | createTree(ele, sitem); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | if(x.GetXml() == "") |
| | | x.LoadXml("<root><items/><roles/></root>"); |
| | | |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | |
| | | if(f == "0" || f == "1") |
| | | { |
| | | msxml::IXMLDOMElement ele1 = e.selectSingleNode("items"); |
| | | OnSetCopy(dw_list, ele1, "item"); |
| | | } |
| | | |
| | | if(f == "0" || f == "2") |
| | | { |
| | | msxml::IXMLDOMElement ele2 = e.selectSingleNode("roles") |
| | | OnSetCopy(dw_role, ele2, "role"); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | int OnRetrieve(xstring id) |
| | | { |
| | | HCURSOR hIcon = xutil::SetCursorWait(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"id", id); |
| | | trace(id); |
| | | arg.AddArg(L"flag", L"-1"); |
| | | //if(xaserver::ExecXQuery(GetServerUrl(),L"[selectRoleInt.xq]",arg.GetString(),x)!=1) |
| | | if (xurl::get(L"/sale/data/Role.config/pref/maint/data", arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"错误返回1=L" + (xstring)x.xml()); |
| | | return -1; |
| | | } |
| | | |
| | | if (x.xml() == L"") |
| | | x.loadXML(L"<root><items/><roles/></root>"); |
| | | |
| | | xml x1; |
| | | |
| | | if (x.selectSingleNode(L"root/items")) |
| | | { |
| | | dw_list.Retrieve(x.selectSingleNode(L"root/items")); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | x1.loadXML(L"<items/>"); |
| | | dw_list.Retrieve(x1); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.Redraw(); |
| | | } |
| | | if (x.selectSingleNode(L"root/roles")) |
| | | { |
| | | dw_role.Retrieve(x.selectSingleNode(L"root/roles")); |
| | | dw_role.SetReadOnly(true); |
| | | dw_role.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | x1.loadXML(L"<roles/>"); |
| | | dw_role.Retrieve(x1); |
| | | dw_role.SetReadOnly(true); |
| | | dw_role.Redraw(); |
| | | } |
| | | xutil::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelecded(TEvent* evt, LPARAM p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | //int wid = dw_tree.GetId(); |
| | | KXMLDOMElement ele = dw_tree.GetItemData(hItem); |
| | | |
| | | xstring id = ele.selectSingleNode(L"id").text(); |
| | | OnRetrieve(id); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSelect() |
| | | { |
| | | int nIndex = dw_ddlb.GetCurSel(); |
| | | |
| | | combobox dw_ddlbdata = new combobox; |
| | | dw_ddlbdata.setNativePointer(GetControl(L"dw_ddlbdata")); |
| | | int h = combobox::FindString(dw_ddlbdata.GetId(), xstring(nIndex)); |
| | | param p; |
| | | xnode bnode; |
| | | xnode anode = new xnode; |
| | | anode.setNativePointer(GetAgentNode(L"tree")); |
| | | if (h < 0) |
| | | { |
| | | xstring str = L"<vbox><xtree name='dw_tree" + xstring(nIndex) + L"' imagelist='0'/></vbox>"; |
| | | bnode = new xnode; |
| | | bnode.setNativePointer(SetAgentNodeContent(anode, str)); |
| | | |
| | | p = combobox::GetItemData(dw_ddlb.GetId(), nIndex); |
| | | KXMLDOMElement ele = p; |
| | | |
| | | dw_tree = new treeview; |
| | | dw_tree.setNativePointer(GetControl(L"dw_tree" + xstring(nIndex))); |
| | | |
| | | createTree(ele, 0); |
| | | AttachEvent(L"dw_tree" + xstring(nIndex), L"TVN_ITEMEXPANDING", (FEvent)&DataConfig::OnTreeExpanding); |
| | | AttachEvent(L"dw_tree" + xstring(nIndex), L"TVN_SELCHANGED", (FEvent)&DataConfig::OnTreeSelecded); |
| | | |
| | | int sk = combobox::AddItem(dw_ddlbdata.GetId(), xstring(nIndex)); |
| | | p = bnode; |
| | | combobox::SetItemData(dw_ddlbdata.GetId(), sk, p); |
| | | } |
| | | else |
| | | { |
| | | p = combobox::GetItemData(dw_ddlbdata.GetId(), h); |
| | | bnode = p; |
| | | SetAgentNodeContent(anode, bnode); |
| | | |
| | | dw_tree = new treeview; |
| | | dw_tree.setNativePointer(GetControl(L"dw_tree" + xstring(nIndex))); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | HTREEITEM m = dw_tree.GetSelectedItem(); |
| | | if (m == 0) return 0; |
| | | |
| | | //int wid = dw_tree.GetId(); |
| | | HTREEITEM hItem = dw_tree.GetSelectedItem(); |
| | | KXMLDOMElement ele = dw_tree.GetItemData(hItem); |
| | | xstring id = ele.selectSingleNode(L"id").text(); |
| | | xstring tpy = ele.selectSingleNode(L"type").text(); |
| | | |
| | | xml x; |
| | | |
| | | dw_list.DwUpdateAllToEx(x); |
| | | KXMLDOMElement e = x.documentElement(); |
| | | e.setAttribute(L"id", id); |
| | | e.setAttribute(L"type", tpy); |
| | | |
| | | xml x1; |
| | | |
| | | dw_role.DwUpdateAllToEx(x1); |
| | | KXMLDOMElement e1 = x1.documentElement(); |
| | | e.appendChild(e1); |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", e.xml()); |
| | | arg.AddArg(L"dbmap", L"Data.config.dbmap"); |
| | | //if(xaserver::ExecXAction(GetServerUrl(),L"[onSave.xa]",arg.GetString(),x)!=1) |
| | | if (xurl::get(L"/sale/data/Role.config/pref/save", arg.GetString(), x) != 1) |
| | | //if(xurl::get(L"/workflow/action/datarole.resource/bill.update",arg.GetString(),x)!=1) |
| | | { |
| | | trace(L"error:" + (xstring)x.xml()); |
| | | alert(L"保存出错!"); |
| | | return 0; |
| | | } |
| | | if (x.selectSingleNode(L"error")) |
| | | { |
| | | alert(L"保存出错2!"); |
| | | return 0; |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_role.ResetUpdateStatus(); |
| | | alert(L"保存成功!"); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSelectDdlb(TEvent* evt, LPARAM p) |
| | | { |
| | | xml x; |
| | | |
| | | dw_list.DwUpdateAllToEx(x); |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (e) |
| | | { |
| | | var list = e.selectNodes(L"//*[@update.new='1' or @update.modify='1' or @update.delete='1']"); |
| | | int s = list.length; |
| | | if (s > 0) |
| | | { |
| | | if(comdid == "Config") |
| | | openUrl("/sale/view/role.config/xpage/data/resource/config"); |
| | | if(comdid == "RightQuery") |
| | | openUrl("/sale/view/role.config/xpage/data/modulerightquery"); |
| | | else if(comdid == "New") |
| | | OnAddRow(); |
| | | else if(comdid == "Del") |
| | | OnDelRow(); |
| | | else if(comdid == "Save") |
| | | int ret = MessageBox(GetHWND(), L"当前修改记录未保存,是否保存?", L"提示", 4); |
| | | if (ret == 6) |
| | | OnSave(); |
| | | else if(comdid == "Copy") |
| | | OnCopy(); |
| | | else if(comdid == "xmProdDivi") |
| | | openUrl("/sale/view/RoleAccount3/xpage/data/proddivi"); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | OnSelect(); |
| | | |
| | | int onload() |
| | | HTREEITEM m = dw_tree.GetSelectedItem(); |
| | | xstring id; |
| | | if (m == 0) |
| | | { |
| | | id = L""; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement ele = dw_tree.GetItemData(m); |
| | | id = ele.selectSingleNode(L"id").text(); |
| | | } |
| | | OnRetrieve(id); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int createTreeRoot() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"pid", L""); |
| | | arg.AddArg(L"tree", L"0"); |
| | | //if(xaserver::ExecXQuery(GetServerUrl(),L"[selectRoleInt.xq]",arg.GetString(),x)!=1) |
| | | if (xurl::get(L"/sale/data/Role.config/pref/user/select", arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"错误返回=L" + (xstring)x.xml()); |
| | | return -1; |
| | | } |
| | | KXMLDOMElement e = x.documentElement(); |
| | | var list = e.selectNodes(L"*"); |
| | | int i; |
| | | int len = list.length; |
| | | KXMLDOMElement ele; |
| | | for (i = 0; i < len; i++) |
| | | { |
| | | ele = list.item(i); |
| | | xstring name = ele.selectSingleNode(L"@tree").text(); |
| | | int sk = combobox::AddItem(dw_ddlb.GetId(), name); |
| | | param p = ele; |
| | | combobox::SetItemData(dw_ddlb.GetId(), sk, p); |
| | | } |
| | | if (len > 0) |
| | | { |
| | | combobox::SetCurSel(dw_ddlb.GetId(), 0); |
| | | OnSelect(); |
| | | } |
| | | OnRetrieve(L""); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | SetAgent(L"data"); |
| | | return 1; |
| | | } |
| | | |
| | | xstring GetPath() |
| | | { |
| | | HTREEITEM h = dw_tree.GetSelectedItem(); |
| | | if (h == 0) return 0; |
| | | |
| | | //int tv = dw_tree.GetId(); |
| | | xstring str = dw_tree.GetItemLabel(h); |
| | | HTREEITEM k = dw_tree.GetParentItem(h); |
| | | while (k > 0) |
| | | { |
| | | xstring tmp = dw_tree.GetItemLabel(k); |
| | | str = tmp + L"\\" + str; |
| | | k = dw_tree.GetParentItem(k); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | int OnAddRole() |
| | | { |
| | | HTREEITEM m = dw_tree.GetSelectedItem(); |
| | | if (m == 0) return -1; |
| | | KXMLDOMElement ele = dw_tree.GetItemData(m); |
| | | xstring tpy = L"" + (xstring)ele.selectSingleNode(L"type").text(); |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"dataUrl", L"/sale/data/Role.config/pref/model/select"); |
| | | openUrl(L"/sale/view/Role.config/xpage/role/select/user", arg); |
| | | xstring str = arg.GetArgString(L"item"); |
| | | if (str == L"") return -1; |
| | | xml x; |
| | | |
| | | x.loadXML(str); |
| | | var list = x.selectNodes(L"items/item"); |
| | | int i = 0, s = list.length; |
| | | KXMLDOMElement xitem; |
| | | int row = dw_role.GetRowCount() + 1; |
| | | xstring treepath = GetPath(); |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | xitem = list.item(i); |
| | | xstring id = L"" + (xstring)xitem.selectSingleNode(L"@id").text(); |
| | | xstring name = L"" + (xstring)xitem.selectSingleNode(L"@name").text(); |
| | | //xstring tpy=L""+xitem.selectSingleNode(L"@type").text(); |
| | | dw_role.InsertRow(0); |
| | | dw_role.SetItemString(row + i, L"id", id); |
| | | dw_role.SetItemString(row + i, L"name", L"" + treepath); |
| | | dw_role.SetItemDisplayString(row + i, L"name", name); |
| | | dw_role.SetItemString(row + i, L"type", tpy); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | HTREEITEM m = dw_tree.GetSelectedItem(); |
| | | if (m == 0) return 0; |
| | | |
| | | int k = m_sheet.GetSheetIndex(); |
| | | if (k == 0) |
| | | //openUrl(L"/sale/view/role.config/xpage/data/select/resource", dw_list); |
| | | OpenWindow(L"dev:xpage[Resource.select.data.config.vx]", dw_list); |
| | | else |
| | | OnAddRole(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnDelRow() |
| | | { |
| | | int k = m_sheet.GetSheetIndex(); |
| | | int row; |
| | | xstring hr_type; |
| | | KXMLDOMElement e; |
| | | if (k == 0) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row<1 || row > dw_list.GetRowCount()) return -1; |
| | | e = dw_list.GetRowElement(row); |
| | | if (e.selectSingleNode(L"fromparent")) |
| | | { |
| | | SetAgent("data"); |
| | | |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(GetControl("dw_list")); |
| | | dw_list.openUrl("/sale/view/Role.config/template/data/config/resourceOrg"); |
| | | dw_list.SetReadOnly(false); |
| | | |
| | | dw_role = new xdwgrid__; |
| | | dw_role.setNativePointer(GetControl("dw_role")); |
| | | //dw_role.SetDataObject(GetServerUrl(), "dev:sheet[leftFrame.tpl/role]"); |
| | | //dw_role.openUrl(m_vface+"/template/role/config/role"); |
| | | dw_role.openUrl("/sale/view/Role.config/template/role/config/role"); |
| | | dw_role.SetReadOnly(false); |
| | | |
| | | dw_ddlb = new combobox__; |
| | | dw_ddlb.setNativePointer(this.GetControl("dw_ddlb")); |
| | | |
| | | m_sheet = new xlayersheet__; |
| | | m_sheet.setNativePointer(this.GetControl("m_sheet")); |
| | | |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_ddlb","CBN_SELCHANGE",OnSelectDdlb); |
| | | |
| | | createTreeRoot(); |
| | | |
| | | return 1; |
| | | hr_type = e.selectSingleNode(L"fromparent").text(); |
| | | if (hr_type != L"") |
| | | { |
| | | alert(L"继承的权限无权删除!"); |
| | | return 0; |
| | | } |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | else |
| | | { |
| | | row = dw_role.GetRow(); |
| | | if (row<1 || row > dw_role.GetRowCount()) return -1; |
| | | e = dw_role.GetRowElement(row); |
| | | if (e.selectSingleNode(L"fromparent")) |
| | | { |
| | | hr_type = e.selectSingleNode(L"fromparent").text(); |
| | | if (hr_type != L"") |
| | | { |
| | | alert(L"继承的权限无权删除!"); |
| | | return 0; |
| | | } |
| | | } |
| | | dw_role.DeleteRow(row); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetCopy(xdwgrid dw, KXMLDOMElement e, xstring name) |
| | | { |
| | | xml x; |
| | | |
| | | KXMLDOMElement ele; |
| | | bool f = false; |
| | | |
| | | int count = dw.GetRowCount(); |
| | | if (count == 0) |
| | | { |
| | | x.loadXML(L"<" + name + L"s/>"); |
| | | ele = x.documentElement(); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e1 = dw.GetRowElement(1); |
| | | ele = e1.parentNode; |
| | | } |
| | | var li = e.selectNodes(name); |
| | | int i; |
| | | int len = li.length; |
| | | xstring treepath = GetPath(); |
| | | for (i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMElement ele1 = li.item(i); |
| | | if (ele1.selectSingleNode(L"fromparent")) |
| | | { |
| | | xstring str = ele1.selectSingleNode(L"fromparent").text(); |
| | | if (str != L"") continue; |
| | | } |
| | | xml x1; |
| | | |
| | | x1.loadXML(ele1.xml()); |
| | | KXMLDOMElement ele2 = x1.documentElement(); |
| | | ele2.setAttribute(L"update.new", L"1"); |
| | | ele2.setAttribute(L"update.modify", L"1"); |
| | | ele2.setAttribute(L"guid", publiccode::GetGuid()); |
| | | if (ele2.selectSingleNode(L"name")) |
| | | ele2.selectSingleNode(L"name").text() = treepath; |
| | | //ele1.selectSingleNode(L"@guid").text() = publiccode::GetGuid(); |
| | | //ele1.selectSingleNode(L"@update.new").text() = L"1"; |
| | | //ele1.selectSingleNode(L"@update.modify").text() = L"1"; |
| | | ele.appendChild(ele2); |
| | | } |
| | | dw.Retrieve(ele); |
| | | dw.SetReadOnly(true); |
| | | dw.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnCopy() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | OpenWindow(L"dev:xpage[Data.config.copy.vx]", arg); |
| | | xstring id = arg.GetArgString(L"id"); |
| | | xstring f = arg.GetArgString(L"flag"); |
| | | if (id == L"") return 1; |
| | | |
| | | xml x; |
| | | |
| | | if (xurl::get(L"/sale/data/Role.config/pref/maint/data", arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"错误返回=L" + (xstring)x.xml()); |
| | | return -1; |
| | | } |
| | | |
| | | if (x.xml() == L"") |
| | | x.loadXML(L"<root><items/><roles/></root>"); |
| | | |
| | | KXMLDOMElement e = x.documentElement(); |
| | | |
| | | if (f == L"0" || f == L"1") |
| | | { |
| | | KXMLDOMElement ele1 = e.selectSingleNode(L"items"); |
| | | OnSetCopy(dw_list, ele1, L"item"); |
| | | } |
| | | |
| | | if (f == L"0" || f == L"2") |
| | | { |
| | | KXMLDOMElement ele2 = e.selectSingleNode(L"roles"); |
| | | OnSetCopy(dw_role, ele2, L"role"); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"Config") |
| | | openUrl(L"/sale/view/role.config/xpage/data/resource/config"); |
| | | if (comdid == L"RightQuery") |
| | | openUrl(L"/sale/view/role.config/xpage/data/modulerightquery"); |
| | | else if (comdid == L"New") |
| | | OnAddRow(); |
| | | else if (comdid == L"Del") |
| | | OnDelRow(); |
| | | else if (comdid == L"Save") |
| | | OnSave(); |
| | | else if (comdid == L"Copy") |
| | | OnCopy(); |
| | | else if (comdid == L"xmProdDivi") |
| | | openUrl(L"/sale/view/RoleAccount3/xpage/data/proddivi"); |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | SetAgent(L"data"); |
| | | |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.openUrl(L"/sale/view/Role.config/template/data/config/resourceOrg"); |
| | | dw_list.SetReadOnly(false); |
| | | |
| | | dw_role = new xdwgrid; |
| | | dw_role.setNativePointer(GetControl(L"dw_role")); |
| | | //dw_role.SetDataObject(GetServerUrl(), L"dev:sheet[leftFrame.tpl/role]"); |
| | | //dw_role.openUrl(m_vface+L"/template/role/config/role"); |
| | | dw_role.openUrl(L"/sale/view/Role.config/template/role/config/role"); |
| | | dw_role.SetReadOnly(false); |
| | | |
| | | dw_ddlb = new combobox; |
| | | dw_ddlb.setNativePointer(GetControl(L"dw_ddlb")); |
| | | |
| | | m_sheet = new xlayersheet; |
| | | m_sheet.setNativePointer(GetControl(L"m_sheet")); |
| | | |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&DataConfig::OnXCommand); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&DataConfig::OnSetFocus); |
| | | AttachEvent(L"dw_ddlb", L"CBN_SELCHANGE", (FEvent)&DataConfig::OnSelectDdlb); |
| | | |
| | | createTreeRoot(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | 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]" |
| | | use "dev:code[pa.tpp]" |
| | | use "list.vl" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | SysUser is extend list; |
| | | about SysUser |
| | | [ |
| | | |
| | | method: |
| | | [ |
| | | treeview__ tv_usergroup; |
| | | xdwgrid__ dw_user; |
| | | xnode__ m_agentNode; |
| | | string strJobID; |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent (anode,s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | SetAgent(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(param p) |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string str = this.m_QueryTxt; |
| | | //trace(ele.xml); |
| | | //alert(str); |
| | | arg.AddArg("guid",str); |
| | | //trace(strJobID); |
| | | if (xaserver__::ExecXQuery("","[list.SysUser.xq]",arg.GetString(),x) == 1) |
| | | { |
| | | dw_user.AcceptText(); |
| | | dw_user.Retrieve(x); |
| | | dw_user.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | |
| | | int wid = tv_usergroup.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | int rootItem = treeview__::GetRootItem(wid); |
| | | //if (hItem <=0 || hItem == rootItem) |
| | | // return 0; |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid,hitem); |
| | | //trace("ok"); |
| | | if (ele) |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | strJobID = ele.selectSingleNode("@JobID").text; |
| | | //trace(ele.xml); |
| | | //alert(strJobID); |
| | | arg.AddArg("guid",strJobID); |
| | | //trace(strJobID); |
| | | if (xaserver__::ExecXQuery("","[list.SysUser.xq]",arg.GetString(),x) == 1) |
| | | { |
| | | dw_user.AcceptText(); |
| | | dw_user.Retrieve(x); |
| | | dw_user.Redraw(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | int xmImport() |
| | | 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) |
| | | { |
| | | |
| | | int wid = tv_usergroup.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | if (!hitem) |
| | | { |
| | | alert("请选择职位!"); |
| | | return 0; |
| | | } |
| | | OpenWindow("dev:xpage[UserImport.vx]",this); |
| | | //openUrl("系统用户.vface/xpage/SysUser/UserImport", this); |
| | | return 1; |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | int OnSave() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | dw_user.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | arg.AddArg("dbmap","SysUser.dbmap"); |
| | | if(getUrl("/sale/data/SysUser/SysUser",arg.GetString(),x)!=1) |
| | | { |
| | | //trace("error:"+x.GetXml()); |
| | | alert("保存失败"); |
| | | } |
| | | else{ |
| | | if(x.GetXmlDoc().selectSingleNode("erroe")) |
| | | { |
| | | alert("保存出错2! "); |
| | | return 0; |
| | | } |
| | | //trace(x.GetXml()); |
| | | dw_user.ResetUpdateStatus(); |
| | | win__::MessageBox(GetHWND(),"保存成功!","提示",0); |
| | | } |
| | | |
| | | /* arg.AddArg("xdata",x.GetXml()); |
| | | //arg.AddArg("jobguid",strJobID); |
| | | //trace(x.GetXml()); |
| | | //trace(strJobID); |
| | | //if (getUrl("/sale/data/SysUser/SysUser",arg.GetString(),x) != 1) |
| | | //trace(xaserver__::ExecXAction(GetServerUrl(),"[SysUser.xa]",arg.GetString(),x)); |
| | | if (xaserver__::ExecXAction(GetServerUrl(),"[SysUser.xa]",arg.GetString(),x)!=1) |
| | | { |
| | | //trace("error:"+x.GetXml()); |
| | | alert("保存失败"); |
| | | } |
| | | else{ |
| | | if(x.GetXmlDoc().selectSingleNode("ERROR")) |
| | | { |
| | | alert("保存出错2! "); |
| | | return 0; |
| | | } |
| | | win__::MessageBox(GetHWND(),"保存成功!","提示",0); |
| | | }*/ |
| | | return 1; |
| | | } |
| | | int OnAddRow() |
| | | { |
| | | int wid = tv_usergroup.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | if(hitem==0) |
| | | { |
| | | alert("请先选择职位类型!"); |
| | | } |
| | | else |
| | | { |
| | | int row = dw_user.InsertRow(0); |
| | | dw_user.SetItemString(row,"Status","Y"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | int wid = tv_usergroup.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | if(hitem==0) |
| | | { |
| | | alert("请先选择职位类型!"); |
| | | } |
| | | else |
| | | { |
| | | int crow=dw_user.GetRow(); |
| | | int row=dw_user.InsertRow(crow); |
| | | dw_user.SetItemString(row,"Status","Y"); |
| | | } |
| | | return 1; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row=dw_user.GetRow(); |
| | | dw_user.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | |
| | | int OnJobType() |
| | | { |
| | | openUrl("组织架构.vface/worknode/Hr/HrJob"); |
| | | return 1; |
| | | } |
| | | |
| | | int OnClicked(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | int col=hdr.col ; |
| | | string colname=dw_user.GetColumnName(col); |
| | | msxml::IXMLDOMElement xrow = dw_user.GetRowElement(row); |
| | | string BindComputer=xrow.selectSingleNode("BindComputer").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if(BindComputer != "" ) |
| | | { |
| | | arg.AddArg("BindComputer",BindComputer); |
| | | } |
| | | |
| | | string comdid; |
| | | if(colname=="BindComputer") |
| | | { |
| | | openUrl("系统用户.vface/xpage/SysUser/BindComputer/dialog", arg); |
| | | comdid = arg.GetArgString("comdid"); |
| | | if(comdid=="ok") |
| | | { |
| | | string strxml = arg.GetArgString("xml"); |
| | | dw_user.SetItemDisplayString(row,colname,strxml); |
| | | dw_user.SetItemString(row,colname,strxml); |
| | | dw_user.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnResetPass() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | int pt = arg.CreateInstance(); |
| | | arg.setNativePointer(pt); |
| | | |
| | | int row = dw_user.GetRow(); |
| | | if(row < 1) return 1; |
| | | arg.AddArg("user", dw_user.GetItemString(row,"EmployeeNo")); |
| | | |
| | | OpenWindow("dev:xpage[ResetUserPassDlg.vx]",pt); |
| | | return 1; |
| | | } |
| | | |
| | | int Onlog() |
| | | { |
| | | openUrl("/sale/view/SysUser/xpage/SysUser/SysLoginRecord"); |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid =="Save") OnSave(); |
| | | else if (comdid =="AddRow") OnAddRow(); |
| | | else if (comdid =="InsertRow") OnInsertRow(); |
| | | else if (comdid =="DeleteRow") OnDeleteRow(); |
| | | else if (comdid =="JobType") OnJobType(); |
| | | else if (comdid=="xmImport") xmImport(); |
| | | else if (comdid == "xmLog") Onlog(); |
| | | else if(comdid=="_cb_grid_search") return GridSearchEx(); |
| | | else if(comdid=="xmResetPass") return OnResetPass(); |
| | | else if(comdid=="xmResetPassEx") OpenWindow("dev:xpage[SysForcePassward.vx]"); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | //获得树的选择事件 |
| | | AttachEvent("tv_usergroup", "TVN_SELCHANGED",OnTreeSelChanged); |
| | | //AttachEvent("dw_user","DWV_ITEMBEINGEDIT",OnClicked); |
| | | AttachEvent("dw_user","DWV_DOUBLECLICKED",OnClicked); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | int SetEntityData(param p) |
| | | { |
| | | xml x; |
| | | |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | 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) |
| | | { |
| | | m_agentNode = new xnode__; |
| | | |
| | | tv_usergroup = new treeview__; |
| | | tv_usergroup.setNativePointer(this.GetControl("tv_usergroup")); |
| | | dw_user = new xdwgrid__; |
| | | dw_user.setNativePointer(this.GetControl("dw_user")); |
| | | dw_user.SetDataObject(GetServerUrl(),"dev:sheet[SysUser.tpl/UserList]"); |
| | | dw_user.SetReadOnly(true); |
| | | dw_user.SetSelectionMode(1); |
| | | |
| | | OnInitial(); |
| | | int wid = tv_usergroup.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid,root); |
| | | |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | x.LoadXml("<Config/>"); |
| | | this.m_configDoc = x.GetXmlDoc(); |
| | | rowSearch("系统用户.vface/template/SysUser/list"); |
| | | GridSearchEx(); |
| | | |
| | | return 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; |
| | | } |
| | | }; |
| | |
| | | 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]" |
| | | use "dev:code[SysUser.vx]" |
| | | use "frame.vl" |
| | | use "file.vl" |
| | | unit vbusiness.xpage |
| | | [ |
| | | UserImport is extend frame; |
| | | about UserImport |
| | | [ |
| | | field: |
| | | [ |
| | | SysUser lw_obj; |
| | | xdwgrid__ dw_list; |
| | | treeview__ tv_org; |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | string m_sTxt; |
| | | string is_orgid; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int SetAgent() |
| | | #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" |
| | | //use "dev:code[SysUser.vx]" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) UserImport : public xframe |
| | | { |
| | | public: |
| | | |
| | | |
| | | SysUser lw_obj; |
| | | xdwgrid dw_list; |
| | | xtreeview tv_org; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | xstring m_sTxt; |
| | | xstring is_orgid; |
| | | public: |
| | | UserImport(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static UserImport* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | UserImport* pWin = new UserImport(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) |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(xstring ls_orgid) |
| | | { |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"OrgID", ls_orgid); |
| | | //trace(ls_orgid); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[MSSqlHrEmployee.xq]",arg.GetString(),x) == 1) |
| | | if (xurl::get(L"SysUser.config/UserSelect.xq", arg.GetString(), x) == 1) |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | //trace(x.xml()); |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK() |
| | | { |
| | | if (GetWinParam()) |
| | | { |
| | | lw_obj = new SysUser; |
| | | lw_obj.setNativePointer(GetParam()); |
| | | lw_obj = GetParam(); |
| | | } |
| | | else |
| | | return 0; |
| | | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | //trace(row); |
| | | if (row < 1) |
| | | { |
| | | alert(L"请选择人员!"); |
| | | return 1; |
| | | } |
| | | |
| | | xstring sPositionID, sPositionName; |
| | | xstring sOrgID, sOrgName; |
| | | xstring sJobID, sJobName; |
| | | int wid = lw_obj.tv_usergroup.GetId(); |
| | | int hitem = tv_org.GetSelectedItem(wid); |
| | | KXMLDOMElement ele = tv_org.GetItemData(wid, hitem); |
| | | |
| | | |
| | | while (row > 0) |
| | | { |
| | | //trace(row); |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | trace(e.xml()); |
| | | xstring sEmployeeNo = e.selectSingleNode(L"EmployeeNo").text() + L""; |
| | | xstring sOldEmpNo = e.selectSingleNode(L"OldEmpNo").text() + L""; |
| | | xstring sPersonID = e.selectSingleNode(L"PersonID").text() + L""; |
| | | xstring sPersonName = e.selectSingleNode(L"Name").text() + L""; |
| | | xstring sPassWord = xutil::MD5(sOldEmpNo); |
| | | |
| | | /* |
| | | xml xx; |
| | | x |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"userno",sOldEmpNo); |
| | | arg.AddArg(L"password",sPassWord); |
| | | if(xurl::get(L"/sale/data/SysUser/GetOldPassWord",arg.GetString(),xx)==1) |
| | | { |
| | | if(xx.xml()!=L"") |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent (anode,s); |
| | | KXMLDOMElement ex = xx.documentElement(); |
| | | sPassWord = L""+ex.text(); |
| | | } |
| | | return 1; |
| | | } |
| | | }*/ |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | int nRow = lw_obj.dw_user.InsertRow(0); |
| | | lw_obj.dw_user.SetItemString(nRow, L"EmployeeNo", sEmployeeNo); |
| | | lw_obj.dw_user.SetItemString(nRow, L"UserName", sOldEmpNo); |
| | | lw_obj.dw_user.SetItemString(nRow, L"PassWord", sPassWord); |
| | | lw_obj.dw_user.SetItemString(nRow, L"PersonID", sPersonID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow, L"PersonID", sPersonName); |
| | | lw_obj.dw_user.SetItemString(nRow, L"Status", L"Y"); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow, L"Status", L"有效"); |
| | | lw_obj.dw_user.SetItemString(nRow, L"OldEmpNo", sOldEmpNo); |
| | | /* |
| | | lw_obj.dw_user.SetItemString(nRow,L"PositionID",sPositionID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,L"PositionID",sPositionName); |
| | | lw_obj.dw_user.SetItemString(nRow,L"OrgID",sOrgID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,L"OrgID",sOrgName); |
| | | lw_obj.dw_user.SetItemString(nRow,L"JobID",sJobID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,L"JobID",sJobName); |
| | | |
| | | lw_obj.dw_user.SetItemString(nRow,L"Status",L"Y"); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,L"Status",L"有效"); |
| | | xstring sdate = TApp::GetCurDate()+L""; |
| | | lw_obj.dw_user.SetItemString(nRow,L"StartDate",sdate+L""); |
| | | lw_obj.dw_user.SetItemString(nRow,L"EndDate",L"2050-12-31");*/ |
| | | |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | //trace(row); |
| | | } |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | int OnSubTree(xstring id, HTREEITEM parentitem) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | if (tv_org.GetChildItem(wid, parentitem) > 0) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"sguid", id); |
| | | if (xurl::post(L"/sale/data/OrganizationStruct/tree.child.OrgChart", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.xml()); |
| | | return -1; |
| | | } |
| | | //trace(x.xml()); |
| | | var list = x.selectNodes(L"//item"); |
| | | int i = 0, s = list.length; |
| | | KXMLDOMElement xitem; |
| | | xstring sName; |
| | | xstring sguid; |
| | | xstring stype; |
| | | if (s > 0) |
| | | { |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | SetAgent(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string ls_orgid) |
| | | { |
| | | |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("OrgID",ls_orgid); |
| | | //trace(ls_orgid); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),"[MSSqlHrEmployee.xq]",arg.GetString(),x) == 1) |
| | | if (url::get("SysUser.config/UserSelect.xq",arg.GetString(),x) == 1) |
| | | xitem = list.item(i); |
| | | sName = xitem.selectSingleNode(L"name").text(); |
| | | sguid = xitem.selectSingleNode(L"id").text(); |
| | | stype = xitem.selectSingleNode(L"typ").text(); |
| | | //int curItem = tv_org.InsertChildItemEx(wid,parentitem,sName,xitem,15,4); |
| | | int curItem = 0; |
| | | if (stype == L"Org") |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | //trace(x.GetXml()); |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK() |
| | | { |
| | | if (GetParam()) |
| | | { |
| | | lw_obj = new SysUser; |
| | | lw_obj.setNativePointer(GetParam()); |
| | | lw_obj = GetParam(); |
| | | curItem = tv_org.InsertChildItemEx(wid, parentitem, sName, xitem, 15, 4); |
| | | tv_org.SetItemChild1(wid, curItem, 1); |
| | | } |
| | | else |
| | | return 0; |
| | | { |
| | | curItem = tv_org.InsertChildItemEx(wid, parentitem, sName, xitem, 21, 21); |
| | | } |
| | | //OnSubTree(sguid,curItem); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | trace(row); |
| | | if (row<1) |
| | | { |
| | | alert("请选择人员!"); |
| | | return 1; |
| | | } |
| | | |
| | | string sPositionID,sPositionName; |
| | | string sOrgID,sOrgName; |
| | | string sJobID,sJobName; |
| | | int wid = lw_obj.tv_usergroup.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid,hitem); |
| | | int OnCreateTree(xstring id, int parentitem) |
| | | { |
| | | //while (tv_1.GetRootItem()>0) |
| | | // tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | int wid = tv_org.GetId(); |
| | | xml x; |
| | | |
| | | |
| | | while (row>0) |
| | | { |
| | | trace(row); |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | trace(e.xml); |
| | | string sEmployeeNo = e.selectSingleNode("EmployeeNo").text+""; |
| | | string sOldEmpNo = e.selectSingleNode("OldEmpNo").text+""; |
| | | string sPersonID = e.selectSingleNode("PersonID").text+""; |
| | | string sPersonName = e.selectSingleNode("Name").text+""; |
| | | string sPassWord = xutil__::MD5(sOldEmpNo); |
| | | |
| | | /* |
| | | xml__ xx = new xml__; |
| | | xx.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("userno",sOldEmpNo); |
| | | arg.AddArg("password",sPassWord); |
| | | if(url::get("/sale/data/SysUser/GetOldPassWord",arg.GetString(),xx)==1) |
| | | { |
| | | if(xx.GetXml()!="") |
| | | { |
| | | msxml::IXMLDOMElement ex = xx.GetXmlDoc().documentElement; |
| | | sPassWord = ""+ex.text; |
| | | } |
| | | }*/ |
| | | x.loadXML(L"<item><id>" + id + L"</id><no/><name>凤凰集团</name><typ>Org</typ></item>"); |
| | | //KXMLDOMDocument root = x; |
| | | //KXMLDOMElement RDoc = x.documentElement(); |
| | | //KXMLDOMElement ele = RDoc.SelectSingleNode(L"//Org"); |
| | | KXMLDOMElement ele = x.selectSingleNode(L"//item"); |
| | | int hItem = tv_org.InsertChildItemEx(wid, 0, L"凤凰集团", ele, 15, 4); |
| | | tv_org.SetItemChild1(wid, hItem, 1); |
| | | return 1; |
| | | |
| | | int nRow = lw_obj.dw_user.InsertRow(0); |
| | | lw_obj.dw_user.SetItemString(nRow,"EmployeeNo",sEmployeeNo); |
| | | lw_obj.dw_user.SetItemString(nRow,"UserName",sOldEmpNo); |
| | | lw_obj.dw_user.SetItemString(nRow,"PassWord",sPassWord); |
| | | lw_obj.dw_user.SetItemString(nRow,"PersonID",sPersonID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"PersonID",sPersonName); |
| | | lw_obj.dw_user.SetItemString(nRow,"Status","Y"); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"Status","有效"); |
| | | lw_obj.dw_user.SetItemString(nRow,"OldEmpNo",sOldEmpNo); |
| | | /* |
| | | lw_obj.dw_user.SetItemString(nRow,"PositionID",sPositionID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"PositionID",sPositionName); |
| | | lw_obj.dw_user.SetItemString(nRow,"OrgID",sOrgID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"OrgID",sOrgName); |
| | | lw_obj.dw_user.SetItemString(nRow,"JobID",sJobID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"JobID",sJobName); |
| | | |
| | | lw_obj.dw_user.SetItemString(nRow,"Status","Y"); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"Status","有效"); |
| | | string sdate = TApp::GetCurDate()+""; |
| | | lw_obj.dw_user.SetItemString(nRow,"StartDate",sdate+""); |
| | | lw_obj.dw_user.SetItemString(nRow,"EndDate","2050-12-31");*/ |
| | | |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | trace(row); |
| | | } |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | int OnSubTree(string id,int parentitem) |
| | | /*xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"sguid",id); |
| | | if(xurl::post(L"/sale/data/OrganizationStruct/tree.child.OrgChart",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.xml()); |
| | | return -1; |
| | | } |
| | | //trace(x.xml()); |
| | | var list=x.selectNodes(L"//item"); |
| | | int i=0,s=list.length; |
| | | KXMLDOMElement xitem; |
| | | xstring sName; |
| | | xstring sguid; |
| | | if (s >0) |
| | | { |
| | | for (i=0;i<s;i++) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | if (treeview__::GetChildItem(wid,parentitem) >0) return 1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sguid",id); |
| | | if(url::post("/sale/data/OrganizationStruct/tree.child.OrgChart",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list=x.GetXmlDoc().selectNodes("//item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | string sName; |
| | | string sguid; |
| | | string stype; |
| | | if (s >0) |
| | | { |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(i); |
| | | sName = xitem.SelectSingleNode("name").text; |
| | | sguid = xitem.SelectSingleNode("id").text; |
| | | stype = xitem.SelectSingleNode("typ").text; |
| | | //int curItem = tv_org.InsertChildItemEx(wid,parentitem,sName,xitem,15,4); |
| | | int curItem=0; |
| | | if (stype =="Org") |
| | | { |
| | | curItem=tv_org.InsertChildItemEx(wid,parentitem,sName,xitem,15,4); |
| | | tv_org.SetItemChild1(wid,curItem,1); |
| | | } |
| | | else |
| | | { |
| | | curItem=tv_org.InsertChildItemEx(wid,parentitem,sName,xitem,21,21); |
| | | } |
| | | //OnSubTree(sguid,curItem); |
| | | } |
| | | } |
| | | return 1; |
| | | xitem= list.item(i); |
| | | sName = xitem.SelectSingleNode(L"@name").text(); |
| | | sguid = xitem.SelectSingleNode(L"@id").text(); |
| | | int curItem = tv_org.InsertChildItemEx(wid,hItem,sName,xitem,15,4); |
| | | tv_org.SetItemChild1(wid,curItem,1); |
| | | //OnSubTree(sguid,curItem); |
| | | } |
| | | |
| | | int OnCreateTree(string id,int parentitem) |
| | | { |
| | | //while (tv_1.GetRootItem()>0) |
| | | // tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | int wid = tv_org.GetId(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | x.LoadXml("<item><id>"+id+"</id><no/><name>凤凰集团</name><typ>Org</typ></item>"); |
| | | //msxml::IXMLDOMDocument root = x.GetXmlDoc(); |
| | | //msxml::IXMLDOMElement RDoc = x.GetXmlDoc().documentElement; |
| | | //msxml::IXMLDOMElement ele = RDoc.SelectSingleNode("//Org"); |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().SelectSingleNode("//item"); |
| | | int hItem = treeview__::InsertChildItemEx(wid,0,"凤凰集团",ele,15,4); |
| | | treeview__::SetItemChild1(wid,hItem,1); |
| | | return 1; |
| | | |
| | | /*xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sguid",id); |
| | | if(url::post("/sale/data/OrganizationStruct/tree.child.OrgChart",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list=x.GetXmlDoc().selectNodes("//item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | string sName; |
| | | string sguid; |
| | | if (s >0) |
| | | { |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(i); |
| | | sName = xitem.SelectSingleNode("@name").text; |
| | | sguid = xitem.SelectSingleNode("@id").text; |
| | | int curItem = tv_org.InsertChildItemEx(wid,hItem,sName,xitem,15,4); |
| | | tv_org.SetItemChild1(wid,curItem,1); |
| | | //OnSubTree(sguid,curItem); |
| | | } |
| | | } |
| | | return 1;*/ |
| | | } |
| | | |
| | | int OnTreeExpanding(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | //string id = treeview__::GetItemData(tv_org.GetId(), sitem); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(),sitem); |
| | | string id = ele.SelectSingleNode("id").text; |
| | | OnSubTree(id, sitem); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TXCommandEvent evt,int p) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid,hitem); |
| | | if (ele) |
| | | { |
| | | string ls_orgid = ele.SelectSingleNode("id").text; |
| | | is_orgid = ls_orgid; |
| | | OnRetrieve(ls_orgid); |
| | | } |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="cb_import") |
| | | OnOK(); |
| | | else if (comdid=="cb_close") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | //获得树的选择事件 |
| | | AttachEvent("tv_org", "TVN_SELCHANGED",OnTreeSelChanged); |
| | | AttachEvent("tv_org", "TVN_ITEMEXPANDING",OnTreeExpanding); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = new treeview__ ; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("系统用户.vface/template/SysUser/EmpSelect"); |
| | | dw_list.SetSelectionMode(3); //3 |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1;*/ |
| | | } |
| | | |
| | | OnInitial(); |
| | | OnCreateTree("00000000-0000-0000-0000-000000000000", 0); |
| | | int wid = tv_org.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid,root); |
| | | OnRetrieve("00000000-0000-0000-0000-000000000000"); |
| | | return 1; |
| | | } |
| | | ] |
| | | int OnTreeExpanding(TEvent* evt, LPARAM p) |
| | | { |
| | | |
| | | ] |
| | | ] |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM sitem = nmtv.itemNew.hItem; |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | //xstring id = tv_org.GetItemData(tv_org.GetId(), sitem); |
| | | KXMLDOMElement ele = tv_org.GetItemData(tv_org.GetId(), sitem); |
| | | xstring id = ele.selectSingleNode(L"id").text(); |
| | | OnSubTree(id, sitem); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | //int wid = tv_org.GetId(); |
| | | int hitem = tv_org.GetSelectedItem(); |
| | | KXMLDOMElement ele = tv_org.GetItemData(hitem); |
| | | if (ele) |
| | | { |
| | | xstring ls_orgid = ele.selectSingleNode(L"id").text(); |
| | | is_orgid = ls_orgid; |
| | | OnRetrieve(ls_orgid); |
| | | } |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"cb_import") |
| | | OnOK(); |
| | | else if (comdid == L"cb_close") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&UserImport::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&UserImport::OnSetFocus); |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_org", L"TVN_SELCHANGED", (FEvent)&UserImport::OnTreeSelChanged); |
| | | AttachEvent(L"tv_org", L"TVN_ITEMEXPANDING", (FEvent)&UserImport::OnTreeExpanding); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = new treeview; |
| | | tv_org.setNativePointer(GetControl(L"tv_org")); |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.openUrl(L"系统用户.vface/template/SysUser/EmpSelect"); |
| | | dw_list.SetSelectionMode(3); //3 |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnCreateTree(L"00000000-0000-0000-0000-000000000000", 0); |
| | | //int wid = tv_org.GetId(); |
| | | int root = tv_org.GetRootItem(); |
| | | tv_org.ExpandItem(root); |
| | | OnRetrieve(L"00000000-0000-0000-0000-000000000000"); |
| | | return 1; |
| | | } |
| | | }; |