| | |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | //use "dev:code[SysUser.vx]" |
| | | |
| | | #include "SysUser.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) UserImport : public xframe |
| | |
| | | public: |
| | | |
| | | |
| | | SysUser lw_obj; |
| | | SysUser* lw_obj; |
| | | xdwgrid dw_list; |
| | | xtreeview tv_org; |
| | | xnode m_agentNode; //Agent Condition |
| | |
| | | xstring m_sTxt; |
| | | xstring is_orgid; |
| | | public: |
| | | UserImport(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | UserImport(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd), lw_obj(nullptr) {} |
| | | public: |
| | | static UserImport* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | |
| | | { |
| | | if (GetWinParam()) |
| | | { |
| | | lw_obj = new SysUser; |
| | | lw_obj.setNativePointer(GetParam()); |
| | | lw_obj = GetParam(); |
| | | lw_obj = (SysUser*)GetWinParam(); |
| | | } |
| | | else |
| | | return 0; |
| | |
| | | xstring sPositionID, sPositionName; |
| | | xstring sOrgID, sOrgName; |
| | | xstring sJobID, sJobName; |
| | | int wid = lw_obj.tv_usergroup.GetId(); |
| | | int hitem = tv_org.GetSelectedItem(wid); |
| | | KXMLDOMElement ele = tv_org.GetItemData(wid, hitem); |
| | | //int wid = lw_obj.tv_usergroup.GetId(); |
| | | HTREEITEM hitem = tv_org.GetSelectedItem(); |
| | | //KXMLDOMElement ele = tv_org.GetItemData(hitem); |
| | | |
| | | |
| | | while (row > 0) |
| | |
| | | //trace(row); |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | trace(e.xml()); |
| | | xstring sEmployeeNo = e.selectSingleNode(L"EmployeeNo").text() + L""; |
| | | xstring sOldEmpNo = e.selectSingleNode(L"OldEmpNo").text() + L""; |
| | | xstring sPersonID = e.selectSingleNode(L"PersonID").text() + L""; |
| | | xstring sPersonName = e.selectSingleNode(L"Name").text() + L""; |
| | | xstring sEmployeeNo = e.selectSingleNode(L"EmployeeNo").text() + (xstring)L""; |
| | | xstring sOldEmpNo = e.selectSingleNode(L"OldEmpNo").text() + (xstring)L""; |
| | | xstring sPersonID = e.selectSingleNode(L"PersonID").text() + (xstring)L""; |
| | | xstring sPersonName = e.selectSingleNode(L"Name").text() + (xstring)L""; |
| | | xstring sPassWord = xutil::MD5(sOldEmpNo); |
| | | |
| | | /* |
| | |
| | | } |
| | | }*/ |
| | | |
| | | int nRow = lw_obj.dw_user.InsertRow(0); |
| | | lw_obj.dw_user.SetItemString(nRow, L"EmployeeNo", sEmployeeNo); |
| | | lw_obj.dw_user.SetItemString(nRow, L"UserName", sOldEmpNo); |
| | | lw_obj.dw_user.SetItemString(nRow, L"PassWord", sPassWord); |
| | | lw_obj.dw_user.SetItemString(nRow, L"PersonID", sPersonID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow, L"PersonID", sPersonName); |
| | | lw_obj.dw_user.SetItemString(nRow, L"Status", L"Y"); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow, L"Status", L"有效"); |
| | | lw_obj.dw_user.SetItemString(nRow, L"OldEmpNo", sOldEmpNo); |
| | | int nRow = lw_obj->dw_user.InsertRow(0); |
| | | lw_obj->dw_user.SetItemString(nRow, L"EmployeeNo", sEmployeeNo); |
| | | lw_obj->dw_user.SetItemString(nRow, L"UserName", sOldEmpNo); |
| | | lw_obj->dw_user.SetItemString(nRow, L"PassWord", sPassWord); |
| | | lw_obj->dw_user.SetItemString(nRow, L"PersonID", sPersonID); |
| | | lw_obj->dw_user.SetItemDisplayString(nRow, L"PersonID", sPersonName); |
| | | lw_obj->dw_user.SetItemString(nRow, L"Status", L"Y"); |
| | | lw_obj->dw_user.SetItemDisplayString(nRow, L"Status", L"有效"); |
| | | lw_obj->dw_user.SetItemString(nRow, L"OldEmpNo", sOldEmpNo); |
| | | /* |
| | | lw_obj.dw_user.SetItemString(nRow,L"PositionID",sPositionID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,L"PositionID",sPositionName); |
| | |
| | | } |
| | | int OnSubTree(xstring id, HTREEITEM parentitem) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | if (tv_org.GetChildItem(wid, parentitem) > 0) return 1; |
| | | //int wid = tv_org.GetId(); |
| | | if (tv_org.GetChildItem( parentitem)) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | |
| | | arg.AddArg(L"sguid", id); |
| | | if (xurl::post(L"/sale/data/OrganizationStruct/tree.child.OrgChart", arg.GetString(), x) != 1) |
| | | { |
| | |
| | | return -1; |
| | | } |
| | | //trace(x.xml()); |
| | | var list = x.selectNodes(L"//item"); |
| | | int i = 0, s = list.length; |
| | | auto list = x.selectNodes(L"//item"); |
| | | int i = 0, s = list.length(); |
| | | KXMLDOMElement xitem; |
| | | xstring sName; |
| | | xstring sguid; |
| | |
| | | sguid = xitem.selectSingleNode(L"id").text(); |
| | | stype = xitem.selectSingleNode(L"typ").text(); |
| | | //int curItem = tv_org.InsertChildItemEx(wid,parentitem,sName,xitem,15,4); |
| | | int curItem = 0; |
| | | HTREEITEM curItem = 0; |
| | | if (stype == L"Org") |
| | | { |
| | | curItem = tv_org.InsertChildItemEx(wid, parentitem, sName, xitem, 15, 4); |
| | | tv_org.SetItemChild1(wid, curItem, 1); |
| | | curItem = tv_org.InsertChildItemEx( parentitem, sName, xitem, 15, 4); |
| | | tv_org.SetItemChild1(curItem, 1); |
| | | } |
| | | else |
| | | { |
| | | curItem = tv_org.InsertChildItemEx(wid, parentitem, sName, xitem, 21, 21); |
| | | curItem = tv_org.InsertChildItemEx(parentitem, sName, xitem, 21, 21); |
| | | } |
| | | //OnSubTree(sguid,curItem); |
| | | } |
| | |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring id, int parentitem) |
| | | int OnCreateTree(xstring id, HTREEITEM parentitem) |
| | | { |
| | | //while (tv_1.GetRootItem()>0) |
| | | // tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | int wid = tv_org.GetId(); |
| | | //int wid = tv_org.GetId(); |
| | | xml x; |
| | | |
| | | x.loadXML(L"<item><id>" + id + L"</id><no/><name>凤凰集团</name><typ>Org</typ></item>"); |
| | | x.loadXML(L"<item><id>" + id + L"</id><no/><name>组织结构</name><typ>Org</typ></item>"); |
| | | //KXMLDOMDocument root = x; |
| | | //KXMLDOMElement RDoc = x.documentElement(); |
| | | //KXMLDOMElement ele = RDoc.SelectSingleNode(L"//Org"); |
| | | KXMLDOMElement ele = x.selectSingleNode(L"//item"); |
| | | int hItem = tv_org.InsertChildItemEx(wid, 0, L"凤凰集团", ele, 15, 4); |
| | | tv_org.SetItemChild1(wid, hItem, 1); |
| | | HTREEITEM hItem = tv_org.InsertChildItemEx( (HTREEITEM)0, L"组织结构", ele, 15, 4); |
| | | tv_org.SetItemChild1(hItem, 1); |
| | | return 1; |
| | | |
| | | /*xaserverarg arg; |
| | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | //xstring id = tv_org.GetItemData(tv_org.GetId(), sitem); |
| | | KXMLDOMElement ele = tv_org.GetItemData(tv_org.GetId(), sitem); |
| | | KXMLDOMElement ele = tv_org.GetItemData(sitem); |
| | | xstring id = ele.selectSingleNode(L"id").text(); |
| | | OnSubTree(id, sitem); |
| | | xutil::RestoreCursor(hCursor); |
| | |
| | | int OnTreeSelChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | //int wid = tv_org.GetId(); |
| | | int hitem = tv_org.GetSelectedItem(); |
| | | HTREEITEM hitem = tv_org.GetSelectedItem(); |
| | | KXMLDOMElement ele = tv_org.GetItemData(hitem); |
| | | if (ele) |
| | | { |
| | |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"cb_import") |
| | | { |
| | | OnOK(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"cb_close") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = new treeview; |
| | | tv_org.setNativePointer(GetControl(L"tv_org")); |
| | | tv_org = GetControl(L"tv_org"); |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.openUrl(L"系统用户.vface/template/SysUser/EmpSelect"); |
| | |
| | | OnInitial(); |
| | | OnCreateTree(L"00000000-0000-0000-0000-000000000000", 0); |
| | | //int wid = tv_org.GetId(); |
| | | int root = tv_org.GetRootItem(); |
| | | HTREEITEM root = tv_org.GetRootItem(); |
| | | tv_org.ExpandItem(root); |
| | | OnRetrieve(L"00000000-0000-0000-0000-000000000000"); |
| | | return 1; |