backupdate.jsp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <%@ page contentType="text/html; charset=utf-8" session="false" %>
  2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>我的工作台</title>
  6. <%@ include file="../common/header.jsp" %>
  7. <script type="text/javascript">
  8. //备份数据
  9. function backupdate(){
  10. var ip = $("#ip").val();
  11. var Port = $("#Port").val();
  12. var pastureName = $("#pastureName").val();
  13. var pastureCode = $("#pastureCode").val();
  14. if(ip.length == 0){
  15. alert("【服务器IP】必填");
  16. $("#ip").focus();
  17. return false;
  18. }else if(Port.length == 0){
  19. alert("【服务器端口】必填");
  20. $("#Port").focus();
  21. return false;
  22. }else if(pastureName.length == 0){
  23. alert("【牧场名称】必填");
  24. $("#pastureName").focus();
  25. return false;
  26. }else{
  27. if(pastureCode.length == 0){
  28. alert("【牧场编号】必填");
  29. $("#pastureCode").focus();
  30. return false;
  31. }else{
  32. $.ajax({
  33. async: false,
  34. type: "post",
  35. dataType: "jsonp", //返回类型json
  36. data: "pastureName="+pastureName+"&pastureCode="+pastureCode+"&callback=backjsonp",
  37. url: "http://"+ip+":"+Port+"/TMRWatchPlatform/admin/basicdata/checkPastureCode.do"
  38. });
  39. }
  40. }
  41. }
  42. function backjsonp(data){
  43. console.log("backjsonp:"+data.status);
  44. if(data.status == "success"){
  45. $.ajax({
  46. async: false,
  47. type: "POST",
  48. dataType: "json", //返回类型json
  49. data: "pastureName="+$("#pastureName").val()+"&pastureCode="+$("#pastureCode").val(),
  50. url: "${contextPath}/admin/basicdata/addPasture.html",
  51. error: function(){alert("系统错误");},
  52. success: function(json){
  53. addStatus = json.addStatus;
  54. if(addStatus == "success"){
  55. alert("启动成功");
  56. $("#pastureName").val("");
  57. $("#pastureCode").val("");
  58. }else{
  59. alert("启动失败");
  60. }
  61. }
  62. });
  63. }else{
  64. alert("服务器验证牧场信息失败!!!");
  65. }
  66. }
  67. </script>
  68. </head>
  69. <body style="background-color: #E0E0E0;">
  70. <div>
  71. <div class="navfrm">
  72. <span>当前位置:</span>
  73. <span><a href="${contextPath }/admin/welcome.html">首页</a></span>
  74. <span>&nbsp;>>&nbsp;</span>
  75. <span>上传登记</span>
  76. </div>
  77. &nbsp;&nbsp;
  78. <table cellspacing="1" cellpadding="0" border="0" style="width: 99%;">
  79. <tr>
  80. <td width="10%" align="right"><font color="red">*</font>服务器IP:</td>
  81. <td algin="left"><input id="ip" name="ip" style="width:100px;" value="" /></td>
  82. </tr>
  83. <tr>
  84. <td align="right"><font color="red">*</font>服务器端口:</td>
  85. <td><input id="Port" name="Port" style="width:100px;" value="" /></td>
  86. </tr>
  87. <tr>
  88. <td align="right"><font color="red">*</font>牧场名称:</td>
  89. <td><input id="pastureName" name="pastureName" style="width:100px;" value="" /></td>
  90. </tr>
  91. <tr>
  92. <td align="right"><font color="red">*</font>牧场编号:</td>
  93. <td><input id="pastureCode" name="pastureCode" style="width:100px;" value="" /></td>
  94. </tr>
  95. <tr>
  96. <td></td>
  97. <td><input type="button" value="启动" onclick="backupdate();" class="sysub" /></td>
  98. </tr>
  99. </table>
  100. </div>
  101. </body>
  102. </html>