|  |  | 
 |  |  | #include "viewobject/view.base.hpp" | 
 |  |  |  | 
 |  |  | using xml = KXMLDOMDocument; | 
 |  |  |    class BlankExcelTemplateView : public xframe | 
 |  |  |    class __declspec(dllexport) BlankExcelTemplateView : public xframe | 
 |  |  |    { | 
 |  |  |    public: | 
 |  |  |       xdwgrid   dw_list; | 
 |  |  |       //xdwtable dw_base;//新增弹窗时使用 | 
 |  |  |  | 
 |  |  |       xnode   m_agentNode;   //Agent Condition | 
 |  |  |  | 
 |  |  |    public: | 
 |  |  |       BlankExcelTemplateView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} | 
 |  |  |    public: | 
 |  |  |       static BlankExcelTemplateView* CreateInstance(void* implPtr, void* hWnd) | 
 |  |  |       { | 
 |  |  |          BlankExcelTemplateView* pWin = new BlankExcelTemplateView(implPtr, (HWND)hWnd); | 
 |  |  |          return pWin; | 
 |  |  |       } | 
 |  |  |       int SetAgent() | 
 |  |  |       { | 
 |  |  |          string xfNodeAgentArea = "agentarea"; | 
 |  |  |          xstring xfNodeAgentArea = L"agentarea"; | 
 |  |  |          xnode anode = GetAgentNode(xfNodeAgentArea); | 
 |  |  |          if (m_agentNode) | 
 |  |  |          { | 
 |  |  |             SetAgentNodeContent(anode, m_agentNode); | 
 |  |  |             SetAgentNode(anode, m_agentNode); | 
 |  |  |          } | 
 |  |  |          else | 
 |  |  |          { | 
 |  |  |             msxml::IXMLDOMElement xframeElement = GetElement(); | 
 |  |  |             msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); | 
 |  |  |             KXMLDOMElement xframeElement = GetElement(); | 
 |  |  |             KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); | 
 |  |  |             if (agent) | 
 |  |  |             { | 
 |  |  |                string s = agent.xml; | 
 |  |  |                m_agentNode = SetAgentNodeContent(anode, s); | 
 |  |  |                xstring s = agent.xml(); | 
 |  |  |                m_agentNode = SetAgentNode(anode, s); | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       //焦点激活处理函数 | 
 |  |  |       int OnSetFocus(ref TEvent evt, int param) | 
 |  |  |       int OnSetFocus(TEvent* evt, LPARAM p) | 
 |  |  |       { | 
 |  |  |          //重置工具条 | 
 |  |  |          SetAgent(); | 
 |  |  | 
 |  |  |  | 
 |  |  |       int OnSave() | 
 |  |  |       { | 
 |  |  |          xml x = new xml; | 
 |  |  |          x.setNativePointer(xml::CreateInstance()); | 
 |  |  |          xml x ; | 
 |  |  | 			 | 
 |  |  |          dw_list.AcceptText(); | 
 |  |  |          dw_list.DwUpdateAllToEx(x.GetXmlDoc()); | 
 |  |  |          xaserverarg arg = new xaserverarg; | 
 |  |  |          arg.setNativePointer(xaserverarg::CreateInstance()); | 
 |  |  |          arg.AddArg("content", x.GetXml().replace(" 00:00:00", "").replace("0000-00-00", "")); | 
 |  |  |          //trace(x.GetXml().replace(" 00:00:00", "").replace("0000-00-00", ""));//运行界面打印			 | 
 |  |  |          if (getUrl("/sale/data/ManpowerFile/multiUpdate", arg.GetString(), x) != 1) { | 
 |  |  |             string error = x.GetXmlDoc().text; | 
 |  |  |             alert("err:" + error); | 
 |  |  |          dw_list.DwUpdateAllToEx(x); | 
 |  |  |          xaserverarg arg; | 
 |  |  | 			 | 
 |  |  |          arg.AddArg(L"content", xstring(x.xml()).replace(L" 00:00:00", L"").replace(L"0000-00-00", L"")); | 
 |  |  |          //trace(x.xml().replace(L" 00:00:00", L"").replace(L"0000-00-00", L""));//运行界面打印			 | 
 |  |  |          if (getUrl(L"/sale/data/ManpowerFile/multiUpdate", arg.GetString(), x) != 1) { | 
 |  |  |             xstring error = x.text(); | 
 |  |  |             alert(L"err:" + error); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          string str = x.GetXmlDoc().documentElement.getAttribute("text"); | 
 |  |  |          if (str == "true") | 
 |  |  |          xstring str = x.documentElement().getAttribute(L"text"); | 
 |  |  |          if (str == L"true") | 
 |  |  |          { | 
 |  |  |             dw_list.ResetUpdateStatus();//更改更新状态,防止多保存 | 
 |  |  |             alert("保存成功!"); | 
 |  |  |             alert(L"保存成功!"); | 
 |  |  |  | 
 |  |  |          } | 
 |  |  |          else | 
 |  |  |          { | 
 |  |  |             alert("保存失败!"); | 
 |  |  |             alert(L"保存失败!"); | 
 |  |  |          } | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       //命令发布函数 | 
 |  |  |       int OnCmdDispatch(string comdid) | 
 |  |  |       int OnCmdDispatch(xstring comdid) | 
 |  |  |       { | 
 |  |  |          if (comdid == "xmSave") | 
 |  |  |          if (comdid == L"xmSave") | 
 |  |  |             return OnSave(); | 
 |  |  |          return 0; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       //命令处理事件 | 
 |  |  |       int OnXCommand(ref TXCommandEvent evt, int param) | 
 |  |  |       int OnXCommand(TEvent* evt, LPARAM p) | 
 |  |  |       { | 
 |  |  |          return OnCmdDispatch(evt.pStrID); | 
 |  |  |          return OnCmdDispatch(evt->xcommand.pStrID); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       int OnAttachEvent() | 
 |  |  |       { | 
 |  |  |          //绑定工具条点击事件 | 
 |  |  |          AttachEvent("WM_XCOMMAND", OnXCommand); | 
 |  |  |          AttachEvent(L"WM_XCOMMAND", (FEvent)&BlankExcelTemplateView::OnXCommand); | 
 |  |  |          //获取焦点事件,用于重置工具条 | 
 |  |  |          AttachEvent("WM_SETFOCUS", OnSetFocus); | 
 |  |  |          AttachEvent(L"WM_SETFOCUS", (FEvent)&BlankExcelTemplateView::OnSetFocus); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       /*//加载数据 | 
 |  |  |       int  OnRetrieve() | 
 |  |  |       { | 
 |  |  |          xml x = new xml; | 
 |  |  |          x.setNativePointer(xml::CreateInstance()); | 
 |  |  |          xaserverarg arg = new xaserverarg; | 
 |  |  |          arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |          arg.AddArg("xxx","xxx"); | 
 |  |  |          if (getUrl("",arg.GetString(),x)!=1) | 
 |  |  |          xml x ; | 
 |  |  | 			 | 
 |  |  |          xaserverarg arg; | 
 |  |  | 			 | 
 |  |  |          arg.AddArg(L"xxx",L"xxx"); | 
 |  |  |          if (getUrl(L"",arg.GetString(),x)!=1) | 
 |  |  |          { | 
 |  |  |             trace(x.GetXmlDoc().text); | 
 |  |  |             trace(x.text()); | 
 |  |  |             return -1; | 
 |  |  |          }else | 
 |  |  |          { | 
 |  |  | 
 |  |  |  | 
 |  |  |       int onload() | 
 |  |  |       { | 
 |  |  |          dw_list = GetControl("dw_list"); | 
 |  |  |          dw_list.openUrl("/sale/view/ManpowerFile/template/list"); | 
 |  |  |          dw_list = GetControl(L"dw_list"); | 
 |  |  |          dw_list.openUrl(L"/sale/view/ManpowerFile/template/list"); | 
 |  |  |  | 
 |  |  |          OnAttachEvent(); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |    }; | 
 |  |  | ] | 
 |  |  |    }; |