add.jsp 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <!doctype html>
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <%@ include file="../../common/head.jsp"%>
  8. <link rel="stylesheet" type="text/css" href="../res/js//plugins/webuploader/webuploader.css">
  9. <link rel="stylesheet" type="text/css" href="../res/css/demo/webuploader-demo.css">
  10. <script type="text/javascript" src="../res/js/plugins/webuploader/webuploader.js"></script>
  11. <script type="text/javascript" src="../res/js/plugins/webuploader/uploader.js"></script>
  12. <cs:initFile/>
  13. <script type="text/javascript">
  14. $(function () {
  15. $("#airportDiv").hide();
  16. $("#airwaysDiv").hide();
  17. });
  18. function dotype(type){
  19. if(type == 0){
  20. $("#airportDiv").hide();
  21. $("#airwaysDiv").hide();
  22. }else if(type == 1){
  23. $("#airportDiv").show();
  24. $("#airwaysDiv").hide();
  25. }else if(type ==2){
  26. $("#airportDiv").show();
  27. $("#airwaysDiv").show();
  28. }
  29. }
  30. function doItem(id) {
  31. $('#airwaysId').empty();
  32. $('#airwaysId').html('<option value="">--无--</option>');
  33. $.getJSON('../machine/getAirways.cs', {
  34. 'airportId': $('#airportId').val()
  35. }, function (data) {
  36. $.each(data, function (i, obj) {
  37. $("#airwaysId").append('<option value="' + obj.id+'">' + obj.name + '</option>');
  38. });
  39. });
  40. }
  41. </script>
  42. </head>
  43. <body>
  44. <div class="wrapper wrapper-content">
  45. <div class="row">
  46. <div class="col-sm-12">
  47. <cs:form_validate formId="addUserForm"/>
  48. <form class="form-horizontal" action="add.cs" id="addUserForm" method="POST">
  49. <div class="form-group">
  50. <label class="col-sm-3 control-label">项目名称:</label>
  51. <div class="col-sm-6">
  52. <input id="name" name="name" class="form-control" validate="{required:true}" validateMessage="{required:'请输入名称'}" >
  53. </div>
  54. </div>
  55. <div class="form-group">
  56. <label class="col-sm-3 control-label">省:</label>
  57. <div class="col-sm-6">
  58. <select id="provinceCode" name="provinceCode" class="form-control" validate="{required:true}" validateMessage="{required:'请输入名称'}">
  59. <option value="" disabled selected hidden>省</option>
  60. </select>
  61. <input type="hidden" id="province" name="province"/>
  62. </div>
  63. </div>
  64. <div class="form-group">
  65. <label class="col-sm-3 control-label">市:</label>
  66. <div class="col-sm-6">
  67. <select id="cityCode" name="cityCode" class="form-control" validate="{required:true}" validateMessage="{required:'请输入名称'}">
  68. <option value="" disabled selected hidden>市</option>
  69. </select>
  70. <input type="hidden" id="city" name="city"/>
  71. </div>
  72. </div>
  73. <!-- <div class="form-group">
  74. <label class="col-sm-3 control-label">区 / 县:</label>
  75. <div class="col-sm-6">
  76. <select id="countyCode" name="countyCode" class="form-control" validate="{required:true}" validateMessage="{required:'请输入名称'}">
  77. <option value="" disabled selected hidden>区 / 县</option>
  78. </select>
  79. <input type="hidden" id="county" name="county"/>
  80. </div>
  81. </div> -->
  82. <div class="form-group">
  83. <label class="col-sm-3 control-label">描述:</label>
  84. <div class="col-sm-6">
  85. <textarea id="info" name="info" class="form-control" style="height: 310px;"></textarea>
  86. </div>
  87. </div>
  88. <div class="form-group">
  89. <div class="col-sm-4 col-sm-offset-3 pull-left">
  90. <button class="btn btn-default btn-dlg-close">取消</button>
  91. <button class="btn btn-primary" type="submit">提交</button>
  92. </div>
  93. </div>
  94. </form>
  95. </div>
  96. </div>
  97. </div>
  98. <script type="text/javascript">
  99. var curProvinceCode='41';//河南省
  100. $.get('<%=basePath%>area/getProvice.cs',function(data){
  101. for(var i in data){
  102. var _option = '';
  103. if(curProvinceCode ==data[i].code ){
  104. _option = '<option value="' + data[i].code + '" selected>' + data[i].name + '</option>';
  105. $('#province').val(data[i].name);
  106. }else{
  107. _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
  108. }
  109. $('#provinceCode').append(_option);
  110. }
  111. });
  112. if(curProvinceCode != ''){
  113. $.get('<%=basePath%>area/getByParentCode.cs',{'param': curProvinceCode}, function(data){
  114. for(var i in data){
  115. var _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
  116. $('#cityCode').append(_option);
  117. }
  118. });
  119. }
  120. ///省
  121. $("#provinceCode").change(function(){
  122. var self = $(this);
  123. $('#cityCode').empty();
  124. var _option = '<option>请选择</option>';
  125. $('#cityCode').append(_option);
  126. $('#city').val("");
  127. $('#countyCode').empty();
  128. var _option = '<option>请选择</option>';
  129. $('#countyCode').append(_option);
  130. $('#county').val("");
  131. $('#townshipCode').empty();
  132. var _option = '<option>请选择</option>';
  133. $('#townshipCode').append(_option);
  134. $('#township').val("");
  135. alert(self.val());
  136. $.get('<%=basePath%>area/getByParentCode.cs',{'param': self.val()}, function(data){
  137. for(var i in data){
  138. var _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
  139. $('#cityCode').append(_option);
  140. }
  141. });
  142. $('#province').val(self.find("option:selected").text());
  143. });
  144. ///城市
  145. $("#cityCode").change(function(){
  146. var self = $(this);
  147. $('#countyCode').empty();
  148. var _option = '<option>请选择</option>';
  149. $('#countyCode').append(_option);
  150. $('#county').val("");
  151. $('#townshipCode').empty();
  152. var _option = '<option>请选择</option>';
  153. $('#townshipCode').append(_option);
  154. $('#township').val("");
  155. <%-- $.get('<%=basePath%>area/getByParentCode.cs',{'param': self.val()}, function(data){
  156. for(var i in data){
  157. var _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
  158. //if(num == 1){
  159. $('#countyCode').append(_option);
  160. // }
  161. }
  162. }); --%>
  163. $('#city').val(self.find("option:selected").text());
  164. });
  165. <%-- ///县、区
  166. $("#countyCode").change(function(){
  167. var self = $(this);
  168. $('#townshipCode').empty();
  169. var _option = '<option>请选择</option>';
  170. $('#townshipCode').append(_option);
  171. $('#township').val("");
  172. $.get('<%=basePath%>area/getByParentCode.cs',{'param': self.val()}, function(data){
  173. for(var i in data){
  174. var _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
  175. //if(num == 1){
  176. $('#townshipCode').append(_option);
  177. // }
  178. }
  179. });
  180. $('#county').val(self.find("option:selected").text());
  181. }); --%>
  182. </script>
  183. </body>
  184. </html>