| | |
| | | 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" |
| | | #include "HrPosition.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"); |
| | | int i = 0, s = list.length; |
| | | msxml::IXMLDOMElement e; |
| | | string sname; |
| | | auto list = x.selectNodes(L"//Type"); |
| | | int i = 0, s = list.length(); |
| | | 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()); |
| | | lw_obj = GetParam(); |
| | | lw_obj = (HrPosition*)GetWinParam(); |
| | | } |
| | | else |
| | | return 0; |
| | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert("请选择工种!"); |
| | | alert(L"请选择工种!"); |
| | | return 1; |
| | | } |
| | | //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; |
| | | //treeview tv_org = new treeview; |
| | | //tv_org.setNativePointer(lw_obj->tv_org); |
| | | 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); |
| | | int nRow = lw_obj->dw_list.InsertRow(0); |
| | | 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 = 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; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | }; |