¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | 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 "list.vl" |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrOrgMaint is extend list; |
| | | about HrOrgMaint |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | xdwtable__ dw_detail; |
| | | string m_operate; |
| | | string m_sguid; |
| | | string m_tvOrgID; |
| | | string m_tvOrgName; |
| | | string m_tvRootOrgID; |
| | | string m_tvRootOrgName; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | 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; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", m_sguid); |
| | | if (url::get("OrganizationStruct/detail.HrOrg", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | dw_detail.Retrieve(x); |
| | | dw_detail.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | //dw_detail.AcceptText(); |
| | | string val; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | dw_detail.DwUpdateAllTo(xdoc); |
| | | val = xdoc.xml; |
| | | //trace(val); |
| | | //return 1; |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("content", val); |
| | | //trace(val); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.HrOrg", args.GetString(), x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | win__::MessageBox(GetHWND(), "ä¿åæåï¼", "æç¤º", 0); |
| | | } |
| | | dw_detail.ResetUpdateStatus(); |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnNew() |
| | | { |
| | | dw_detail.openUrl("ç»ç»æ¶æ.vface/template/HrOrg/detail"); |
| | | if (m_operate == "new0") |
| | | { |
| | | dw_detail.SetItemString(1, "ParentOrgID", m_tvOrgID); |
| | | dw_detail.SetItemDisplayString(1, "ParentOrgID", m_tvOrgName); |
| | | } |
| | | dw_detail.SetItemString(1, "Status", "Y"); |
| | | //dw_detail.SetItemDisplayString(1,"Status","ææ"); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "New") OnNew(); |
| | | if (comdid == "Save") OnSave(); |
| | | if (comdid == "xmOk") OnSave(); |
| | | if (comdid == "xmCancel") CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnChildContent(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | string col = dwhdr.colname; |
| | | if (col != "") { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string query; |
| | | query = "[IResourceMSSql.xq]"; |
| | | if (col == "OrgTypeID") { |
| | | arg.AddArg("ResourceType", "HrOrgType");//ç»ç»ç±»å |
| | | } |
| | | else if (col == "OrgAddress000") { |
| | | arg.AddArg("ResourceType", "HR_Address");//ç»ç»å°å |
| | | } |
| | | else if (col == "CompanyID") { |
| | | arg.AddArg("ResourceType", "CompanyInfo");//æå±æ³äºº |
| | | } |
| | | else if (col == "OrgProLine") { |
| | | arg.AddArg("ResourceType", "OrgProLine");//产å线 |
| | | } |
| | | if (xaserver__::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) |
| | | dwhdr.data = x.GetXml(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnClicked(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | |
| | | string colname = hdr.colname; |
| | | if (colname == "ParentOrgID") |
| | | { |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/HrOrg/Chart", arg); |
| | | //trace(arg.GetString()); |
| | | string comdid = arg.GetArgString("comdid"); |
| | | if (comdid == "xmOk") |
| | | { |
| | | string OrgName = arg.GetArgString("OrgName"); |
| | | string OrgID = arg.GetArgString("OrgId"); |
| | | dw_detail.SetItemDisplayString(1, "ParentOrgID", OrgName); |
| | | dw_detail.SetItemString(1, "ParentOrgID", OrgID); |
| | | dw_detail.Redraw(); |
| | | } |
| | | } |
| | | if (colname == "LeaderID") |
| | | { |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/hremployee/select", arg); |
| | | comdid = arg.GetArgString("comdid"); |
| | | if (comdid == "xmOk") |
| | | { |
| | | string sPersonID = arg.GetArgString("sPersonID"); |
| | | //trace(sPersonID); |
| | | string sPersonName = arg.GetArgString("sPersonName"); |
| | | dw_detail.SetItemDisplayString(1, colname, sPersonName); |
| | | dw_detail.SetItemString(1, colname, sPersonID); |
| | | dw_detail.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //ä¸ææ¡ æä¾å
容 |
| | | AttachEvent("dw_detail", "DWV_CHILDCONTENT", OnChildContent); |
| | | AttachEvent("dw_detail", "DWV_ITEMFOCUSCHANGED", OnClicked); |
| | | } |
| | | |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_detail = new xdwtable__; |
| | | dw_detail.setNativePointer(this.GetControl("dw_detail")); |
| | | dw_detail.openUrl("ç»ç»æ¶æ.vface/template/HrOrg/detail"); |
| | | OnInitial(); |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = this.GetParam(); |
| | | if (arg) |
| | | { |
| | | m_operate = arg.GetArgString("operate"); |
| | | m_sguid = arg.GetArgString("guid"); |
| | | m_tvOrgID = arg.GetArgString("tvOrgID");//ç»ç»æ çID |
| | | m_tvOrgName = arg.GetArgString("tvOrgName");//ç»ç»æ çName |
| | | m_tvRootOrgID = arg.GetArgString("tvRootOrgID");//ç»ç»æ çID |
| | | m_tvRootOrgName = arg.GetArgString("tvRootOrgName");//ç»ç»æ çName |
| | | //alert(m_tvRootOrgName); |
| | | } |
| | | /*if ( m_sguid == "" || m_sguid == nil) |
| | | { |
| | | m_sguid = win__::GetGuid();//é误 |
| | | trace(m_sguid); |
| | | }*/ |
| | | if (m_sguid != "") { |
| | | OnRetrieve(); |
| | | }; |
| | | if (m_operate == "new0") |
| | | { |
| | | //trace(m_tvOrgID); |
| | | dw_detail.SetItemString(1, "ParentOrgID", m_tvOrgID); |
| | | dw_detail.SetItemDisplayString(1, "ParentOrgID", m_tvOrgName); |
| | | dw_detail.SetItemString(1, "CompanyID", m_tvRootOrgID); |
| | | dw_detail.SetItemDisplayString(1, "CompanyID", m_tvRootOrgName); |
| | | dw_detail.SetItemString(1, "Status", "Y"); |
| | | //dw_detail.SetItemDisplayString(1,"Status","ææ"); |
| | | } |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |