edit.jsp 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  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. <script type="text/javascript" charset="utf-8" src="<%=basePath %>res/js/plugins/UEditor/ueditor.config.js"></script>
  13. <script type="text/javascript" charset="utf-8" src="<%=basePath %>res/js/plugins/UEditor/ueditor.all.min.js"> </script>
  14. <cs:initFile/>
  15. <script type="text/javascript">
  16. $(function () {
  17. $("#airportDiv").hide();
  18. $("#airwaysDiv").hide();
  19. });
  20. function dotype(type){
  21. if(type == 0){
  22. $("#airportDiv").hide();
  23. $("#airwaysDiv").hide();
  24. }else if(type == 1){
  25. $("#airportDiv").show();
  26. $("#airwaysDiv").hide();
  27. }else if(type ==2){
  28. $("#airportDiv").show();
  29. $("#airwaysDiv").show();
  30. }
  31. }
  32. function doItem(id) {
  33. $('#airwaysId').empty();
  34. $('#airwaysId').html('<option value="">--无--</option>');
  35. $.getJSON('../machine/getAirways.cs', {
  36. 'airportId': $('#airportId').val()
  37. }, function (data) {
  38. $.each(data, function (i, obj) {
  39. $("#airwaysId").append('<option value="' + obj.id+'">' + obj.name + '</option>');
  40. });
  41. });
  42. }
  43. </script>
  44. <script>
  45. function initUe(){
  46. var productImg = $("input[name='productImg']");
  47. var productGroupImg = $("#input[name='productGroupImg']");
  48. if(productImg.length > 2){
  49. layer.msg("主图只能有1个");
  50. return false;
  51. }
  52. if(productGroupImg.length > 6){
  53. layer.msg("组图最多5个");
  54. return false;
  55. }
  56. $("#productAttr").val(ue1.getContent());
  57. $("#productBody").val(ue2.getContent());
  58. $("#policy").val(ue4.getContent());
  59. $("#addUserForm").submit();
  60. return true;
  61. }
  62. </script>
  63. </head>
  64. <body>
  65. <div class="wrapper wrapper-content">
  66. <div class="row">
  67. <div class="col-sm-12">
  68. <cs:form_validate formId="addUserForm"/>
  69. <form class="form-horizontal" action="edit.cs" id="addUserForm" method="POST" onsubmit="return false;">
  70. <input name="id" id="id" type="hidden" value="${mgmProduct.id }"/>
  71. <div class="form-group col-sm-12">
  72. <div class="form-group col-sm-6">
  73. <label class="col-sm-4 control-label">产品名称:</label>
  74. <div class="col-sm-8">
  75. <input id="productName" name="productName" value="${mgmProduct.productName }" class="form-control" validate="{required:true,maxlength: 50}" validateMessage="{required:'请输入名称',maxlength:'输入的名称超出长度限制'}" >
  76. </div>
  77. </div>
  78. <div class="form-group col-sm-6">
  79. <label class="col-sm-4 control-label">产品型号:</label>
  80. <div class="col-sm-8">
  81. <input id="productModel" name="productModel" value="${mgmProduct.productModel }" class="form-control" validate="{required:true,maxlength: 25}" validateMessage="{required:'请输入型号',maxlength:'输入的型号超出长度限制'}" >
  82. </div>
  83. </div>
  84. </div>
  85. <div class="form-group col-sm-12">
  86. <div class="form-group col-sm-6">
  87. <label class="col-sm-4 control-label">产品标示:</label>
  88. <div class="col-sm-8">
  89. <input id="productRemark" name="productRemark" placeholder="地产项目请填写城市区域,其他产品请填写产品特色" value="${mgmProduct.productRemark }" class="form-control" validate="{required:true,maxlength: 150}" validateMessage="{required:'请输入型号',maxlength:'输入的标识超出长度限制'}" >
  90. </div>
  91. </div>
  92. <div class="form-group col-sm-6">
  93. <label class="col-sm-4 control-label">佣金比例(%):</label>
  94. <div class="col-sm-8">
  95. <input id="commissionRate" name="commissionRate" value="${mgmProduct.commissionRate }" class="form-control" validate="{required:true,min:0,maxlength:100}" validateMessage="{required:'请输入佣金比率',min:'请输入大于等于0的值',maxlength:'输入的佣金比率超出长度限制'}">
  96. </div>
  97. </div>
  98. </div>
  99. <div class="form-group col-sm-12">
  100. <div class="form-group col-sm-6">
  101. <label class="col-sm-4 control-label">联系电话:</label>
  102. <div class="col-sm-8">
  103. <input id="hotline" name="hotline" class="form-control" value="${mgmProduct.hotline }" validate="{required:true,maxlength:30}" validateMessage="{required:'请输入联系电话',maxlength:'输入的电话超出长度限制'}" >
  104. </div>
  105. </div>
  106. <div class="form-group col-sm-6" >
  107. <label class="col-sm-4 control-label">产品价格:</label>
  108. <div class="col-sm-8">
  109. <input id="productPrice" name="productPrice" value="${mgmProduct.productPrice }" class="form-control" validate="{required:true,maxlength:50}" validateMessage="{required:'请输入产品价格',maxlength:'输入的产品价格超出长度限制'}" >
  110. </div>
  111. </div>
  112. </div>
  113. <div class="form-group col-sm-12">
  114. <div class="form-group col-sm-6">
  115. <label class="col-sm-4 control-label">单位:</label>
  116. <div class="col-sm-8">
  117. <input id="unit" name="unit" value="${mgmProduct.unit }" class="form-control" validate="{required:true,maxlength:5}" validateMessage="{required:'请输入单位',maxlength:'输入的单位超出长度限制'}" >
  118. </div>
  119. </div>
  120. <div class="form-group col-sm-6">
  121. <label class="col-sm-4 control-label">权重:</label>
  122. <div class="col-sm-8">
  123. <input id="weight" name="weight" oninput='this.value=this.value.replace(/^[0]+[0-9]*$/gi,"")' onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" placeholder="请输入数字" value="${mgmProduct.weight }" class="form-control" validate="{required:true,maxlength:8}" validateMessage="{required:'请输入权重,内容为数字,从小到大排序',maxlength:'输入的权重超出长度限制'}" >
  124. </div>
  125. </div>
  126. </div>
  127. <div class="form-group col-sm-12">
  128. <div class="form-group col-sm-6">
  129. <label class="col-sm-4 control-label">是否推荐:</label>
  130. <div class="col-sm-8">
  131. <div class="radio i-checks">
  132. <label><input type="radio" name ="isHome" value="1" <c:if test="${mgmProduct.isHome == '1' }">checked="checked"</c:if>> <i></i> 是</label>
  133. <label><input type="radio" name="isHome" value="0" <c:if test="${mgmProduct.isHome == '0' }">checked="checked"</c:if>> <i></i> 否</label>
  134. </div>
  135. </div>
  136. </div>
  137. <div class="form-group col-sm-6">
  138. <label class="col-sm-4 control-label">是否公开:</label>
  139. <div class="col-sm-8">
  140. <select id="openFlag" name="openFlag" class="form-control">
  141. <option value="1" <c:if test="${mgmProduct.openFlag}">selected</c:if>>公开</option>
  142. <option value="0" <c:if test="${!mgmProduct.openFlag}">selected</c:if>>内部</option>
  143. </select>
  144. </div>
  145. </div>
  146. </div>
  147. <div class="form-group col-sm-12">
  148. <div class="form-group col-sm-6" >
  149. <label class="col-sm-4 control-label">上级分类:</label>
  150. <div class="col-sm-8">
  151. <select <c:if test="${role.ONE_CATEGORY_Id != null && role.ONE_CATEGORY_Id != '' && role.ONE_CATEGORY_Id!= '0'}">disabled="disabled"</c:if> class="form-control m-b" id="gcId" name="gcId" onchange="menuChange(this)" validate="{required:true}" validateMessage="{required:'请选择分类'}">
  152. <option value="">请选择</option>
  153. <c:forEach items="${firstCategory }" var="superMenu">
  154. <option value="${superMenu.id }" <c:if test="${mgmProduct.gcId == superMenu.id }">selected</c:if>>${superMenu.gcName}</option>
  155. </c:forEach>
  156. </select>
  157. </div>
  158. </div>
  159. <script type="text/javascript">
  160. function menuChange(obj){
  161. var ss = $(obj).children('option:selected').val();
  162. $("#tlb").css("display","none");
  163. $('#tlb select').find("option:selected").prop('selected',false);
  164. $("#thlb").css("display","none");
  165. $('#thlb select').find("option:selected").prop('selected',false);
  166. $("#folb").css("display","none");
  167. $('#folb select').find("option:selected").prop('selected',false);
  168. $('#dcfllb select').find("option:selected").prop('selected',false);
  169. $('#dcfllb').css("display","none");
  170. $("#gcParentId").empty();
  171. $("#gcThreeId").empty();
  172. $("#gcFourId").empty();
  173. $.ajax({
  174. type: "get",
  175. url: "<%=basePath%>mgmProductCategoryCtl/nextCategory.cs",
  176. data: {id:ss},
  177. dataType: "json",
  178. success: function(data){
  179. if(data.mlist.length > 0){
  180. $("#tlb").css("display","block");
  181. $("#gcParentId").empty();
  182. $("#gcParentId").append("<option value='0'>请选择</option>");
  183. data.mlist.forEach(function(val,index,arr){
  184. $("#gcParentId").append("<option value='"+val.id+"'>"+ val.gcName+"</option>");
  185. });
  186. }
  187. if(data.type == "1"){
  188. $('#dcfllb').css("display","block");
  189. }
  190. }
  191. });
  192. }
  193. function twoMenuChange(obj){
  194. var ss = $(obj).children('option:selected').val();
  195. $("#thlb").css("display","none");
  196. $('#thlb select').find("option:selected").prop('selected',false);
  197. $("#folb").css("display","none");
  198. $('#folb select').find("option:selected").prop('selected',false);
  199. $("#gcThreeId").empty();
  200. $("#gcFourId").empty();
  201. $.ajax({
  202. type: "get",
  203. url: "<%=basePath%>mgmProductCategoryCtl/nextCategory.cs",
  204. data: {id:ss},
  205. dataType: "json",
  206. success: function(data){
  207. if(data.mlist.length > 0){
  208. $("#thlb").css("display","block");
  209. $("#gcThreeId").empty();
  210. $("#gcThreeId").append("<option value='0'>请选择</option>");
  211. data.mlist.forEach(function(val,index,arr){
  212. $("#gcThreeId").append("<option value='"+val.id+"'>"+ val.gcName+"</option>");
  213. });
  214. }
  215. }
  216. });
  217. }
  218. function threeMenuChange(obj){
  219. var ss = $(obj).children('option:selected').val();
  220. $("#folb").css("display","none");
  221. $('#folb select').find("option:selected").prop('selected',false);
  222. $("#gcFourId").empty();
  223. $.ajax({
  224. type: "get",
  225. url: "<%=basePath%>mgmProductCategoryCtl/nextCategory.cs",
  226. data: {id:ss},
  227. dataType: "json",
  228. success: function(data){
  229. if(data.mlist.length > 0){
  230. $("#folb").css("display","block");
  231. $("#gcFourId").empty();
  232. $("#gcFourId").append("<option value='0'>请选择</option>");
  233. data.mlist.forEach(function(val,index,arr){
  234. $("#gcFourId").append("<option value='"+val.id+"'>"+ val.gcName+"</option>");
  235. });
  236. }
  237. }
  238. });
  239. }
  240. </script>
  241. <div id="tlb" class="form-group col-sm-6" >
  242. <label class="col-sm-4 control-label">二级分类:</label>
  243. <div class="col-sm-8">
  244. <select <c:if test="${role.TWO_CATEGORY_Id != null && role.TWO_CATEGORY_Id != '' && role.TWO_CATEGORY_Id!= '0'}">disabled="disabled"</c:if> class="form-control m-b" id="gcParentId" name="gcParentId" onchange="twoMenuChange(this)" validate="{required:true}" validateMessage="{required:'请选择分类'}">
  245. <option value="">请选择</option>
  246. <c:forEach items="${twoCategory }" var="superMenu">
  247. <option value="${superMenu.id }" <c:if test="${mgmProduct.gcParentId == superMenu.id }">selected</c:if> >${superMenu.gcName}</option>
  248. </c:forEach>
  249. </select>
  250. </div>
  251. </div>
  252. </div>
  253. <div class="form-group col-sm-12">
  254. <div id="thlb" class="form-group col-sm-6" <c:if test="${threeCategory.isEmpty() }">style="display:none;"</c:if>>
  255. <label class="col-sm-4 control-label">三级分类:</label>
  256. <div class="col-sm-8">
  257. <select <c:if test="${role.THREE_CATEGORY_Id != null && role.THREE_CATEGORY_Id != '' && role.THREE_CATEGORY_Id!= '0'}">disabled="disabled"</c:if> class="form-control m-b" id="gcThreeId" name="gcThreeId" onchange="threeMenuChange(this)" validate="{required:true}" validateMessage="{required:'请选择分类'}">
  258. <option value="">请选择</option>
  259. <c:forEach items="${threeCategory }" var="superMenu">
  260. <option value="${superMenu.id }" <c:if test="${mgmProduct.gcThreeId == superMenu.id }">selected</c:if> >${superMenu.gcName}</option>
  261. </c:forEach>
  262. </select>
  263. </div>
  264. </div>
  265. <div id="folb" class="form-group col-sm-6" <c:if test="${fourCategory.isEmpty() }">style="display:none;"</c:if>>
  266. <label class="col-sm-4 control-label">四级分类:</label>
  267. <div class="col-sm-8">
  268. <select <c:if test="${role.FOUR_CATEGORY_Id != null && role.FOUR_CATEGORY_Id != '' && role.FOUR_CATEGORY_Id!= '0'}">disabled="disabled"</c:if> class="form-control m-b" id="gcFourId" name="gcFourId" validate="{required:true}" validateMessage="{required:'请选择分类'}">
  269. <option value="">请选择</option>
  270. <c:forEach items="${fourCategory }" var="superMenu">
  271. <option value="${superMenu.id }" <c:if test="${mgmProduct.gcFourId == superMenu.id }">selected</c:if> >${superMenu.gcName}</option>
  272. </c:forEach>
  273. </select>
  274. </div>
  275. </div>
  276. <!-- //地产项目分类 -->
  277. <div id="dcfllb" class="form-group col-sm-6" <c:if test="${mgmProduct.productType != '1' }">style="display:none;"</c:if>>
  278. <label class="col-sm-4 control-label">地产项目分类:</label>
  279. <div class="col-sm-8">
  280. <select class="form-control m-b" id="xmCode" name="xmCode" validate="{required:true}" validateMessage="{required:'请输入地产项目分类'}">
  281. <option value="">请选择</option>
  282. <c:forEach items="${diclist }" var="superMenu">
  283. <option value="${superMenu.code }" <c:if test="${mgmProduct.xmCode == superMenu.code }">selected</c:if>>${superMenu.name}</option>
  284. </c:forEach>
  285. </select>
  286. </div>
  287. </div>
  288. </div>
  289. <div class="form-group col-sm-12">
  290. <label class="col-sm-2 control-label">商品主图:</label>
  291. <div class="col-sm-10">
  292. <cs:file name="productImg" type="100" url="${mgmProduct.productImg }" num="1"></cs:file>
  293. </div>
  294. </div>
  295. <div class="form-group col-sm-12">
  296. <label class="col-sm-2 control-label">商品组图:</label>
  297. <div class="col-sm-10">
  298. <cs:file name="productGroupImg" type="100" url="${mgmProduct.productGroupImg }" num="5"></cs:file>
  299. </div>
  300. </div>
  301. <%-- <div class="form-group">
  302. <label class="col-sm-3 control-label">产品说明:</label>
  303. <div class="col-sm-6">
  304. <div class="content">
  305. <script id="editor" type="text/plain" style="width:100%;height:500px;"></script>
  306. <script type="text/javascript">
  307. //实例化编辑器
  308. //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
  309. var ue = UE.getEditor('editor');
  310. ue.ready(function(){
  311. ue.setContent('${mgmProduct.productMsg }');
  312. });
  313. ue.addListener('selectionchange',function(){
  314. $("#productMsg").val(ue.getContent());
  315. console.log("选区已经变化!");
  316. })
  317. </script>
  318. <textarea rows="" cols="" id="productMsg" style="display:none;" name="productMsg">${mgmProduct.productMsg }</textarea>
  319. </div>
  320. </div>
  321. </div> --%>
  322. <div class="form-group col-sm-12">
  323. <label class="col-sm-2 control-label">产品参数:</label>
  324. <div class="col-sm-10">
  325. <div class="content">
  326. <script id="editor1" type="text/plain" style="width:100%;height:500px;">${mgmProduct.productAttr }</script>
  327. <script type="text/javascript">
  328. //实例化编辑器
  329. //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
  330. var ue1 = UE.getEditor('editor1');
  331. /* ue1.ready(function(){
  332. ue1.setContent('${mgmProduct.productAttr }');
  333. });
  334. ue1.addListener('selectionchange',function(){
  335. $("#productAttr").val(ue1.getContent());
  336. console.log("选区已经变化!");
  337. }) */
  338. </script>
  339. <textarea rows="" cols="" id="productAttr" style="display:none;" name="productAttr"></textarea>
  340. </div>
  341. </div>
  342. </div>
  343. <div class="form-group col-sm-12">
  344. <label class="col-sm-2 control-label">产品详情:</label>
  345. <div class="col-sm-10">
  346. <div class="content">
  347. <script id="editor2" type="text/plain" style="width:100%;height:500px;">${mgmProduct.productBody }</script>
  348. <script type="text/javascript">
  349. //实例化编辑器
  350. //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
  351. var ue2 = UE.getEditor('editor2');
  352. /* ue2.ready(function(){
  353. ue2.setContent('${mgmProduct.productBody }');
  354. });
  355. ue2.addListener('selectionchange',function(){
  356. $("#productBody").val(ue2.getContent());
  357. console.log("选区已经变化!");
  358. }) */
  359. </script>
  360. <textarea rows="" cols="" id="productBody" style="display:none;" name="productBody"></textarea>
  361. </div>
  362. </div>
  363. </div>
  364. <%-- <div class="form-group">
  365. <label class="col-sm-3 control-label">佣金说明:</label>
  366. <div class="col-sm-6">
  367. <div class="content">
  368. <script id="editor3" type="text/plain" style="width:100%;height:500px;"></script>
  369. <script type="text/javascript">
  370. //实例化编辑器
  371. //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
  372. var ue3 = UE.getEditor('editor3');
  373. ue3.ready(function(){
  374. ue3.setContent('${mgmProduct.commissionRemark }');
  375. });
  376. ue3.addListener('selectionchange',function(){
  377. $("#commissionRemark").val(ue3.getContent());
  378. console.log("选区已经变化!");
  379. })
  380. </script>
  381. <textarea rows="" cols="" id="commissionRemark" style="display:none;" name="commissionRemark">${mgmProduct.commissionRemark }</textarea>
  382. </div>
  383. </div>
  384. </div> --%>
  385. <div class="form-group col-sm-12">
  386. <label class="col-sm-2 control-label">优惠政策:</label>
  387. <div class="col-sm-10">
  388. <div class="content">
  389. <script id="editor4" type="text/plain" style="width:100%;height:500px;">${mgmProduct.policy }</script>
  390. <script type="text/javascript">
  391. //实例化编辑器
  392. //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
  393. var ue4 = UE.getEditor('editor4');
  394. /* ue4.ready(function(){
  395. ue4.setContent('${mgmProduct.policy }');
  396. });
  397. ue4.addListener('selectionchange',function(){
  398. $("#policy").val(ue4.getContent());
  399. console.log("选区已经变化!");
  400. }) */
  401. </script>
  402. <textarea rows="" cols="" id="policy" name="policy" style="display:none;"></textarea>
  403. </div>
  404. </div>
  405. </div>
  406. <!-- <div class="form-group">
  407. <label class="col-sm-3 control-label">省:</label>
  408. <div class="col-sm-6">
  409. <select id="provinceCode" name="provinceCode" class="form-control" validate="{required:true}" validateMessage="{required:'请输入名称'}">
  410. <option value="" disabled selected hidden>省</option>
  411. </select>
  412. <input type="hidden" id="province" name="province"/>
  413. </div>
  414. </div>
  415. <div class="form-group">
  416. <label class="col-sm-3 control-label">市:</label>
  417. <div class="col-sm-6">
  418. <select id="cityCode" name="cityCode" class="form-control" validate="{required:true}" validateMessage="{required:'请输入名称'}">
  419. <option value="" disabled selected hidden>市</option>
  420. </select>
  421. <input type="hidden" id="city" name="city"/>
  422. </div>
  423. </div>
  424. <div class="form-group">
  425. <label class="col-sm-3 control-label">区 / 县:</label>
  426. <div class="col-sm-6">
  427. <select id="countyCode" name="countyCode" class="form-control" validate="{required:true}" validateMessage="{required:'请输入名称'}">
  428. <option value="" disabled selected hidden>区 / 县</option>
  429. </select>
  430. <input type="hidden" id="county" name="county"/>
  431. </div>
  432. </div> -->
  433. <div class="form-group">
  434. <div class="col-sm-4 col-sm-offset-3 pull-left">
  435. <button class="btn btn-default btn-dlg-close">取消</button>
  436. <button class="btn btn-primary" type="button" onclick="initUe();">提交</button>
  437. </div>
  438. </div>
  439. </form>
  440. </div>
  441. </div>
  442. </div>
  443. <script type="text/javascript">
  444. <%-- $.get('<%=basePath%>area/getProvice.cs',function(data){
  445. for(var i in data){
  446. var _option = '';
  447. if(curProvinceCode ==data[i].code ){
  448. _option = '<option value="' + data[i].code + '" selected>' + data[i].name + '</option>';
  449. $('#province').val(data[i].name);
  450. }else{
  451. _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
  452. }
  453. $('#provinceCode').append(_option);
  454. }
  455. });
  456. if(curProvinceCode != ''){
  457. $.get('<%=basePath%>area/getByParentCode.cs',{'param': curProvinceCode}, function(data){
  458. for(var i in data){
  459. var _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
  460. $('#cityCode').append(_option);
  461. }
  462. });
  463. }
  464. ///省
  465. $("#provinceCode").change(function(){
  466. var self = $(this);
  467. $('#cityCode').empty();
  468. var _option = '<option>请选择</option>';
  469. $('#cityCode').append(_option);
  470. $('#city').val("");
  471. $('#countyCode').empty();
  472. var _option = '<option>请选择</option>';
  473. $('#countyCode').append(_option);
  474. $('#county').val("");
  475. $('#townshipCode').empty();
  476. var _option = '<option>请选择</option>';
  477. $('#townshipCode').append(_option);
  478. $('#township').val("");
  479. $.get('<%=basePath%>area/getByParentCode.cs',{'param': self.val()}, function(data){
  480. for(var i in data){
  481. var _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
  482. $('#cityCode').append(_option);
  483. }
  484. });
  485. $('#province').val(self.find("option:selected").text());
  486. });
  487. ///城市
  488. $("#cityCode").change(function(){
  489. var self = $(this);
  490. $('#countyCode').empty();
  491. var _option = '<option>请选择</option>';
  492. $('#countyCode').append(_option);
  493. $('#county').val("");
  494. $('#townshipCode').empty();
  495. var _option = '<option>请选择</option>';
  496. $('#townshipCode').append(_option);
  497. $('#township').val("");
  498. $.get('<%=basePath%>area/getByParentCode.cs',{'param': self.val()}, function(data){
  499. for(var i in data){
  500. var _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
  501. //if(num == 1){
  502. $('#countyCode').append(_option);
  503. // }
  504. }
  505. });
  506. $('#city').val(self.find("option:selected").text());
  507. });
  508. ///县、区
  509. $("#countyCode").change(function(){
  510. var self = $(this);
  511. $('#townshipCode').empty();
  512. var _option = '<option>请选择</option>';
  513. $('#townshipCode').append(_option);
  514. $('#township').val("");
  515. $.get('<%=basePath%>area/getByParentCode.cs',{'param': self.val()}, function(data){
  516. for(var i in data){
  517. var _option = '<option value="' + data[i].code + '" >' + data[i].name + '</option>';
  518. //if(num == 1){
  519. $('#townshipCode').append(_option);
  520. // }
  521. }
  522. });
  523. $('#county').val(self.find("option:selected").text());
  524. }); --%>
  525. </script>
  526. </body>
  527. </html>