QueryDataBaseHandler.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. function getAddress() {
  2. var address = document.getElementById("addressName").value;
  3. if(address.length>2){
  4. new WsCommonClass("GetAddressAnalyseResult", ["address", "pageSize", "pageIndex"], [address, 20, 1], queryProjectSucess, "findAddress");
  5. }
  6. }
  7. function searchRoadPage(count) {
  8. if(searchRoadName==null){
  9. return;
  10. }
  11. if(count==-1){//上一页
  12. if(searchRoadNameThisPage==1){
  13. return;
  14. } else {
  15. searchRoadNameThisPage--;//当前页减一
  16. }
  17. }else if (count==-2){//下一页
  18. if(searchRoadNameThisPage==searchRoadNameAllPage) {
  19. return;
  20. }else {
  21. searchRoadNameThisPage++;
  22. }
  23. }else if (count==-3){//尾页
  24. if(searchRoadNameThisPage==searchRoadNameAllPage){
  25. return
  26. }else {
  27. searchRoadNameThisPage=searchRoadNameAllPage;
  28. }
  29. }else if(count==0){//首页
  30. if(searchRoadNameThisPage==1){
  31. return
  32. }else {
  33. searchRoadNameThisPage=1;
  34. }
  35. }else {
  36. searchRoadNameThisPage=count
  37. }
  38. btClear_Click()
  39. new WsCommonClass("GetAddressAnalyseResult", ["address", "pageSize", "pageIndex"], [searchRoadName, 6, searchRoadNameThisPage], queryProjectSucess, "addressNamePage");
  40. }
  41. function queryProjectSucess(evt, keyValue) {
  42. var xmlUtil = new XMLUtil();
  43. var xmlResult = xmlUtil.stringToXml(evt[0].childNodes[0].textContent);
  44. if (xmlResult) {
  45. var xmlAddressResult = xmlResult.getElementsByTagName("Address");
  46. var promptLenth = xmlAddressResult.length;
  47. switch (keyValue) {
  48. case "findAddress":
  49. var option = "";;
  50. for (var i = 0; i < promptLenth; i++) {
  51. var name = xmlAddressResult[i].getElementsByTagName("PoiName")[0].innerHTML;
  52. option += "<option value='" + name + "'>"
  53. }
  54. document.getElementById("browsers").innerHTML = option;;
  55. break;
  56. case "addressNamePage":
  57. var count=xmlResult.getElementsByTagName("AnalyseStatus")[0].getElementsByTagName("MatchCount")[0].innerHTML;
  58. searchRoadNameAllPage=xmlResult.getElementsByTagName("AnalyseStatus")[0].getElementsByTagName("PageCount")[0].innerHTML;
  59. var pageIndex=xmlResult.getElementsByTagName("AnalyseStatus")[0].getElementsByTagName("PageIndex")[0].innerHTML;
  60. document.getElementById("roadCount").innerHTML="共"+count+"条数据";
  61. var td="";;
  62. for (var i = 0; i < promptLenth; i++) {
  63. var name = xmlAddressResult[i].getElementsByTagName("PoiName")[0].innerHTML;
  64. var roadType=xmlAddressResult[i].attributes.getNamedItem("TypeName").nodeValue;
  65. var area=xmlAddressResult[i].getElementsByTagName("AreaName")[0].innerHTML;
  66. var street=xmlAddressResult[i].getElementsByTagName("TownName")[0].innerHTML;
  67. var x=parseFloat(xmlAddressResult[i].getElementsByTagName("X")[0].innerHTML);
  68. var y=parseFloat(xmlAddressResult[i].getElementsByTagName("Y")[0].innerHTML);
  69. showRoadPoint(x,y,name);
  70. td+="<tr><td>";
  71. td+="<a class='roadNameA' onclick='showRoad("+x+","+y+")'>名称:"+name+"</a><br>["+roadType+"]<br>"+area+"-"+street;;
  72. td+="</td></tr>";
  73. }
  74. m_view.goTo(GraphicsLayer_myLayer.graphics);
  75. // ZoomOut();
  76. document.getElementById("table10").innerHTML=td;
  77. document.getElementById("roadAllPage").innerHTML="共"+promptLenth+"条记录 分"+searchRoadNameAllPage+"页 当前第"+pageIndex+"页";
  78. break;
  79. }
  80. }
  81. }