From f22bb7edb66856f3d1b6e44d6f6b170848a48dd7 Mon Sep 17 00:00:00 2001 From: xj qian <qianxj15@sina.com> Date: 星期二, 16 七月 2024 08:37:26 +0800 Subject: [PATCH] updte --- jrj/project/business/Company/HrEmployeeAdd.cpp | 265 +++++++++++++++++++++++++--------------------------- 1 files changed, 129 insertions(+), 136 deletions(-) diff --git a/jrj/project/business/Company/HrEmployeeAdd.cpp b/jrj/project/business/Company/HrEmployeeAdd.cpp index 904dfff..4de852c 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,143 @@ 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; - int OnOK() - { - if (GetParam()) - { - lw_obj = new HrEmployee; - lw_obj.setNativePointer(GetParam()); - lw_obj = GetParam(); - } - else - return 0; + xaserverarg arg; - int row = dw_list.GetNextSelectRow(1); - if (row < 1) - { - alert(L"请选择人员!"); - return 1; - } + 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; + } - 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(); - } + int OnOK() + { + if (GetWinParam()) + { + lw_obj = (HrEmployee*)GetWinParam(); + } + else + return 0; - 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""; + int row = dw_list.GetNextSelectRow(1); + if (row < 1) + { + alert(L"请选择人员!"); + return 1; + } - 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); + 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(); + } - 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); + 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(); - 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"); + 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); - row = dw_list.GetNextSelectRow(row + 1); - } - CloseWindow(); - return 1; - } + 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); - //命令发布函数 - int OnCmdDispatch(xstring comdid) - { - if (comdid == L"xmOk") - OnOK(); - else if (comdid == L"query") - OnRetrieve(); - else if (comdid == L"xmCancel") - CloseWindow(); - return 0; - } + 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"); - //命令处理事件 - int OnXCommand(TEvent* evt, LPARAM param) - { - return OnCmdDispatch(evt->xcommand.pStrID); - } + row = dw_list.GetNextSelectRow(row + 1); + } + CloseWindow(); + return 1; + } - int OnAttachEvent() - { - //绑定工具条点击事件 - AttachEvent(L"WM_XCOMMAND", (FEvent)&HrEmployeeAdd::OnXCommand); - //获取焦点事件,用于重置工具条 - AttachEvent(L"WM_SETFOCUS", (FEvent)&HrEmployeeAdd::OnSetFocus); - 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 OnInitial() - { - SetAgent(); - OnAttachEvent(); - return 1; - } + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } - 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 OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&HrEmployeeAdd::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&HrEmployeeAdd::OnSetFocus); + return 1; + } - OnInitial(); - OnRetrieve(); + int OnInitial() + { + SetAgent(); + OnAttachEvent(); + return 1; + } - 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); - ] -] \ No newline at end of file + OnInitial(); + OnRetrieve(); + + return 1; + } +}; \ No newline at end of file -- Gitblit v1.9.3