¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | #include <xcontrol/xdatetimepick.hpp> |
| | | |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) TypeListMaintWin : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xtreeview tv_folder; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | public: |
| | | TypeListMaintWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static TypeListMaintWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | TypeListMaintWin* pWin = new TypeListMaintWin(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() |
| | | { |
| | | xml x; |
| | | xaserverarg arg ; |
| | | |
| | | xml x1; |
| | | x1.loadXML(L"<root/>"); |
| | | |
| | | dw_list.DwUpdateAllToEx(x); |
| | | KXMLDOMNodeList t = x.selectNodes(L"root/Supplier[@update.modify]"); |
| | | KXMLDOMElement e1= x1.documentElement(); |
| | | int len = t.length(); |
| | | for(int i=0;i<len;i++) |
| | | { |
| | | e1.appendChild(t.item(i)); |
| | | } |
| | | arg.AddArg(L"content",x1.xml()); |
| | | if(xurl::get(L"/sale/data/SupplierV3/entity/save/v3", arg.GetString(),x)!=1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(error); |
| | | return 1; |
| | | }else |
| | | { |
| | | |
| | | if( x.selectSingleNode(L"ok")) |
| | | { |
| | | alert(L"ä¿åæå"); |
| | | dw_list.ResetUpdateStatus(); |
| | | }else |
| | | { |
| | | alert(L"ä¿å失败!"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if(comdid==L"xmSave") |
| | | return OnSave(); |
| | | else if(comdid==L"xmSearch") |
| | | return OnRetrieve(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | HTREEITEM hItem =tv_folder.GetSelectedItem(); |
| | | xstring typ = tv_folder.GetItemData(hItem); |
| | | xstring searchStr = xcontrol(GetControl(L"SearchContent")).GetText(); |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/SupplierV3/type/list", L"sType",typ,L"SearchText",searchStr); |
| | | if(x) |
| | | dw_list.Retrieve(x); |
| | | else |
| | | dw_list.Reset(); |
| | | dw_list.Redraw(); |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //æ éæ© |
| | | int OnTreeSelChanged(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | return OnRetrieve(); |
| | | } |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&TypeListMaintWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&TypeListMaintWin::OnSetFocus); |
| | | AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&TypeListMaintWin::OnTreeSelChanged); |
| | | return 1; |
| | | } |
| | | |
| | | /* |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"xxx",L"xxx"); |
| | | if (getUrl(L"",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.text); |
| | | return -1; |
| | | }else |
| | | { |
| | | //dw_list.Retrieve(x); |
| | | //dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | */ |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/SupplierV3/template/supplier/mainttypelist"); |
| | | |
| | | tv_folder = GetControl(L"tv_folder"); |
| | | OnAttachEvent(); |
| | | tv_folder.ExpandItem(tv_folder.GetRootItem()); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |