Detail.cshtml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. @using MES.Production.Service;
  2. @using Central.Control.Domain;
  3. @using Ant.Service.Common;
  4. @using CommonToolHelper;
  5. @{
  6. ViewBag.Title = "Detail";
  7. Layout = "~/Views/Shared/_Layout.cshtml";
  8. }
  9. @model MES.Production.Entity.DistributorUser
  10. <style>
  11. body {
  12. background-color: white;
  13. }
  14. .changeicon {
  15. float: right;
  16. margin-right: 22px;
  17. position: absolute;
  18. right: -7px;
  19. top: 0px;
  20. border: none;
  21. background-color: #18a689;
  22. color: #FFFFFF;
  23. line-height: 33px;
  24. height: 33px;
  25. }
  26. </style>
  27. <link href="~/Content/uploadone/CSS/webuploader.css" rel="stylesheet" />
  28. <link href="~/Content/uploadone/CSS/bootstrap.min.css" rel="stylesheet" />
  29. <link href="~/Content/uploadone/CSS/uploadstyle.css" rel="stylesheet" />
  30. <link href="~/Content/uploadone/CSS/font-awesome.css" rel="stylesheet" />
  31. @*<script src="~/Content/js/jquery/jquery-1.8.2.min.js"></script>*@
  32. <script src="~/Content/uploadone/Script/webuploader.js"></script>
  33. @using (Ajax.BeginForm("Save", null, new AjaxOptions()
  34. {
  35. HttpMethod = "Post",
  36. OnBegin = "SubAjax.Loading",
  37. OnComplete = "SubAjax.Complate",
  38. OnFailure = "SubAjax.Failure",
  39. OnSuccess = "SubAjax.Success"
  40. },
  41. new { @class = "form-horizontal dig-from", @role = "form" }))
  42. {
  43. <div class="wrapper-content">
  44. @Html.Hidden("hidfilename", Model.distributorInfo.LICENSEURL)
  45. @Html.Hidden("hidfileid", Model.distributorInfo.LICENSEVALUE)
  46. <div class="panel-body">
  47. <div class="tab-content">
  48. <div id="tab-1" class="tab-pane active">
  49. <div class="form-group">
  50. <label class="col-lg-3 control-label">所属经销商:</label>
  51. <div class="col-lg-8">
  52. <select id="PARENTID" name="PARENTID" onchange="" class="form-control select2" style="width: 100%;">
  53. @*<option value="" @(Model.distributorInfo.PARENTID == "" ? "selected" : "")>一级经销商</option>*@
  54. @{
  55. foreach (var item in ViewBag.moduleparent)
  56. {
  57. <option value="@item.ID" @(Model.distributorInfo.PARENTID == @item.ID ? "selected" : "")>@CommonHtmlHelper.RtfTextToHtml(item.NAME)</option>
  58. }
  59. }
  60. </select>
  61. </div>
  62. </div>
  63. <div class="form-group">
  64. <label class="col-lg-3 control-label">经销商编号:</label>
  65. <div class="col-lg-8">
  66. @Html.TextBoxFor(p => p.distributorInfo.DealerNumber, new { @class = "form-control", @id = "DealerNumber", @placeholder = "请输入经销商编号", @datatype = "*", @nullmsg = "请输入经销商编号!", @errormsg = "请输入经销商编号!" })
  67. </div>
  68. </div>
  69. <div class="form-group">
  70. <label class="col-lg-3 control-label">经销商名称:</label>
  71. <div class="col-lg-8">
  72. @Html.HiddenFor(p => p.distributorInfo.ID)
  73. @Html.TextBoxFor(p => p.distributorInfo.NAME, new { @class = "form-control", @id = "modulename", @placeholder = "请输入经销商名称", @datatype = "*", @nullmsg = "请输入经销商名称!", @errormsg = "请输入经销商名称!" })
  74. </div>
  75. </div>
  76. <div class="form-group">
  77. <label class="col-lg-3 control-label">所在省市区:</label>
  78. <div class="col-lg-8">
  79. @Html.Hidden("hjzd", Model.distributorInfo.ProvinceCity)
  80. <select name="hkprov" id="hkprov" onchange="SelectCity('hkprov', 'hkcity')" class="input-sm form-control input-s-sm inline" style="width:145px;">
  81. <option value="">--请选择--</option>
  82. </select>
  83. <select name="hkcity" id="hkcity" onchange="SelectCountry('hkcity', 'hkcountry')" class="input-sm form-control input-s-sm inline" style="width:146px;">
  84. <option value="">--请选择--</option>
  85. </select>
  86. <select name="hkcountry" id="hkcountry" class="input-sm form-control input-s-sm inline" style="width:146px;">
  87. <option value="">--请选择--</option>
  88. </select>
  89. </div>
  90. </div>
  91. @*<div class="form-group">
  92. <label class="col-lg-3 control-label">上传营业执照:</label>
  93. <div class="col-lg-8">
  94. <div id="fileNameList">
  95. </div>
  96. <div class="cp_img_jia" id="fileNamePicker"></div>
  97. @*<%--<input type="button" id="ctlUpBtn" class="btn btn-default" style="margin-top: 25px;" value="开始上传"> --%>
  98. <%-- <button id="ctlUpBtn" class="btn btn-default" style="margin-top: 25px;">开始上传</button>--%>
  99. </div>
  100. </div>*@
  101. <div class="form-group">
  102. <label class="col-lg-3 control-label">地址:</label>
  103. <div class="col-lg-8">
  104. @Html.TextBoxFor(p => p.distributorInfo.Address, new { @class = "form-control", @id = "moduleaddress", @placeholder = "请输入经销商地址,用于创建电子围栏" })
  105. </div>
  106. </div>
  107. <div class="form-group">
  108. <label class="col-lg-3 control-label">电子围栏范围:</label>
  109. <div class="col-lg-8">
  110. @Html.HiddenFor(p => p.distributorInfo.FenceID)
  111. <select name="example_length" aria-controls="example" class="form-control input-sm">
  112. <option value="100" @(Model.distributorInfo.FenceRadius == 100 ? "selected" : "")>100米</option>
  113. <option value="200" @(Model.distributorInfo.FenceRadius == 200 ? "selected" : "")>200米</option>
  114. <option value="500" @(Model.distributorInfo.FenceRadius == 500 ? "selected" : "")>500米</option>
  115. <option value="1000" @(Model.distributorInfo.FenceRadius == 1000 || Model.distributorInfo.FenceRadius.IsNull() ? "selected" : "")>1000米</option>
  116. <option value="2000" @(Model.distributorInfo.FenceRadius == 2000 ? "selected" : "")>2000米</option>
  117. <option value="3000" @(Model.distributorInfo.FenceRadius == 3000 ? "selected" : "")>3000米</option>
  118. </select>
  119. @*@Html.TextBoxFor(p => p.distributorInfo.FenceRadius, new { @class = "form-control", @id = "modulepath", @placeholder = "请输入电子围栏范围", @datatype = "n", @nullmsg = "请输入电子围栏范围", @errormsg = "只能输入数字" })*@
  120. </div>
  121. </div>
  122. <div class="form-group">
  123. <label class="col-lg-3 control-label">经纬度:</label>
  124. <div class="col-lg-8">
  125. @Html.TextBoxFor(p => p.distributorInfo.Theodolite, new { @class = "form-control", @id = "moduletheodolite", @placeholder = "请输入经销商经纬度,用于创建电子围栏", @datatype = "*", @nullmsg = "请输入经销商经纬度用逗号隔开", @errormsg = "请输入经销商经纬度!" })
  126. </div>
  127. </div>
  128. @*<div class="form-group">
  129. <label class="col-lg-3 control-label">所属人员:</label>
  130. <div class="col-lg-8">
  131. @{
  132. var fromuser = ViewData["userid"] as string;
  133. }
  134. <span id="readuser" class="form-control" style="padding:8px 5px; font-size:14px;overflow:hidden;">
  135. @if (!string.IsNullOrEmpty(fromuser))
  136. {
  137. @Html.Raw(fromuser.Split('|')[1]);
  138. }
  139. </span>
  140. @Html.Hidden("hidsendUserid", (!string.IsNullOrEmpty(fromuser) ? fromuser.Split('|')[0] : ""))
  141. <button class="changeicon" id="changesendUser" type="button">
  142. 选择
  143. </button>
  144. </div>
  145. </div>*@
  146. <div class="clearfix f-hafl">
  147. <div class="col-hafl">
  148. <div class="form-group">
  149. <label class="col-lg-3 control-label">手机号:</label>
  150. <div class="col-lg-8">
  151. @Html.HiddenFor(p => p.userInfo.ID)
  152. @Html.TextBoxFor(p => p.userInfo.PHONE, new
  153. {
  154. @class = "form-control"
  155. })
  156. </div>
  157. </div>
  158. </div>
  159. <div class="col-hafl">
  160. <div class="form-group">
  161. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">联系人:</label>
  162. <div class="col-lg-8">
  163. @Html.TextBoxFor(p => p.userInfo.NAME, new { @class = "form-control"
  164. })
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. @*<div class="form-group">
  170. <label class="col-lg-3 control-label">销售产品:</label>
  171. <div class="col-lg-8">
  172. @Html.TextBoxFor(p => p.distributorInfo.SaleCar, new { @class = "form-control", @id = "moduletheodolite", @placeholder = "请输入经销商销售产品", @datatype = "*", @nullmsg = "请输入经销商销售产品", @errormsg = "请输入经销商销售产品!" })
  173. </div>
  174. </div>*@
  175. @{
  176. var fromuser = ViewData["usertype"].ToString();
  177. if (fromuser == "2")
  178. {
  179. <div class="form-group">
  180. <label class="col-lg-3 control-label">轮拖轮式收条线</label>
  181. <div class="col-lg-8">
  182. <label class="radio-inline">
  183. @Html.CheckBox("ckb_per", ViewData["line1"].ToBool(), new { @value = "601" })
  184. 轮 拖
  185. </label>
  186. <label class="radio-inline">
  187. @Html.CheckBox("ckb_per", ViewData["line2"].ToBool(), new { @value = "615" })
  188. 轮式收
  189. @*<input type="radio" name="sexcode" value="2" @(Model.SEXCODE != null && Model.SEXCODE == 2 ? "checked" : "")>女*@
  190. </label>
  191. </div>
  192. </div>
  193. <div class="form-group">
  194. <label class="col-lg-3 control-label">履带插秧条线</label>
  195. <div class="col-lg-8">
  196. <label class="radio-inline">
  197. @Html.CheckBox("ckb_per", ViewData["line3"].ToBool(), new { @value = "612" })
  198. 履带收
  199. </label>
  200. <label class="radio-inline">
  201. @Html.CheckBox("ckb_per", ViewData["line4"].ToBool(), new { @value = "611" })
  202. 插秧机
  203. </label>
  204. </div>
  205. </div>
  206. <div class="form-group">
  207. <label class="col-lg-3 control-label">玉米收花生机线</label>
  208. <div class="col-lg-8">
  209. <label class="radio-inline">
  210. @Html.CheckBox("ckb_per", ViewData["line5"].ToBool(), new { @value = "622" })
  211. 玉米收
  212. </label>
  213. <label class="radio-inline">
  214. @Html.CheckBox("ckb_per", ViewData["line6"].ToBool(), new { @value = "628" })
  215. 花生机
  216. </label>
  217. </div>
  218. </div>
  219. }
  220. }
  221. <div class="hr-line-dashed">
  222. <div class="form-group m20">
  223. <div class="col-sm-2 col-sm-offset-2">
  224. <button class="btn btn-primary btn-save" type="submit"><i class="fa fa-check"></i> <span>确定保存</span></button>
  225. <button class="btn btn-warning" id="btn-dig-close" type="button"><i class="im-undo2"></i> 取消返回</button>
  226. </div>
  227. </div>
  228. </div>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. }
  234. @section scripts{
  235. <script type="text/javascript">
  236. var applicationPath = "http://" + window.location.host;
  237. $(function () {
  238. var filename = document.getElementById("hidfilename").value;
  239. if (filename != null && filename != "") {
  240. //alert(filename);
  241. var headstr = "<div id=\"WU_FILE_0\" class=\"cpup_img upload-state-done\"><img src=\"";
  242. var footstr = "\"><div class=\"upcp_img_jian\"></div><p class=\"progress hide\"><span style=\"width: 100%;\"></span></p></div>";
  243. document.getElementById("fileNameList").innerHTML = headstr + filename + footstr;
  244. }
  245. var $ = jQuery, fileId,
  246. $list = $('#fileNameList'),
  247. // 优化retina, 在retina下这个值是2
  248. ratio = window.devicePixelRatio || 1,
  249. // 缩略图大小
  250. thumbnailWidth = 90 * ratio,
  251. thumbnailHeight = 90 * ratio,
  252. // Web Uploader实例
  253. uploader;
  254. uploader = WebUploader.create({
  255. // 选完文件后,是否自动上传。
  256. auto: true,
  257. disableGlobalDnd: true,
  258. // swf文件路径
  259. swf: applicationPath + '/Script/Uploader.swf',
  260. // 文件接收服务端。
  261. //server: applicationPath + '/Home/UpLoadProcess',
  262. server: applicationPath + '/Sys/Home/UpLoadProcess',
  263. // 选择文件的按钮。可选。
  264. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  265. pick: '#fileNamePicker',
  266. //只允许选择图片
  267. accept: {
  268. title: 'Images',
  269. extensions: 'gif,jpg,jpeg,bmp,png',
  270. mimeTypes: 'image/*'
  271. }
  272. });
  273. // 当有文件添加进来的时候
  274. uploader.on('fileQueued', function (file) {
  275. var $li = $(
  276. '<div id="' + file.id + '" class="cpup_img">' +
  277. '<img id="jjgimg">' +
  278. '<div class="upcp_img_jian"></div></div>'
  279. ),
  280. $img = $li.find('img');
  281. $list.children().remove();//先清空元素内容
  282. if (fileId != file.id && fileId != null) {
  283. //alert(fileId);
  284. uploader.removeFile(uploader.getFile(fileId, true));
  285. }
  286. fileId = file.id;
  287. // $list为容器jQuery实例
  288. $list.append($li);
  289. // 创建缩略图
  290. // 如果为非图片文件,可以不用调用此方法。
  291. // thumbnailWidth x thumbnailHeight 为 100 x 100
  292. uploader.makeThumb(file, function (error, src) {
  293. if (error) {
  294. $img.replaceWith('<span>不能预览</span>');
  295. return;
  296. }
  297. //alert(src);
  298. //alert(file);
  299. $img.attr('src', src);
  300. }, thumbnailWidth, thumbnailHeight);
  301. });
  302. //上传压缩宽度
  303. uploader.option('compress', {
  304. width: 700
  305. });
  306. // 文件上传过程中创建进度条实时显示。
  307. uploader.on('uploadProgress', function (file, percentage) {
  308. var $li = $('#' + file.id),
  309. $percent = $li.find('.progress span');
  310. // 避免重复创建
  311. if (!$percent.length) {
  312. $percent = $('<p class="progress"><span></span></p>')
  313. .appendTo($li)
  314. .find('span');
  315. }
  316. $percent.css('width', percentage * 100 + '%');
  317. });
  318. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  319. uploader.on('uploadSuccess', function (file, response) {
  320. //alert(file.name);//原来文件名
  321. //alert(response.id);//文件路径
  322. var imgurl = response.filePath; //上传图片的路径
  323. var fileid = response.fileid; //上传图片的路径
  324. console.log(response.id);
  325. console.log(imgurl);
  326. $('#' + file.id).addClass('upload-state-done');
  327. //alert(document.getElementById("fileNameList").innerHTML.replace('class="progress"', 'class="progress hide"'));
  328. $("#hidfilename").val(imgurl);
  329. $("#jjgimg").attr('src', imgurl);//季健国加为了解决保存一串字符串
  330. $("#hidfileid").val(fileid);
  331. });
  332. // 文件上传失败,显示上传出错。
  333. uploader.on('uploadError', function (file) {
  334. var $li = $('#' + file.id),
  335. $error = $li.find('div.error');
  336. // 避免重复创建
  337. if (!$error.length) {
  338. $error = $('<div class="error"></div>').appendTo($li);
  339. }
  340. $error.text('上传失败');
  341. });
  342. // 完成上传完了,成功或者失败,先删除进度条。
  343. uploader.on('uploadComplete', function (file) {
  344. $('#' + file.id).find('.progress').remove();
  345. });
  346. //所有文件上传完毕
  347. uploader.on("uploadFinished", function () {
  348. //提交表单
  349. });
  350. //开始上传
  351. $("#ctlUpBtn").click(function () {
  352. uploader.upload();
  353. });
  354. //显示删除按钮
  355. $(".cpup_img").on("mouseover", function () {
  356. $(this).children(".upcp_img_jian").css('display', 'block');
  357. });
  358. //隐藏删除按钮
  359. $(".cpup_img").on("mouseout", function () {
  360. $(this).children(".upcp_img_jian").css('display', 'none');
  361. });
  362. //执行删除方法
  363. $list.on("click", ".upcp_img_jian", function () {
  364. var Id = $(this).parent().attr("id");
  365. try {
  366. uploader.removeFile(uploader.getFile(Id, true));
  367. }
  368. catch (ex) { }
  369. $(this).parent().remove();
  370. });
  371. $('.form-horizontal').initValidform();
  372. $('.select2').select2();
  373. //分配部门
  374. $('#changeDpt').click(function () {
  375. var vals = $('#hiddpt').val();
  376. top.dialog({
  377. url: '/Sys/Department/GetSelectDpt',
  378. title: '选择景点',
  379. width: 450,
  380. height: 500,
  381. data: vals, // 给 iframe 的数据
  382. onclose: function () {
  383. if (this.returnValue != 'no') {
  384. $('#hiddpt').val(this.returnValue.split('|')[0]);
  385. $('#dpt').html(this.returnValue.split('|')[1]);
  386. //清理岗位
  387. $('#hidpost').val('');
  388. $('#post').html('');
  389. }
  390. },
  391. oniframeload: function () {
  392. }
  393. }).showModal();
  394. return false;
  395. });
  396. $('#changesendUser').click(function () {
  397. var vals = $('#hidsendUserid').val();
  398. dig.addModel('选择用户', '/Sys/User/SelectUser?userid=' + vals, 800, 500, function () {
  399. if (this.returnValue != 'no' && this.returnValue != 'undefined' && this.returnValue != '') {
  400. var vl = "";
  401. if ($('#hidsendUserid').val() == "") {
  402. vl = this.returnValue.split('|')[0]
  403. }
  404. else {
  405. vl = $('#hidsendUserid').val() + "," + this.returnValue.split('|')[0]
  406. }
  407. //alert(vl);
  408. $('#hidsendUserid').val(vl);
  409. var vals = "";
  410. if ($('#readuser').html().replace(/^\s\s*/, '').replace(/\s\s*$/, '').length == 0) {
  411. vals = this.returnValue.split('|')[1];
  412. }
  413. else {
  414. vals = $('#readuser').html().replace(/^\s\s*/, '').replace(/\s\s*$/, '') + "," + this.returnValue.split('|')[1];
  415. }
  416. $('#readuser').html(vals);
  417. }
  418. });
  419. });
  420. $("#moduletheodolite").change(function () {
  421. var latlnt = $('#moduletheodolite').val();
  422. $.ajax({
  423. url: '/Sys/Distributors/getLatLntAdderss?latlntstr=' + latlnt,
  424. data: null,
  425. type: 'post',
  426. dataType: 'json',
  427. async: false,
  428. cache: false,
  429. success: function (res) {
  430. if (res.Status == 'y') {
  431. //alert(res.Data);
  432. $('#moduleaddress').val(res.Data);
  433. }
  434. else {
  435. dig.alertError('提示', res.Data);
  436. }
  437. }
  438. });
  439. });
  440. //分配岗位
  441. $('#changePost').click(function () {
  442. var dptid = $('#DPTID').val() + ',' + $('#hiddpt').val();
  443. if ($('#DPTID').val() == '' && $('#hiddpt').val() == '') {
  444. dig.alertError('提示', '请选择部门后再选择岗位');
  445. return;
  446. }
  447. var vals = $('#hidpost').val();
  448. top.dialog({
  449. url: '/Sys/Post/PostUser?dptid=' + dptid,
  450. title: '分配岗位',
  451. width: 500,
  452. height: 500,
  453. data: vals, // 给 iframe 的数据
  454. onclose: function () {
  455. if (this.returnValue != 'no') {
  456. var vl = this.returnValue.split('|')[0]
  457. $('#hidpost').val(vl);
  458. var vals = $('#readuser').val() + this.returnValue.split('|')[1]
  459. $('#post').html(vals);
  460. }
  461. },
  462. oniframeload: function () {
  463. }
  464. }).showModal();
  465. return false;
  466. });
  467. });
  468. $.ajax({
  469. url: '/Sys/CodeArea/prov',
  470. data: null,
  471. type: 'post',
  472. dataType: 'json',
  473. async: false,
  474. cache: false,
  475. success: function (res) {
  476. if (res.Status == 'y') {
  477. var option = '<option value="">--请选择--</option>';
  478. var data = eval(res.Data);
  479. for (var i = 0; i < data.length; i++) {
  480. var jsonH = data[i];
  481. option += '<option value="' + jsonH.Code + '">' + jsonH.Name + '</option>';
  482. }
  483. $('#hkprov').html(option);
  484. }
  485. }
  486. });
  487. //所在省市区
  488. var hjzd = $('#hjzd').val();
  489. if (hjzd != '') {
  490. var hkprov = hjzd.split(',')[0];
  491. var hkcity = hjzd.split(',')[1];
  492. var hkcountry = hjzd.split(',')[2];
  493. $('#hkprov').find('option[value="' + hkprov + '"]').attr('selected', 'selected');
  494. if (hkprov != '') {
  495. SelectCity('hkprov', 'hkcity');
  496. $('#hkcity').find('option[value="' + hkcity + '"]').attr('selected', 'selected');
  497. if (hkcity != '') {
  498. SelectCountry('hkcity', 'hkcountry');
  499. $('#hkcountry').find('option[value="' + hkcountry + '"]').attr('selected', 'selected');
  500. }
  501. }
  502. }
  503. //加载城市
  504. function SelectCity(t, n) {
  505. var prov = $('#' + t).val();
  506. var city = $('#' + n);
  507. var option = '<option value="">--请选择--</option>';
  508. if (prov == '') {
  509. city.html(option);
  510. } else {
  511. $.ajax({
  512. url: '/Sys/CodeArea/City/' + prov,
  513. data: null,
  514. type: 'post',
  515. dataType: 'json',
  516. async: false,
  517. cache: false,
  518. success: function (res) {
  519. if (res.Status == 'y') {
  520. var data = eval(res.Data);
  521. for (var i = 0; i < data.length; i++) {
  522. var jsonH = data[i];
  523. option += '<option value="' + jsonH.AreaCode + '">' + jsonH.AreaName + '</option>';
  524. }
  525. }
  526. city.html(option);
  527. }
  528. });
  529. }
  530. }
  531. //加载县级市
  532. function SelectCountry(t, n) {
  533. var city = $('#' + t).val();
  534. var country = $('#' + n);
  535. var option = '<option value="">--请选择--</option>';
  536. if (city == '') {
  537. country.html(option);
  538. } else {
  539. $.ajax({
  540. url: '/Sys/CodeArea/Country/' + city,
  541. data: null,
  542. type: 'post',
  543. dataType: 'json',
  544. async: false,
  545. cache: false,
  546. success: function (res) {
  547. if (res.Status == 'y') {
  548. var data = eval(res.Data);
  549. for (var i = 0; i < data.length; i++) {
  550. var jsonH = data[i];
  551. option += '<option value="' + jsonH.AreaCode + '">' + jsonH.AreaName + '</option>';
  552. }
  553. }
  554. country.html(option);
  555. }
  556. });
  557. }
  558. }
  559. </script>
  560. }