Merge branch 'master' of http://116.62.18.175:6699/r/mis-prj
| | |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\CompanyList.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\CompanyMaint.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | |
| | | 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 |
| | | [ |
| | | CompanyList is extend list; |
| | | about CompanyList |
| | | [ |
| | | 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; |
| | | string m_agentCond; //Agent Node |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | int SetAgent() |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) CompanyList : public xwin |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xstring m_agentCond; //Agent Node |
| | | xnode m_agentNode; |
| | | public: |
| | | CompanyList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static CompanyList* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | CompanyList* pWin = new CompanyList(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | //arg.AddArg(L"sType",c_type); |
| | | if (xurl::get(L"OrganizationStruct/list.CompanyInfo", arg.GetString(), x) != 1) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | else |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | //arg.AddArg("sType",c_type); |
| | | if (url::get("OrganizationStruct/list.CompanyInfo", arg.GetString(), x) != 1) |
| | | //trace(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | |
| | | //xgridex双击 |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if (row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sguid = e.selectSingleNode(L"@guid").text(); |
| | | |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.AddArg(L"operate", L"modify"); |
| | | arg.AddArg(L"guid", sguid); |
| | | //trace(sguid); |
| | | //trace(row.toString()); |
| | | //win::OpenWindow(L"dev:xpage[CompanyMaint.vx]",arg); |
| | | openUrl(L"组织架构.vface/xpage/CompanyInfo/maint", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | KXMLDOMElement e; |
| | | xstring sguid; |
| | | xstring sName; |
| | | |
| | | if (comdid == L"AddRow") |
| | | { |
| | | arg.AddArg(L"operate", L"new0"); |
| | | arg.AddArg(L"guid", L""); |
| | | //win::OpenWindow(L"dev:xpage[CompanyMaint.vx]",arg); |
| | | openUrl(L"组织架构.vface/xpage/CompanyInfo/maint", &arg); |
| | | } |
| | | else if (comdid == L"ModifyRow") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | MessageBox(GetHWND(), L"请选中要修改的公司行!", L"提示", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | e = dw_list.GetRowElement(row); |
| | | sguid = e.selectSingleNode(L"@guid").text(); |
| | | arg.AddArg(L"operate", L"modify"); |
| | | arg.AddArg(L"guid", sguid); |
| | | //win::OpenWindow(L"dev:xpage[CompanyMaint.vx]",arg); |
| | | openUrl(L"组织架构.vface/xpage/CompanyInfo/maint", &arg); |
| | | } |
| | | else if (comdid == L"DeleteRow") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | MessageBox(GetHWND(), L"请选中要删除的公司行!", L"提示", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | e = dw_list.GetRowElement(row); |
| | | |
| | | sguid = e.selectSingleNode(L"@guid").text(); |
| | | sName = e.selectSingleNode(L"Name").text(); |
| | | |
| | | sName += L""; |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBox(GetHWND(), L"确认要删除公司 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | arg.AddArg(L"guid", sguid); |
| | | trace(sguid); |
| | | xml x1; |
| | | |
| | | if (xurl::post(L"OrganizationStruct/delete.CompanyInfo", arg.GetString(), x1) != 1) |
| | | { |
| | | xstring error = x1.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | //trace(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | MessageBox(GetHWND(), L"删除成功!", L"提示", 0); |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | |
| | | } |
| | | |
| | | //xgridex双击 |
| | | int OnDoubleClicked(ref TNotifyEvent evt, int p) |
| | | else if (comdid == L"Refresh") |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | if (row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.SelectSingleNode("@guid").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sguid); |
| | | //trace(sguid); |
| | | //trace(row.toString()); |
| | | //win__::OpenWindow("dev:xpage[CompanyMaint.vx]",arg); |
| | | openUrl("组织架构.vface/xpage/CompanyInfo/maint", arg); |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | msxml::IXMLDOMElement e; |
| | | string sguid; |
| | | string sName; |
| | | |
| | | if (comdid == "AddRow") |
| | | { |
| | | arg.AddArg("operate", "new0"); |
| | | arg.AddArg("guid", ""); |
| | | //win__::OpenWindow("dev:xpage[CompanyMaint.vx]",arg); |
| | | openUrl("组织架构.vface/xpage/CompanyInfo/maint", arg); |
| | | } |
| | | else if (comdid == "ModifyRow") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(), "请选中要修改的公司行!", "提示", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | e = dw_list.GetRowElement(row); |
| | | sguid = e.SelectSingleNode("@guid").text; |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sguid); |
| | | //win__::OpenWindow("dev:xpage[CompanyMaint.vx]",arg); |
| | | openUrl("组织架构.vface/xpage/CompanyInfo/maint", arg); |
| | | } |
| | | else if (comdid == "DeleteRow") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(), "请选中要删除的公司行!", "提示", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | e = dw_list.GetRowElement(row); |
| | | |
| | | sguid = e.SelectSingleNode("@guid").text; |
| | | sName = e.selectSingleNode("Name").text; |
| | | |
| | | sName += ""; |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (win__::MessageBox(GetHWND(), "确认要删除公司 " + sName + " 的信息吗?", "提示", MB_YESNO) != IDYES) return 1; |
| | | arg.AddArg("guid", sguid); |
| | | trace(sguid); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/delete.CompanyInfo", arg.GetString(), x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | win__::MessageBox(GetHWND(), "删除成功!", "提示", 0); |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | |
| | | } |
| | | else if (comdid == "Refresh") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //双击 |
| | | AttachEvent("dw_list", "DWV_DOUBLECLICKED", OnDoubleClicked); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | |
| | | //xaserverarg__ args = new xaserverarg__; |
| | | //args.setNativePointer(args.CreateInstance()); |
| | | //args.AddArg("type","CompanyList"); |
| | | //dw_list.SetDataObject(GetServerUrl(),pref::getPref("HumanResource/GetHrObject",args.GetString())); |
| | | dw_list.openUrl("组织架构.vface/template/company/list"); |
| | | dw_list.SetSelectionMode(1); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | ] |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&CompanyList::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&CompanyList::OnSetFocus); |
| | | //双击 |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&CompanyList::OnDoubleClicked); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | |
| | | //xaserverarg args; |
| | | //args.setNativePointer(args.CreateInstance()); |
| | | //args.AddArg(L"type",L"CompanyList"); |
| | | //dw_list.SetDataObject(GetServerUrl(),pref::getPref(L"HumanResource/GetHrObject",args.GetString())); |
| | | dw_list.openUrl(L"组织架构.vface/template/company/list"); |
| | | dw_list.SetSelectionMode(1); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | 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 "dev:vm[pagecontrol.vm]" |
| | | use "maint.vl" |
| | | use "publiccode.vl" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | CompanyMaint is extend maint; |
| | | about CompanyMaint |
| | | [ |
| | | control: |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | method: |
| | | [ |
| | | pagecontrol__ m_layer; |
| | | xdwtable__ dw_detail; |
| | | xdwtable__ dw_bank; |
| | | string m_operate; |
| | | string m_sguid; |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) CompanyMaint : public xframe |
| | | { |
| | | public: |
| | | pagecontrol m_layer; |
| | | xdwtable dw_detail; |
| | | xdwtable dw_bank; |
| | | xstring m_operate; |
| | | xstring m_sguid; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | int SetAgent() |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | public: |
| | | CompanyMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static CompanyMaint* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | CompanyMaint* pWin = new CompanyMaint(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(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | int OnPreSave() |
| | | { |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_detail.FindDwTable(L"CompanyInfo")); |
| | | xstring sPartyNo = dw.GetItemString(1, L"PartyNo"); |
| | | if (sPartyNo == L"") |
| | | { |
| | | xstring sGetNo = publiccode::GetIdentityNo(L""); |
| | | dw.SetItemString(1, L"PartyNo", sGetNo); |
| | | //alert(L"公司编号为空!"); |
| | | //return -1; |
| | | } |
| | | xstring sPartyName = dw.GetItemString(1, L"Name"); |
| | | if (sPartyName == L"") |
| | | { |
| | | alert(L"公司名称为空!"); |
| | | return -1; |
| | | } |
| | | |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw.SetItemString(1, L"ModifierID", suserid); |
| | | dw.SetItemString(1, L"ModifyDate", sdate); |
| | | |
| | | dw.setNativePointer(dw_bank.FindDwTable(L"item", 0)); |
| | | if (dw) |
| | | { |
| | | xstring sno; |
| | | xstring sname; |
| | | xstring status; |
| | | |
| | | int i; |
| | | int row = dw.GetRowCount(); |
| | | for (i = 1; i <= row; i++) |
| | | { |
| | | status = dw.GetItemString(i, L"Status") + L""; |
| | | if (status == L"") |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | dw.SetItemString(i, L"Status", L"Y"); |
| | | //alert(L"第"+i.toString()+L"行状态为空"); |
| | | //return -1; |
| | | } |
| | | /* |
| | | sno=dw.GetItemString(i,L"BankAccountNo",0)+L""; |
| | | sname=dw.GetItemString(i,L"BankName",0)+L""; |
| | | status=dw.GetItemString(i,L"Status",0)+L""; |
| | | if (sno==L"" || sno==nil) |
| | | { |
| | | if(sname !=L"" && sname != nil) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | alert(L"第"+i.toString()+L"行银行编号为空"); |
| | | return -1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | if (sname==L"" || sname==nil) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | int OnPreSave() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_detail.FindDwTable("CompanyInfo", 0)); |
| | | string sPartyNo = dw.GetItemString(1, "PartyNo", 0); |
| | | if (sPartyNo == "" || sPartyNo == nil) |
| | | if(sno !=L"" && sno != nil) |
| | | { |
| | | string sGetNo = publiccode::GetIdentityNo(""); |
| | | dw.SetItemString(1, "PartyNo", sGetNo); |
| | | //alert("公司编号为空!"); |
| | | alert(L"第"+i.toString()+L"行银行名称为空"); |
| | | return -1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (status==L"" || status==nil) |
| | | { |
| | | dw.SetItemString(i,L"Status",L"Y"); |
| | | //alert(L"第"+i.toString()+L"行状态为空"); |
| | | //return -1; |
| | | } |
| | | string sPartyName = dw.GetItemString(1, "Name", 0); |
| | | if (sPartyName == "" || sPartyName == nil) |
| | | { |
| | | alert("公司名称为空!"); |
| | | return -1; |
| | | } |
| | | |
| | | string suserid = publiccode::GetUserInfo().id; |
| | | string sdate = publiccode::GetCurDate(); |
| | | dw.SetItemString(1, "ModifierID", suserid); |
| | | dw.SetItemString(1, "ModifyDate", sdate); |
| | | |
| | | dw.setNativePointer(dw_bank.FindDwTable("item", 0)); |
| | | if (dw) |
| | | { |
| | | string sno; |
| | | string sname, |
| | | string status; |
| | | int i; |
| | | int row = dw.GetRowCount(); |
| | | for (i = 1; i <= row; i++) |
| | | { |
| | | status = dw.GetItemString(i, "Status", 0) + ""; |
| | | if (status == "" || status == nil) |
| | | { |
| | | dw.SetItemString(i, "Status", "Y"); |
| | | //alert("第"+i.toString()+"行状态为空"); |
| | | //return -1; |
| | | } |
| | | /* |
| | | sno=dw.GetItemString(i,"BankAccountNo",0)+""; |
| | | sname=dw.GetItemString(i,"BankName",0)+""; |
| | | status=dw.GetItemString(i,"Status",0)+""; |
| | | if (sno=="" || sno==nil) |
| | | { |
| | | if(sname !="" && sname != nil) |
| | | { |
| | | alert("第"+i.toString()+"行银行编号为空"); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | if (sname=="" || sname==nil) |
| | | { |
| | | if(sno !="" && sno != nil) |
| | | { |
| | | alert("第"+i.toString()+"行银行名称为空"); |
| | | return -1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (status=="" || status==nil) |
| | | { |
| | | dw.SetItemString(i,"Status","Y"); |
| | | //alert("第"+i.toString()+"行状态为空"); |
| | | //return -1; |
| | | } |
| | | } |
| | | */ |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | */ |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_detail.AcceptText(); |
| | | dw_bank.AcceptText(); |
| | | int rec; |
| | | rec = OnPreSave(); |
| | | if (rec == -1) |
| | | return -1; |
| | | int OnSave() |
| | | { |
| | | dw_detail.AcceptText(); |
| | | dw_bank.AcceptText(); |
| | | int rec; |
| | | rec = OnPreSave(); |
| | | if (rec == -1) |
| | | return -1; |
| | | |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | HCURSOR hIcon = xutil::SetCursorWait(); |
| | | |
| | | xstring val, val2; |
| | | xml x; |
| | | |
| | | string val, val2; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | dw_detail.DwUpdateAllTo(xdoc); |
| | | //val = xdoc.xml ; |
| | | dw_bank.DwUpdateAllTo(xdoc); |
| | | val = xdoc.xml; |
| | | trace(val); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("content", val); |
| | | args.AddArg("dbmap", "CompanyInfo.dbmap"); |
| | | //trace(m_EntityValueEx); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.companyinfoex", args.GetString(), x1) != 1) |
| | | //if (xaserver__::ExecXAction("","[update.CompanyInfoEx.xa]",args.GetString(),x1) !=1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | trace(x1.GetXml()); |
| | | if (x1.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("保存出错2!"); |
| | | return 0; |
| | | } |
| | | win__::MessageBox(GetHWND(), "保存成功!", "提示", 0); |
| | | } |
| | | xutil__::RestoreCursor(hIcon); |
| | | dw_detail.ResetUpdateStatus(); |
| | | dw_bank.ResetUpdateStatus(); |
| | | var xdoc2 = x.GetXmlDoc(); |
| | | dw_detail.DwUpdateAllTo(xdoc2); |
| | | val = xdoc.xml; |
| | | trace(val); |
| | | return 1; |
| | | } |
| | | var xdoc = x; |
| | | dw_detail.DwUpdateAllTo(xdoc); |
| | | //val = xdoc.xml ; |
| | | dw_bank.DwUpdateAllTo(xdoc); |
| | | val = xdoc.xml; |
| | | trace(val); |
| | | xaserverarg args; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg(L"content", val); |
| | | args.AddArg(L"dbmap", L"CompanyInfo.dbmap"); |
| | | //trace(m_EntityValueEx); |
| | | xml x1; |
| | | |
| | | if (xurl::post(L"OrganizationStruct/update.companyinfoex", args.GetString(), x1) != 1) |
| | | //if (xaserver::ExecXAction(L"",L"[update.CompanyInfoEx.xa]",args.GetString(),x1) !=1) |
| | | { |
| | | xstring error = x1.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | trace(x1.xml()); |
| | | if (x1.selectSingleNode(L"error")) |
| | | { |
| | | alert(L"保存出错2!"); |
| | | return 0; |
| | | } |
| | | MessageBox(GetHWND(), L"保存成功!", L"提示", 0); |
| | | } |
| | | xutil::RestoreCursor(hIcon); |
| | | dw_detail.ResetUpdateStatus(); |
| | | dw_bank.ResetUpdateStatus(); |
| | | var xdoc2 = x; |
| | | dw_detail.DwUpdateAllTo(xdoc2); |
| | | val = xdoc.xml; |
| | | trace(val); |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | int row = dwhdr.row; |
| | | string col = dwhdr.colname; |
| | | string data = dwhdr.data; |
| | | if (col == "Name") |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("Name", data); |
| | | } |
| | | int OnItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& dwhdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = dwhdr.row; |
| | | xstring col = dwhdr.colname; |
| | | xstring data = dwhdr.data; |
| | | if (col == L"Name") |
| | | { |
| | | xml x; |
| | | |
| | | return 1; |
| | | } |
| | | xaserverarg arg; |
| | | |
| | | 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 == "TradeType") { |
| | | arg.AddArg("ResourceType", "TradeType");//贸易方式 |
| | | } |
| | | if (xaserver__::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) |
| | | dwhdr.data = x.GetXml(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | return 1; |
| | | } |
| | | arg.AddArg(L"Name", data); |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | int h = m_layer.GetSheetIndex(); |
| | | if (h == 1) |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_bank.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "item") |
| | | { |
| | | int row = dw.InsertRow(0); |
| | | dw.SetItemString(row, "Status", "Y"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | int h = m_layer.GetSheetIndex(); |
| | | if (h == 1) |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_bank.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "item") |
| | | { |
| | | int row = dw.GetRow(); |
| | | int crow = dw.InsertRow(row); |
| | | dw.SetItemString(crow, "Status", "Y"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnChildContent(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& dwhdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring col = dwhdr.colname; |
| | | if (col != L"") { |
| | | xml x; |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int h = m_layer.GetSheetIndex(); |
| | | if (h == 1) |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_bank.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "item") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | xaserverarg arg; |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "Save") OnSave(); |
| | | else if (comdid == "AddRow") OnAddRow(); |
| | | else if (comdid == "InsertRow") OnInsertRow(); |
| | | else if (comdid == "DeleteRow") OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | xstring query; |
| | | query = L"[IResourceMSSql.xq]"; |
| | | if (col == L"TradeType") { |
| | | arg.AddArg(L"ResourceType", L"TradeType");//贸易方式 |
| | | } |
| | | if (xaserver::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) |
| | | dwhdr.data = x.xml(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | int OnAddRow() |
| | | { |
| | | int h = m_layer.GetSheetIndex(); |
| | | if (h == 1) |
| | | { |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_bank.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"item") |
| | | { |
| | | int row = dw.InsertRow(0); |
| | | dw.SetItemString(row, L"Status", L"Y"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //下拉框 提供内容 |
| | | AttachEvent("dw_detail", "DWV_CHILDCONTENT", OnChildContent); |
| | | AttachEvent("dw_detail", "DWV_ITEMCHANGED", OnItemChanged); |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | int h = m_layer.GetSheetIndex(); |
| | | if (h == 1) |
| | | { |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_bank.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"item") |
| | | { |
| | | int row = dw.GetRow(); |
| | | int crow = dw.InsertRow(row); |
| | | dw.SetItemString(crow, L"Status", L"Y"); |
| | | } |
| | | } |
| | | 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); |
| | | //trace(m_sguid); |
| | | //if (url::get("OrganizationStruct/detail.CompanyInfo",arg.GetString(),x) != 1) |
| | | if (url::post("OrganizationStruct/detail.CompanyInfo", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_detail.Retrieve(x); |
| | | dw_detail.Redraw(); |
| | | dw_bank.Retrieve(x); |
| | | dw_bank.Redraw(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | int OnDeleteRow() |
| | | { |
| | | int h = m_layer.GetSheetIndex(); |
| | | if (h == 1) |
| | | { |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_bank.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"item") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | 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 0; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = this.GetParam(); |
| | | if (arg) |
| | | { |
| | | m_operate = arg.GetArgString("operate"); |
| | | m_sguid = arg.GetArgString("guid"); |
| | | } |
| | | /*if ( m_sguid == "" || m_sguid == nil) |
| | | { |
| | | m_sguid = win__::GetGuid(); |
| | | trace(m_sguid); |
| | | }*/ |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&CompanyMaint::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&CompanyMaint::OnSetFocus); |
| | | //下拉框 提供内容 |
| | | AttachEvent(L"dw_detail", L"DWV_CHILDCONTENT", (FEvent)&CompanyMaint::OnChildContent); |
| | | AttachEvent(L"dw_detail", L"DWV_ITEMCHANGED", (FEvent)&CompanyMaint::OnItemChanged); |
| | | return 1; |
| | | } |
| | | |
| | | OnAttachEvent(); |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | return 1; |
| | | } |
| | | xaserverarg arg; |
| | | |
| | | int onload() |
| | | { |
| | | m_layer = new pagecontrol__; |
| | | m_layer.setNativePointer(this.GetControl("cTab")); |
| | | arg.AddArg(L"guid", m_sguid); |
| | | //trace(m_sguid); |
| | | //if (xurl::get(L"OrganizationStruct/detail.CompanyInfo",arg.GetString(),x) != 1) |
| | | if (xurl::post(L"OrganizationStruct/detail.CompanyInfo", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_detail.Retrieve(x); |
| | | dw_detail.Redraw(); |
| | | dw_bank.Retrieve(x); |
| | | dw_bank.Redraw(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | |
| | | dw_detail = new xdwtable__; |
| | | dw_detail.setNativePointer(this.GetControl("dw_detail")); |
| | | dw_detail.openUrl("组织架构.vface/template/company/detail"); |
| | | dw_detail.SetColHeaderHeight(0); |
| | | dw_detail.SetRowSelectorWidth(0); |
| | | dw_bank = new xdwtable__; |
| | | dw_bank.setNativePointer(this.GetControl("dw_bank")); |
| | | dw_bank.openUrl("组织架构.vface/template/company/bank"); |
| | | return 1; |
| | | } |
| | | |
| | | OnInitial(); |
| | | if (m_sguid != "") { |
| | | OnRetrieve(); |
| | | } |
| | | else { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_detail.FindDwTable("CompanyInfo", 0)); |
| | | dw.SetItemString(1, "Status", "1"); |
| | | dw.SetItemString(1, "InternalFlag", "Y"); |
| | | dw.SetItemString(1, "Type", "0"); |
| | | string suserid = publiccode::GetUserInfo().id; |
| | | /*string susername = publiccode::GetUserInfo().name; |
| | | string sdate = publiccode::GetCurDate(); |
| | | dw.SetItemString(1,"CreatorID",suserid); |
| | | dw.SetItemDisplayString(1,"CreatorID",susername); |
| | | dw.SetItemString(1,"CreateDate",sdate);*/ |
| | | int OnInitial() |
| | | { |
| | | SetArg(); |
| | | SetAgent(); |
| | | xaserverarg arg; |
| | | arg = GetArg(); |
| | | if (arg) |
| | | { |
| | | m_operate = arg.GetArgString(L"operate"); |
| | | m_sguid = arg.GetArgString(L"guid"); |
| | | } |
| | | /*if ( m_sguid == L"" || m_sguid == nil) |
| | | { |
| | | m_sguid = win::GetGuid(); |
| | | trace(m_sguid); |
| | | }*/ |
| | | |
| | | dw.setNativePointer(dw_detail.FindDwTable("address", 0)); |
| | | dw.SetItemString(1, "IdentifyAddressFlag", "Y"); |
| | | dw.SetItemString(1, "Status", "1"); |
| | | dw.setNativePointer(dw_detail.FindDwTable("Regist", 0)); |
| | | dw.SetItemString(1, "IdentifyAddressFlag", "N"); |
| | | dw.SetItemString(1, "Status", "1"); |
| | | OnAttachEvent(); |
| | | |
| | | dw.setNativePointer(dw_bank.FindDwTable("item", 0)); |
| | | if (dw) { |
| | | //msxml::IXMLDOMElement ele = dw.GetElement(); |
| | | //trace(ele.xml); |
| | | //dw.SetItemString(1,"Status","Y"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | ] |
| | | int onload() |
| | | { |
| | | m_layer = new pagecontrol; |
| | | m_layer.setNativePointer(GetControl(L"cTab")); |
| | | |
| | | ] |
| | | ] |
| | | dw_detail = new xdwtable; |
| | | dw_detail.setNativePointer(GetControl(L"dw_detail")); |
| | | dw_detail.openUrl(L"组织架构.vface/template/company/detail"); |
| | | dw_detail.SetColHeaderHeight(0); |
| | | dw_detail.SetRowSelectorWidth(0); |
| | | dw_bank = new xdwtable; |
| | | dw_bank.setNativePointer(GetControl(L"dw_bank")); |
| | | dw_bank.openUrl(L"组织架构.vface/template/company/bank"); |
| | | |
| | | OnInitial(); |
| | | if (m_sguid != L"") { |
| | | OnRetrieve(); |
| | | } |
| | | else { |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_detail.FindDwTable(L"CompanyInfo", 0)); |
| | | dw.SetItemString(1, L"Status", L"1"); |
| | | dw.SetItemString(1, L"InternalFlag", L"Y"); |
| | | dw.SetItemString(1, L"Type", L"0"); |
| | | xstring suserid = publiccode::GetUser().id; |
| | | /*xstring susername = publiccode::GetUserInfo().name; |
| | | xstring sdate = publiccode::GetCurDate(); |
| | | dw.SetItemString(1,L"CreatorID",suserid); |
| | | dw.SetItemDisplayString(1,L"CreatorID",susername); |
| | | dw.SetItemString(1,L"CreateDate",sdate);*/ |
| | | |
| | | dw.setNativePointer(dw_detail.FindDwTable(L"address", 0)); |
| | | dw.SetItemString(1, L"IdentifyAddressFlag", L"Y"); |
| | | dw.SetItemString(1, L"Status", L"1"); |
| | | dw.setNativePointer(dw_detail.FindDwTable(L"Regist", 0)); |
| | | dw.SetItemString(1, L"IdentifyAddressFlag", L"N"); |
| | | dw.SetItemString(1, L"Status", L"1"); |
| | | |
| | | dw.setNativePointer(dw_bank.FindDwTable(L"item", 0)); |
| | | if (dw) { |
| | | //KXMLDOMElement ele = dw.GetElement(); |
| | | //trace(ele.xml); |
| | | //dw.SetItemString(1,L"Status",L"Y"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.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" |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrPerson is extend frame; |
| | | about HrPerson |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | xdwgrid__ dw_list; |
| | | xdwgrid__ dw_HrEmployee; |
| | | string m_sTxt; |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | int SetAgent() |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) HrPerson : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xdwgrid dw_HrEmployee; |
| | | xstring m_sTxt; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | public: |
| | | HrPerson(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static HrPerson* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrPerson* pWin = new HrPerson(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) |
| | | { |
| | | 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; |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | { |
| | | SetAgent(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | //xgridex双击 |
| | | int OnDoubleClicked(TEvent* evt, int p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if (row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sguid = e.selectSingleNode(L"@guid").text(); |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | //xgridex双击 |
| | | int OnDoubleClicked(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | if(row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.SelectSingleNode("@guid").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate","modify"); |
| | | arg.AddArg("guid",sguid); |
| | | //trace(sguid); |
| | | //xwin::OpenWindow("dev:xpage[HrPersonMaint.xpage]",arg); |
| | | openUrl("组织架构.vface/xpage/Hr/HrPersonMaint", arg); |
| | | return 1; |
| | | } |
| | | //行改变 |
| | | int OnRowFocusChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | if(row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sPersonID = e.SelectSingleNode("@guid").text; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid",sPersonID); |
| | | |
| | | if (url::get("OrganizationStruct/Person.HrEmployee",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_HrEmployee.Retrieve(x); |
| | | dw_HrEmployee.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | arg.AddArg(L"operate", L"modify"); |
| | | arg.AddArg(L"guid", sguid); |
| | | //trace(sguid); |
| | | //xwin::OpenWindow(L"dev:xpage[HrPersonMaint.xpage]",arg); |
| | | openUrl(L"组织架构.vface/xpage/Hr/HrPersonMaint", &arg); |
| | | return 1; |
| | | } |
| | | //行改变 |
| | | int OnRowFocusChanged(TEvent* evt, int p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if (row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sPersonID = e.selectSingleNode(L"@guid").text(); |
| | | xml x; |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sTxt",m_sTxt); |
| | | if (url::get("OrganizationStruct/list.HrPerson",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"guid", sPersonID); |
| | | |
| | | if (xurl::get(L"OrganizationStruct/Person.HrEmployee", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_HrEmployee.Retrieve(x); |
| | | dw_HrEmployee.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sTxt", m_sTxt); |
| | | if (xurl::get(L"OrganizationStruct/list.HrPerson", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | // if (dw_list.GetRowCount() >0) |
| | | // OnRowFocusChanged(); |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSearch() |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("QueryTxt")); |
| | | m_sTxt= xc.GetText(); |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | int OnSearch() |
| | | { |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(L"QueryTxt")); |
| | | m_sTxt = xc.GetText(); |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnUpdateAssignmentView() |
| | | int OnUpdateAssignmentView() |
| | | { |
| | | xml x1; |
| | | if (xurl::post(L"OrganizationStruct/update.Assignmentview", L"", x1) != 1) |
| | | { |
| | | xstring error = x1.text(); |
| | | trace(error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | trace(x1.xml()); |
| | | MessageBox(GetHWND(), L"更新成功!", L"提示", 0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | KXMLDOMElement e; |
| | | xstring sPersonID; |
| | | xstring sName; |
| | | if (comdid == L"AddPerson") |
| | | { |
| | | arg.AddArg(L"operate", L"new0"); |
| | | arg.AddArg(L"guid", L""); |
| | | openUrl(L"组织架构.vface/xpage/Hr/HrPersonMaint", &arg); |
| | | } |
| | | else if (comdid == L"UpdateAssignmentView") |
| | | OnUpdateAssignmentView(); |
| | | else if (comdid == L"ModifyPerson") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.Assignmentview","",x1) != 1) |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | trace(x1.GetXml()); |
| | | win__::MessageBox(GetHWND(),"更新成功!","提示",0); |
| | | MessageBox(GetHWND(), L"请选中要修改的人员行!", L"提示", 0); |
| | | return -1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | e = dw_list.GetRowElement(row); |
| | | sPersonID = e.selectSingleNode(L"@guid").text(); |
| | | arg.AddArg(L"operate", L"modify"); |
| | | arg.AddArg(L"guid", sPersonID); |
| | | openUrl(L"组织架构.vface/xpage/Hr/HrPersonMaint", &arg); |
| | | } |
| | | else if (comdid == L"DeletePerson") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | msxml::IXMLDOMElement e; |
| | | string sPersonID; |
| | | string sName; |
| | | if (comdid =="AddPerson") |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | arg.AddArg("operate","new0"); |
| | | arg.AddArg("guid",""); |
| | | openUrl("组织架构.vface/xpage/Hr/HrPersonMaint", arg); |
| | | MessageBox(GetHWND(), L"请选中要删除的人员行!", L"提示", 0); |
| | | return -1; |
| | | } |
| | | else if(comdid=="UpdateAssignmentView") |
| | | OnUpdateAssignmentView(); |
| | | else if (comdid =="ModifyPerson") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(),"请选中要修改的人员行!","提示",0); |
| | | return -1; |
| | | } |
| | | } |
| | | e = dw_list.GetRowElement(row); |
| | | sPersonID = e.SelectSingleNode("@guid").text; |
| | | arg.AddArg("operate","modify"); |
| | | arg.AddArg("guid",sPersonID); |
| | | openUrl("组织架构.vface/xpage/Hr/HrPersonMaint", arg); |
| | | } |
| | | else if (comdid =="DeletePerson") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(),"请选中要删除的人员行!","提示",0); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | e = dw_list.GetRowElement(row); |
| | | sPersonID = e.SelectSingleNode("@guid").text; |
| | | sName = e.selectSingleNode("Name").text; |
| | | sName += ""; |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if(win__::MessageBox(GetHWND(),"确认要删除 "+sName+" 的信息吗?","提示",MB_YESNO)!=IDYES) return 1; |
| | | |
| | | |
| | | arg.AddArg("guid",sPersonID); |
| | | |
| | | |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/delete.HrPerson",arg.GetString(),x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | //win32::MessageBox(GetHWND(),"删除成功!","提示",0); |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | else if (comdid =="Refresh") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else if (comdid =="search" || comdid=="query") |
| | | { |
| | | OnSearch(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | |
| | | e = dw_list.GetRowElement(row); |
| | | sPersonID = e.selectSingleNode(L"@guid").text(); |
| | | sName = e.selectSingleNode(L"Name").text(); |
| | | sName += L""; |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBox(GetHWND(), L"确认要删除 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | |
| | | |
| | | arg.AddArg(L"guid", sPersonID); |
| | | |
| | | |
| | | xml x1; |
| | | |
| | | if (xurl::post(L"OrganizationStruct/delete.HrPerson", arg.GetString(), x1) != 1) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | xstring error = x1.text(); |
| | | trace(error); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | else |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_list","DWV_CLICKED",OnRowFocusChanged); |
| | | AttachEvent("dw_list","DWV_DOUBLECLICKED",OnDoubleClicked); |
| | | //win32::MessageBox(GetHWND(),L"删除成功!",L"提示",0); |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | else if (comdid == L"Refresh") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else if (comdid == L"search" || comdid == L"query") |
| | | { |
| | | OnSearch(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_sTxt=""; |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("组织架构.vface/template/HrPerson/list"); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetSelectionMode(1); |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&HrPerson::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrPerson::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_CLICKED", (FEvent)&HrPerson::OnRowFocusChanged); |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&HrPerson::OnDoubleClicked); |
| | | return 1; |
| | | } |
| | | |
| | | dw_HrEmployee = new xdwgrid__; |
| | | dw_HrEmployee.setNativePointer(this.GetControl("dw_HrEmployee")); |
| | | dw_HrEmployee.openUrl("组织架构.vface/template/HrPerson/listemp"); |
| | | //dw_HrEmployee.openUrl("组织架构.vface/template/HrEmployee/list"); |
| | | OnInitial(); |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_sTxt = L""; |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.openUrl(L"组织架构.vface/template/HrPerson/list"); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetSelectionMode(1); |
| | | |
| | | dw_HrEmployee = new xdwgrid; |
| | | dw_HrEmployee.setNativePointer(GetControl(L"dw_HrEmployee")); |
| | | dw_HrEmployee.openUrl(L"组织架构.vface/template/HrPerson/listemp"); |
| | | //dw_HrEmployee.openUrl(L"组织架构.vface/template/HrEmployee/list"); |
| | | OnInitial(); |
| | | |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | 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 "list.vl" |
| | | use "treeview.vm" |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrEmployee is extend list; |
| | | about HrEmployee |
| | | [ |
| | | field: |
| | | [ |
| | | treeview__ tv_org; |
| | | xdwgrid__ dw_emp; |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | string is_orgid |
| | | string is_orgname; |
| | | string is_inflag; |
| | | xdwtable__ dw_empmaint; |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | ] |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) HrEmployee : public xwin |
| | | { |
| | | public: |
| | | |
| | | xtreeview tv_org; |
| | | xdwgrid dw_emp; |
| | | |
| | | xstring is_orgid; |
| | | xstring is_orgname; |
| | | xstring is_inflag; |
| | | xdwtable dw_empmaint; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | |
| | | public: |
| | | HrEmployee(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static HrEmployee* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrEmployee* pWin = new HrEmployee(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 p) |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string ls_orgid) |
| | | int OnRetrieve(xstring ls_orgid) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("OrgID", ls_orgid); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"OrgID", ls_orgid); |
| | | //trace(ls_orgid); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),"[MSSqlHrEmployee.xq]",arg.GetString(),x) == 1) |
| | | if (url::get("OrganizationStruct/list.Employee", arg.GetString(), x) == 1) |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[MSSqlHrEmployee.xq]",arg.GetString(),x) == 1) |
| | | if (xurl::get(L"OrganizationStruct/list.Employee", arg.GetString(), x) == 1) |
| | | { |
| | | dw_emp.Retrieve(x); |
| | | dw_emp.Redraw(); |
| | |
| | | |
| | | int OnSave() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | dw_emp.AcceptText(); |
| | | dw_emp.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | HCURSOR hIcon = xutil::SetCursorWait(); |
| | | xml x; |
| | | |
| | | string val = x.GetXml(); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content", val); |
| | | dw_emp.AcceptText(); |
| | | dw_emp.DwUpdateAllToEx(x); |
| | | |
| | | xstring val = x.xml(); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", val); |
| | | //trace(x.GetXml()); |
| | | //return 1; |
| | | if (url::post("OrganizationStruct/update.Employee", arg.GetString(), x) != 1) |
| | | if (xurl::post(L"OrganizationStruct/update.Employee", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().documentElement.text); |
| | | alert("保存失败"); |
| | | trace(x.documentElement().text()); |
| | | alert(L"保存失败"); |
| | | } |
| | | else { |
| | | dw_emp.ResetUpdateStatus(); |
| | | alert("保存成功"); |
| | | alert(L"保存成功"); |
| | | } |
| | | trace(x.GetXml()); |
| | | xutil__::RestoreCursor(hIcon); |
| | | xutil::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSubTree(string id, int parentitem) |
| | | int OnSubTree(xstring id, HTREEITEM parentitem) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | if (treeview__::GetChildItem(wid, parentitem) > 0) return 1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sguid", id); |
| | | if (url::post("/sale/data/OrganizationStruct/tree.child.OrgChart", arg.GetString(), x) != 1) |
| | | //int wid = tv_org.GetId(); |
| | | if (tv_org.GetChildItem(parentitem) > 0) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sguid", id); |
| | | if (xurl::post(L"/sale/data/OrganizationStruct/tree.child.OrgChart", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | trace(x.xml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list = x.GetXmlDoc().selectNodes("//item"); |
| | | var list = x.selectNodes(L"//item"); |
| | | int i = 0, s = list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | string sName; |
| | | string sguid; |
| | | string stype; |
| | | KXMLDOMElement xitem; |
| | | xstring sName; |
| | | xstring sguid; |
| | | xstring stype; |
| | | if (s > 0) |
| | | { |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | xitem = list.item(i); |
| | | sName = xitem.SelectSingleNode("name").text; |
| | | sguid = xitem.SelectSingleNode("id").text; |
| | | stype = xitem.SelectSingleNode("typ").text; |
| | | sName = xitem.selectSingleNode(L"name").text(); |
| | | sguid = xitem.selectSingleNode(L"id").text(); |
| | | stype = xitem.selectSingleNode(L"typ").text(); |
| | | //int curItem = tv_org.InsertChildItemEx(wid,parentitem,sName,xitem,15,4); |
| | | int curItem = 0; |
| | | if (stype == "Org") |
| | | HTREEITEM curItem = 0; |
| | | if (stype == L"Org") |
| | | { |
| | | curItem = tv_org.InsertChildItemEx(wid, parentitem, sName, xitem, 15, 4); |
| | | tv_org.SetItemChild1(wid, curItem, 1); |
| | | curItem = tv_org.InsertChildItemEx(parentitem, sName, xitem, 15, 4); |
| | | tv_org.SetItemChild1(curItem, 1); |
| | | } |
| | | else |
| | | { |
| | | curItem = tv_org.InsertChildItemEx(wid, parentitem, sName, xitem, 21, 21); |
| | | curItem = tv_org.InsertChildItemEx(parentitem, sName, xitem, 21, 21); |
| | | } |
| | | //OnSubTree(sguid,curItem); |
| | | } |
| | |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(string id, int parentitem) |
| | | int OnCreateTree(xstring id, HTREEITEM parentitem) |
| | | { |
| | | //while (tv_1.GetRootItem()>0) |
| | | // tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | int wid = tv_org.GetId(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | x.LoadXml("<item><id>" + id + "</id><no/><name>宁波家尔佳</name><typ>Org</typ></item>"); |
| | | //msxml::IXMLDOMDocument root = x.GetXmlDoc(); |
| | | //msxml::IXMLDOMElement RDoc = x.GetXmlDoc().documentElement; |
| | | //msxml::IXMLDOMElement ele = RDoc.SelectSingleNode("//Org"); |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().SelectSingleNode("//item"); |
| | | int hItem = treeview__::InsertChildItemEx(wid, 0, "宁波家尔佳", ele, 15, 4); |
| | | treeview__::SetItemChild1(wid, hItem, 1); |
| | | //int wid = tv_org.GetId(); |
| | | xml x; |
| | | |
| | | x.loadXML(L"<item><id>" + id + L"</id><no/><name>宁波家尔佳</name><typ>Org</typ></item>"); |
| | | //KXMLDOMDocument root = x; |
| | | //KXMLDOMElement RDoc = x.documentElement; |
| | | //KXMLDOMElement ele = RDoc.selectSingleNode(L"//Org"); |
| | | KXMLDOMElement ele = x.selectSingleNode(L"//item"); |
| | | HTREEITEM hItem = tv_org.InsertChildItemEx(0, L"宁波家尔佳", ele, 15, 4); |
| | | tv_org.SetItemChild1(hItem, 1); |
| | | return 1; |
| | | |
| | | /*xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sguid",id); |
| | | if(url::post("/sale/data/OrganizationStruct/tree.child.OrgChart",arg.GetString(),x)!=1) |
| | | /*xaserverarg arg=new xaserverarg; |
| | | |
| | | arg.AddArg(L"sguid",id); |
| | | if(xurl::post(L"/sale/data/OrganizationStruct/tree.child.OrgChart",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list=x.GetXmlDoc().selectNodes("//item"); |
| | | var list=x.selectNodes(L"//item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | string sName; |
| | | string sguid; |
| | | KXMLDOMElement xitem; |
| | | xstring sName; |
| | | xstring sguid; |
| | | if (s >0) |
| | | { |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(i); |
| | | sName = xitem.SelectSingleNode("@name").text; |
| | | sguid = xitem.SelectSingleNode("@id").text; |
| | | sName = xitem.selectSingleNode(L"@name").text(); |
| | | sguid = xitem.selectSingleNode(L"@id").text(); |
| | | int curItem = tv_org.InsertChildItemEx(wid,hItem,sName,xitem,15,4); |
| | | tv_org.SetItemChild1(wid,curItem,1); |
| | | //OnSubTree(sguid,curItem); |
| | |
| | | return 1;*/ |
| | | } |
| | | |
| | | int OnTreeExpanding(ref TNotifyEvent evt, int p) |
| | | int OnTreeExpanding(TEvent* evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM sitem = nmtv.itemNew.hItem; |
| | | |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | //string id = treeview__::GetItemData(tv_org.GetId(), sitem); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(), sitem); |
| | | string id = ele.SelectSingleNode("id").text; |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | //xstring id = tv_org.GetItemData(tv_org.GetId(), sitem); |
| | | KXMLDOMElement ele = tv_org.GetItemData(sitem); |
| | | xstring id = ele.selectSingleNode(L"id").text(); |
| | | OnSubTree(id, sitem); |
| | | xutil__::RestoreCursor(hCursor); |
| | | xutil::RestoreCursor(hCursor); |
| | | 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); |
| | | //int wid = tv_org.GetId(); |
| | | HTREEITEM hitem = tv_org.GetSelectedItem(); |
| | | KXMLDOMElement ele = tv_org.GetItemData(hitem); |
| | | if (ele) |
| | | { |
| | | string ls_orgid = ele.SelectSingleNode("id").text; |
| | | xstring ls_orgid = ele.selectSingleNode(L"id").text(); |
| | | is_orgid = ls_orgid; |
| | | OnRetrieve(ls_orgid); |
| | | } |
| | |
| | | |
| | | 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; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | string stype = ele.SelectSingleNode("typ").text; |
| | | if (stype != "Pos") |
| | | KXMLDOMElement ele = tv_org.GetItemData(hitem); |
| | | xstring stype = ele.selectSingleNode(L"typ").text(); |
| | | if (stype != L"Pos") |
| | | { |
| | | alert("请选择岗位!"); |
| | | alert(L"请选择岗位!"); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | OpenWindow("dev:xpage[HrEmployeeAdd.vx]", this); |
| | | //openUrl("组织架构.vface/xpage/Hr/HrEmployeeAdd", this); |
| | | OpenWindow(L"dev:xpage[HrEmployeeAdd.vx]", this); |
| | | //openUrl(L"组织架构.vface/xpage/Hr/HrEmployeeAdd", this); |
| | | return 1; |
| | | } |
| | | |
| | |
| | | row = dw_emp.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(), "请选中要修改的任职信息行!", "提示", 0); |
| | | MessageBox(GetHWND(), L"请选中要修改的任职信息行!", L"提示", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | int wid = dw_emp.GetId(); |
| | | msxml::IXMLDOMElement e = dw_emp.GetRowElement(row); |
| | | string sPersonID = e.selectSingleNode("PersonID").text; |
| | | //int wid = dw_emp.GetId(); |
| | | KXMLDOMElement e = dw_emp.GetRowElement(row); |
| | | xstring sPersonID = e.selectSingleNode(L"PersonID").text(); |
| | | //trace(e.xml); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sPersonID); |
| | | //xwin::OpenWindow("dev:xpage[HrPersonMaint.xpage]",arg); |
| | | openUrl("组织架构.vface/xpage/Hr/HrPersonMaint", arg); |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"operate", L"modify"); |
| | | arg.AddArg(L"guid", sPersonID); |
| | | //xwin::OpenWindow(L"dev:xpage[HrPersonMaint.xpage]",arg); |
| | | openUrl(L"组织架构.vface/xpage/Hr/HrPersonMaint", &arg); |
| | | return 1; |
| | | } |
| | | |
| | |
| | | ll_row = dw_emp.GetRow(); |
| | | if (ll_row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(), "请选中要删除的任职信息行!", "提示", 0); |
| | | MessageBox(GetHWND(), L"请选中要删除的任职信息行!", L"提示", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | string sName = dw_emp.GetItemDisplayString(ll_row, "PersonID", 0); |
| | | if (win__::MessageBox(GetHWND(), "确定删除" + sName + "任职信息吗?", "提示", 1) != 1) |
| | | xstring sName = dw_emp.GetItemDisplayString(ll_row, L"PersonID"); |
| | | if (MessageBox(GetHWND(), L"确定删除" + sName + L"任职信息吗?", L"提示", 1) != 1) |
| | | return 0; |
| | | |
| | | msxml::IXMLDOMElement ele = dw_emp.GetRowElement(ll_row); |
| | | string empid = ele.selectSingleNode("@guid").text; |
| | | KXMLDOMElement ele = dw_emp.GetRowElement(ll_row); |
| | | xstring empid = ele.selectSingleNode(L"@guid").text(); |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | xml x; |
| | | |
| | | xaserverarg args; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("guid", empid); |
| | | //if(xaserver__::ExecXAction(GetServerUrl(),"[MSSqlHrEmployeeDel.xq]",args.GetString(),x) !=1) |
| | | if (url::post("OrganizationStruct/delete.Employee", args.GetString(), x) != 1) |
| | | args.AddArg(L"guid", empid); |
| | | //if(xaserver::ExecXAction(GetServerUrl(),L"[MSSqlHrEmployeeDel.xq]",args.GetString(),x) !=1) |
| | | if (xurl::post(L"OrganizationStruct/delete.Employee", args.GetString(), x) != 1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | |
| | | |
| | | int SetText() |
| | | { |
| | | win__::SetWindowText(GetHWND(), "所属组织:" + is_orgname + " 操作状态:" + is_inflag); |
| | | SetWindowText(GetHWND(), L"所属组织:" + is_orgname + L" 操作状态:" + is_inflag); |
| | | return 1; |
| | | } |
| | | |
| | | //xgridex双击 |
| | | int OnDoubleClicked(ref TNotifyEvent evt, int p) |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if (row < 1 || row > dw_emp.GetRowCount()) |
| | | return 1; |
| | | msxml::IXMLDOMElement e = dw_emp.GetRowElement(row); |
| | | string sPersonID = e.selectSingleNode("PersonID").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sPersonID); |
| | | //xwin::OpenWindow("dev:xpage[HrPersonMaint.xpage]",arg); |
| | | openUrl("组织架构.vface/xpage/Hr/HrPersonMaint", arg); |
| | | KXMLDOMElement e = dw_emp.GetRowElement(row); |
| | | xstring sPersonID = e.selectSingleNode(L"PersonID").text(); |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"operate", L"modify"); |
| | | arg.AddArg(L"guid", sPersonID); |
| | | //xwin::OpenWindow(L"dev:xpage[HrPersonMaint.xpage]",arg); |
| | | openUrl(L"组织架构.vface/xpage/Hr/HrPersonMaint", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == "Save") return OnSave(); |
| | | else if (comdid == "AddRow") return OnAddRow(); |
| | | else if (comdid == "ModifyRow") return OnModifyRow(); |
| | | else if (comdid == "DeleteRow") return OnDeleteRow(); |
| | | else if (comdid == "Refresh") return OnRetrieve(is_orgid); |
| | | /*else if(comdid =="adjustorg") return OnAdjustOrg();*/ |
| | | if (comdid == L"Save") return OnSave(); |
| | | else if (comdid == L"AddRow") return OnAddRow(); |
| | | else if (comdid == L"ModifyRow") return OnModifyRow(); |
| | | else if (comdid == L"DeleteRow") return OnDeleteRow(); |
| | | else if (comdid == L"Refresh") return OnRetrieve(is_orgid); |
| | | /*else if(comdid ==L"adjustorg") return OnAdjustOrg();*/ |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | 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)&HrEmployee::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrEmployee::OnSetFocus); |
| | | //获得树的选择事件 |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | AttachEvent("tv_org", "TVN_ITEMEXPANDING", OnTreeExpanding); |
| | | AttachEvent("dw_emp", "DWV_DOUBLECLICKED", OnDoubleClicked); |
| | | AttachEvent(L"tv_org", L"TVN_SELCHANGED", (FEvent)&HrEmployee::OnTreeSelChanged); |
| | | AttachEvent(L"tv_org", L"TVN_ITEMEXPANDING", (FEvent)&HrEmployee::OnTreeExpanding); |
| | | AttachEvent(L"dw_emp", L"DWV_DOUBLECLICKED", (FEvent)&HrEmployee::OnDoubleClicked); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | m_agentNode = new xnode__; |
| | | m_agentNode = new xnode; |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | |
| | |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | dw_emp = new xdwgrid__; |
| | | dw_emp.setNativePointer(this.GetControl("dw_emp")); |
| | | dw_emp.openUrl("组织架构.vface/template/HrEmployee/list"); |
| | | tv_org = new treeview; |
| | | tv_org.setNativePointer(GetControl(L"tv_org")); |
| | | dw_emp = new xdwgrid; |
| | | dw_emp.setNativePointer(GetControl(L"dw_emp")); |
| | | dw_emp.openUrl(L"组织架构.vface/template/HrEmployee/list"); |
| | | //dw_emp.SetReadOnly(true); |
| | | //dw_emp.SetSelectionMode(1); |
| | | |
| | | OnInitial(); |
| | | OnCreateTree("00000000-0000-0000-0000-000000000000", 0); |
| | | int wid = tv_org.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid, root); |
| | | OnCreateTree(L"00000000-0000-0000-0000-000000000000", 0); |
| | | //int wid = tv_org.GetId(); |
| | | HTREEITEM root = tv_org.GetRootItem(); |
| | | tv_org.ExpandItem( root); |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | }; |
| | |
| | | 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" |
| | | use "dev:code[HrEmployee.vx]" |
| | | use "publiccode.vl" |
| | | #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 |
| | | [ |
| | | HrEmployeeAdd is extend frame; |
| | | about HrEmployeeAdd |
| | | [ |
| | | field: |
| | | [ |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) HrEmployeeAdd : public xframe |
| | | { |
| | | public: |
| | | HrEmployee lw_obj; |
| | | xdwgrid__ dw_list; |
| | | xdwgrid dw_list; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | string m_sTxt; |
| | | ] |
| | | |
| | | 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 |
| | | xstring m_sTxt; |
| | | public: |
| | | HrEmployeeAdd(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static HrEmployeeAdd* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrEmployeeAdd* pWin = new HrEmployeeAdd(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(); |
| | | //重置工具条 |
| | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("QueryTxt")); |
| | | m_sTxt = xc.GetText() + ""; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sTxt", m_sTxt); |
| | | if (url::post("OrganizationStruct/select.Employee", arg.GetString(), x) != 1) |
| | | 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.GetXmlDoc().text); |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert("请选择人员!"); |
| | | alert(L"请选择人员!"); |
| | | return 1; |
| | | } |
| | | |
| | | string sPositionID, sPositionName; |
| | | string sOrgID, sOrgName; |
| | | string sJobID, sJobName; |
| | | xstring sPositionID, sPositionName; |
| | | xstring sOrgID, sOrgName; |
| | | xstring sJobID, sJobName; |
| | | int wid = lw_obj.tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | int hitem = treeview::GetSelectedItem(wid); |
| | | KXMLDOMElement ele = treeview::GetItemData(wid, hitem); |
| | | if (ele) |
| | | { |
| | | sPositionID = ele.SelectSingleNode("id").text; |
| | | sPositionName = ele.SelectSingleNode("name").text; |
| | | sOrgID = ele.SelectSingleNode("OrgID").text; |
| | | sOrgName = ele.SelectSingleNode("OrgName").text; |
| | | sJobID = ele.SelectSingleNode("JobID").text; |
| | | sJobName = ele.SelectSingleNode("JobName").text; |
| | | 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) |
| | | { |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sEmployeeNo = e.selectSingleNode("EmployeeNo").text + ""; |
| | | string sPersonID = e.selectSingleNode("PersonID").text + ""; |
| | | string sPersonName = e.selectSingleNode("Name").text + ""; |
| | | 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 nRow = lw_obj.dw_emp.InsertRow(0); |
| | | lw_obj.dw_emp.SetItemString(nRow, "EmployeeNo", sEmployeeNo); |
| | | lw_obj.dw_emp.SetItemString(nRow, "PersonID", sPersonID); |
| | | lw_obj.dw_emp.SetItemDisplayString(nRow, "PersonID", sPersonName); |
| | | 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, "PositionID", sPositionID); |
| | | lw_obj.dw_emp.SetItemDisplayString(nRow, "PositionID", sPositionName); |
| | | lw_obj.dw_emp.SetItemString(nRow, "OrgID", sOrgID); |
| | | lw_obj.dw_emp.SetItemDisplayString(nRow, "OrgID", sOrgName); |
| | | lw_obj.dw_emp.SetItemString(nRow, "JobID", sJobID); |
| | | lw_obj.dw_emp.SetItemDisplayString(nRow, "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, "Status", "Y"); |
| | | lw_obj.dw_emp.SetItemDisplayString(nRow, "Status", "有效"); |
| | | string sdate = publiccode::GetCurDate() + ""; |
| | | lw_obj.dw_emp.SetItemString(nRow, "StartDate", sdate + ""); |
| | | lw_obj.dw_emp.SetItemString(nRow, "EndDate", "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::GetCurDate() + L""; |
| | | lw_obj.dw_emp.SetItemString(nRow, L"StartDate", sdate + L""); |
| | | lw_obj.dw_emp.SetItemString(nRow, L"EndDate", L"2050-12-31"); |
| | | |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == "xmOk") |
| | | if (comdid == L"xmOk") |
| | | OnOK(); |
| | | else if (comdid == "query") |
| | | else if (comdid == L"query") |
| | | OnRetrieve(); |
| | | else if (comdid == "xmCancel") |
| | | else if (comdid == L"xmCancel") |
| | | CloseWindow(); |
| | | 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)&HrEmployeeAdd::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrEmployeeAdd::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("组织架构.vface/template/HrEmployee/PersonSel"); |
| | | 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); |
| | | |
| | |
| | | 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 "list.vl" |
| | | use "treeview.vm" |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrEmployeex is extend list; |
| | | about HrEmployeex |
| | | [ |
| | | field: |
| | | [ |
| | | treeview__ tv_org; |
| | | xdwtable__ dw_1; |
| | | xnode__ m_agentNode; |
| | | string is_orgid |
| | | string is_orgname; |
| | | string is_inflag; |
| | | xdwtable__ dw_empmaint; |
| | | ] |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | |
| | | class __declspec(dllexport) HrEmployeex : public xwin |
| | | { |
| | | public: |
| | | xtreeview tv_org; |
| | | xdwtable dw_1; |
| | | xnode m_agentNode; |
| | | xstring is_orgid; |
| | | xstring is_orgname; |
| | | xstring is_inflag; |
| | | xdwtable dw_empmaint; |
| | | public: |
| | | HrEmployeex(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static HrEmployeex* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrEmployeex* pWin = new HrEmployeex(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 p) |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | //重置工具条 |
| | |
| | | |
| | | int OnSave() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | HCURSOR hIcon = xutil::SetCursorWait(); |
| | | |
| | | string val; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | xstring val; |
| | | xml x; |
| | | |
| | | var xdoc = x; |
| | | dw_1.AcceptText(); |
| | | dw_1.DwUpdateAllTo(xdoc); |
| | | val = xdoc.xml; |
| | | //trace(val); |
| | | //return 1; |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("content", val); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.Employee", args.GetString(), x1) != 1) |
| | | xaserverarg args; |
| | | |
| | | args.AddArg(L"content", val); |
| | | xml x1; |
| | | |
| | | if (xurl::post(L"OrganizationStruct/update.Employee", args.GetString(), x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | xstring error = x1.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | win__::MessageBox(GetHWND(), "保存成功!", "提示", 0); |
| | | MessageBox(GetHWND(), L"保存成功!", L"提示", 0); |
| | | } |
| | | |
| | | xutil__::RestoreCursor(hIcon); |
| | | xutil::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string ls_orgid) |
| | | int OnRetrieve(xstring ls_orgid) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("OrgID", ls_orgid); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"OrgID", ls_orgid); |
| | | //trace(ls_orgid); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),"[MSSqlHrEmployee.xq]",arg.GetString(),x) == 1) |
| | | if (url::get("OrganizationStruct/detail.Employee", arg.GetString(), x) == 1) |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[MSSqlHrEmployee.xq]",arg.GetString(),x) == 1) |
| | | if (xurl::get(L"OrganizationStruct/detail.Employee", arg.GetString(), x) == 1) |
| | | { |
| | | dw_1.openUrl("组织架构.vface/template/HrEmployee/detail"); |
| | | dw_1.openUrl(L"组织架构.vface/template/HrEmployee/detail"); |
| | | dw_1.Retrieve(x); |
| | | dw_1.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; |
| | | //int wid = tv_org.GetId(); |
| | | HTREEITEM hitem = tv_org.GetSelectedItem(); |
| | | KXMLDOMElement ele = tv_org.GetItemData(hitem); |
| | | xstring ls_orgid = ele.selectSingleNode(L"@guid").text(); |
| | | is_orgid = ls_orgid; |
| | | //trace(is_orgid); |
| | | OnRetrieve(ls_orgid); |
| | |
| | | |
| | | int OnAddRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"HrEmployee") |
| | | dw.InsertRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.InsertRow(row); |
| | |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.DeleteRow(row); |
| | |
| | | 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 == "PositionID") { |
| | | arg.AddArg("ResourceType", "HrPosition"); |
| | | 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"PositionID") { |
| | | arg.AddArg(L"ResourceType", L"HrPosition"); |
| | | } |
| | | else if (col == "PersonID") { |
| | | arg.AddArg("ResourceType", "HrPerson"); |
| | | else if (col == L"PersonID") { |
| | | arg.AddArg(L"ResourceType", L"HrPerson"); |
| | | } |
| | | else if (col == "OrgID") { |
| | | arg.AddArg("ResourceType", "HrOrg"); |
| | | else 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 OnItemChanged(ref TNotifyEvent evt, int p) |
| | | int OnItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | int HCursor = xutil__::SetCursorWait(); |
| | | DWNMHDR& dwhdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | HCURSOR HCursor = xutil::SetCursorWait(); |
| | | |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | |
| | | int row = dwhdr.row; |
| | | string col = dwhdr.colname; |
| | | string data = dwhdr.data; |
| | | trace(row); |
| | | if (col == "PositionID") |
| | | xstring col = dwhdr.colname; |
| | | xstring data = dwhdr.data; |
| | | trace(xstring(row)); |
| | | if (col == L"PositionID") |
| | | { |
| | | xdwtable__ dw_HrEmployee = new xdwtable__; |
| | | dw_HrEmployee.setNativePointer(dw_1.FindDwTable("HrEmployee")); |
| | | string sPositionID = dw_HrEmployee.GetItemString(row, "PositionID"); |
| | | xdwtable dw_HrEmployee = new xdwtable; |
| | | dw_HrEmployee.setNativePointer(dw_1.FindDwTable(L"HrEmployee")); |
| | | xstring sPositionID = dw_HrEmployee.GetItemString(row, L"PositionID"); |
| | | |
| | | if (sPositionID == "" || sPositionID == nil) |
| | | if (sPositionID == L"") |
| | | return 1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", sPositionID); |
| | | arg.AddArg("type", "GetOrgIDJobID"); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"guid", sPositionID); |
| | | arg.AddArg(L"type", L"GetOrgIDJobID"); |
| | | //trace(arg.GetString()); |
| | | if (url::get("OrganizationStruct/GetOrgIDJobID", arg.GetString(), x) != 1) |
| | | if (xurl::get(L"OrganizationStruct/GetOrgIDJobID", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMDocument xdoc = x.GetXmlDoc(); |
| | | //IXMLDOMNodeList nlist = xdoc.getElementsByTagName("OrgID"); |
| | | msxml::IXMLDOMElement e = xdoc.documentElement; |
| | | string sOrgID = e.SelectSingleNode("@OrgID").text; |
| | | string sOrgName = e.SelectSingleNode("@OrgName").text; |
| | | string sJobID = e.SelectSingleNode("@JobID").text; |
| | | string sJobName = e.SelectSingleNode("@JobName").text; |
| | | dw_HrEmployee.SetItemString(row, "OrgID", sOrgID); |
| | | dw_HrEmployee.SetItemDisplayString(row, "OrgID", sOrgName); |
| | | dw_HrEmployee.SetItemString(row, "JobID", sJobID); |
| | | dw_HrEmployee.SetItemDisplayString(row, "JobID", sJobName); |
| | | KXMLDOMDocument xdoc = x; |
| | | //IXMLDOMNodeList nlist = xdoc.getElementsByTagName(L"OrgID"); |
| | | KXMLDOMElement e = xdoc.documentElement(); |
| | | xstring sOrgID = e.selectSingleNode(L"@OrgID").text(); |
| | | xstring sOrgName = e.selectSingleNode(L"@OrgName").text(); |
| | | xstring sJobID = e.selectSingleNode(L"@JobID").text(); |
| | | xstring sJobName = e.selectSingleNode(L"@JobName").text(); |
| | | dw_HrEmployee.SetItemString(row, L"OrgID", sOrgID); |
| | | dw_HrEmployee.SetItemDisplayString(row, L"OrgID", sOrgName); |
| | | dw_HrEmployee.SetItemString(row, L"JobID", sJobID); |
| | | dw_HrEmployee.SetItemDisplayString(row, L"JobID", sJobName); |
| | | } |
| | | } |
| | | xutil__::RestoreCursor(HCursor); |
| | | xutil::RestoreCursor(HCursor); |
| | | return 0; |
| | | } |
| | | |
| | | int OnImportData() |
| | | { |
| | | openUrl("组织架构.vface/xpage/Hr/HrPersonSel", this); |
| | | openUrl(L"组织架构.vface/xpage/Hr/HrPersonSel", this); |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == "AddRow") return OnAddRow(); |
| | | else if (comdid == "InsertRow") return OnInsertRow(); |
| | | else if (comdid == "DeleteRow") return OnDeleteRow(); |
| | | else if (comdid == "Save") return OnSave(); |
| | | else if (comdid == "ImportData") return OnImportData(); |
| | | if (comdid == L"AddRow") return OnAddRow(); |
| | | else if (comdid == L"InsertRow") return OnInsertRow(); |
| | | else if (comdid == L"DeleteRow") return OnDeleteRow(); |
| | | else if (comdid == L"Save") return OnSave(); |
| | | else if (comdid == L"ImportData") return OnImportData(); |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | 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)&HrEmployeex::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrEmployeex::OnSetFocus); |
| | | //获得树的选择事件 |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | AttachEvent(L"tv_org", L"TVN_SELCHANGED", (FEvent)&HrEmployeex::OnTreeSelChanged); |
| | | //下拉框 提供内容 |
| | | AttachEvent("dw_1", "DWV_CHILDCONTENT", OnChildContent); |
| | | AttachEvent("dw_1", "DWV_ITEMCHANGED", OnItemChanged); |
| | | AttachEvent(L"dw_1", L"DWV_CHILDCONTENT", (FEvent)&HrEmployeex::OnChildContent); |
| | | AttachEvent(L"dw_1", L"DWV_ITEMCHANGED", (FEvent)&HrEmployeex::OnItemChanged); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | dw_1 = new xdwtable__; |
| | | dw_1.setNativePointer(this.GetControl("dw_1")); |
| | | dw_1.openUrl("组织架构.vface/template/HrEmployee/detail"); |
| | | tv_org = new treeview; |
| | | tv_org.setNativePointer(GetControl(L"tv_org")); |
| | | dw_1 = new xdwtable; |
| | | dw_1.setNativePointer(GetControl(L"dw_1")); |
| | | dw_1.openUrl(L"组织架构.vface/template/HrEmployee/detail"); |
| | | |
| | | 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); |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | }; |
| | |
| | | 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 |
| | | [ |
| | | HrJob is extend frame; |
| | | about HrJob |
| | | [ |
| | | field: |
| | | [ |
| | | treeview__ tv_1; |
| | | xdwgrid__ dw_list; |
| | | string m_type; |
| | | #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) HrJob : public xframe |
| | | { |
| | | public: |
| | | xtreeview tv_1; |
| | | xdwgrid dw_list; |
| | | xstring m_type; |
| | | |
| | | 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: |
| | | HrJob(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static HrJob* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrJob* pWin = new HrJob(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(); |
| | | |
| | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | string query = "[MSSqlHrJob.xq]"; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("type", m_type); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1) |
| | | if (url::post("OrganizationStruct/list.Job", arg.GetString(), x) != 1) |
| | | xstring query = L"[MSSqlHrJob.xq]"; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"type", m_type); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1) |
| | | if (xurl::post(L"OrganizationStruct/list.Job", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.openUrl("组织架构.vface/template/HrJob/list"); |
| | | dw_list.openUrl(L"组织架构.vface/template/HrJob/list"); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt, int p) { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | int OnTreeSelChanged(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | |
| | | int wid = tv_1.GetId(); |
| | | int hItem = treeview__::GetSelectedItem(wid); |
| | | int rootItem = treeview__::GetRootItem(wid); |
| | | //int wid = tv_1.GetId(); |
| | | HTREEITEM hItem = tv_1.GetSelectedItem(); |
| | | HTREEITEM rootItem = tv_1.GetRootItem(); |
| | | if (hItem <= 0 || hItem == rootItem) |
| | | { |
| | | m_type = "all"; |
| | | m_type = L"all"; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hItem); |
| | | m_type = ele.SelectSingleNode("@name").text; |
| | | KXMLDOMElement ele = tv_1.GetItemData(hItem); |
| | | m_type = ele.selectSingleNode(L"@name").text(); |
| | | } |
| | | OnRetrieve(); |
| | | return 1; |
| | |
| | | |
| | | int OnCreateTree() |
| | | { |
| | | int wid = tv_1.GetId(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | x.Load("<Type code='0.0' name='all' guid='' />"); |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().SelectSingleNode("Type"); |
| | | int hItem = tv_1.InsertChildItemEx(wid, 0, "工种类型", ele, 15, 4); |
| | | //int wid = tv_1.GetId(); |
| | | xml x; |
| | | |
| | | x.loadXML(L"<Type code='0.0' name='all' guid='' />"); |
| | | KXMLDOMElement ele = x.selectSingleNode(L"Type"); |
| | | HTREEITEM hItem = tv_1.InsertChildItemEx(0, L"工种类型", ele, 15, 4); |
| | | |
| | | if (url::post("/sale/data/OrganizationStruct/type.Job", "", x) != 1) |
| | | if (xurl::post(L"/sale/data/OrganizationStruct/type.Job", L"", x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | trace(x.xml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list = x.GetXmlDoc().selectNodes("//Type"); |
| | | var list = x.selectNodes(L"//Type"); |
| | | int i = 0, s = list.length; |
| | | msxml::IXMLDOMElement e; |
| | | string sname; |
| | | KXMLDOMElement e; |
| | | xstring sname; |
| | | if (s > 0) |
| | | { |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | e = list.item(i); |
| | | sname = e.SelectSingleNode("@name").text; |
| | | int curItem = tv_1.InsertChildItemEx(wid, hItem, sname, e, 15, 4); |
| | | sname = e.selectSingleNode(L"@name").text(); |
| | | HTREEITEM curItem = tv_1.InsertChildItemEx( hItem, sname, e, 15, 4); |
| | | } |
| | | } |
| | | 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(); |
| | | trace(x.GetXml()); |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | |
| | | xstring xdata = x.xml(); |
| | | trace(x.xml()); |
| | | //return 1; |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("xdata", xdata); |
| | | xaserverarg arg; |
| | | |
| | | string xAction = "[MSSqlHrJobUpdate.xa]"; |
| | | //if(xaserver__::ExecXAction(GetServerUrl(),xAction,arg.GetString())!=1) |
| | | if (url::post("OrganizationStruct/update.Job", arg.GetString(), x) != 1) |
| | | arg.AddArg(L"xdata", xdata); |
| | | |
| | | xstring xAction = L"[MSSqlHrJobUpdate.xa]"; |
| | | //if(xaserver::ExecXAction(GetServerUrl(),xAction,arg.GetString())!=1) |
| | | if (xurl::post(L"OrganizationStruct/update.Job", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().documentElement.text); |
| | | alert("保存失败"); |
| | | trace(x.documentElement().text()); |
| | | alert(L"保存失败"); |
| | | } |
| | | else { |
| | | alert("保存成功"); |
| | | alert(L"保存成功"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | if (m_type == "all") |
| | | if (m_type == L"all") |
| | | { |
| | | alert("请先选择工种类型!"); |
| | | alert(L"请先选择工种类型!"); |
| | | } |
| | | else |
| | | { |
| | | int row = dw_list.InsertRow(0); |
| | | trace(row.toString()); |
| | | dw_list.SetItemString(row, "JobType", m_type); |
| | | dw_list.SetItemString(row, "Status", "Y"); |
| | | trace(xstring(row)); |
| | | dw_list.SetItemString(row, L"JobType", m_type); |
| | | dw_list.SetItemString(row, L"Status", L"Y"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | if (m_type == "all") |
| | | if (m_type == L"all") |
| | | { |
| | | alert("请先选择工种类型!"); |
| | | alert(L"请先选择工种类型!"); |
| | | } |
| | | else |
| | | { |
| | | int crow = dw_list.GetRow(); |
| | | int row = dw_list.InsertRow(crow); |
| | | dw_list.SetItemString(row, "JobType", m_type); |
| | | dw_list.SetItemString(row, "Status", "Y"); |
| | | dw_list.SetItemString(row, L"JobType", m_type); |
| | | dw_list.SetItemString(row, L"Status", L"Y"); |
| | | } |
| | | return 1; |
| | | } |
| | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.selectSingleNode("@guid").text; |
| | | string sName = e.selectSingleNode("JobName").text; |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sguid = e.selectSingleNode(L"@guid").text(); |
| | | xstring sName = e.selectSingleNode(L"JobName").text(); |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", sguid); |
| | | if (url::post("OrganizationStruct/used.Job", arg.GetString(), x) != 1) |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"guid", sguid); |
| | | if (xurl::post(L"OrganizationStruct/used.Job", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; |
| | | string snums = ele.SelectSingleNode("@num").text; |
| | | KXMLDOMElement ele = x.documentElement(); |
| | | xstring snums = ele.selectSingleNode(L"@num").text(); |
| | | int num = snums.toInt(); |
| | | if (num != 0) |
| | | { |
| | | win__::MessageBox(GetHWND(), "工种 " + sName + " 已启用,禁止删除!", "提示", 0); |
| | | MessageBox(GetHWND(), L"工种 " + sName + L" 已启用,禁止删除!", L"提示", 0); |
| | | return -1; |
| | | } |
| | | } |
| | |
| | | |
| | | int OnJobType() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id", "工种类型"); |
| | | openUrl("公共设置.vface/worknode/quickcode/config", arg); |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"id", L"工种类型"); |
| | | openUrl(L"公共设置.vface/worknode/quickcode/config", &arg); |
| | | 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(); |
| | | else if (comdid == "JobType") OnJobType(); |
| | | if (comdid == L"Save") OnSave(); |
| | | else if (comdid == L"AddRow") OnAddRow(); |
| | | else if (comdid == L"InsertRow") OnInsertRow(); |
| | | else if (comdid == L"DeleteRow") OnDeleteRow(); |
| | | else if (comdid == L"JobType") OnJobType(); |
| | | 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)&HrJob::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrJob::OnSetFocus); |
| | | //获得树的选择事件 |
| | | AttachEvent("tv_1", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&HrJob::OnTreeSelChanged); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | |
| | | |
| | | int onload() |
| | | { |
| | | m_type = "all"; |
| | | tv_1 = new treeview__; |
| | | tv_1.setNativePointer(this.GetControl("tv_1")); |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("组织架构.vface/template/HrJob/list"); |
| | | m_type = L"all"; |
| | | tv_1 = new treeview; |
| | | tv_1.setNativePointer(GetControl(L"tv_1")); |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.openUrl(L"组织架构.vface/template/HrJob/list"); |
| | | |
| | | OnInitial(); |
| | | OnCreateTree(); |
| | | int wid = tv_1.GetId(); |
| | | int hItem = treeview__::GetRootItem(wid); |
| | | tv_1.ExpandItem(wid, hItem); |
| | | //int wid = tv_1.GetId(); |
| | | HTREEITEM hItem = tv_1.GetRootItem(); |
| | | tv_1.ExpandItem(hItem); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | }; |
| | |
| | | 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 |
| | | [ |
| | | HrOrg is extend list; |
| | | about HrOrg |
| | | [ |
| | | 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; |
| | | treeview__ tv_org; |
| | | string sOrgID; |
| | | string sOrgName; |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | string sRootOrgID; |
| | | string sRootOrgName; |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) HrOrg : public xwin |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xtreeview tv_org; |
| | | xstring sOrgID; |
| | | xstring sOrgName; |
| | | |
| | | 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; |
| | | } |
| | | xstring sRootOrgID; |
| | | xstring sRootOrgName; |
| | | |
| | | 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", sOrgID); |
| | | if (url::get("OrganizationStruct/list.HrOrg", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | public: |
| | | HrOrg(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static HrOrg* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrOrg* pWin = new HrOrg(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 p) |
| | | { |
| | | SetAgent(); |
| | | //OnRetrieve(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | HCURSOR hIcon = xutil::SetCursorWait(); |
| | | xml x; |
| | | |
| | | int OnCreateTree(string sguid, int parentitem) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sguid", sguid); |
| | | if (url::post("/sale/data/OrganizationStruct/tree.child.OrgChart", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list = x.GetXmlDoc().selectNodes("//Org"); |
| | | int i = 0, s = list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | string sname; |
| | | string sguid; |
| | | if (s > 0) |
| | | { |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | xitem = list.item(s - i - 1); |
| | | sname = xitem.SelectSingleNode("OrgName").text; |
| | | sguid = xitem.SelectSingleNode("@guid").text; |
| | | int curItem = tv_org.InsertChildItemEx(wid, parentitem, sname, xitem, 15, 4); |
| | | OnCreateTree(sguid, curItem); |
| | | /*string id = xitem.selectSingleNode("ModuleID").text; |
| | | string Name=""; |
| | | if(xitem.selectSingleNode("ModuleName")) Name=xitem.selectSingleNode("ModuleName").text; |
| | | string image = 15; |
| | | if(xitem.selectSingleNode("ModuelImage")) image=xitem.selectSingleNode("ModuelImage").text; |
| | | int curItem=treeview__::InsertItem(tv_menu.GetId(), parentItem,0,Name,id,image.toInt()); |
| | | string child=xitem.selectSingleNode("@child").text;//item.getAttribute("HasChild"); |
| | | if (child != "0") |
| | | treeview__::SetItemChild1(tv_menu.GetId(), curItem,1);*/ |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | xaserverarg arg; |
| | | |
| | | int OnTreeExpanding(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | arg.AddArg(L"guid", sOrgID); |
| | | if (xurl::get(L"OrganizationStruct/list.HrOrg", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | xutil::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | string id = treeview__::GetItemData(tv_org.GetId(), sitem); |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | OnCreateTree(id, sitem); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | //OnRetrieve(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | //树点击事件 |
| | | int OnTreeSelecded(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | int wid = tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | int OnCreateTree(xstring sguid, HTREEITEM parentitem) |
| | | { |
| | | //int wid = ; |
| | | xml x; |
| | | |
| | | int hroot = treeview__::GetParentItem(wid, hitem); |
| | | int hparent = treeview__::GetParentItem(wid, hroot); |
| | | if (!hparent) |
| | | { |
| | | hparent = hroot; |
| | | hroot = hitem; |
| | | } |
| | | bool found = false; |
| | | if (hparent) found = true; |
| | | while (treeview__::GetParentItem(wid, hparent)) |
| | | { |
| | | hroot = hparent; |
| | | hparent = treeview__::GetParentItem(wid, hroot); |
| | | } |
| | | if (found) |
| | | { |
| | | msxml::IXMLDOMElement ele1 = treeview__::GetItemData(wid, hroot); |
| | | //trace(ele1.xml); |
| | | //sRootOrgID = ele1.SelectSingleNode("CompanyID").text; |
| | | //sRootOrgName = ele1.selectSingleNode("CompanyID/@_displaystring").text; |
| | | } |
| | | xaserverarg arg; |
| | | |
| | | string ls_orgid = ele.SelectSingleNode("@guid").text; |
| | | sOrgID = ls_orgid + ""; |
| | | //trace(sOrgID); |
| | | sOrgName = ele.selectSingleNode("OrgName").text; |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | arg.AddArg(L"sguid", sguid); |
| | | if (xurl::post(L"/sale/data/OrganizationStruct/tree.child.OrgChart", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.xml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list = x.selectNodes(L"//Org"); |
| | | int i = 0, s = list.length; |
| | | KXMLDOMElement xitem; |
| | | xstring sname; |
| | | xstring sguid; |
| | | if (s > 0) |
| | | { |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | xitem = list.item(s - i - 1); |
| | | sname = xitem.selectSingleNode(L"OrgName").text(); |
| | | sguid = xitem.selectSingleNode(L"@guid").text(); |
| | | HTREEITEM curItem = tv_org.InsertChildItemEx(parentitem, sname, xitem, 15, 4); |
| | | OnCreateTree(sguid, curItem); |
| | | /*xstring id = xitem.selectSingleNode(L"ModuleID").text(); |
| | | xstring Name=L""; |
| | | if(xitem.selectSingleNode(L"ModuleName")) Name=xitem.selectSingleNode(L"ModuleName").text(); |
| | | xstring image = 15; |
| | | if(xitem.selectSingleNode(L"ModuelImage")) image=xitem.selectSingleNode(L"ModuelImage").text(); |
| | | int curItem=tv_org.InsertItem(tv_menu.GetId(), parentItem,0,Name,id,image.toInt()); |
| | | xstring child=xitem.selectSingleNode(L"@child").text();//item.getAttribute(L"HasChild"); |
| | | if (child != L"0") |
| | | tv_org.SetItemChild1(tv_menu.GetId(), curItem,1);*/ |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeMoveNode(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref TVNNMHDR nmtv = evt.pnmh; |
| | | int xfrom = nmtv.FromItem; |
| | | int xto = nmtv.ToItem; |
| | | int OnTreeExpanding(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM sitem = nmtv.itemNew.hItem; |
| | | |
| | | int ret = win__::MessageBox(this.GetHWND(), "确定移动组织节点?", "提示:", 1); |
| | | //trace(ret); |
| | | int wid = tv_org.GetId(); |
| | | if (ret == 2) |
| | | { |
| | | treeview__::DeleteItem(wid, xto); |
| | | return -1; |
| | | } |
| | | xstring id = tv_org.GetItemData(sitem); |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnCreateTree(id, sitem); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | //string fid = treeview__::GetItemData(wid, xfrom); |
| | | //string tid = treeview__::GetItemData(wid, xto); |
| | | int xtop = treeview__::GetParentItem(wid, xto); |
| | | msxml::IXMLDOMElement ef = treeview__::GetItemData(wid, xfrom); |
| | | msxml::IXMLDOMElement et = treeview__::GetItemData(wid, xtop); |
| | | string fid = ef.SelectSingleNode("@guid").text;//ef.xml; |
| | | string tid = et.SelectSingleNode("@guid").text;//et.xml; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("from", fid); |
| | | arg.AddArg("to", tid); |
| | | //trace(et.xml); |
| | | //return 1; |
| | | if (url::post("OrganizationStruct/move.update.HrOrg", arg.GetString(), x) != 1) |
| | | { |
| | | trace("error:" + x.GetXml()); |
| | | alert("移动组织节点出错!"); |
| | | treeview__::DeleteItem(wid, xto); |
| | | return 0; |
| | | } |
| | | treeview__::DeleteItem(wid, xfrom); |
| | | return 1; |
| | | } |
| | | //树点击事件 |
| | | int OnTreeSelecded(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | int wid = 0; |
| | | HTREEITEM hitem = tv_org.GetSelectedItem(); |
| | | KXMLDOMElement ele = tv_org.GetItemData(hitem); |
| | | |
| | | //xgridex双击 |
| | | int OnDoubleClicked(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | if (row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.SelectSingleNode("@guid").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sguid); |
| | | arg.AddArg("tvOrgID", sOrgID); |
| | | arg.AddArg("tvOrgName", sOrgName); |
| | | arg.AddArg("tvRootOrgID", sRootOrgID); |
| | | arg.AddArg("tvRootOrgName", sRootOrgName); |
| | | //trace(row.toString()); |
| | | //win__::OpenWindow("dev:xpage[HrOrgMaint.xpage]",arg); |
| | | openUrl("组织架构.vface/xpage/HrOrg/maint", arg); |
| | | return 1; |
| | | } |
| | | HTREEITEM hroot = tv_org.GetParentItem(hitem); |
| | | HTREEITEM hparent = tv_org.GetParentItem(hroot); |
| | | if (!hparent) |
| | | { |
| | | hparent = hroot; |
| | | hroot = hitem; |
| | | } |
| | | bool found = false; |
| | | if (hparent) found = true; |
| | | while (tv_org.GetParentItem(hparent)) |
| | | { |
| | | hroot = hparent; |
| | | hparent = tv_org.GetParentItem(hroot); |
| | | } |
| | | if (found) |
| | | { |
| | | KXMLDOMElement ele1 = tv_org.GetItemData(hroot); |
| | | //trace(ele1.xml); |
| | | //sRootOrgID = ele1.selectSingleNode(L"CompanyID").text(); |
| | | //sRootOrgName = ele1.selectSingleNode(L"CompanyID/@_displaystring").text(); |
| | | } |
| | | |
| | | int AddRow() |
| | | { |
| | | /*int wid = tv_org.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | int root=treeview__::GetRootItem(wid); |
| | | if (hitem == root) |
| | | { |
| | | win32::MessageBox(GetHWND(),"根组织!","提示",0); |
| | | return -1; |
| | | }*/ |
| | | //int row = dw_list.GetNextSelectRow(1); |
| | | //IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | //string sguid = e.getAttribute("guid"); |
| | | xstring ls_orgid = ele.selectSingleNode(L"@guid").text(); |
| | | sOrgID = ls_orgid + L""; |
| | | //trace(sOrgID); |
| | | sOrgName = ele.selectSingleNode(L"OrgName").text(); |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "new0"); |
| | | arg.AddArg("guid", ""); |
| | | arg.AddArg("tvOrgID", sOrgID); |
| | | arg.AddArg("tvOrgName", sOrgName); |
| | | arg.AddArg("tvRootOrgID", sRootOrgID); |
| | | arg.AddArg("tvRootOrgName", sRootOrgName); |
| | | openUrl("组织架构.vface/xpage/HrOrg/maint", arg); |
| | | return 1; |
| | | } |
| | | int OnTreeMoveNode(TEvent* evt, int p) |
| | | { |
| | | TVNNMHDR& nmtv = *(TVNNMHDR*)evt->notify.pnmh; |
| | | HTREEITEM xfrom = nmtv.FromItem; |
| | | HTREEITEM xto = nmtv.ToItem; |
| | | |
| | | int ModifyRow() |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(), "请选中要修改的组织数据行!", "提示", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.SelectSingleNode("@guid").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sguid); |
| | | arg.AddArg("tvOrgID", sOrgID); |
| | | arg.AddArg("tvOrgName", sOrgName); |
| | | arg.AddArg("tvRootOrgID", sRootOrgID); |
| | | arg.AddArg("tvRootOrgName", sRootOrgName); |
| | | openUrl("组织架构.vface/xpage/HrOrg/maint", arg); |
| | | return 1; |
| | | } |
| | | int ret = MessageBox(GetHWND(), L"确定移动组织节点?", L"提示:", 1); |
| | | //trace(ret); |
| | | int wid = 0; |
| | | if (ret == 2) |
| | | { |
| | | tv_org.DeleteItem(xto); |
| | | return -1; |
| | | } |
| | | |
| | | int OnDeleteItem(string sguid) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | int ditem = treeview__::GetChildItem(wid, hitem); |
| | | msxml::IXMLDOMElement e = treeview__::GetItemData(wid, ditem); |
| | | if (e) |
| | | { |
| | | string dguid = e.SelectSingleNode("@guid").text; |
| | | while (dguid != sguid) |
| | | { |
| | | ditem = treeview__::GetNextItem(wid, ditem); |
| | | e = treeview__::GetItemData(wid, ditem); |
| | | dguid = e.SelectSingleNode("@guid").text; |
| | | } |
| | | treeview__::DeleteItem(wid, ditem); |
| | | } |
| | | return 1; |
| | | } |
| | | int DeleteRow() |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | //win__::MessageBox(GetHWND(),"请选中要删除的组织数据行!","提示",0); |
| | | return -1; |
| | | } |
| | | } |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.SelectSingleNode("@guid").text; |
| | | string sName = e.selectSingleNode("OrgName").text; |
| | | sName += ""; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", sguid); |
| | | if (url::get("OrganizationStruct/child.OrgNums", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; |
| | | string snums = ele.SelectSingleNode("@num").text; |
| | | int num = snums.toInt(); |
| | | if (num != 0) |
| | | { |
| | | win__::MessageBox(GetHWND(), "组织 " + sName + " 存在下级组织单元,禁止删除!", "提示", 0); |
| | | return 1; |
| | | } |
| | | } |
| | | //xstring fid = tv_org.GetItemData(wid, xfrom); |
| | | //xstring tid = tv_org.GetItemData(wid, xto); |
| | | HTREEITEM xtop = tv_org.GetParentItem(xto); |
| | | KXMLDOMElement ef = tv_org.GetItemData(xfrom); |
| | | KXMLDOMElement et = tv_org.GetItemData(xtop); |
| | | xstring fid = ef.selectSingleNode(L"@guid").text();//ef.xml; |
| | | xstring tid = et.selectSingleNode(L"@guid").text();//et.xml; |
| | | xml x; |
| | | |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (win__::MessageBox(GetHWND(), "确认要删除组织 " + sName + " 的信息吗?", "提示", MB_YESNO) != IDYES) return 1; |
| | | arg.AddArg("guid", sguid); |
| | | //trace(sguid); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("/sale/data/OrganizationStruct/delete.HrOrg", arg.GetString(), x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | //win32::MessageBox(GetHWND(),"删除成功!","提示",0); |
| | | dw_list.DeleteRow(row); |
| | | OnDeleteItem(sguid); |
| | | } |
| | | return 1; |
| | | } |
| | | xaserverarg arg; |
| | | |
| | | int Productlinemaint() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id", "产品线"); |
| | | openUrl("公共设置.vface/worknode/quickcode/config", arg); |
| | | //openUrl("下拉窗口.vface/xpage/hremployee/select", arg); |
| | | arg.AddArg(L"from", fid); |
| | | arg.AddArg(L"to", tid); |
| | | //trace(et.xml); |
| | | //return 1; |
| | | if (xurl::post(L"OrganizationStruct/move.update.HrOrg", arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"error:" + (xstring)x.xml()); |
| | | alert(L"移动组织节点出错!"); |
| | | tv_org.DeleteItem(xto); |
| | | return 0; |
| | | } |
| | | tv_org.DeleteItem(xfrom); |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int setTree() |
| | | { |
| | | string str = "<vbox name='tree' >"; |
| | | str += "<xtree name='tv_org' imagelist='0' drag='true'>"; |
| | | str += "<treeitem src='xquery:[OrgChart.hr.xq]' src1='xquery:[OrgStructureRetrieve.xq]' xcaption='OrgName' xroot='/root' xpath='Org' xchildpath='Org' image='15' loop='yes' xdata='.'/>"; |
| | | str += "</xtree></vbox>"; |
| | | string xfNodeAgentArea = "tree"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | SetAgentNodeContent(anode, str); |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelecded); |
| | | int root = treeview__::GetRootItem(tv_org.GetId()); |
| | | if (root > 0) |
| | | { |
| | | treeview__::ExpandItemEx(tv_org.GetId(), root); |
| | | } |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "AddRow") { return AddRow(); } |
| | | else if (comdid == "ModifyRow") { return ModifyRow(); } |
| | | else if (comdid == "DeleteRow") { return DeleteRow(); } |
| | | else if (comdid == "OrgType") |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id", "组织类型"); |
| | | openUrl("公共设置.vface/worknode/quickcode/config", arg); |
| | | //openUrl("组织架构.vface/xpage/HrOrg/type"); |
| | | } |
| | | else if (comdid == "Refresh") |
| | | { |
| | | OnRetrieve(); |
| | | setTree(); |
| | | AttachEvent("tv_org", "TVN_ENDDRAG", OnTreeMoveNode); |
| | | } |
| | | else if (comdid == "Productlinemaint") |
| | | { |
| | | Productlinemaint(); |
| | | } |
| | | return 0; |
| | | } |
| | | //xgridex双击 |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if (row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sguid = e.selectSingleNode(L"@guid").text(); |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | arg.AddArg(L"operate", L"modify"); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"tvOrgID", sOrgID); |
| | | arg.AddArg(L"tvOrgName", sOrgName); |
| | | arg.AddArg(L"tvRootOrgID", sRootOrgID); |
| | | arg.AddArg(L"tvRootOrgName", sRootOrgName); |
| | | //trace(row.toString()); |
| | | //win::OpenWindow(L"dev:xpage[HrOrgMaint.xpage]",arg); |
| | | openUrl(L"组织架构.vface/xpage/HrOrg/maint", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //获得树的点击事件 |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelecded); |
| | | AttachEvent("tv_org", "TVN_ITEMEXPANDING", OnTreeExpanding); |
| | | AttachEvent("tv_org", "TVN_ENDDRAG", OnTreeMoveNode); |
| | | //双击 |
| | | AttachEvent("dw_list", "DWV_DOUBLECLICKED", OnDoubleClicked); |
| | | } |
| | | int AddRow() |
| | | { |
| | | /*int wid = ; |
| | | int hitem=tv_org.GetSelectedItem(wid); |
| | | int root=tv_org.GetRootItem(wid); |
| | | if (hitem == root) |
| | | { |
| | | win32::MessageBox(GetHWND(),L"根组织!",L"提示",0); |
| | | return -1; |
| | | }*/ |
| | | //int row = dw_list.GetNextSelectRow(1); |
| | | //IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | //xstring sguid = e.getAttribute(L"guid"); |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | OnAttachEvent(); |
| | | arg.AddArg(L"operate", L"new0"); |
| | | arg.AddArg(L"guid", L""); |
| | | arg.AddArg(L"tvOrgID", sOrgID); |
| | | arg.AddArg(L"tvOrgName", sOrgName); |
| | | arg.AddArg(L"tvRootOrgID", sRootOrgID); |
| | | arg.AddArg(L"tvRootOrgName", sRootOrgName); |
| | | openUrl(L"组织架构.vface/xpage/HrOrg/maint", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int ModifyRow() |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | MessageBox(GetHWND(), L"请选中要修改的组织数据行!", L"提示", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sguid = e.selectSingleNode(L"@guid").text(); |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | 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/HrOrg/list"); |
| | | dw_list.SetSelectionMode(1); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetColumnState("OrgPlat", false); |
| | | dw_list.SetColumnState("OrgComLeader", false); |
| | | dw_list.SetColumnState("OrgSupLeader", false); |
| | | dw_list.SetColumnState("OrgProLine", false); |
| | | arg.AddArg(L"operate", L"modify"); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"tvOrgID", sOrgID); |
| | | arg.AddArg(L"tvOrgName", sOrgName); |
| | | arg.AddArg(L"tvRootOrgID", sRootOrgID); |
| | | arg.AddArg(L"tvRootOrgName", sRootOrgName); |
| | | openUrl(L"组织架构.vface/xpage/HrOrg/maint", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteItem(xstring sguid) |
| | | { |
| | | int wid = 0; |
| | | HTREEITEM hitem = tv_org.GetSelectedItem(); |
| | | HTREEITEM ditem = tv_org.GetChildItem(hitem); |
| | | KXMLDOMElement e = tv_org.GetItemData(ditem); |
| | | if (e) |
| | | { |
| | | xstring dguid = e.selectSingleNode(L"@guid").text(); |
| | | while (dguid != sguid) |
| | | { |
| | | ditem = tv_org.GetNextItem(ditem); |
| | | e = tv_org.GetItemData(ditem); |
| | | dguid = e.selectSingleNode(L"@guid").text(); |
| | | } |
| | | tv_org.DeleteItem(ditem); |
| | | } |
| | | return 1; |
| | | } |
| | | int DeleteRow() |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的组织数据行!",L"提示",0); |
| | | return -1; |
| | | } |
| | | } |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sguid = e.selectSingleNode(L"@guid").text(); |
| | | xstring sName = e.selectSingleNode(L"OrgName").text(); |
| | | sName += L""; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"guid", sguid); |
| | | if (xurl::get(L"OrganizationStruct/child.OrgNums", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement ele = x.documentElement(); |
| | | xstring snums = ele.selectSingleNode(L"@num").text(); |
| | | int num = snums.toInt(); |
| | | if (num != 0) |
| | | { |
| | | MessageBox(GetHWND(), L"组织 " + sName + L" 存在下级组织单元,禁止删除!", L"提示", 0); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBox(GetHWND(), L"确认要删除组织 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | arg.AddArg(L"guid", sguid); |
| | | //trace(sguid); |
| | | xml x1; |
| | | |
| | | if (xurl::post(L"/sale/data/OrganizationStruct/delete.HrOrg", arg.GetString(), x1) != 1) |
| | | { |
| | | xstring error = x1.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | //win32::MessageBox(GetHWND(),L"删除成功!",L"提示",0); |
| | | dw_list.DeleteRow(row); |
| | | OnDeleteItem(sguid); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int Productlinemaint() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"id", L"产品线"); |
| | | openUrl(L"公共设置.vface/worknode/quickcode/config", &arg); |
| | | //openUrl(L"下拉窗口.vface/xpage/hremployee/select", arg); |
| | | |
| | | return 1; |
| | | } |
| | | int setTree() |
| | | { |
| | | xstring str = L"<vbox name='tree' >"; |
| | | str += L"<xtree name='tv_org' imagelist='0' drag='true'>"; |
| | | str += L"<treeitem src='xquery:[OrgChart.hr.xq]' src1='xquery:[OrgStructureRetrieve.xq]' xcaption='OrgName' xroot='/root' xpath='Org' xchildpath='Org' image='15' loop='yes' xdata='.'/>"; |
| | | str += L"</xtree></vbox>"; |
| | | xstring xfNodeAgentArea = L"tree"; |
| | | xnode anode = new xnode; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | SetAgentNode(anode, str); |
| | | tv_org = new treeview; |
| | | tv_org.setNativePointer(GetControl(L"tv_org")); |
| | | AttachEvent(L"tv_org", L"TVN_SELCHANGED", (FEvent)&HrOrg::OnTreeSelecded); |
| | | HTREEITEM root = tv_org.GetRootItem(); |
| | | if (root > 0) |
| | | { |
| | | tv_org.ExpandItemEx(root); |
| | | } |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"AddRow") { return AddRow(); } |
| | | else if (comdid == L"ModifyRow") { return ModifyRow(); } |
| | | else if (comdid == L"DeleteRow") { return DeleteRow(); } |
| | | else if (comdid == L"OrgType") |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"id", L"组织类型"); |
| | | openUrl(L"公共设置.vface/worknode/quickcode/config", &arg); |
| | | //openUrl(L"组织架构.vface/xpage/HrOrg/type"); |
| | | } |
| | | else if (comdid == L"Refresh") |
| | | { |
| | | OnRetrieve(); |
| | | setTree(); |
| | | AttachEvent(L"tv_org", L"TVN_ENDDRAG", (FEvent)&HrOrg::OnTreeMoveNode); |
| | | } |
| | | else if (comdid == L"Productlinemaint") |
| | | { |
| | | Productlinemaint(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&HrOrg::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrOrg::OnSetFocus); |
| | | //获得树的点击事件 |
| | | AttachEvent(L"tv_org", L"TVN_SELCHANGED", (FEvent)&HrOrg::OnTreeSelecded); |
| | | AttachEvent(L"tv_org", L"TVN_ITEMEXPANDING", (FEvent)&HrOrg::OnTreeExpanding); |
| | | AttachEvent(L"tv_org", L"TVN_ENDDRAG", (FEvent)&HrOrg::OnTreeMoveNode); |
| | | //双击 |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&HrOrg::OnDoubleClicked); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | 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/HrOrg/list"); |
| | | dw_list.SetSelectionMode(1); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetColumnState(L"OrgPlat", false); |
| | | dw_list.SetColumnState(L"OrgComLeader", false); |
| | | dw_list.SetColumnState(L"OrgSupLeader", false); |
| | | dw_list.SetColumnState(L"OrgProLine", false); |
| | | |
| | | |
| | | OnInitial(); |
| | | OnInitial(); |
| | | |
| | | //OnCreateTree("00000000-0000-0000-0000-000000000000", 0); |
| | | int root = treeview__::GetRootItem(tv_org.GetId()); |
| | | if (root > 0) |
| | | { |
| | | treeview__::ExpandItemEx(tv_org.GetId(), root); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(), root); |
| | | if (ele) |
| | | { |
| | | string ls_orgid = ele.SelectSingleNode("@guid").text; |
| | | sOrgID = ls_orgid + ""; |
| | | sOrgName = ele.selectSingleNode("OrgName").text; |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | //OnCreateTree(L"00000000-0000-0000-0000-000000000000", 0); |
| | | HTREEITEM root = tv_org.GetRootItem(); |
| | | if (root > 0) |
| | | { |
| | | tv_org.ExpandItemEx(root); |
| | | KXMLDOMElement ele = tv_org.GetItemData(root); |
| | | if (ele) |
| | | { |
| | | xstring ls_orgid = ele.selectSingleNode(L"@guid").text(); |
| | | sOrgID = ls_orgid + L""; |
| | | sOrgName = ele.selectSingleNode(L"OrgName").text(); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | 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]" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrOrgChart is extend win__; |
| | | about HrOrgChart |
| | | [ |
| | | control: |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | method: |
| | | [ |
| | | treeview__ tv_org; |
| | | xdwtable__ dw_parent; |
| | | int m_bCanDestroy; |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) HrOrgChart : public xwin |
| | | { |
| | | public: |
| | | xtreeview tv_org; |
| | | xdwtable dw_parent; |
| | | int m_bCanDestroy; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | public: |
| | | HrOrgChart(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static HrOrgChart* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrOrgChart* pWin = new HrOrgChart(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hitem = nmtv.itemNew.hItem; |
| | | if (hitem == 0) |
| | | hitem = treeview__::GetRootItem(tv_org.GetId()); |
| | | string label = treeview__::GetItemLabel(tv_org.GetId(), hitem); |
| | | string pUnit; |
| | | pUnit = treeview__::GetItemLabel(tv_org.GetId(), hitem) + "\\"; |
| | | int pitem = treeview__::GetParentItem(tv_org.GetId(), hitem); |
| | | while (pitem > 0) |
| | | { |
| | | pUnit = treeview__::GetItemLabel(tv_org.GetId(), pitem) + "\\" + pUnit; |
| | | pitem = treeview__::GetParentItem(tv_org.GetId(), pitem); |
| | | } |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(), hitem); |
| | | string guid = ele.SelectSingleNode("@guid").text; |
| | | int OnTreeSelChanged(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hitem = nmtv.itemNew.hItem; |
| | | if (hitem == 0) |
| | | hitem = tv_org.GetRootItem(); |
| | | xstring label = tv_org.GetItemLabel(hitem); |
| | | xstring pUnit; |
| | | pUnit = tv_org.GetItemLabel(hitem) + L"\\"; |
| | | HTREEITEM pitem = tv_org.GetParentItem(hitem); |
| | | while (pitem > 0) |
| | | { |
| | | pUnit = tv_org.GetItemLabel(pitem) + L"\\" + pUnit; |
| | | pitem = tv_org.GetParentItem(pitem); |
| | | } |
| | | KXMLDOMElement ele = tv_org.GetItemData(hitem); |
| | | xstring guid = ele.selectSingleNode(L"@guid").text(); |
| | | |
| | | //CloseWindow(); |
| | | return 1; |
| | | } |
| | | //CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnActive(ref TEvent evt, int p) |
| | | { |
| | | /*int WA_INACTIVE = 0; |
| | | int WA_ACTIVE = 1; |
| | | int WA_CLICKACTIVE = 2; |
| | | int lw = evt.wParam & 0xffff; |
| | | if( lw ==WA_INACTIVE && m_bCanDestroy==1 ) |
| | | { |
| | | win__::CloseWindow(); |
| | | return 1; |
| | | } |
| | | if(lw !=WA_INACTIVE)m_bCanDestroy = 1; |
| | | return 1;*/ |
| | | } |
| | | int OnActive(TEvent* evt, int p) |
| | | { |
| | | /*int WA_INACTIVE = 0; |
| | | int WA_ACTIVE = 1; |
| | | int WA_CLICKACTIVE = 2; |
| | | int lw = evt.wParam & 0xffff; |
| | | if( lw ==WA_INACTIVE && m_bCanDestroy==1 ) |
| | | { |
| | | win::CloseWindow(); |
| | | return 1; |
| | | } |
| | | if(lw !=WA_INACTIVE)m_bCanDestroy = 1; |
| | | return 1;*/ |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK(string comdid) |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = win__::GetParam(); |
| | | arg.AddArg("comdid", comdid); |
| | | int hitem = treeview__::GetSelectedItem(tv_org.GetId()); |
| | | if (hitem > 0) |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(), hitem); |
| | | string guid = ele.SelectSingleNode("@guid").text; |
| | | string label = ele.selectSingleNode("OrgName").text; |
| | | arg.AddArg("OrgName", label); |
| | | arg.AddArg("OrgId", guid); |
| | | win__::CloseWindow(); |
| | | } |
| | | else |
| | | win__::MessageBox(GetHWND(), "请选择组织!", "提示", 0); |
| | | return 1; |
| | | } |
| | | int OnOK(xstring comdid) |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | if (comdid == "xmOk") |
| | | OnOK(comdid); |
| | | else if (comdid == "xmCancel") |
| | | CloseWindow(); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | arg = GetArg(); |
| | | arg.AddArg(L"comdid", comdid); |
| | | HTREEITEM hitem = tv_org.GetSelectedItem(); |
| | | if (hitem > 0) |
| | | { |
| | | KXMLDOMElement ele = tv_org.GetItemData( hitem); |
| | | xstring guid = ele.selectSingleNode(L"@guid").text(); |
| | | xstring label = ele.selectSingleNode(L"OrgName").text(); |
| | | arg.AddArg(L"OrgName", label); |
| | | arg.AddArg(L"OrgId", guid); |
| | | CloseWindow(); |
| | | } |
| | | else |
| | | MessageBox(GetHWND(), L"请选择组织!", L"提示", 0); |
| | | return 1; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | if (comdid == L"xmOk") |
| | | OnOK(comdid); |
| | | else if (comdid == L"xmCancel") |
| | | CloseWindow(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | //AttachEvent("WM_ACTIVATE",OnActive); |
| | | } |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | OnAttachEvent(); |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&HrOrgChart::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrOrgChart::OnSetFocus); |
| | | AttachEvent(L"tv_org", L"TVN_SELCHANGED", (FEvent)&HrOrgChart::OnTreeSelChanged); |
| | | |
| | | return 1; |
| | | } |
| | | //AttachEvent(L"WM_ACTIVATE",OnActive); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_bCanDestroy = 1; |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | OnInitial(); |
| | | int OnInitial() |
| | | { |
| | | OnAttachEvent(); |
| | | |
| | | int root = treeview__::GetRootItem(tv_org.GetId()); |
| | | treeview__::ExpandItemEx(tv_org.GetId(), root); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | SetArg(); |
| | | m_bCanDestroy = 1; |
| | | tv_org = new xtreeview; |
| | | tv_org.setNativePointer(GetControl(L"tv_org")); |
| | | OnInitial(); |
| | | |
| | | HTREEITEM root = tv_org.GetRootItem(); |
| | | tv_org.ExpandItemEx( root); |
| | | |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | 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()); |
| | | var 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, sPersonName); |
| | | dw_detail.SetItemString(1, colname, 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; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | 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; |
| | | } |
| | | }; |
| | |
| | | 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; |
| | | } |
| | | var 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.setNativePointer(args.CreateInstance()); |
| | | 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; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | //命令处理事件 |
| | | 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; |
| | | } |
| | | }; |
| | |
| | | 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" |
| | | use "dev:code[HrEmployee.vx]" |
| | | use "publiccode.vl" |
| | | #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 |
| | | [ |
| | | HrPersonAdd is extend frame; |
| | | about HrPersonAdd |
| | | [ |
| | | field: |
| | | [ |
| | | HrEmployee lw_obj; |
| | | 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 |
| | | string m_sTxt; |
| | | ] |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) HrPersonAdd : public xframe |
| | | { |
| | | public: |
| | | HrEmployee lw_obj; |
| | | xdwgrid dw_list; |
| | | |
| | | 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 |
| | | xstring m_sTxt; |
| | | public: |
| | | HrPersonAdd(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static HrPersonAdd* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrPersonAdd* pWin = new HrPersonAdd(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) |
| | | { |
| | | SetAgent(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("QueryTxt")); |
| | | m_sTxt = xc.GetText() + ""; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sTxt", m_sTxt); |
| | | if (url::post("OrganizationStruct/select.Person", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(L"QueryTxt")); |
| | | m_sTxt = xc.GetText() + L""; |
| | | xml x; |
| | | |
| | | int OnOK(string comdid) |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = win__::GetParam(); |
| | | arg.AddArg("comdid", comdid); |
| | | xaserverarg arg; |
| | | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert("请选择人员!"); |
| | | return 1; |
| | | } |
| | | arg.AddArg(L"sTxt", m_sTxt); |
| | | if (xurl::post(L"OrganizationStruct/select.Person", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | while (row > 0) |
| | | { |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sPersonID = e.selectSingleNode("PersonID").text + ""; |
| | | string sPersonName = e.selectSingleNode("Name").text + ""; |
| | | arg.AddArg("sPersonID", sPersonID); |
| | | arg.AddArg("sPersonName", sPersonName); |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | int OnOK(xstring comdid) |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmOk") |
| | | OnOK(comdid); |
| | | else if (comdid == "query") |
| | | OnRetrieve(); |
| | | else if (comdid == "xmCancel") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | arg = GetArg(); |
| | | arg.AddArg(L"comdid", comdid); |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert(L"请选择人员!"); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | } |
| | | while (row > 0) |
| | | { |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sPersonID = e.selectSingleNode(L"PersonID").text() + (xstring)L""; |
| | | xstring sPersonName = e.selectSingleNode(L"Name").text() + (xstring)L""; |
| | | arg.AddArg(L"sPersonID", sPersonID); |
| | | arg.AddArg(L"sPersonName", sPersonName); |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmOk") |
| | | OnOK(comdid); |
| | | else if (comdid == L"query") |
| | | OnRetrieve(); |
| | | else if (comdid == L"xmCancel") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("组织架构.vface/template/HrEmployee/PersonSel"); |
| | | dw_list.SetSelectionMode(4); //3 |
| | | dw_list.SetReadOnly(true); |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&HrPersonAdd::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrPersonAdd::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | int onload() |
| | | { |
| | | SetArg(); |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.openUrl(L"组织架构.vface/template/HrEmployee/PersonSel"); |
| | | dw_list.SetSelectionMode(4); //3 |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | ] |
| | | ] |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | 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 "publiccode.vl" |
| | | #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 |
| | | [ |
| | | HrPersonMaint is extend frame; |
| | | about HrPersonMaint |
| | | [ |
| | | control: |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | method: |
| | | [ |
| | | xdwtable__ dw_1; |
| | | string m_operate; |
| | | string m_sguid; |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) HrPersonMaint : public xframe |
| | | { |
| | | public: |
| | | xdwtable dw_1; |
| | | xstring m_operate; |
| | | xstring m_sguid; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | int SetAgent() |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | public: |
| | | HrPersonMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static HrPersonMaint* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrPersonMaint* pWin = new HrPersonMaint(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(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | HCURSOR hIcon = xutil::SetCursorWait(); |
| | | |
| | | xstring val; |
| | | xml x; |
| | | |
| | | var xdoc = x; |
| | | dw_1.AcceptText(); |
| | | dw_1.DwUpdateAllTo(xdoc); |
| | | val = xdoc.xml; |
| | | //trace(val); |
| | | xaserverarg args; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg(L"content", val); |
| | | //trace(m_EntityValueEx); |
| | | //trace(val); |
| | | xml x1; |
| | | |
| | | if (xurl::post(L"OrganizationStruct/update.HrPerson", args.GetString(), x1) != 1) |
| | | { |
| | | xstring error = x1.text(); |
| | | trace(error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | trace(x1.xml()); |
| | | MessageBox(GetHWND(), L"保存成功!", L"提示", 0); |
| | | } |
| | | dw_1.ResetUpdateStatus(); |
| | | xutil::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"HrEmployee") |
| | | dw.InsertRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.InsertRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.DeleteRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnUpdateAssignmentView() |
| | | { |
| | | xml x1; |
| | | |
| | | if (xurl::post(L"OrganizationStruct/update.Assignmentview", L"", x1) != 1) |
| | | { |
| | | xstring error = x1.text(); |
| | | trace(error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | trace(x1.xml()); |
| | | MessageBox(GetHWND(), L"更新成功!", L"提示", 0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | 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(); |
| | | else if (comdid == L"Close") CloseWindow(); |
| | | else if (comdid == L"UpdateAssignmentView") |
| | | OnUpdateAssignmentView(); |
| | | return 0; |
| | | } |
| | | |
| | | 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"PositionID") { |
| | | arg.AddArg(L"ResourceType", L"HrPosition"); |
| | | } |
| | | if (xaserver::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) |
| | | dwhdr.data = x.xml(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(TEvent* evt, int p) |
| | | { |
| | | DWNMHDR& dwhdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | HCURSOR HCursor = xutil::SetCursorWait(); |
| | | |
| | | |
| | | int row = dwhdr.row; |
| | | xstring col = dwhdr.colname; |
| | | xstring data = dwhdr.data; |
| | | trace(xstring(row)); |
| | | |
| | | if (col == L"Name") |
| | | { |
| | | xstring Name = dw_1.GetItemString(1, L"Name"); |
| | | |
| | | xml xs; |
| | | |
| | | xaserverarg args; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg(L"Name", Name); |
| | | if (xurl::get(L"/sale/data/ManpowerFile/GetUserName", args.GetString(), xs) != 1) |
| | | { |
| | | trace(xs.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList items = xs.selectNodes(L"data/Item"); |
| | | int len = items.length(); |
| | | if (len != 0) |
| | | { |
| | | 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; |
| | | KXMLDOMNode t = items.item(0); |
| | | |
| | | xstring english_name = L""; |
| | | xstring sex = L""; |
| | | xstring sexex = L""; |
| | | xstring birth_date = L""; |
| | | xstring contact = L""; |
| | | xstring induction_time = L""; |
| | | xstring household_register = L""; |
| | | xstring EmailAddress = L""; |
| | | if (t.selectSingleNode(L"english_name")) english_name = t.selectSingleNode(L"english_name").text(); |
| | | if (t.selectSingleNode(L"sex")) sex = t.selectSingleNode(L"sexex").text(); |
| | | if (t.selectSingleNode(L"sexex")) sexex = t.selectSingleNode(L"sexex").text(); |
| | | if (t.selectSingleNode(L"birth_date")) birth_date = t.selectSingleNode(L"birth_date").text(); |
| | | if (t.selectSingleNode(L"contact")) contact = t.selectSingleNode(L"contact").text(); |
| | | if (t.selectSingleNode(L"induction_time")) induction_time = t.selectSingleNode(L"induction_time").text(); |
| | | if (t.selectSingleNode(L"household_register")) household_register = t.selectSingleNode(L"household_register").text(); |
| | | if (t.selectSingleNode(L"EmailAddress")) EmailAddress = t.selectSingleNode(L"EmailAddress").text(); |
| | | |
| | | dw_1.SetItemString(1, L"NickName", english_name); |
| | | dw_1.SetItemDisplayString(1, L"Gender", sexex); |
| | | dw_1.SetItemString(1, L"Gender", sex); |
| | | dw_1.SetItemString(1, L"Birthday", birth_date); |
| | | dw_1.SetItemString(1, L"Mobile", contact); |
| | | dw_1.SetItemString(1, L"HireDate", induction_time); |
| | | dw_1.SetItemString(1, L"BirthPlace", household_register); |
| | | dw_1.SetItemString(1, L"Email", EmailAddress); |
| | | } |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | SetAgent(); |
| | | } |
| | | if (col == L"PositionID") |
| | | { |
| | | xdwtable dw_HrEmployee = new xdwtable; |
| | | dw_HrEmployee.setNativePointer(dw_1.FindDwTable(L"HrEmployee")); |
| | | xstring sPositionID = dw_HrEmployee.GetItemString(row, L"PositionID"); |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | if (sPositionID == L"") |
| | | return 1; |
| | | xml x; |
| | | |
| | | int OnSave() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | xaserverarg arg; |
| | | |
| | | string val; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | dw_1.AcceptText(); |
| | | dw_1.DwUpdateAllTo(xdoc); |
| | | val = xdoc.xml; |
| | | //trace(val); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("content", val); |
| | | //trace(m_EntityValueEx); |
| | | //trace(val); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.HrPerson", args.GetString(), x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | trace(x1.GetXml()); |
| | | win__::MessageBox(GetHWND(), "保存成功!", "提示", 0); |
| | | } |
| | | dw_1.ResetUpdateStatus(); |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | arg.AddArg(L"guid", sPositionID); |
| | | arg.AddArg(L"type", L"GetOrgIDJobID"); |
| | | //trace(arg.GetString()); |
| | | if (xurl::get(L"OrganizationStruct/GetOrgIDJobID", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMDocument xdoc = x; |
| | | //IXMLDOMNodeList nlist = xdoc.getElementsByTagName(L"OrgID"); |
| | | KXMLDOMElement e = xdoc.documentElement(); |
| | | xstring sOrgID = e.selectSingleNode(L"@OrgID").text(); |
| | | xstring sJobID = e.selectSingleNode(L"@JobID").text(); |
| | | dw_HrEmployee.SetItemString(row, L"OrgID", sOrgID); |
| | | dw_HrEmployee.SetItemString(row, L"JobID", sJobID); |
| | | xstring sdate = publiccode::GetCurrentDate() + (xstring)L""; |
| | | dw_HrEmployee.SetItemString(row, L"StartDate", sdate + L""); |
| | | dw_HrEmployee.SetItemString(row, L"EndDate", L"2050-12-31"); |
| | | } |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | dw.InsertRow(0); |
| | | return 1; |
| | | } |
| | | xutil::RestoreCursor(HCursor); |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.InsertRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.DeleteRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnUpdateAssignmentView() |
| | | { |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.Assignmentview", "", x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | trace(x1.GetXml()); |
| | | win__::MessageBox(GetHWND(), "更新成功!", "提示", 0); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&HrPersonMaint::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrPersonMaint::OnSetFocus); |
| | | //下拉框 提供内容 |
| | | AttachEvent(L"dw_detail", L"DWV_CHILDCONTENT", (FEvent)&HrPersonMaint::OnChildContent); |
| | | //内容改变 |
| | | AttachEvent(L"dw_detail", L"DWV_ITEMCHANGED", (FEvent)&HrPersonMaint::OnItemChanged); |
| | | // |
| | | //AttachEvent(L"dw_detail",L"DWV_ITEMFOCUSCHANGED",OnItemFocusChanged); |
| | | 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(); |
| | | else if (comdid == "Close") CloseWindow(); |
| | | else if (comdid == "UpdateAssignmentView") |
| | | OnUpdateAssignmentView(); |
| | | return 0; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | 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 == "PositionID") { |
| | | arg.AddArg("ResourceType", "HrPosition"); |
| | | } |
| | | if (xaserver__::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) |
| | | dwhdr.data = x.GetXml(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | return 1; |
| | | } |
| | | xaserverarg arg; |
| | | |
| | | int OnItemChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | int HCursor = xutil__::SetCursorWait(); |
| | | arg.AddArg(L"guid", m_sguid); |
| | | if (xurl::get(L"OrganizationStruct/detail.HrPerson", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_1.Retrieve(x); |
| | | dw_1.Redraw(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | int row = dwhdr.row; |
| | | string col = dwhdr.colname; |
| | | string data = dwhdr.data; |
| | | trace(row); |
| | | return 1; |
| | | } |
| | | |
| | | if (col == "Name") |
| | | { |
| | | string Name = dw_1.GetItemString(1, "Name", 0); |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | xml__ xs = new xml__; |
| | | xs.setNativePointer(xs.CreateInstance()); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("Name", Name); |
| | | if (url::get("/sale/data/ManpowerFile/GetUserName", args.GetString(), xs) != 1) |
| | | { |
| | | trace(xs.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMNodeList items = xs.GetXmlDoc().selectNodes("data/Item"); |
| | | int len = items.length; |
| | | if (len != 0) |
| | | { |
| | | msxml::IXMLDOMNode t = items.item(0); |
| | | OnAttachEvent(); |
| | | |
| | | string english_name = ""; |
| | | string sex = ""; |
| | | string sexex = ""; |
| | | string birth_date = ""; |
| | | string contact = ""; |
| | | string induction_time = ""; |
| | | string household_register = ""; |
| | | string EmailAddress = ""; |
| | | if (t.selectSingleNode("english_name")) english_name = t.selectSingleNode("english_name").text; |
| | | if (t.selectSingleNode("sex")) sex = t.selectSingleNode("sexex").text; |
| | | if (t.selectSingleNode("sexex")) sexex = t.selectSingleNode("sexex").text; |
| | | if (t.selectSingleNode("birth_date")) birth_date = t.selectSingleNode("birth_date").text; |
| | | if (t.selectSingleNode("contact")) contact = t.selectSingleNode("contact").text; |
| | | if (t.selectSingleNode("induction_time")) induction_time = t.selectSingleNode("induction_time").text; |
| | | if (t.selectSingleNode("household_register")) household_register = t.selectSingleNode("household_register").text; |
| | | if (t.selectSingleNode("EmailAddress")) EmailAddress = t.selectSingleNode("EmailAddress").text; |
| | | return 1; |
| | | } |
| | | |
| | | dw_1.SetItemString(1, "NickName", english_name); |
| | | dw_1.SetItemDisplayString(1, "Gender", sexex); |
| | | dw_1.SetItemString(1, "Gender", sex); |
| | | dw_1.SetItemString(1, "Birthday", birth_date); |
| | | dw_1.SetItemString(1, "Mobile", contact); |
| | | dw_1.SetItemString(1, "HireDate", induction_time); |
| | | dw_1.SetItemString(1, "BirthPlace", household_register); |
| | | dw_1.SetItemString(1, "Email", EmailAddress); |
| | | } |
| | | } |
| | | int onload() |
| | | { |
| | | SetArg(); |
| | | dw_1 = new xdwtable; |
| | | dw_1.setNativePointer(GetControl(L"dw_detail")); |
| | | dw_1.openUrl(L"组织架构.vface/template/HrPerson/maint"); |
| | | OnInitial(); |
| | | |
| | | } |
| | | if (col == "PositionID") |
| | | { |
| | | xdwtable__ dw_HrEmployee = new xdwtable__; |
| | | dw_HrEmployee.setNativePointer(dw_1.FindDwTable("HrEmployee")); |
| | | string sPositionID = dw_HrEmployee.GetItemString(row, "PositionID"); |
| | | xaserverarg arg; |
| | | |
| | | if (sPositionID == "" || sPositionID == nil) |
| | | return 1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", sPositionID); |
| | | arg.AddArg("type", "GetOrgIDJobID"); |
| | | //trace(arg.GetString()); |
| | | if (url::get("OrganizationStruct/GetOrgIDJobID", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMDocument xdoc = x.GetXmlDoc(); |
| | | //IXMLDOMNodeList nlist = xdoc.getElementsByTagName("OrgID"); |
| | | msxml::IXMLDOMElement e = xdoc.documentElement; |
| | | string sOrgID = e.SelectSingleNode("@OrgID").text; |
| | | string sJobID = e.SelectSingleNode("@JobID").text; |
| | | dw_HrEmployee.SetItemString(row, "OrgID", sOrgID); |
| | | dw_HrEmployee.SetItemString(row, "JobID", sJobID); |
| | | string sdate = publiccode::GetCurDate() + ""; |
| | | dw_HrEmployee.SetItemString(row, "StartDate", sdate + ""); |
| | | dw_HrEmployee.SetItemString(row, "EndDate", "2050-12-31"); |
| | | } |
| | | } |
| | | arg = GetArg(); |
| | | if (arg) |
| | | { |
| | | m_operate = arg.GetArgString(L"operate"); |
| | | m_sguid = arg.GetArgString(L"guid"); |
| | | } |
| | | |
| | | xutil__::RestoreCursor(HCursor); |
| | | /*if ( m_sguid == L"" || m_sguid == nil) |
| | | { |
| | | xstring val; |
| | | xml x ; |
| | | |
| | | return 0; |
| | | } |
| | | var xdoc = x; |
| | | dw_1.DwUpdateTo(xdoc); |
| | | val = xdoc.xml ; |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //下拉框 提供内容 |
| | | AttachEvent("dw_detail", "DWV_CHILDCONTENT", OnChildContent); |
| | | //内容改变 |
| | | AttachEvent("dw_detail", "DWV_ITEMCHANGED", OnItemChanged); |
| | | // |
| | | //AttachEvent("dw_detail","DWV_ITEMFOCUSCHANGED",OnItemFocusChanged); |
| | | } |
| | | |
| | | 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.HrPerson", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_1.Retrieve(x); |
| | | dw_1.Redraw(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | |
| | | dw_1 = new xdwtable__; |
| | | dw_1.setNativePointer(this.GetControl("dw_detail")); |
| | | dw_1.openUrl("组织架构.vface/template/HrPerson/maint"); |
| | | OnInitial(); |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = this.GetParam(); |
| | | if (arg) |
| | | { |
| | | m_operate = arg.GetArgString("operate"); |
| | | m_sguid = arg.GetArgString("guid"); |
| | | } |
| | | |
| | | /*if ( m_sguid == "" || m_sguid == nil) |
| | | { |
| | | string val; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | dw_1.DwUpdateTo(xdoc); |
| | | val = xdoc.xml ; |
| | | |
| | | xml__ xx = new xml__; |
| | | xx.setNativePointer(xx.CreateInstance()); |
| | | xx.loadXML(val); |
| | | msxml::IXMLDOMElement e; |
| | | e = xx.GetXmlDoc().selectSingleNode("HrPerson"); |
| | | if (e) |
| | | { |
| | | string sguid = e.getAttribute("guid"); |
| | | m_sguid = sguid; |
| | | } |
| | | //trace(m_sguid); |
| | | }*/ |
| | | if (m_sguid != "") |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | xml xx ; |
| | | xx.setNativePointer(xx.CreateInstance()); |
| | | xx.loadXML(val); |
| | | KXMLDOMElement e; |
| | | e = xx.selectSingleNode(L"HrPerson"); |
| | | if (e) |
| | | { |
| | | xstring sguid = e.getAttribute(L"guid"); |
| | | m_sguid = sguid; |
| | | } |
| | | //trace(m_sguid); |
| | | }*/ |
| | | if (m_sguid != L"") |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | 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" |
| | | use "dev:code[HrEmployeex.vx]" |
| | | use "publiccode.vl" |
| | | #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 |
| | | [ |
| | | HrPersonSel is extend frame; |
| | | about HrPersonSel |
| | | [ |
| | | field: |
| | | [ |
| | | HrEmployeex lw_obj; |
| | | 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 |
| | | string m_sTxt; |
| | | ] |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) HrPersonSel : public xframe |
| | | { |
| | | public: |
| | | HrEmployeex lw_obj; |
| | | xdwgrid dw_list; |
| | | |
| | | 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 |
| | | xstring m_sTxt; |
| | | public: |
| | | HrPersonSel(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static HrPersonSel* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrPersonSel* pWin = new HrPersonSel(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(); |
| | | //重置工具条 |
| | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("QueryTxt")); |
| | | m_sTxt = xc.GetText() + ""; |
| | | string query = "[MSSqlHrJob.xq]"; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sTxt", m_sTxt); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1 |
| | | if (url::post("OrganizationStruct/select.Employee", arg.GetString(), x) != 1) |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(L"QueryTxt")); |
| | | m_sTxt = xc.GetText() + L""; |
| | | xstring query = L"[MSSqlHrJob.xq]"; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sTxt", m_sTxt); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1 |
| | | if (xurl::post(L"OrganizationStruct/select.Employee", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | |
| | | |
| | | int OnOK() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = win__::GetParam(); |
| | | arg.AddArg("comdid", "xmOk"); |
| | | xaserverarg arg; |
| | | |
| | | arg =GetArg(); |
| | | arg.AddArg(L"comdid", L"xmOk"); |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert("请选择人员!"); |
| | | alert(L"请选择人员!"); |
| | | return 1; |
| | | } |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | trace(e.xml); |
| | | string EmployeeID = e.selectSingleNode("EmployeeID").text + ""; |
| | | string Name = e.selectSingleNode("Name").text + ""; |
| | | arg.AddArg("EmployeeID", EmployeeID); |
| | | arg.AddArg("Name", Name); |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | trace(e.xml()); |
| | | xstring EmployeeID = e.selectSingleNode(L"EmployeeID").text() + (xstring)L""; |
| | | xstring Name = e.selectSingleNode(L"Name").text() + (xstring)L""; |
| | | arg.AddArg(L"EmployeeID", EmployeeID); |
| | | arg.AddArg(L"Name", Name); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == "xmOk") |
| | | if (comdid == L"xmOk") |
| | | OnOK(); |
| | | else if (comdid == "query") |
| | | else if (comdid == L"query") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else if (comdid == "xmCancel") |
| | | else if (comdid == L"xmCancel") |
| | | CloseWindow(); |
| | | 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)&HrPersonSel::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrPersonSel::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("组织架构.vface/template/HrEmployee/PersonSel"); |
| | | SetArg(); |
| | | 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); |
| | | |
| | |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | }; |
| | |
| | | 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(); |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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() |
| | |
| | | |
| | | 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; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | }; |
| | |
| | | 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" |
| | | use "dev:code[HrPosition.vx]" |
| | | use "HrPosition.vx" |
| | | #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 |
| | | [ |
| | | HrPositionAdd is extend frame; |
| | | about HrPositionAdd |
| | | [ |
| | | field: |
| | | [ |
| | | HrPosition lw_obj; |
| | | xdwgrid__ dw_list; |
| | | treeview__ tv_1; |
| | | string m_type; |
| | | #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) HrPositionAdd : public xframe |
| | | { |
| | | public: |
| | | |
| | | 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; |
| | | } |
| | | HrPosition lw_obj; |
| | | xdwgrid dw_list; |
| | | xtreeview tv_1; |
| | | xstring m_type; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | public: |
| | | HrPositionAdd(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static HrPositionAdd* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | HrPositionAdd* pWin = new HrPositionAdd(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(); |
| | | //重置工具条 |
| | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | string query = "[MSSqlHrJob.xq]"; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("type", m_type); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1 |
| | | if (url::post("OrganizationStruct/list.Job", arg.GetString(), x) != 1) |
| | | xstring query = L"[MSSqlHrJob.xq]"; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"type", m_type); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1 |
| | | if (xurl::post(L"OrganizationStruct/list.Job", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt, int p) { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | int OnTreeSelChanged(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | |
| | | int wid = tv_1.GetId(); |
| | | int hItem = treeview__::GetSelectedItem(wid); |
| | | int rootItem = treeview__::GetRootItem(wid); |
| | | //int wid = tv_1.GetId(); |
| | | HTREEITEM hItem = tv_1.GetSelectedItem(); |
| | | HTREEITEM rootItem = tv_1.GetRootItem(); |
| | | if (hItem <= 0 || hItem == rootItem) |
| | | { |
| | | m_type = "all"; |
| | | m_type = L"all"; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hItem); |
| | | m_type = ele.SelectSingleNode("@name").text; |
| | | KXMLDOMElement ele = tv_1.GetItemData(hItem); |
| | | m_type = ele.selectSingleNode(L"@name").text(); |
| | | } |
| | | OnRetrieve(); |
| | | return 1; |
| | |
| | | |
| | | int OnCreateTree() |
| | | { |
| | | int wid = tv_1.GetId(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | x.Load("<Type name='all'/>"); |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().SelectSingleNode("Type"); |
| | | int hItem = tv_1.InsertChildItemEx(wid, 0, "工种类型", ele, 15, 4); |
| | | //int wid = tv_1.GetId(); |
| | | xml x; |
| | | |
| | | x.loadXML(L"<Type name='all'/>"); |
| | | KXMLDOMElement ele = x.selectSingleNode(L"Type"); |
| | | HTREEITEM hItem = tv_1.InsertChildItemEx(0, L"工种类型", ele, 15, 4); |
| | | |
| | | if (url::post("/sale/data/OrganizationStruct/type.Job", "", x) != 1) |
| | | if (xurl::post(L"/sale/data/OrganizationStruct/type.Job", L"", x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | trace(x.xml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list = x.GetXmlDoc().selectNodes("//Type"); |
| | | var list = x.selectNodes(L"//Type"); |
| | | int i = 0, s = list.length; |
| | | msxml::IXMLDOMElement e; |
| | | string sname; |
| | | KXMLDOMElement e; |
| | | xstring sname; |
| | | if (s > 0) |
| | | { |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | e = list.item(i); |
| | | sname = e.SelectSingleNode("@name").text; |
| | | int curItem = tv_1.InsertChildItemEx(wid, hItem, sname, e, 15, 4); |
| | | sname = e.selectSingleNode(L"@name").text(); |
| | | HTREEITEM curItem = tv_1.InsertChildItemEx( hItem, sname, e, 15, 4); |
| | | } |
| | | } |
| | | return 1; |
| | |
| | | |
| | | int OnOK() |
| | | { |
| | | if (GetParam()) |
| | | if (GetWinParam()) |
| | | { |
| | | lw_obj = new HrPosition; |
| | | lw_obj.setNativePointer(GetParam()); |
| | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert("请选择工种!"); |
| | | alert(L"请选择工种!"); |
| | | return 1; |
| | | } |
| | | //treeview__ tv_org = new treeview__; |
| | | //treeview tv_org = new treeview; |
| | | //tv_org.setNativePointer(lw_obj.tv_org); |
| | | int wid = lw_obj.tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | string sOrgID = ele.selectSingleNode("@guid").text; |
| | | string sOrgName = ele.selectSingleNode("OrgName").text; |
| | | HTREEITEM wid = lw_obj.tv_org.GetId(); |
| | | HTREEITEM hitem = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement ele = tv_1.GetItemData( hitem); |
| | | xstring sOrgID = ele.selectSingleNode(L"@guid").text(); |
| | | xstring sOrgName = ele.selectSingleNode(L"OrgName").text(); |
| | | while (row > 0) |
| | | { |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sJobID = e.selectSingleNode("@guid").text + ""; |
| | | string sJobName = e.selectSingleNode("JobName").text + ""; |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring sJobID = e.selectSingleNode(L"@guid").text() + (xstring)L""; |
| | | xstring sJobName = e.selectSingleNode(L"JobName").text() + (xstring)L""; |
| | | |
| | | int nRow = lw_obj.dw_list.InsertRow(0); |
| | | lw_obj.dw_list.SetItemString(nRow, "JobID", sJobID); |
| | | lw_obj.dw_list.SetItemDisplayString(nRow, "JobID", sJobName); |
| | | lw_obj.dw_list.SetItemString(nRow, "Status", "Y"); |
| | | lw_obj.dw_list.SetItemDisplayString(nRow, "Status", "有效"); |
| | | lw_obj.dw_list.SetItemString(nRow, "OrgID", sOrgID); |
| | | lw_obj.dw_list.SetItemDisplayString(nRow, "OrgID", sOrgName); |
| | | lw_obj.dw_list.SetItemString(nRow, "PositionName", sOrgName + sJobName); |
| | | lw_obj.dw_list.SetItemString(nRow, L"JobID", sJobID); |
| | | lw_obj.dw_list.SetItemDisplayString(nRow, L"JobID", sJobName); |
| | | lw_obj.dw_list.SetItemString(nRow, L"Status", L"Y"); |
| | | lw_obj.dw_list.SetItemDisplayString(nRow, L"Status", L"有效"); |
| | | lw_obj.dw_list.SetItemString(nRow, L"OrgID", sOrgID); |
| | | lw_obj.dw_list.SetItemDisplayString(nRow, L"OrgID", sOrgName); |
| | | lw_obj.dw_list.SetItemString(nRow, L"PositionName", sOrgName + sJobName); |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | CloseWindow(); |
| | |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == "xmOk") |
| | | if (comdid == L"xmOk") |
| | | OnOK(); |
| | | else if (comdid == "xmCancel") |
| | | else if (comdid == L"xmCancel") |
| | | CloseWindow(); |
| | | 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)&HrPositionAdd::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&HrPositionAdd::OnSetFocus); |
| | | //获得树的选择事件 |
| | | AttachEvent("tv_1", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&HrPositionAdd::OnTreeSelChanged); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | |
| | | |
| | | int onload() |
| | | { |
| | | m_type = "all"; |
| | | tv_1 = new treeview__; |
| | | tv_1.setNativePointer(this.GetControl("tv_1")); |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("组织架构.vface/template/HrJob/list"); |
| | | SetArg(); |
| | | m_type = L"all"; |
| | | tv_1 = new treeview; |
| | | tv_1.setNativePointer(GetControl(L"tv_1")); |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.openUrl(L"组织架构.vface/template/HrJob/list"); |
| | | dw_list.SetSelectionMode(3); //3 |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnCreateTree(); |
| | | int wid = tv_1.GetId(); |
| | | int hItem = treeview__::GetRootItem(wid); |
| | | tv_1.ExpandItem(wid, hItem); |
| | | //int wid = tv_1.GetId(); |
| | | HTREEITEM hItem = tv_1.GetRootItem(); |
| | | tv_1.ExpandItem( hItem); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | }; |