From 5b84edb6183ab2eb8554021c631d8550ebbf6dfa Mon Sep 17 00:00:00 2001 From: LiFan <2308045698@qq.com> Date: 星期四, 07 十一月 2024 10:33:56 +0800 Subject: [PATCH] update --- jrj/project/business/Company/HrEmployeeAdd.cpp | 265 +++++++++++++++++++++++++--------------------------- 1 files changed, 128 insertions(+), 137 deletions(-) diff --git a/jrj/project/business/Company/HrEmployeeAdd.cpp b/jrj/project/business/Company/HrEmployeeAdd.cpp index 904dfff..1c330ef 100644 --- a/jrj/project/business/Company/HrEmployeeAdd.cpp +++ b/jrj/project/business/Company/HrEmployeeAdd.cpp @@ -6,17 +6,18 @@ #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" #include "viewobject/view.base.hpp" +#include "hremployee.hpp" using xml = KXMLDOMDocument; class __declspec(dllexport) HrEmployeeAdd : public xframe { public: - HrEmployee lw_obj; - xdwgrid dw_list; + HrEmployee* lw_obj; + xdwgrid dw_list; - xnode m_agentNode; //Agent Condition - xstring m_agentCond; //Agent Node - xstring m_sTxt; + xnode m_agentNode; //Agent Condition + xstring m_agentCond; //Agent Node + xstring m_sTxt; public: HrEmployeeAdd(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} public: @@ -46,151 +47,141 @@ return 1; } - //焦点激活处理函数 - int OnSetFocus(TEvent* evt, LPARAM param) - { - SetAgent(); - //重置工具条 - return 1; - } + //焦点激活处理函数 + int OnSetFocus(TEvent* evt, LPARAM param) + { + SetAgent(); + //重置工具条 + return 1; + } - int OnRetrieve() - { - control xc = new control; - xc.setNativePointer(GetControl(L"QueryTxt")); - m_sTxt = xc.GetText() + L""; - xml x ; - - xaserverarg arg; - - arg.AddArg(L"sTxt", m_sTxt); - if (xurl::post(L"OrganizationStruct/select.Employee", arg.GetString(), x) != 1) - { - trace(x.text()); - return -1; - } - else - { - dw_list.Retrieve(x); - dw_list.Redraw(); - dw_list.SetReadOnly(true); - } - return 1; - } + int OnRetrieve() + { + xcontrol xc = GetControl(L"QueryTxt"); + m_sTxt = xc.GetText() + L""; + xml x; + xaserverarg arg; + arg.AddArg(L"sTxt", m_sTxt); + if (xurl::post(L"OrganizationStruct/select.Employee", arg.GetString(), x) != 1) + { + trace(x.text()); + return -1; + } + else + { + dw_list.Retrieve(x); + dw_list.Redraw(); + dw_list.SetReadOnly(true); + } + return 1; + } - int OnOK() - { - if (GetParam()) - { - lw_obj = new HrEmployee; - lw_obj.setNativePointer(GetParam()); - lw_obj = GetParam(); - } - else - return 0; + int OnOK() + { + if (GetWinParam()) + { + lw_obj = (HrEmployee*)GetWinParam(); + } + else + return 0; - int row = dw_list.GetNextSelectRow(1); - if (row < 1) - { - alert(L"请选择人员!"); - return 1; - } + int row = dw_list.GetNextSelectRow(1); + if (row < 1) + { + alert(L"请选择人员!"); + return 1; + } - xstring sPositionID, sPositionName; - xstring sOrgID, sOrgName; - xstring sJobID, sJobName; - int wid = lw_obj.tv_org.GetId(); - int hitem = treeview::GetSelectedItem(wid); - KXMLDOMElement ele = treeview::GetItemData(wid, hitem); - if (ele) - { - sPositionID = ele.selectSingleNode(L"id").text(); - sPositionName = ele.selectSingleNode(L"name").text(); - sOrgID = ele.selectSingleNode(L"OrgID").text(); - sOrgName = ele.selectSingleNode(L"OrgName").text(); - sJobID = ele.selectSingleNode(L"JobID").text(); - sJobName = ele.selectSingleNode(L"JobName").text(); - } + xstring sPositionID, sPositionName; + xstring sOrgID, sOrgName; + xstring sJobID, sJobName; + KXMLDOMElement ele = lw_obj->tv_org.GetItemData(lw_obj->tv_org.GetSelectedItem()); + if (ele) + { + sPositionID = ele.selectSingleNode(L"id").text(); + sPositionName = ele.selectSingleNode(L"name").text(); + sOrgID = ele.selectSingleNode(L"OrgID").text(); + sOrgName = ele.selectSingleNode(L"OrgName").text(); + sJobID = ele.selectSingleNode(L"JobID").text(); + sJobName = ele.selectSingleNode(L"JobName").text(); + } - while (row > 0) - { - KXMLDOMElement e = dw_list.GetRowElement(row); - xstring sEmployeeNo = e.selectSingleNode(L"EmployeeNo").text + L""; - xstring sPersonID = e.selectSingleNode(L"PersonID").text + L""; - xstring sPersonName = e.selectSingleNode(L"Name").text + L""; + while (row > 0) + { + KXMLDOMElement e = dw_list.GetRowElement(row); + xstring sEmployeeNo = e.selectSingleNode(L"EmployeeNo").text(); + xstring sPersonID = e.selectSingleNode(L"PersonID").text(); + xstring sPersonName = e.selectSingleNode(L"Name").text(); - int nRow = lw_obj.dw_emp.InsertRow(0); - lw_obj.dw_emp.SetItemString(nRow, L"EmployeeNo", sEmployeeNo); - lw_obj.dw_emp.SetItemString(nRow, L"PersonID", sPersonID); - lw_obj.dw_emp.SetItemDisplayString(nRow, L"PersonID", sPersonName); + int nRow = lw_obj->dw_emp.InsertRow(0); + lw_obj->dw_emp.SetItemString(nRow, L"EmployeeNo", sEmployeeNo); + lw_obj->dw_emp.SetItemString(nRow, L"PersonID", sPersonID); + lw_obj->dw_emp.SetItemDisplayString(nRow, L"PersonID", sPersonName); - lw_obj.dw_emp.SetItemString(nRow, L"PositionID", sPositionID); - lw_obj.dw_emp.SetItemDisplayString(nRow, L"PositionID", sPositionName); - lw_obj.dw_emp.SetItemString(nRow, L"OrgID", sOrgID); - lw_obj.dw_emp.SetItemDisplayString(nRow, L"OrgID", sOrgName); - lw_obj.dw_emp.SetItemString(nRow, L"JobID", sJobID); - lw_obj.dw_emp.SetItemDisplayString(nRow, L"JobID", sJobName); + lw_obj->dw_emp.SetItemString(nRow, L"PositionID", sPositionID); + lw_obj->dw_emp.SetItemDisplayString(nRow, L"PositionID", sPositionName); + lw_obj->dw_emp.SetItemString(nRow, L"OrgID", sOrgID); + lw_obj->dw_emp.SetItemDisplayString(nRow, L"OrgID", sOrgName); + lw_obj->dw_emp.SetItemString(nRow, L"JobID", sJobID); + lw_obj->dw_emp.SetItemDisplayString(nRow, L"JobID", sJobName); - lw_obj.dw_emp.SetItemString(nRow, L"Status", L"Y"); - lw_obj.dw_emp.SetItemDisplayString(nRow, L"Status", L"有效"); - xstring sdate = publiccode::GetCurDate() + L""; - lw_obj.dw_emp.SetItemString(nRow, L"StartDate", sdate + L""); - lw_obj.dw_emp.SetItemString(nRow, L"EndDate", L"2050-12-31"); + lw_obj->dw_emp.SetItemString(nRow, L"Status", L"Y"); + lw_obj->dw_emp.SetItemDisplayString(nRow, L"Status", L"有效"); + xstring sdate = publiccode::GetCurrentDate(); + lw_obj->dw_emp.SetItemString(nRow, L"StartDate", sdate); + lw_obj->dw_emp.SetItemString(nRow, L"EndDate", L"2050-12-31"); - row = dw_list.GetNextSelectRow(row + 1); - } - CloseWindow(); - return 1; - } + row = dw_list.GetNextSelectRow(row + 1); + } + CloseWindow(); + return 1; + } - //命令发布函数 - int OnCmdDispatch(xstring comdid) - { - if (comdid == L"xmOk") - OnOK(); - else if (comdid == L"query") - OnRetrieve(); - else if (comdid == L"xmCancel") - CloseWindow(); - return 0; - } + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + if (comdid == L"xmOk") + OnOK(); + else if (comdid == L"query") + OnRetrieve(); + else if (comdid == L"xmCancel") + CloseWindow(); + return 0; + } - //命令处理事件 - int OnXCommand(TEvent* evt, LPARAM param) - { - return OnCmdDispatch(evt->xcommand.pStrID); - } + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } - int OnAttachEvent() - { - //绑定工具条点击事件 - AttachEvent(L"WM_XCOMMAND", (FEvent)&HrEmployeeAdd::OnXCommand); - //获取焦点事件,用于重置工具条 - AttachEvent(L"WM_SETFOCUS", (FEvent)&HrEmployeeAdd::OnSetFocus); - return 1; - } + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&HrEmployeeAdd::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&HrEmployeeAdd::OnSetFocus); + return 1; + } - int OnInitial() - { - SetAgent(); - OnAttachEvent(); - 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/HrEmployee/PersonSel"); - dw_list.SetSelectionMode(3); //3 - dw_list.SetReadOnly(true); + int onload() + { + dw_list = new xdwgrid; + dw_list.setNativePointer(GetControl(L"dw_list")); + dw_list.openUrl(L"组织架构.vface/template/HrEmployee/PersonSel"); + dw_list.SetSelectionMode(3); //3 + dw_list.SetReadOnly(true); - OnInitial(); - OnRetrieve(); + OnInitial(); + OnRetrieve(); - return 1; - } - ] - - ] -] \ No newline at end of file + return 1; + } +}; \ No newline at end of file -- Gitblit v1.9.3