Detail.cshtml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  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" 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.HiddenFor(p => p.distributorInfo.ID)
  67. @Html.TextBoxFor(p => p.distributorInfo.NAME, new { @class = "form-control", @id = "modulename", @placeholder = "请输入经销商名称", @datatype = "*", @nullmsg = "请输入经销商名称!", @errormsg = "请输入经销商名称!" })
  68. </div>
  69. </div>
  70. <div class="form-group">
  71. <label class="col-lg-3 control-label">所在省市区:</label>
  72. <div class="col-lg-8">
  73. @Html.Hidden("hjzd", Model.distributorInfo.ProvinceCity)
  74. <select name="hkprov" id="hkprov" onchange="SelectCity('hkprov', 'hkcity')" class="input-sm form-control input-s-sm inline" style="width:145px;">
  75. <option value="">--请选择--</option>
  76. </select>
  77. <select name="hkcity" id="hkcity" onchange="SelectCountry('hkcity', 'hkcountry')" class="input-sm form-control input-s-sm inline" style="width:146px;">
  78. <option value="">--请选择--</option>
  79. </select>
  80. <select name="hkcountry" id="hkcountry" class="input-sm form-control input-s-sm inline" style="width:146px;">
  81. <option value="">--请选择--</option>
  82. </select>
  83. </div>
  84. </div>
  85. <div class="form-group">
  86. <label class="col-lg-3 control-label">上传营业执照:</label>
  87. <div class="col-lg-8">
  88. <div id="fileNameList">
  89. </div>
  90. <div class="cp_img_jia" id="fileNamePicker"></div>
  91. @*<%--<input type="button" id="ctlUpBtn" class="btn btn-default" style="margin-top: 25px;" value="开始上传"> --%>
  92. <%-- <button id="ctlUpBtn" class="btn btn-default" style="margin-top: 25px;">开始上传</button>--%>*@
  93. </div>
  94. </div>
  95. <div class="form-group">
  96. <label class="col-lg-3 control-label">地址:</label>
  97. <div class="col-lg-8">
  98. @Html.TextBoxFor(p => p.distributorInfo.Address, new { @class = "form-control", @id = "moduleaddress", @placeholder = "请输入经销商地址,用于创建电子围栏", @datatype = "*", @nullmsg = "请输入经销商排序值,正序排列", @errormsg = "请输入经销商地址!" })
  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.HiddenFor(p => p.distributorInfo.FenceID)
  105. <select name="example_length" aria-controls="example" class="form-control input-sm">
  106. <option value="50" @(Model.distributorInfo.FenceRadius == 50 ? "selected" : "")>50米</option>
  107. <option value="1000" @(Model.distributorInfo.FenceRadius == 1000 ? "selected" : "")>1000米</option>
  108. <option value="2000" @(Model.distributorInfo.FenceRadius == 2000 ? "selected" : "")>2000米</option>
  109. <option value="3000" @(Model.distributorInfo.FenceRadius == 3000 ? "selected" : "")>3000米</option>
  110. </select>
  111. @*@Html.TextBoxFor(p => p.distributorInfo.FenceRadius, new { @class = "form-control", @id = "modulepath", @placeholder = "请输入电子围栏范围", @datatype = "n", @nullmsg = "请输入电子围栏范围", @errormsg = "只能输入数字" })*@
  112. </div>
  113. </div>
  114. <div class="form-group">
  115. <label class="col-lg-3 control-label">所属销售员:</label>
  116. <div class="col-lg-8">
  117. @{
  118. var fromuser = ViewData["userid"] as string;
  119. }
  120. <span id="readuser" class="form-control" style="padding:8px 5px; font-size:14px;overflow:hidden;">
  121. @if (!string.IsNullOrEmpty(fromuser))
  122. {
  123. @Html.Raw(fromuser.Split('|')[1]);
  124. }
  125. </span>
  126. @Html.Hidden("hidsendUserid", (!string.IsNullOrEmpty(fromuser) ? fromuser.Split('|')[0] : ""))
  127. <button class="changeicon" id="changesendUser" type="button">
  128. 选择
  129. </button>
  130. </div>
  131. </div>
  132. <div class="clearfix f-hafl">
  133. <div class="col-hafl">
  134. @*<div class="form-group">
  135. <label class="col-lg-3 control-label">登录账号:</label>
  136. <div class="col-lg-8">
  137. @Html.HiddenFor(p => p.userInfo.ID)
  138. @Html.TextBoxFor(p => p.userInfo.ACCOUNT, new { @class = "form-control", @id = "account", @placeholder = "请输入登录账号", @datatype = "*", @nullmsg = "请输入登录账号!", @errormsg = "请输入登录账号!" })
  139. </div>
  140. </div>*@
  141. <div class="form-group">
  142. <label class="col-lg-3 control-label">手机号:</label>
  143. <div class="col-lg-8">
  144. @Html.TextBoxFor(p => p.userInfo.PHONE, new
  145. {
  146. @class = "form-control",
  147. @datatype = "n",
  148. @nullmsg = "请输入手机号",
  149. @placeholder = "请输入手机号",
  150. @errormsg = "手机号只能输入数字"
  151. })
  152. </div>
  153. </div>
  154. </div>
  155. <div class="col-hafl">
  156. <div class="form-group">
  157. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">联系人:</label>
  158. <div class="col-lg-8">
  159. @Html.TextBoxFor(p => p.userInfo.NAME, new { @class = "form-control", @placeholder = "请输入用户姓名", @datatype = "*1-10", @nullmsg = "请输入用户姓名" })
  160. </div>
  161. </div>
  162. @*<div class="form-group">
  163. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">属性:</label>
  164. <div class="col-lg-8" style="text-align:left;">
  165. <label class="checkbox-inline">
  166. <input type="checkbox" class="i-check" id="iscanlogin" name="iscanlogin" @(Model.userInfo.ISCANLOGIN != false ? "checked" : "") />是否锁定
  167. </label>
  168. </div>
  169. </div>*@
  170. </div>
  171. </div>
  172. <div class="hr-line-dashed">
  173. <div class="form-group m20">
  174. <div class="col-sm-2 col-sm-offset-2">
  175. <button class="btn btn-primary btn-save" type="submit"><i class="fa fa-check"></i> <span>确定保存</span></button>
  176. <button class="btn btn-warning" id="btn-dig-close" type="button"><i class="im-undo2"></i> 取消返回</button>
  177. </div>
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. }
  185. @section scripts{
  186. <script type="text/javascript">
  187. var applicationPath = "http://" + window.location.host;
  188. $(function () {
  189. var filename = document.getElementById("hidfilename").value;
  190. if (filename != null && filename != "") {
  191. //alert(filename);
  192. var headstr = "<div id=\"WU_FILE_0\" class=\"cpup_img upload-state-done\"><img src=\"";
  193. var footstr = "\"><div class=\"upcp_img_jian\"></div><p class=\"progress hide\"><span style=\"width: 100%;\"></span></p></div>";
  194. document.getElementById("fileNameList").innerHTML = headstr + filename + footstr;
  195. }
  196. var $ = jQuery, fileId,
  197. $list = $('#fileNameList'),
  198. // 优化retina, 在retina下这个值是2
  199. ratio = window.devicePixelRatio || 1,
  200. // 缩略图大小
  201. thumbnailWidth = 90 * ratio,
  202. thumbnailHeight = 90 * ratio,
  203. // Web Uploader实例
  204. uploader;
  205. uploader = WebUploader.create({
  206. // 选完文件后,是否自动上传。
  207. auto: true,
  208. disableGlobalDnd: true,
  209. // swf文件路径
  210. swf: applicationPath + '/Script/Uploader.swf',
  211. // 文件接收服务端。
  212. //server: applicationPath + '/Home/UpLoadProcess',
  213. server: applicationPath + '/Sys/Home/UpLoadProcess',
  214. // 选择文件的按钮。可选。
  215. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  216. pick: '#fileNamePicker',
  217. //只允许选择图片
  218. accept: {
  219. title: 'Images',
  220. extensions: 'gif,jpg,jpeg,bmp,png',
  221. mimeTypes: 'image/*'
  222. }
  223. });
  224. // 当有文件添加进来的时候
  225. uploader.on('fileQueued', function (file) {
  226. var $li = $(
  227. '<div id="' + file.id + '" class="cpup_img">' +
  228. '<img id="jjgimg">' +
  229. '<div class="upcp_img_jian"></div></div>'
  230. ),
  231. $img = $li.find('img');
  232. $list.children().remove();//先清空元素内容
  233. if (fileId != file.id && fileId != null) {
  234. //alert(fileId);
  235. uploader.removeFile(uploader.getFile(fileId, true));
  236. }
  237. fileId = file.id;
  238. // $list为容器jQuery实例
  239. $list.append($li);
  240. // 创建缩略图
  241. // 如果为非图片文件,可以不用调用此方法。
  242. // thumbnailWidth x thumbnailHeight 为 100 x 100
  243. uploader.makeThumb(file, function (error, src) {
  244. if (error) {
  245. $img.replaceWith('<span>不能预览</span>');
  246. return;
  247. }
  248. //alert(src);
  249. //alert(file);
  250. $img.attr('src', src);
  251. }, thumbnailWidth, thumbnailHeight);
  252. });
  253. //上传压缩宽度
  254. uploader.option('compress', {
  255. width: 700
  256. });
  257. // 文件上传过程中创建进度条实时显示。
  258. uploader.on('uploadProgress', function (file, percentage) {
  259. var $li = $('#' + file.id),
  260. $percent = $li.find('.progress span');
  261. // 避免重复创建
  262. if (!$percent.length) {
  263. $percent = $('<p class="progress"><span></span></p>')
  264. .appendTo($li)
  265. .find('span');
  266. }
  267. $percent.css('width', percentage * 100 + '%');
  268. });
  269. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  270. uploader.on('uploadSuccess', function (file, response) {
  271. //alert(file.name);//原来文件名
  272. //alert(response.id);//文件路径
  273. var imgurl = response.filePath; //上传图片的路径
  274. var fileid = response.fileid; //上传图片的路径
  275. console.log(response.id);
  276. console.log(imgurl);
  277. $('#' + file.id).addClass('upload-state-done');
  278. //alert(document.getElementById("fileNameList").innerHTML.replace('class="progress"', 'class="progress hide"'));
  279. $("#hidfilename").val(imgurl);
  280. $("#jjgimg").attr('src', imgurl);//季健国加为了解决保存一串字符串
  281. $("#hidfileid").val(fileid);
  282. });
  283. // 文件上传失败,显示上传出错。
  284. uploader.on('uploadError', function (file) {
  285. var $li = $('#' + file.id),
  286. $error = $li.find('div.error');
  287. // 避免重复创建
  288. if (!$error.length) {
  289. $error = $('<div class="error"></div>').appendTo($li);
  290. }
  291. $error.text('上传失败');
  292. });
  293. // 完成上传完了,成功或者失败,先删除进度条。
  294. uploader.on('uploadComplete', function (file) {
  295. $('#' + file.id).find('.progress').remove();
  296. });
  297. //所有文件上传完毕
  298. uploader.on("uploadFinished", function () {
  299. //提交表单
  300. });
  301. //开始上传
  302. $("#ctlUpBtn").click(function () {
  303. uploader.upload();
  304. });
  305. //显示删除按钮
  306. $(".cpup_img").on("mouseover", function () {
  307. $(this).children(".upcp_img_jian").css('display', 'block');
  308. });
  309. //隐藏删除按钮
  310. $(".cpup_img").on("mouseout", function () {
  311. $(this).children(".upcp_img_jian").css('display', 'none');
  312. });
  313. //执行删除方法
  314. $list.on("click", ".upcp_img_jian", function () {
  315. var Id = $(this).parent().attr("id");
  316. try {
  317. uploader.removeFile(uploader.getFile(Id, true));
  318. }
  319. catch (ex) { }
  320. $(this).parent().remove();
  321. });
  322. $('.form-horizontal').initValidform();
  323. $('.select2').select2();
  324. //分配部门
  325. $('#changeDpt').click(function () {
  326. var vals = $('#hiddpt').val();
  327. top.dialog({
  328. url: '/Sys/Department/GetSelectDpt',
  329. title: '选择景点',
  330. width: 450,
  331. height: 500,
  332. data: vals, // 给 iframe 的数据
  333. onclose: function () {
  334. if (this.returnValue != 'no') {
  335. $('#hiddpt').val(this.returnValue.split('|')[0]);
  336. $('#dpt').html(this.returnValue.split('|')[1]);
  337. //清理岗位
  338. $('#hidpost').val('');
  339. $('#post').html('');
  340. }
  341. },
  342. oniframeload: function () {
  343. }
  344. }).showModal();
  345. return false;
  346. });
  347. $('#changesendUser').click(function () {
  348. var vals = $('#hidsendUserid').val();
  349. dig.addModel('选择用户', '/Sys/User/SelectUser?userid=' + vals, 900, 500, function () {
  350. if (this.returnValue != 'no') {
  351. $('#hidsendUserid').val(this.returnValue.split('|')[0]);
  352. $('#readuser').html(this.returnValue.split('|')[1]);
  353. }
  354. });
  355. });
  356. //分配岗位
  357. $('#changePost').click(function () {
  358. var dptid = $('#DPTID').val() + ',' + $('#hiddpt').val();
  359. if ($('#DPTID').val() == '' && $('#hiddpt').val() == '') {
  360. dig.alertError('提示', '请选择部门后再选择岗位');
  361. return;
  362. }
  363. var vals = $('#hidpost').val();
  364. top.dialog({
  365. url: '/Sys/Post/PostUser?dptid=' + dptid,
  366. title: '分配岗位',
  367. width: 500,
  368. height: 500,
  369. data: vals, // 给 iframe 的数据
  370. onclose: function () {
  371. if (this.returnValue != 'no') {
  372. $('#hidpost').val(this.returnValue.split('|')[0]);
  373. $('#post').html(this.returnValue.split('|')[1]);
  374. }
  375. },
  376. oniframeload: function () {
  377. }
  378. }).showModal();
  379. return false;
  380. });
  381. });
  382. $.ajax({
  383. url: '/Sys/CodeArea/prov',
  384. data: null,
  385. type: 'post',
  386. dataType: 'json',
  387. async: false,
  388. cache: false,
  389. success: function (res) {
  390. if (res.Status == 'y') {
  391. var option = '<option value="">--请选择--</option>';
  392. var data = eval(res.Data);
  393. for (var i = 0; i < data.length; i++) {
  394. var jsonH = data[i];
  395. option += '<option value="' + jsonH.Code + '">' + jsonH.Name + '</option>';
  396. }
  397. $('#hkprov').html(option);
  398. }
  399. }
  400. });
  401. //所在省市区
  402. var hjzd = $('#hjzd').val();
  403. if (hjzd != '') {
  404. var hkprov = hjzd.split(',')[0];
  405. var hkcity = hjzd.split(',')[1];
  406. var hkcountry = hjzd.split(',')[2];
  407. $('#hkprov').find('option[value="' + hkprov + '"]').attr('selected', 'selected');
  408. if (hkprov != '') {
  409. SelectCity('hkprov', 'hkcity');
  410. $('#hkcity').find('option[value="' + hkcity + '"]').attr('selected', 'selected');
  411. if (hkcity != '') {
  412. SelectCountry('hkcity', 'hkcountry');
  413. $('#hkcountry').find('option[value="' + hkcountry + '"]').attr('selected', 'selected');
  414. }
  415. }
  416. }
  417. //加载城市
  418. function SelectCity(t, n) {
  419. var prov = $('#' + t).val();
  420. var city = $('#' + n);
  421. var option = '<option value="">--请选择--</option>';
  422. if (prov == '') {
  423. city.html(option);
  424. } else {
  425. $.ajax({
  426. url: '/Sys/CodeArea/City/' + prov,
  427. data: null,
  428. type: 'post',
  429. dataType: 'json',
  430. async: false,
  431. cache: false,
  432. success: function (res) {
  433. if (res.Status == 'y') {
  434. var data = eval(res.Data);
  435. for (var i = 0; i < data.length; i++) {
  436. var jsonH = data[i];
  437. option += '<option value="' + jsonH.AreaCode + '">' + jsonH.AreaName + '</option>';
  438. }
  439. }
  440. city.html(option);
  441. }
  442. });
  443. }
  444. }
  445. //加载县级市
  446. function SelectCountry(t, n) {
  447. var city = $('#' + t).val();
  448. var country = $('#' + n);
  449. var option = '<option value="">--请选择--</option>';
  450. if (city == '') {
  451. country.html(option);
  452. } else {
  453. $.ajax({
  454. url: '/Sys/CodeArea/Country/' + city,
  455. data: null,
  456. type: 'post',
  457. dataType: 'json',
  458. async: false,
  459. cache: false,
  460. success: function (res) {
  461. if (res.Status == 'y') {
  462. var data = eval(res.Data);
  463. for (var i = 0; i < data.length; i++) {
  464. var jsonH = data[i];
  465. option += '<option value="' + jsonH.AreaCode + '">' + jsonH.AreaName + '</option>';
  466. }
  467. }
  468. country.html(option);
  469. }
  470. });
  471. }
  472. }
  473. </script>
  474. }