Edit.cshtml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. @using MySystem.BsModels;
  2. @{RightDic editData = ViewBag.data as RightDic;}
  3. @{
  4. string RightInfo = ViewBag.RightInfo as string;
  5. string right = ViewBag.right as string;
  6. string PColId = ViewBag.PColId as string;
  7. }
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <meta charset="utf-8">
  12. <title>导航菜单(修改)</title>
  13. <meta name="renderer" content="webkit">
  14. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  15. <meta name="viewport"
  16. content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  17. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  18. <script src="/admin/js/jquery-1.10.1.min.js"></script>
  19. <script src="/admin/js/LAreaData2.js"></script>
  20. </head>
  21. <body>
  22. <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
  23. <input type="hidden" name="Id" value="@editData.Id" />
  24. <input type="hidden" name="OldPColId" value="@ViewBag.OldPColId" />
  25. <div class="layui-card">
  26. <div class="layui-card-body">
  27. <div class="layui-tab" lay-filter="mytabbar">
  28. <ul class="layui-tab-title">
  29. <li class="layui-this" lay-id="1">基本信息</li>
  30. <li lay-id="2">后台主界面</li>
  31. </ul>
  32. <div class="layui-tab-content mt20">
  33. <div class="layui-tab-item layui-show">
  34. <div class="layui-form-item">
  35. <label class="layui-form-label">上级栏目</label>
  36. <div class="layui-input-inline">
  37. <select id="PColId" name="PColId" lay-search="">
  38. <option value="">作为顶级导航</option>
  39. @{List<MySystem.BsModels.RightDic> ColIds = new MySystem.BsModels.WebCMSEntities().RightDic.OrderBy(m => m.Id).ToList();}
  40. @foreach (MySystem.BsModels.RightDic subColId in ColIds)
  41. {
  42. string checkCol = subColId.Id.Replace("_", "");
  43. string kg = "";
  44. for (int i = 1; i < checkCol.Length; i++)
  45. {
  46. kg += "  ";
  47. }
  48. <option value="@subColId.Id" @(subColId.Id == PColId ? "selected=selected" : "")>@(kg+subColId.Name)</option>
  49. }
  50. </select>
  51. </div>
  52. </div>
  53. <div class="layui-form-item">
  54. <label class="layui-form-label">标题</label>
  55. <div class="layui-input-block">
  56. <input class="layui-input" type="text" id="Name" name="Name" value="@editData.Name"
  57. maxlength="50" lay-verify="" autocomplete="off" placeholder="请输入标题">
  58. </div>
  59. </div>
  60. </div>
  61. <div class="layui-tab-item">
  62. <div class="layui-form-item">
  63. <label class="layui-form-label">快捷方式</label>
  64. <div class="layui-input-block">
  65. <input type="checkbox" id="MainMenu" name="MainMenu" value="1" @(editData.MainMenu == 1 ? "checked=checked" : "") lay-skin="switch" lay-filter="switchTest" title="开关">
  66. </div>
  67. </div>
  68. <div class="layui-form-item">
  69. <label class="layui-form-label">统计</label>
  70. <div class="layui-input-block">
  71. <input type="checkbox" id="MainStat" name="MainStat" value="1" @(editData.MainStat == 1 ? "checked=checked" : "") lay-skin="switch" lay-filter="switchTest" title="开关">
  72. </div>
  73. </div>
  74. <div class="layui-form-item">
  75. <label class="layui-form-label">主界面数据列表</label>
  76. <div class="layui-input-block">
  77. <input type="checkbox" id="MainDataList" name="MainDataList" value="1" @(editData.MainDataList == 1 ? "checked=checked" : "") lay-skin="switch" lay-filter="switchTest" title="开关">
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="layui-form-item layui-hide">
  84. <input type="button" lay-submit lay-filter="LAY-list-front-submit" id="LAY-list-front-submit"
  85. value="确认">
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. <script src="/layuiadmin/layui/layui.js"></script>
  91. <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
  92. <script src="/other/mybjq/kindeditor-min.js"></script>
  93. <script src="/other/mybjq/lang/zh_CN.js"></script>
  94. <script>
  95. //编辑器
  96. KindEditor.ready(function (K) {
  97. });
  98. var ids = "";
  99. function getChildren(obj) {
  100. $.each(obj, function (index, value) {
  101. var id = obj[index].id;
  102. ids += id + ",";
  103. var children = obj[index].children;
  104. if (children) {
  105. getChildren(children);
  106. }
  107. });
  108. }
  109. function AreasProvinceInit(tagId, areasVal, form) {
  110. for (var i = 0; i < provs_data.length; i++) {
  111. var sel = "";
  112. if (areasVal.indexOf(provs_data[i].text) > -1) {
  113. sel = " selected=selected";
  114. }
  115. $("#" + tagId + "Province").append('<option value="' + provs_data[i].value + '"' + sel + '>' +
  116. provs_data[i].text + '</option>');
  117. }
  118. form.render();
  119. }
  120. function AreasProvinceSelected(tagId, areasVal, form, value) {
  121. $("#" + tagId + "City").html('<option value="">市</option>');
  122. var list = citys_data[value];
  123. for (var i = 0; i < list.length; i++) {
  124. var sel = "";
  125. if (areasVal.indexOf(list[i].text) > -1) {
  126. sel = " selected=selected";
  127. }
  128. $("#" + tagId + "City").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text +
  129. '</option>');
  130. }
  131. $("#" + tagId + "Area").html('<option value="">县/区</option>');
  132. form.render();
  133. $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId +
  134. "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
  135. }
  136. function AreasCitySelected(tagId, areasVal, form, value) {
  137. $("#" + tagId + "Area").html('<option value="">县/区</option>');
  138. var list = dists_data[value];
  139. for (var i = 0; i < list.length; i++) {
  140. var sel = "";
  141. if (areasVal.indexOf(list[i].text) > -1) {
  142. sel = " selected=selected";
  143. }
  144. $("#" + tagId + "Area").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text +
  145. '</option>');
  146. }
  147. form.render();
  148. $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId +
  149. "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
  150. }
  151. function AreasAreaSelected(tagId, form) {
  152. form.render();
  153. $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId +
  154. "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
  155. }
  156. function movePrev(obj, tagId) {
  157. $(obj).parent().prev().insertAfter($(obj).parent());
  158. checkPics(tagId);
  159. }
  160. function moveNext(obj, tagId) {
  161. $(obj).parent().next().insertBefore($(obj).parent());
  162. checkPics(tagId);
  163. }
  164. function deletePic(obj, tagId) {
  165. $(obj).parent().remove();
  166. checkPics(tagId);
  167. }
  168. function checkPics(tagId) {
  169. var pics = "";
  170. var texts = "";
  171. $("#" + tagId + "Image div img").each(function (i) {
  172. pics += $(this).attr("src").replace(osshost, '') + "|";
  173. });
  174. $("#" + tagId + "Image div input").each(function (i) {
  175. texts += $(this).val() + "|";
  176. });
  177. if (pics == "") {
  178. $("#" + tagId).val("");
  179. } else {
  180. pics = pics.substring(0, pics.length - 1);
  181. texts = texts.substring(0, pics.length - 1);
  182. $("#" + tagId).val(pics + "#cut#" + texts);
  183. }
  184. }
  185. function checkBox(tagId) {
  186. var text = "";
  187. $("input[type=checkbox][name=" + tagId + "List]:checked").each(function (i) {
  188. text += $(this).val() + ",";
  189. });
  190. $("#" + tagId).val(text);
  191. }
  192. function showBigPic(picpath) {
  193. parent.layer.open({
  194. type: 1,
  195. title: false,
  196. closeBtn: 0,
  197. shadeClose: true,
  198. area: ['auto', 'auto'],
  199. content: '<img src="' + picpath + '" style="max-width:800px; max-height:800px;" />'
  200. });
  201. }
  202. var tree;
  203. var element;
  204. layui.config({
  205. base: '/layuiadmin/' //静态资源所在路径
  206. }).extend({
  207. index: 'lib/index' //主入口模块
  208. }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'],
  209. function () {
  210. var $ = layui.$,
  211. form = layui.form,
  212. layer = layui.layer,
  213. layedit = layui.layedit,
  214. laydate = layui.laydate,
  215. croppers = layui.croppers,
  216. upload = layui.upload,
  217. transfer = layui.transfer,
  218. util = layui.util;
  219. tree = layui.tree;
  220. element = layui.element;
  221. //Hash地址的定位
  222. var layid = location.hash.replace(/^#test=/, '');
  223. element.tabChange('test', layid);
  224. element.on('tab(test)', function (elem) {
  225. location.hash = 'test=' + $(this).attr('lay-id');
  226. });
  227. //日期
  228. //上传文件
  229. //穿梭框
  230. //TreeView,比如权限管理
  231. //省市区
  232. })
  233. </script>
  234. </body>
  235. </html>