qianxj2004
18 小时以前 3e154206139f2fc8aeeab61c12c38717e55b3fc6
jrj/xframe/vbusiness/vframe/frame.vframe.vbusiness.hpp
@@ -3,10 +3,15 @@
#include <wobject/xwin.hpp>
#include <wobject/xurl.hpp>
#include <wobject/xapp.hpp>
#include "viewobject/view.base.hpp"
#include "xcontrol/xshtml.hpp"
class xframe : public xwin
{
public:
   xframe(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {}
   xframe(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {
   }
   static int getUrl(string url1, string para, KXMLDOMDocument x)
   {
@@ -124,7 +129,7 @@
      xstring comdid = arg.GetArgString(L"comdid");
      if (comdid ==L"xmOK")
      {
         string value = arg.GetArgString(L"content");
         xstring value = arg.GetArgString(L"content");
         return value;
      }
      return L"";
@@ -165,13 +170,13 @@
         if (MessageBoxW(GetHWND(),L"是否确定删除记录!",L"提示", 1) == 2)
            return 1;
      }
      xaserverarg& arg = *(new xaserverarg);
      arg.AddArg(L"Action", action);
      KXMLDOMDocument x;
      xstring aurl =L"/workflow/query/actioninfo/" + action;
      if (xurl::get(GetServerUrl(),aurl,L"", x) != 1)
         return -1;
@@ -282,8 +287,8 @@
         if (x1.selectSingleNode(L"//process"))
         {
            KXMLDOMElement e1 = x1.selectSingleNode(L"//process");
            string valid = e1.getAttribute(L"valid");
            string finished = e1.getAttribute(L"finished");
            xstring valid = e1.getAttribute(L"valid");
            xstring finished = e1.getAttribute(L"finished");
            xstring errInfo =L"";
            if (valid ==L"0")
            {
@@ -335,7 +340,7 @@
         }
      }
      //更新要求
      if (execResult & 0xf)
      if (execResult)
      {
         nlist = x.selectNodes(L"//view/update");
         nlen = nlist.length();
@@ -382,9 +387,25 @@
      return 1;
   }
   virtual string GetTaskID()
   virtual xstring GetTaskID()
   {
      return L"";
   }
   virtual int ShowAgentInfo(xstring scene, xstring EntityID)
   {
      if (EntityID != L"")
      {
         KXMLDOMDocument x = ViewObject::RetrieveData(L"/sale/data/Agent/entity", L"scene",scene,L"EntityID", EntityID);
         if (x)
         {
            xshtml xs =GetControl(L"frame:agentinfo");
            string content = x.xml();
            xs.SetContent(content);
            xs.Redraw();
         }
      }
      return 1;
   }
   virtual int SetAgent(xstring scene, xstring EntityID)
@@ -410,8 +431,12 @@
      int  nlen = nlist.length();
      KXMLDOMElement ele;
      auto elenode = anode.GetElement();
      xstring nodeName = elenode.tagName();
      xstring tools =L"<vbox class=''>";
      if (scene ==L"list") tools +=L"<xspace height='12'/>";
      if (nodeName == L"hbox")tools = L"<hbox class=''>";
      for (index = 0; index < nlen; index++)
      {
@@ -430,10 +455,20 @@
         xstring tool;
         if (src !=L"")
            tool =(xstring)L"<xtoolbutton src='" + src +L"'  caption='" + label +L"' name='action:" + name +L"' height='23' style='background-color:none #ceecce  none #ffffff'/>";
         if (nodeName == L"hbox")
         {
            if (src != L"")
               tool = (xstring)L"<xtoolbutton src='" + src + L"'  caption='" + label + L"' name='action:" + name + L"' width='70'  style='font-family:思源黑体 CN Bold;font-size:8pt'/>";
            else
               tool = (xstring)L"<xtoolbutton image='" + image + L"'  caption='" + label + L"' name='action:" + name + L"' width='70'  style='font-family:思源黑体 CN Bold;font-size:8pt'/>";
         }
         else
            tool =(xstring)L"<xtoolbutton image='" + image +L"'  caption='" + label +L"' name='action:" + name +L"' height='23'  style='background-color:none #ceecce none #ffffff'/>";
         {
            if (src != L"")
               tool = (xstring)L"<xtoolbutton src='" + src + L"'  caption='" + label + L"' name='action:" + name + L"' height='23' style='background-color:none #ceecce  none #ffffff'/>";
            else
               tool = (xstring)L"<xtoolbutton image='" + image + L"'  caption='" + label + L"' name='action:" + name + L"' height='23'  style='background-color:none #ceecce none #ffffff'/>";
         }
         tools += tool;
      }
      if (agent)
@@ -447,7 +482,78 @@
            tools += tmp;
         }
      }
      tools +=L"</vbox>";
      if (nodeName == L"hbox")
         tools += L"</hbox>";
      else
         tools +=L"</vbox>";
      SetAgentNode(anode, tools);
      if (GetControl(L"frame:agentinfo"))ShowAgentInfo(scene,EntityID);
      return 1;
   }
   virtual int SetAgent1(xstring scene, xstring EntityID)
   {
      xstring xfNodeAgentArea = L"agentarea";
      xnode anode = GetAgentNode(xfNodeAgentArea);
      KXMLDOMElement xframeElement = GetElement();
      KXMLDOMNode agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*");
      KXMLDOMDocument x;
      xaserverarg arg;
      arg.AddArg(L"scene", scene, L"xs:string");
      arg.AddArg(L"EntityID", EntityID, L"xs:string");
      arg.AddArg(L"TaskID", GetTaskID(), L"xs:string");
      arg.AddArg(L"EntityName", GetEntityName(1), L"xs:string");
      xurl::get(GetServerUrl(), (xstring)L"/workflow/query/datarole/" + GetEntityName(1), arg.GetString(), x);
      //if(x.GetXmlDoc().selectSingleNode("datarole/rightes/right"))
      SetObjectInfo(x.documentElement());
      xstring sNodes;
      sNodes = (xstring)L"datarole/actions/action[contains(@scene,'" + scene + L"')]";
      KXMLDOMNodeList nlist = x.selectNodes(sNodes);
      int  index;
      int  nlen = nlist.length();
      KXMLDOMElement ele;
      xstring tools = L"<vbox class=''>";
      if (scene == L"list") tools += L"<xspace height='12'/>";
      for (index = 0; index < nlen; index++)
      {
         ele = nlist.item(index);
         xstring name = ele.selectSingleNode(L"@id").text();//.getAttribute("id");
         xstring label = ele.selectSingleNode(L"@caption").text();//ele.getAttribute("caption");
         xstring image;
         xstring src = L"";
         if (ele.selectSingleNode(L"@image"))
            image = ele.selectSingleNode(L"@image").text();
         else
            image = L"0 22";
         if (ele.selectSingleNode(L"@src"))
            src = ele.selectSingleNode(L"@src").text();
         xstring tool;
         if (src != L"")
            tool = (xstring)L"<xtoolbutton src='" + src + L"'  caption='" + label + L"' name='action:" + name + L"' height='23' style='background-color:none #ceecce  none #ffffff'/>";
         else
            tool = (xstring)L"<xtoolbutton image='" + image + L"'  caption='" + label + L"' name='action:" + name + L"' height='23'  style='background-color:none #ceecce none #ffffff'/>";
         tools += tool;
      }
      if (agent)
      {
         nlist = agent.selectNodes(L".//xtoolbutton");
         nlen = nlist.length();
         for (index = 0; index < nlen; index++)
         {
            ele = nlist.item(index);
            xstring tmp = ele.xml();
            tools += tmp;
         }
      }
      tools += L"</vbox>";
      SetAgentNode(anode, tools);
      return 1;
@@ -481,13 +587,13 @@
      if (content ==L"") return 1;
      if (content.find(L"update.modify", 0) > 0 || content.find(L"update.delete", 0) > 0)
      {
         int MB_YESNOCANCEL = 3;
         int IDYES = 6;
         int IDNO = 7;
         int IDCANCEL = 2;
         int re = MessageBoxW(GetHWND(),L"数据已经修改,是否保存?",L"提示:", MB_YESNOCANCEL);
         if (re == IDCANCEL) return -1;
         if (re == IDNO) return 1;
         int MB_YESNOCANCEL_ = 3;
         int IDYES_ = 6;
         int IDNO_ = 7;
         int IDCANCEL_ = 2;
         int re = MessageBoxW(GetHWND(),L"数据已经修改,是否保存?",L"提示:", MB_YESNOCANCEL_);
         if (re == IDCANCEL_) return -1;
         if (re == IDNO_) return 1;
         if (DoUpdate(false) == 1) return 1;
         return -1;
      }