add.jsp 31 KB

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