From c73702d600ef2d0843ec7e3ace65f8c63c6905c2 Mon Sep 17 00:00:00 2001 From: LiFan <2308045698@qq.com> Date: 星期二, 16 七月 2024 15:21:53 +0800 Subject: [PATCH] update --- jrj/project/business/Company/HrOrgMaint.cpp | 504 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 256 insertions(+), 248 deletions(-) diff --git a/jrj/project/business/Company/HrOrgMaint.cpp b/jrj/project/business/Company/HrOrgMaint.cpp index 1989e32..be0677a 100644 --- a/jrj/project/business/Company/HrOrgMaint.cpp +++ b/jrj/project/business/Company/HrOrgMaint.cpp @@ -1,266 +1,274 @@ -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 -[ - HrOrgMaint is extend list; - about HrOrgMaint - [ - control: +#include <wobject/xstring.hpp> +#include <xcontrol/xtreeview.hpp> +#include <xcontrol/xdwgrid.hpp> +#include <wobject/xdouble.hpp> +#include <xcontrol/xlayersheet.hpp> - method: - [ - xdwtable__ dw_detail; - string m_operate; - string m_sguid; - string m_tvOrgID; - string m_tvOrgName; - string m_tvRootOrgID; - string m_tvRootOrgName; +#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) HrOrgMaint : public xwin +{ +public: - //焦点激活处理函数 - int OnSetFocus(ref TEvent evt, int p) - { - SetAgent(); + xdwtable dw_detail; + xstring m_operate; + xstring m_sguid; + xstring m_tvOrgID; + xstring m_tvOrgName; + xstring m_tvRootOrgID; + xstring m_tvRootOrgName; - //重置工具条 - return 1; - } + xnode m_agentNode; //Agent Condition + xstring m_agentCond; //Agent Node +public: + HrOrgMaint(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static HrOrgMaint* CreateInstance(void* implPtr, void* hWnd) + { + HrOrgMaint* pWin = new HrOrgMaint(implPtr, (HWND)hWnd); + return pWin; + } + int SetAgent() + { + xstring xfNodeAgentArea = L"agentarea"; + xnode anode = GetAgentNode(xfNodeAgentArea); + if (m_agentNode) + { + SetAgentNode(anode, m_agentNode); + } + else + { + KXMLDOMElement xframeElement = GetElement(); + KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); + if (agent) + { + xstring s = agent.xml(); + m_agentNode = SetAgentNode(anode, s); + } + } + return 1; + } - int OnRetrieve() - { - xml__ x = new xml__; - x.setNativePointer(x.CreateInstance()); - xaserverarg__ arg = new xaserverarg__; - arg.setNativePointer(arg.CreateInstance()); - arg.AddArg("guid", m_sguid); - if (url::get("OrganizationStruct/detail.HrOrg", arg.GetString(), x) != 1) - { - trace(x.GetXmlDoc().text); - return -1; - } - else - { - trace(x.GetXml()); - dw_detail.Retrieve(x); - dw_detail.Redraw(); - } - return 1; - } + //焦点激活处理函数 + int OnSetFocus(TEvent* evt, LPARAM param) + { + SetAgent(); - int OnSave() - { - int hIcon = xutil__::SetCursorWait(); - //dw_detail.AcceptText(); - string val; - xml__ x = new xml__; - x.setNativePointer(x.CreateInstance()); - var xdoc = x.GetXmlDoc(); - dw_detail.DwUpdateAllTo(xdoc); - val = xdoc.xml; - //trace(val); - //return 1; - xaserverarg__ args = new xaserverarg__; - args.setNativePointer(args.CreateInstance()); - args.AddArg("content", val); - //trace(val); - xml__ x1 = new xml__; - x1.setNativePointer(x1.CreateInstance()); - if (url::post("OrganizationStruct/update.HrOrg", args.GetString(), x1) != 1) - { - string error = x1.GetXmlDoc().text; - trace(error); - } - else - { - win__::MessageBox(GetHWND(), "保存成功!", "提示", 0); - } - dw_detail.ResetUpdateStatus(); - xutil__::RestoreCursor(hIcon); - return 1; - } + //重置工具条 + return 1; + } - int OnNew() - { - dw_detail.openUrl("组织架构.vface/template/HrOrg/detail"); - if (m_operate == "new0") - { - dw_detail.SetItemString(1, "ParentOrgID", m_tvOrgID); - dw_detail.SetItemDisplayString(1, "ParentOrgID", m_tvOrgName); - } - dw_detail.SetItemString(1, "Status", "Y"); - //dw_detail.SetItemDisplayString(1,"Status","有效"); - return 1; - } + int OnRetrieve() + { + xml x; - //命令发布函数 - int OnCmdDispatch(string comdid) - { - if (comdid == "New") OnNew(); - if (comdid == "Save") OnSave(); - if (comdid == "xmOk") OnSave(); - if (comdid == "xmCancel") CloseWindow(); - return 0; - } + xaserverarg arg; - //命令处理事件 - int OnXCommand(ref TXCommandEvent evt, int p) - { - return OnCmdDispatch(evt.pStrID); - } + arg.AddArg(L"guid", m_sguid); + if (xurl::get(L"OrganizationStruct/detail.HrOrg", arg.GetString(), x) != 1) + { + trace(x.text()); + return -1; + } + else + { + trace(x.xml()); + dw_detail.Retrieve(x); + dw_detail.Redraw(); + } + return 1; + } - int OnChildContent(ref TNotifyEvent evt, int p) - { - ref DWNMHDR dwhdr = evt.pnmh; - string col = dwhdr.colname; - if (col != "") { - xml__ x = new xml__; - x.setNativePointer(x.CreateInstance()); - xaserverarg__ arg = new xaserverarg__; - arg.setNativePointer(arg.CreateInstance()); - string query; - query = "[IResourceMSSql.xq]"; - if (col == "OrgTypeID") { - arg.AddArg("ResourceType", "HrOrgType");//组织类型 - } - else if (col == "OrgAddress000") { - arg.AddArg("ResourceType", "HR_Address");//组织地址 - } - else if (col == "CompanyID") { - arg.AddArg("ResourceType", "CompanyInfo");//所属法人 - } - else if (col == "OrgProLine") { - arg.AddArg("ResourceType", "OrgProLine");//产品线 - } - if (xaserver__::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) - dwhdr.data = x.GetXml(); - //trace(x.GetXml()); - } - return 1; - } - int OnClicked(ref TNotifyEvent evt, int p) - { - ref DWNMHDR hdr = evt.pnmh; + int OnSave() + { + HCURSOR hIcon = xutil::SetCursorWait(); + //dw_detail.AcceptText(); + xstring val; + xml x; - xaserverarg__ arg = new xaserverarg__; - arg.setNativePointer(arg.CreateInstance()); + auto xdoc = x; + dw_detail.DwUpdateAllTo(xdoc); + val = xdoc.xml(); + //trace(val); + //return 1; + xaserverarg args; + args.setNativePointer(args.CreateInstance()); + args.AddArg(L"content", val); + //trace(val); + xml x1; - string colname = hdr.colname; - if (colname == "ParentOrgID") - { - openUrl("组织架构.vface/xpage/HrOrg/Chart", arg); - //trace(arg.GetString()); - string comdid = arg.GetArgString("comdid"); - if (comdid == "xmOk") - { - string OrgName = arg.GetArgString("OrgName"); - string OrgID = arg.GetArgString("OrgId"); - dw_detail.SetItemDisplayString(1, "ParentOrgID", OrgName); - dw_detail.SetItemString(1, "ParentOrgID", OrgID); - dw_detail.Redraw(); - } - } - if (colname == "LeaderID") - { - openUrl("组织架构.vface/xpage/hremployee/select", arg); - comdid = arg.GetArgString("comdid"); - if (comdid == "xmOk") - { - string sPersonID = arg.GetArgString("sPersonID"); - //trace(sPersonID); - string sPersonName = arg.GetArgString("sPersonName"); - dw_detail.SetItemDisplayString(1, colname, sPersonName); - dw_detail.SetItemString(1, colname, sPersonID); - dw_detail.Redraw(); - } - } - return 1; - } + if (xurl::post(L"OrganizationStruct/update.HrOrg", args.GetString(), x1) != 1) + { + xstring error = x1.text(); + trace(error); + } + else + { + MessageBox(GetHWND(), L"保存成功!", L"提示", 0); + } + dw_detail.ResetUpdateStatus(); + xutil::RestoreCursor(hIcon); + return 1; + } - int OnAttachEvent() - { - //绑定工具条点击事件 - AttachEvent("WM_XCOMMAND", OnXCommand); - //获取焦点事件,用于重置工具条 - AttachEvent("WM_SETFOCUS", OnSetFocus); - //下拉框 提供内容 - AttachEvent("dw_detail", "DWV_CHILDCONTENT", OnChildContent); - AttachEvent("dw_detail", "DWV_ITEMFOCUSCHANGED", OnClicked); - } + int OnNew() + { + dw_detail.openUrl(L"组织架构.vface/template/HrOrg/detail"); + if (m_operate == L"new0") + { + dw_detail.SetItemString(1, L"ParentOrgID", m_tvOrgID); + dw_detail.SetItemDisplayString(1, L"ParentOrgID", m_tvOrgName); + } + dw_detail.SetItemString(1, L"Status", L"Y"); + //dw_detail.SetItemDisplayString(1,L"Status",L"有效"); + return 1; + } + + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + if (comdid == L"New") OnNew(); + if (comdid == L"Save") OnSave(); + if (comdid == L"xmOk") OnSave(); + if (comdid == L"xmCancel") CloseWindow(); + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnChildContent(TEvent* evt, LPARAM p) + { + DWNMHDR& dwhdr = *(DWNMHDR*)evt->notify.pnmh; + xstring col = dwhdr.colname; + if (col != L"") { + xml x; + + xaserverarg arg; + + xstring query; + query = L"[IResourceMSSql.xq]"; + if (col == L"OrgTypeID") { + arg.AddArg(L"ResourceType", L"HrOrgType");//组织类型 + } + else if (col == L"OrgAddress000") { + arg.AddArg(L"ResourceType", L"HR_Address");//组织地址 + } + else if (col == L"CompanyID") { + arg.AddArg(L"ResourceType", L"CompanyInfo");//所属法人 + } + else if (col == L"OrgProLine") { + arg.AddArg(L"ResourceType", L"OrgProLine");//产品线 + } + if (xaserver::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) + dwhdr.data = x.xml(); + //trace(x.GetXml()); + } + return 1; + } + int OnClicked(TEvent* evt, LPARAM p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + + xaserverarg& arg = *new xaserverarg; - int OnInitial() - { - SetAgent(); - OnAttachEvent(); - return 1; - } + xstring colname = hdr.colname; + if (colname == L"ParentOrgID") + { + openUrl(L"组织架构.vface/xpage/HrOrg/Chart", &arg); + //trace(arg.GetString()); + xstring comdid = arg.GetArgString(L"comdid"); + if (comdid == L"xmOk") + { + xstring OrgName = arg.GetArgString(L"OrgName"); + xstring OrgID = arg.GetArgString(L"OrgId"); + dw_detail.SetItemDisplayString(1, L"ParentOrgID", OrgName); + dw_detail.SetItemString(1, L"ParentOrgID", OrgID); + dw_detail.Redraw(); + } + } + if (colname == L"LeaderID") + { + openUrl(L"组织架构.vface/xpage/hremployee/select", &arg); + xstring comdid = arg.GetArgString(L"comdid"); + if (comdid == L"xmOk") + { + xstring sPersonID = arg.GetArgString(L"sPersonID"); + //trace(sPersonID); + xstring sPersonName = arg.GetArgString(L"sPersonName"); + dw_detail.SetItemDisplayString(1, colname.c_str(), sPersonName); + dw_detail.SetItemString(1, colname.c_str(), sPersonID); + dw_detail.Redraw(); + } + } + return 1; + } - int onload() - { - dw_detail = new xdwtable__; - dw_detail.setNativePointer(this.GetControl("dw_detail")); - dw_detail.openUrl("组织架构.vface/template/HrOrg/detail"); - OnInitial(); + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&HrOrgMaint::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&HrOrgMaint::OnSetFocus); + //下拉框 提供内容 + AttachEvent(L"dw_detail", L"DWV_CHILDCONTENT", (FEvent)&HrOrgMaint::OnChildContent); + AttachEvent(L"dw_detail", L"DWV_ITEMFOCUSCHANGED", (FEvent)&HrOrgMaint::OnClicked); + return 1; + } - xaserverarg__ arg = new xaserverarg__; - arg.setNativePointer(arg.CreateInstance()); - arg = this.GetParam(); - if (arg) - { - m_operate = arg.GetArgString("operate"); - m_sguid = arg.GetArgString("guid"); - m_tvOrgID = arg.GetArgString("tvOrgID");//组织树的ID - m_tvOrgName = arg.GetArgString("tvOrgName");//组织树的Name - m_tvRootOrgID = arg.GetArgString("tvRootOrgID");//组织树的ID - m_tvRootOrgName = arg.GetArgString("tvRootOrgName");//组织树的Name - //alert(m_tvRootOrgName); - } - /*if ( m_sguid == "" || m_sguid == nil) - { - m_sguid = win__::GetGuid();//错误 - trace(m_sguid); - }*/ - if (m_sguid != "") { - OnRetrieve(); - }; - if (m_operate == "new0") - { - //trace(m_tvOrgID); - dw_detail.SetItemString(1, "ParentOrgID", m_tvOrgID); - dw_detail.SetItemDisplayString(1, "ParentOrgID", m_tvOrgName); - dw_detail.SetItemString(1, "CompanyID", m_tvRootOrgID); - dw_detail.SetItemDisplayString(1, "CompanyID", m_tvRootOrgName); - dw_detail.SetItemString(1, "Status", "Y"); - //dw_detail.SetItemDisplayString(1,"Status","有效"); - } - return 1; - } - ] - ] -] \ No newline at end of file + int OnInitial() + { + SetAgent(); + OnAttachEvent(); + return 1; + } + + int onload() + { + SetArg(); + dw_detail = new xdwtable; + dw_detail.setNativePointer(GetControl(L"dw_detail")); + dw_detail.openUrl(L"组织架构.vface/template/HrOrg/detail"); + OnInitial(); + + xaserverarg arg; + + arg = GetArg(); + if (arg) + { + m_operate = arg.GetArgString(L"operate"); + m_sguid = arg.GetArgString(L"guid"); + m_tvOrgID = arg.GetArgString(L"tvOrgID");//组织树的ID + m_tvOrgName = arg.GetArgString(L"tvOrgName");//组织树的Name + m_tvRootOrgID = arg.GetArgString(L"tvRootOrgID");//组织树的ID + m_tvRootOrgName = arg.GetArgString(L"tvRootOrgName");//组织树的Name + //alert(m_tvRootOrgName); + } + /*if ( m_sguid == L"" || m_sguid == nil) + { + m_sguid = GetGuid();//错误 + trace(m_sguid); + }*/ + if (m_sguid != L"") { + OnRetrieve(); + }; + if (m_operate == L"new0") + { + //trace(m_tvOrgID); + dw_detail.SetItemString(1, L"ParentOrgID", m_tvOrgID); + dw_detail.SetItemDisplayString(1, L"ParentOrgID", m_tvOrgName); + dw_detail.SetItemString(1, L"CompanyID", m_tvRootOrgID); + dw_detail.SetItemDisplayString(1, L"CompanyID", m_tvRootOrgName); + dw_detail.SetItemString(1, L"Status", L"Y"); + //dw_detail.SetItemDisplayString(1,L"Status",L"有效"); + } + return 1; + } +}; \ No newline at end of file -- Gitblit v1.9.3