From ff3a1ed12e84447954c8ac76ba8712f209504f04 Mon Sep 17 00:00:00 2001 From: LiFan <2308045698@qq.com> Date: 星期一, 15 七月 2024 17:54:46 +0800 Subject: [PATCH] update --- jrj/project/business/Company/HrPosition.cpp | 287 +++++++++++++++++++++++++++++---------------------------- 1 files changed, 145 insertions(+), 142 deletions(-) diff --git a/jrj/project/business/Company/HrPosition.cpp b/jrj/project/business/Company/HrPosition.cpp index 3acacfb..de946c5 100644 --- a/jrj/project/business/Company/HrPosition.cpp +++ b/jrj/project/business/Company/HrPosition.cpp @@ -1,50 +1,54 @@ -use "win.vl" -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 "frame.vl" -use "treeview.vm" +#include <wobject/xstring.hpp> +#include <xcontrol/xtreeview.hpp> +#include <xcontrol/xdwgrid.hpp> +#include <wobject/xdouble.hpp> +#include <xcontrol/xlayersheet.hpp> -//unit vclient.vobject tpp -unit vbusiness.xpage -[ - HrPosition is extend frame; - about HrPosition - [ - field: - [ - treeview__ tv_org; - xdwgrid__ dw_list; - string sOrgID; - string sOrgName; +#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" +#include "viewobject/view.base.hpp" - xnode__ m_agentNode; //Agent Condition - string m_agentCond; //Agent Node - ] +using xml = KXMLDOMDocument; +class __declspec(dllexport) HrPosition : public xframe +{ +public: + xtreeview tv_org; + xdwgrid dw_list; + xstring sOrgID; + xstring sOrgName; - method: - [ - 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; - } + xnode m_agentNode; //Agent Condition + xstring m_agentCond; //Agent Node +public: + HrPosition(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static HrPosition* CreateInstance(void* implPtr, void* hWnd) + { + HrPosition* pWin = new HrPosition(implPtr, (HWND)hWnd); + return pWin; + } + int SetAgent() + { + xstring xfNodeAgentArea = L"agentarea"; + xnode anode = GetAgentNode(xfNodeAgentArea); + if (m_agentNode) + { + SetAgentNode(anode, m_agentNode); + } + else + { + KXMLDOMElement xframeElement = GetElement(); + KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); + if (agent) + { + xstring s = agent.xml(); + m_agentNode = SetAgentNode(anode, s); + } + } + return 1; + } //焦点激活处理函数 - int OnSetFocus(ref TEvent evt, int param) + int OnSetFocus(TEvent* evt, LPARAM param) { SetAgent(); @@ -52,82 +56,82 @@ return 1; } - int OnRetrieve(string ls_orgid) + int OnRetrieve(xstring ls_orgid) { - string query = "[MSSqlHrPosition.xq]"; - xml__ x = new xml__; - x.setNativePointer(x.CreateInstance()); - xaserverarg__ arg = new xaserverarg__; - arg.setNativePointer(arg.CreateInstance()); - arg.AddArg("orgID", ls_orgid); - //if (xaserver__::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1) - if (url::post("OrganizationStruct/list.Position", arg.GetString(), x) != 1) + xstring query = L"[MSSqlHrPosition.xq]"; + xml x; + + xaserverarg arg; + + arg.AddArg(L"orgID", ls_orgid); + //if (xaserver::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1) + if (xurl::post(L"OrganizationStruct/list.Position", arg.GetString(), x) != 1) { - trace(x.GetXmlDoc().text); + trace(x.text()); return -1; } else { //trace(x.GetXml()); - //dw_list.openUrl("组织架构.vface/template/HrPosition/list"); + //dw_list.openUrl(L"组织架构.vface/template/HrPosition/list"); dw_list.Retrieve(x); dw_list.Redraw(); } return 1; } - int OnTreeSelChanged(ref TXCommandEvent evt, int p) + int OnTreeSelChanged(TEvent* evt, int p) { - int wid = tv_org.GetId(); - int hitem = treeview__::GetSelectedItem(wid); - msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); - string ls_orgid = ele.selectSingleNode("@guid").text; - sOrgID = ls_orgid + ""; - sOrgName = ele.selectSingleNode("OrgName").text; + //int wid = tv_org.GetId(); + HTREEITEM hitem = tv_org.GetSelectedItem(); + KXMLDOMElement ele = tv_org.GetItemData(hitem); + xstring ls_orgid = ele.selectSingleNode(L"@guid").text(); + sOrgID = ls_orgid + L""; + sOrgName = ele.selectSingleNode(L"OrgName").text(); OnRetrieve(ls_orgid); return 1; } int OnSave() { - xml__ x = new xml__; - x.setNativePointer(x.CreateInstance()); - dw_list.AcceptText(); - dw_list.DwUpdateAllToEx(x.GetXmlDoc()); + xml x; - string xdata = x.GetXml(); - xaserverarg__ arg = new xaserverarg__; - arg.setNativePointer(arg.CreateInstance()); - arg.AddArg("xdata", xdata); + dw_list.AcceptText(); + dw_list.DwUpdateAllToEx(x); + + xstring xdata = x.xml(); + xaserverarg arg; + + arg.AddArg(L"xdata", xdata); //trace(x.GetXml()); //return 1; - //string xAction="[MSSqlHrPositionUpdate.xa]"; - //if(xaserver__::ExecXAction(GetServerUrl(),xAction,arg.GetString())!=1) - if (url::post("OrganizationStruct/update.Position", arg.GetString(), x) != 1) + //xstring xAction=L"[MSSqlHrPositionUpdate.xa]"; + //if(xaserver::ExecXAction(GetServerUrl(),xAction,arg.GetString())!=1) + if (xurl::post(L"OrganizationStruct/update.Position", arg.GetString(), x) != 1) { - trace(x.GetXmlDoc().documentElement.text); - alert("保存失败1"); + trace(x.documentElement().text()); + alert(L"保存失败1"); } else { dw_list.ResetUpdateStatus(); - alert("保存成功"); + alert(L"保存成功"); } return 1; } int OnAddRow() { - int wid = tv_org.GetId(); - int hitem = treeview__::GetSelectedItem(wid); + //int wid = tv_org.GetId(); + HTREEITEM hitem = tv_org.GetSelectedItem(); if (!hitem) { - alert("请选择组织架构!"); + alert(L"请选择组织架构!"); return 0; } - //openUrl("组织架构.vface/xpage/Hr/HrPositionAdd", this); - OpenWindow("dev:xpage[HrPositionAdd.vx]", this); + //openUrl(L"组织架构.vface/xpage/Hr/HrPositionAdd", this); + OpenWindow(L"dev:xpage[HrPositionAdd.vx]", this); return 1; } @@ -143,102 +147,104 @@ int row = dw_list.GetRow(); if (row > 0) { - string sPositionName = dw_list.GetItemString(row, "PositionName", 0); - int del_flog = win__::MessageBox(0, "确定要删除选中的岗位 " + sPositionName + " 吗?", "提示", 4); + xstring sPositionName = dw_list.GetItemString(row, L"PositionName"); + int del_flog =MessageBox(0, L"确定要删除选中的岗位 " + sPositionName + L" 吗?", L"提示", 4); if (del_flog == 7) { return 0; } //判断HrEmployee里面是否存在该岗位 - //string sPositionID = dw_list.GetItemString(row,"PositionID",0); - msxml::IXMLDOMElement e = dw_list.GetRowElement(row); - string sPositionID = e.selectSingleNode("@guid").text; - xml__ x = new xml__; - x.setNativePointer(x.CreateInstance()); - xaserverarg__ args = new xaserverarg__; - args.setNativePointer(args.CreateInstance()); - args.AddArg("guid", sPositionID); - //if(xaserver__::ExecXQuery(GetServerUrl(),"[HrpositionSel.xq]",args.GetString(),x)!=1) - if (url::post("OrganizationStruct/select.Position", args.GetString(), x) != 1) + //xstring sPositionID = dw_list.GetItemString(row,L"PositionID",0); + KXMLDOMElement e = dw_list.GetRowElement(row); + xstring sPositionID = e.selectSingleNode(L"@guid").text(); + xml x; + + xaserverarg args; + + args.AddArg(L"guid", sPositionID); + //if(xaserver::ExecXQuery(GetServerUrl(),L"[HrpositionSel.xq]",args.GetString(),x)!=1) + if (xurl::post(L"OrganizationStruct/select.Position", args.GetString(), x) != 1) { - trace(x.GetXml()); + trace(x.xml()); return 0; } - var doc = x.GetXmlDoc(); - string cnt = doc.text; + var doc = x; + xstring cnt = doc.text(); int ll_cnt = cnt.toInt(); if (ll_cnt == 0) //判断HrEmploee里面是否存在该岗位 { args.ClearArgs(); - //xaserverarg__ Args = new xaserverarg__; + //xaserverarg Args; //Args.setNativePointer(Args.CreateInstance()); - args.AddArg("guid", sPositionID); - //if(xaserver__::ExecXAction(GetServerUrl(),"[HrPositionDel.xa]",Args.GetString(),x)!=1) - if (url::post("OrganizationStruct/delete.Position", args.GetString(), x) != 1) + args.AddArg(L"guid", sPositionID); + //if(xaserver::ExecXAction(GetServerUrl(),L"[HrPositionDel.xa]",Args.GetString(),x)!=1) + if (xurl::post(L"OrganizationStruct/delete.Position", args.GetString(), x) != 1) { - trace(x.GetXmlDoc().documentElement.text); - alert("删除失败"); + trace(x.documentElement().text()); + alert(L"删除失败"); } else { dw_list.DeleteRow(row); - alert("删除成功"); + alert(L"删除成功"); } } else { - alert("其他地方已经使用该岗位,不允许删除!"); + alert(L"其他地方已经使用该岗位,不允许删除!"); return 0; } } return 1; } - int OnChildContent(ref TNotifyEvent evt, int param) { - 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 == "OrgID") { - arg.AddArg("ResourceType", "HrOrg"); + int OnChildContent(TEvent* evt, int 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"OrgID") { + arg.AddArg(L"ResourceType", L"HrOrg"); } - else if (col == "JobID") { - arg.AddArg("ResourceType", "HrJob"); + else if (col == L"JobID") { + arg.AddArg(L"ResourceType", L"HrJob"); } - if (xaserver__::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) - dwhdr.data = x.GetXml(); + if (xaserver::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) + dwhdr.data = x.xml(); //trace(x.GetXml()); } return 1; } //命令发布函数 - int OnCmdDispatch(string comdid) + int OnCmdDispatch(xstring comdid) { - if (comdid == "Save") OnSave(); - else if (comdid == "AddRow") OnAddRow(); - else if (comdid == "InsertRow") OnInsertRow(); - else if (comdid == "DeleteRow") OnDeleteRow(); + if (comdid == L"Save") OnSave(); + else if (comdid == L"AddRow") OnAddRow(); + else if (comdid == L"InsertRow") OnInsertRow(); + else if (comdid == L"DeleteRow") OnDeleteRow(); return 0; } //命令处理事件 - int OnXCommand(ref TXCommandEvent evt, int param) + int OnXCommand(TEvent* evt, LPARAM param) { - return OnCmdDispatch(evt.pStrID); + return OnCmdDispatch(evt->xcommand.pStrID); } int OnAttachEvent() { //绑定工具条点击事件 - AttachEvent("WM_XCOMMAND", OnXCommand); + AttachEvent(L"WM_XCOMMAND", (FEvent)&HrPosition::OnXCommand); //获取焦点事件,用于重置工具条 - AttachEvent("WM_SETFOCUS", OnSetFocus); + AttachEvent(L"WM_SETFOCUS", (FEvent)&HrPosition::OnSetFocus); //获得树的选择事件 - AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelChanged); - //AttachEvent("dw_list","DWV_CHILDCONTENT",OnChildContent); - //AttachEvent("dw_list","DWV_ITEMCHANGED",OnItemChanged); + AttachEvent(L"tv_org", L"TVN_SELCHANGED", (FEvent)&HrPosition::OnTreeSelChanged); + //AttachEvent(L"dw_list",L"DWV_CHILDCONTENT",OnChildContent); + //AttachEvent(L"dw_list",L"DWV_ITEMCHANGED",OnItemChanged); + return 1; } int OnInitial() @@ -250,22 +256,19 @@ 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/HrPosition/list"); + 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/HrPosition/list"); OnInitial(); - int wid = tv_org.GetId(); - int root = treeview__::GetRootItem(wid); - treeview__::ExpandItem(wid, root); + //int wid = tv_org.GetId(); + HTREEITEM root = tv_org.GetRootItem(); + tv_org.ExpandItem( root); //OnRetrieve(); return 1; } - ] - - ] -] \ No newline at end of file +}; \ No newline at end of file -- Gitblit v1.9.3