From ca7bfcdac21b765d29d0045308d434dfd038b10c Mon Sep 17 00:00:00 2001 From: xj qian <qianxj15@sina.com> Date: 星期三, 04 九月 2024 16:16:56 +0800 Subject: [PATCH] update jarch --- jrj/project/business/Company/HrOrgType.cpp | 333 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 169 insertions(+), 164 deletions(-) diff --git a/jrj/project/business/Company/HrOrgType.cpp b/jrj/project/business/Company/HrOrgType.cpp index 59517b6..60551d9 100644 --- a/jrj/project/business/Company/HrOrgType.cpp +++ b/jrj/project/business/Company/HrOrgType.cpp @@ -1,186 +1,191 @@ -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 "list.vl" -unit vbusiness.xpage -[ - HrOrgType is extend list; - about HrOrgType - [ - control: +#include <wobject/xstring.hpp> +#include <xcontrol/xtreeview.hpp> +#include <xcontrol/xdwgrid.hpp> +#include <wobject/xdouble.hpp> +#include <xcontrol/xlayersheet.hpp> - method: - [ - xdwgrid__ dw_list; +#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" +#include "viewobject/view.base.hpp" - xnode__ m_agentNode; //Agent Condition - string m_agentCond; //Agent Node - 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; - } +using xml = KXMLDOMDocument; +class __declspec(dllexport) HrOrgType : public xwin +{ +public: + xdwgrid dw_list; - //焦点激活处理函数 - int OnSetFocus(ref TEvent evt, int p) - { - SetAgent(); + xnode m_agentNode; //Agent Condition + xstring m_agentCond; //Agent Node +public: + HrOrgType(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static HrOrgType* CreateInstance(void* implPtr, void* hWnd) + { + HrOrgType* pWin = new HrOrgType(implPtr, (HWND)hWnd); + return pWin; + } + int SetAgent() + { + xstring xfNodeAgentArea = L"agentarea"; + xnode anode = GetAgentNode(xfNodeAgentArea); + if (m_agentNode) + { + SetAgentNode(anode, m_agentNode); + } + else + { + KXMLDOMElement xframeElement = GetElement(); + KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); + if (agent) + { + xstring s = agent.xml(); + m_agentNode = SetAgentNode(anode, s); + } + } + return 1; + } - //重置工具条 - return 1; - } + //焦点激活处理函数 + int OnSetFocus(TEvent* evt, LPARAM param) + { + SetAgent(); - int OnSave() - { - int hIcon = xutil__::SetCursorWait(); + //重置工具条 + return 1; + } - xml__ x = new xml__; - x.setNativePointer(x.CreateInstance()); - var xdoc = x.GetXmlDoc(); - dw_list.AcceptText(); - dw_list.DwUpdateAllTo(xdoc);//dw_list.DwUpdateAllTo(xdoc); //dw_list.DwUpdateTo(xdoc); + int OnSave() + { + HCURSOR hIcon = xutil::SetCursorWait(); - string val = xdoc.xml; - xaserverarg__ args = new xaserverarg__; - args.setNativePointer(args.CreateInstance()); - args.AddArg("content", val); - //trace(val); - //return 1; - if (url::post("OrganizationStruct/update.HrOrgType", args.GetString(), x) != 1) - { - string error = x.GetXmlDoc().text; - trace(error); - xutil__::RestoreCursor(hIcon); - return -1; - } + xml x; - xutil__::RestoreCursor(hIcon); - win__::MessageBox(GetHWND(), "保存成功!", "提示", 0); - return 1; - } + auto xdoc = x; + dw_list.AcceptText(); + dw_list.DwUpdateAllTo(xdoc);//dw_list.DwUpdateAllTo(xdoc); //dw_list.DwUpdateTo(xdoc); - int OnRetrieve() - { - int hIcon = xutil__::SetCursorWait(); - xml__ x = new xml__; - x.setNativePointer(x.CreateInstance()); - xaserverarg__ arg = new xaserverarg__; - arg.setNativePointer(arg.CreateInstance()); - //arg.AddArg("guid","xxx"); - if (url::post("OrganizationStruct/list.HrOrgType", arg.GetString(), x) != 1) - { - trace(x.GetXmlDoc().text); - return -1; - } - else - { - dw_list.Retrieve(x); - dw_list.Redraw(); - } - xutil__::RestoreCursor(hIcon); - return 1; - } + xstring val = xdoc.xml(); + xaserverarg args; + args.AddArg(L"content", val); + //trace(val); + //return 1; + if (xurl::post(L"OrganizationStruct/update.HrOrgType", args.GetString(), x) != 1) + { + xstring error = x.text(); + trace(error); + xutil::RestoreCursor(hIcon); + return -1; + } - int OnAddrow() - { - dw_list.InsertRow(0); - return 1; - } + xutil::RestoreCursor(hIcon); + MessageBox(GetHWND(), L"保存成功!", L"提示", 0); + return 1; + } - int OnInsertrow() - { - int row = dw_list.GetRow(); - if (row < 1) return 0; - dw_list.InsertRow(row); - return 1; - } + int OnRetrieve() + { + HCURSOR hIcon = xutil::SetCursorWait(); + xml x; - int OnDeleteRow() - { - int row = dw_list.GetRow(); - if (row < 1) return 0; + xaserverarg arg; - msxml::IXMLDOMElement e = dw_list.GetRowElement(row); - string sguid = e.selectSingleNode("Code").text; //e.getAttribute("guid"); - xaserverarg__ arg = new xaserverarg__; - arg.setNativePointer(arg.CreateInstance()); - arg.AddArg("guid", sguid); - //trace(sguid); - xml__ x = new xml__; - x.setNativePointer(x.CreateInstance()); - if (url::post("OrganizationStruct/delete.HrOrgType", arg.GetString(), x) != 1) - { - string error = x.GetXmlDoc().text; - trace(error); - } - else - { - dw_list.DeleteRow(row); - } - return 1; - } + //arg.AddArg(L"guid",L"xxx"); + if (xurl::post(L"OrganizationStruct/list.HrOrgType", arg.GetString(), x) != 1) + { + trace(x.text()); + return -1; + } + else + { + dw_list.Retrieve(x); + dw_list.Redraw(); + } + xutil::RestoreCursor(hIcon); + 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(); + int OnAddrow() + { + dw_list.InsertRow(0); + return 1; + } - return 0; - } + int OnInsertrow() + { + int row = dw_list.GetRow(); + if (row < 1) return 0; + dw_list.InsertRow(row); + return 1; + } - //命令处理事件 - int OnXCommand(ref TXCommandEvent evt, int p) - { - return OnCmdDispatch(evt.pStrID); - } + int OnDeleteRow() + { + int row = dw_list.GetRow(); + if (row < 1) return 0; - int OnAttachEvent() - { - //绑定工具条点击事件 - AttachEvent("WM_XCOMMAND", OnXCommand); - //获取焦点事件,用于重置工具条 - AttachEvent("WM_SETFOCUS", OnSetFocus); - } + KXMLDOMElement e = dw_list.GetRowElement(row); + xstring sguid = e.selectSingleNode(L"Code").text(); //e.getAttribute(L"guid"); + xaserverarg arg; - int OnInitial() - { - SetAgent(); - OnAttachEvent(); - return 1; - } + arg.AddArg(L"guid", sguid); + //trace(sguid); + xml x; - int onload() - { - dw_list = new xdwgrid__; - dw_list.setNativePointer(this.GetControl("dw_list")); - dw_list.openUrl("组织架构.vface/template/HrOrg/orgtype"); - //dw_list.SetSelectionMode(1); - //dw_list.SetReadOnly(true); + if (xurl::post(L"OrganizationStruct/delete.HrOrgType", arg.GetString(), x) != 1) + { + xstring error = x.text(); + trace(error); + } + else + { + dw_list.DeleteRow(row); + } + return 1; + } - OnInitial(); - OnRetrieve(); + //命令发布函数 + 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(); - return 1; - } - ] + return 0; + } - ] -] \ No newline at end of file + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&HrOrgType::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&HrOrgType::OnSetFocus); + return 1; + } + + int OnInitial() + { + SetAgent(); + OnAttachEvent(); + return 1; + } + + int onload() + { + dw_list = new xdwgrid; + dw_list.setNativePointer(GetControl(L"dw_list")); + dw_list.openUrl(L"组织架构.vface/template/HrOrg/orgtype"); + //dw_list.SetSelectionMode(1); + //dw_list.SetReadOnly(true); + + OnInitial(); + OnRetrieve(); + + return 1; + } +}; \ No newline at end of file -- Gitblit v1.9.3