|  |  | 
 |  |  | use "system.vl" | 
 |  |  | use "win.vl" | 
 |  |  | use "list.vl" | 
 |  |  | use "treeview.vm" | 
 |  |  | use "dev:vm[gridpages.vm]" | 
 |  |  | #include <wobject/xstring.hpp> | 
 |  |  | #include <xcontrol/xtreeview.hpp> | 
 |  |  | #include <xcontrol/xdwgrid.hpp> | 
 |  |  | #include <wobject/xdouble.hpp> | 
 |  |  | #include <xcontrol/xlayersheet.hpp> | 
 |  |  |  | 
 |  |  | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" | 
 |  |  | #include "viewobject/view.base.hpp" | 
 |  |  |  | 
 |  |  | using xml = KXMLDOMDocument; | 
 |  |  | class __declspec(dllexport) ForwarderList : public listwin | 
 |  |  | { | 
 |  |  |  | 
 |  |  | public: | 
 |  |  |    //xdwpages dw_pages; | 
 |  |  |    //xstring m_QueryTxt; | 
 |  |  |    //KXMLDOMDocument m_configDoc; | 
 |  |  |    xtreeview      tv_1; | 
 |  |  |    xstring      sType; | 
 |  |  |    //static int dw_hWnd; | 
 |  |  |    //int m_pageIndex; | 
 |  |  |    //int m_pageNumber; | 
 |  |  |    //xdwgrid   dw_list; | 
 |  |  | public: | 
 |  |  |    ForwarderList(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} | 
 |  |  | public: | 
 |  |  |    static ForwarderList* CreateInstance(void* implPtr, void* hWnd) | 
 |  |  |    { | 
 |  |  |       ForwarderList* pWin = new ForwarderList(implPtr, (HWND)hWnd); | 
 |  |  |       return pWin; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | unit vbusiness.entity | 
 |  |  | [ | 
 |  |  |    ForwarderList is extend list; | 
 |  |  |    about ForwarderList | 
 |  |  |    [ | 
 |  |  |       field: | 
 |  |  |       [ | 
 |  |  |    int SetEntityData(xaserverarg arg) | 
 |  |  |    { | 
 |  |  |  | 
 |  |  |          //xdwpages__ dw_pages; | 
 |  |  |          string m_QueryTxt; | 
 |  |  |          msxml::IXMLDOMDocument m_configDoc; | 
 |  |  |          treeview__      tv_1;	 | 
 |  |  |          string      sType;			 | 
 |  |  |          static int dw_hWnd; | 
 |  |  |          int m_pageIndex; | 
 |  |  |          int m_pageNumber;			 | 
 |  |  |       ] | 
 |  |  | 		 | 
 |  |  |       method: | 
 |  |  |       [ | 
 |  |  |       arg.AddArg(L"sType", sType); | 
 |  |  |       xml x; | 
 |  |  |  | 
 |  |  | 		 | 
 |  |  | 			 | 
 |  |  |          int SetEntityData(xaserverarg__ arg) | 
 |  |  |          {	 | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             arg.AddArg("sType",sType);										 | 
 |  |  |             xml__ x = new xml__; | 
 |  |  |             x.setNativePointer(xml__ ::CreateInstance()); | 
 |  |  |             getUrl("/sale/data/LogisticsCode/entity/list",arg.GetString(),x); | 
 |  |  |             msxml::IXMLDOMElement e=x.GetXmlDoc().documentElement; | 
 |  |  |             if(e) | 
 |  |  |             { | 
 |  |  |                if(list::dw_pages.__nativept && e.selectSingleNode("@TotalPage")) | 
 |  |  |                { | 
 |  |  |                   string s=e.selectSingleNode("@TotalPage").text; //总数量				 | 
 |  |  |                   list::dw_pages.SetMaxPage(s.toInt()); | 
 |  |  |                } | 
 |  |  |             } | 
 |  |  |             this.dw_list.Retrieve(x); | 
 |  |  |             this.dw_list.Redraw(); | 
 |  |  |             this.dw_list.SetReadOnly(true);	 | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  | 			 | 
 |  |  | 					 | 
 |  |  | 			 | 
 |  |  | 					 | 
 |  |  |          int OnRetrieve() | 
 |  |  |          {			 | 
 |  |  |             xaserverarg__ arg = new xaserverarg__; | 
 |  |  |             arg.setNativePointer(arg.CreateInstance());		 | 
 |  |  |             arg.AddArg("pageindex", m_pageIndex.toString()); //第几页 | 
 |  |  |             arg.AddArg("pagenumber", m_pageNumber.toString()); //每页数量 | 
 |  |  |             //trace(list::m_QueryTxt); | 
 |  |  |             arg.AddArg("QueryTxt", list::m_QueryTxt); //每页数量					 | 
 |  |  |             return SetEntityData(arg); | 
 |  |  |          } | 
 |  |  |          int OnTreeSelChanged(ref TNotifyEvent evt,int p) | 
 |  |  |       getUrl(L"/sale/data/LogisticsCode/entity/list", arg.GetString(), x); | 
 |  |  |       KXMLDOMElement e = x.documentElement(); | 
 |  |  |       /*if (e) | 
 |  |  |       { | 
 |  |  |          if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) | 
 |  |  |          { | 
 |  |  |             ref NMTREEVIEW nmtv = evt.pnmh; | 
 |  |  |             int hItem = nmtv.itemNew.hItem;	 | 
 |  |  |             list::m_QueryTxt = ""; | 
 |  |  |             int wid = tv_1.GetId(); | 
 |  |  |             int hitem=treeview__::GetSelectedItem(wid); | 
 |  |  |             //c_type=dw_type.GetItemLabel(hitem); | 
 |  |  |             //如果是跟节点 | 
 |  |  |             int roothitem=treeview__::GetRootItem(wid); | 
 |  |  |             msxml::IXMLDOMElement e = treeview__::GetItemData(wid,hitem);					 | 
 |  |  |             string value = e.SelectSingleNode("@data").text; | 
 |  |  |             sType= value+"";				 | 
 |  |  |             OnRetrieve(); | 
 |  |  |             return 1;	 | 
 |  |  |             xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量				 | 
 |  |  |             listwin::dw_pages.SetMaxPage(s.toInt()); | 
 |  |  |          } | 
 |  |  |          int OnChangePages(ref TNotifyEvent evt,int p) | 
 |  |  |          { | 
 |  |  |             ref PAGENMHDR h = evt.pnmh; | 
 |  |  |             int c = h.cur; | 
 |  |  |             int hCursor = xutil__::SetCursorWait(); | 
 |  |  |             m_pageIndex = c; | 
 |  |  |             OnRetrieve(); | 
 |  |  |             xutil__::RestoreCursor(hCursor); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  | 			 | 
 |  |  |          int ViewUpdate(param pr,string updateItem,xaserverarg__   arg) | 
 |  |  |             { | 
 |  |  |                if(   updateItem=="del") | 
 |  |  |                { | 
 |  |  |                   int DelRow = this.dw_list.GetRow(); | 
 |  |  |                   this.dw_list.DeleteRow(DelRow); | 
 |  |  |       }*/ | 
 |  |  |       dw_list.Retrieve(x); | 
 |  |  |       dw_list.Redraw(); | 
 |  |  |       dw_list.SetReadOnly(true); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |                } | 
 |  |  |  | 
 |  |  |                return 1; | 
 |  |  |             } | 
 |  |  | 			 | 
 |  |  |          int OnAttachEvent() | 
 |  |  |          { | 
 |  |  |             //获得树的选择事件 | 
 |  |  |             AttachEvent("tv_1", "TVN_SELCHANGED",OnTreeSelChanged);		 | 
 |  |  |             return 0; | 
 |  |  |          } | 
 |  |  | 			 | 
 |  |  |          int onload() | 
 |  |  |          {	 | 
 |  |  |             list::m_QueryTxt = "";			 | 
 |  |  |             m_pageIndex = 1; | 
 |  |  |             m_pageNumber = 30;			 | 
 |  |  |             sType="0";		 | 
 |  |  |             list::onload();	 | 
 |  |  | 				 | 
 |  |  |             OnAttachEvent(); | 
 |  |  | 				 | 
 |  |  | 				 | 
 |  |  | 				 | 
 |  |  |             tv_1 =  new treeview__; | 
 |  |  |             tv_1.setNativePointer(this.GetControl("tv_1")); | 
 |  |  |             int wid = tv_1.GetId(); | 
 |  |  |             int root = treeview__::GetRootItem(wid);		 | 
 |  |  |             treeview__::ExpandItem(wid,root); | 
 |  |  |             this.dw_list.SetColumnStaus("ForwarderID",false); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  | 					 | 
 |  |  |       ] | 
 |  |  |    ] | 
 |  |  | ] | 
 |  |  |  | 
 |  |  |  | 
 |  |  |    int OnRetrieve() | 
 |  |  |    { | 
 |  |  |       xaserverarg arg; | 
 |  |  |  | 
 |  |  |       arg.AddArg(L"pageindex", xstring(m_pageIndex)); //第几页 | 
 |  |  |       arg.AddArg(L"pagenumber", xstring(m_pageNumber)); //每页数量 | 
 |  |  |       //trace(list::m_QueryTxt); | 
 |  |  |       arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); //每页数量					 | 
 |  |  |       return SetEntityData(arg); | 
 |  |  |    } | 
 |  |  |    int OnTreeSelChanged(TEvent* evt, LPARAM p) | 
 |  |  |    { | 
 |  |  |       NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; | 
 |  |  |       HTREEITEM hItem = nmtv.itemNew.hItem; | 
 |  |  |       listwin::m_QueryTxt = L""; | 
 |  |  |  | 
 |  |  |       HTREEITEM hitem = tv_1.GetSelectedItem(); | 
 |  |  |       //c_type=dw_type.GetItemLabel(hitem); | 
 |  |  |       //如果是跟节点 | 
 |  |  |       HTREEITEM roothitem = tv_1.GetRootItem(); | 
 |  |  |       KXMLDOMElement e = tv_1.GetItemData(hitem); | 
 |  |  |       xstring value = e.selectSingleNode(L"@data").text(); | 
 |  |  |       sType = value + L""; | 
 |  |  |       OnRetrieve(); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |    int OnChangePages(TEvent* evt, LPARAM p) | 
 |  |  |    { | 
 |  |  |       PAGENMHDR& h = *(PAGENMHDR*)evt->notify.pnmh; | 
 |  |  |       int c = h.cur; | 
 |  |  |       HCURSOR hCursor = xutil::SetCursorWait(); | 
 |  |  |       m_pageIndex = c; | 
 |  |  |       OnRetrieve(); | 
 |  |  |       xutil::RestoreCursor(hCursor); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int ViewUpdate(LPARAM pr, xstring updateItem, xaserverarg   arg) | 
 |  |  |    { | 
 |  |  |       if (updateItem == L"del") | 
 |  |  |       { | 
 |  |  |          int DelRow = dw_list.GetRow(); | 
 |  |  |          dw_list.DeleteRow(DelRow); | 
 |  |  |  | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnAttachEvent() | 
 |  |  |    { | 
 |  |  |       //获得树的选择事件 | 
 |  |  |       AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&ForwarderList::OnTreeSelChanged); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int onload() | 
 |  |  |    { | 
 |  |  |       SetAgent(); | 
 |  |  |       listwin::m_QueryTxt = L""; | 
 |  |  |       m_pageIndex = 1; | 
 |  |  |       m_pageNumber = 30; | 
 |  |  |       sType = L"0"; | 
 |  |  |       listwin::onload(); | 
 |  |  |  | 
 |  |  |       OnAttachEvent(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |       tv_1 = GetControl(L"tv_1"); | 
 |  |  |  | 
 |  |  |       HTREEITEM root = tv_1.GetRootItem(); | 
 |  |  |       tv_1.ExpandItem(root); | 
 |  |  |       dw_list.SetColumnState(L"ForwarderID", false); | 
 |  |  |  | 
 |  |  |       OnRetrieve(); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  | }; |