SysHelpesList.cshtml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width" />
  9. <title>SysHelpesList</title>
  10. <link href="~/easyui/themes/default/easyui.css" rel="stylesheet" />
  11. <link rel="stylesheet" type="text/css" href="~/easyui/themes/icon.css" />
  12. <link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
  13. <link href="~/Content/js/plugins/layer/skin/layer.css" rel="stylesheet" />
  14. <script src="~/Content/js/jquery.min.js"></script>
  15. <script src="~/Content/js/bootstrap.min.js"></script>
  16. <script src="~/easyui/jquery.easyui.min.js"></script>
  17. <script src="~/easyui/jquery.easyui.mobile.js"></script>
  18. <script src="~/easyui/locale/easyui-lang-zh_CN.js"></script>
  19. <script src="~/Content/js/plugins/layer/laydate/laydate.js"></script>
  20. <script src="~/Content/js/plugins/layer/layer.min.js"></script>
  21. <script src="~/js/Utils.js"></script>
  22. <link href="~/Content/css/Style/Markets.css" rel="stylesheet" />
  23. <link href="~/Content/kindeditor-master/themes/default/default.css" rel="stylesheet" />
  24. <script src="~/Content/kindeditor-master/kindeditor-all.js"></script>
  25. <script src="~/Content/kindeditor-master/kindeditor-all-min.js"></script>
  26. <script src="~/Content/kindeditor-master/lang/zh-CN.js"></script>
  27. </head>
  28. <body>
  29. <section class="hidden">
  30. <input id="hid_Type" name="hid_Type" type="hidden" value="0" />
  31. </section>
  32. @*<section class="text-center title">
  33. <h2>市场信息</h2>
  34. </section>*@
  35. <section class="container-fluid" style="height: 100vh; padding-top: 5px;">
  36. <div class="row tbToolBar" id="tbToolBar">
  37. <div class="toolbar" id="CurdTool" style="float:left">
  38. <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="btn_Add()">添加</a>
  39. <span class="shuxian"></span>
  40. <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="btn_Edit()">修改</a>
  41. <span class="shuxian"></span>
  42. <a href="#" class="easyui-linkbutton" iconCls="icon-no" plain="true" onclick="btn_Del()">删除</a>
  43. </div>
  44. </div>
  45. <table id="dgTable" class="easyui-datagrid" style="height: 100%;"
  46. data-options="singleSelect: true,
  47. method: 'post',
  48. multiSort: false,
  49. toolbar: '#tbToolBar',
  50. fitColumns: true,
  51. @*rownumbers: true,*@
  52. remoteSort: false,
  53. loadFilter: pagerFilter,
  54. onDblClickRow: function () {
  55. btn_Edit();
  56. },
  57. pagination: true,
  58. pageSize: 100,
  59. pageList: [15, 25, 50, 100]
  60. ">
  61. <thead>
  62. <tr>
  63. <th data-options="field:'HelpId',width:100">编号</th>
  64. <th data-options="field:'FunctionId',width:150">菜单编号</th>
  65. <th data-options="field:'HelpTitle',width:150,">标题</th>
  66. </tr>
  67. </thead>
  68. </table>
  69. </section>
  70. <section>
  71. <div id="winSetSysHelpesInfo" class="easyui-window" title="功能菜单维护" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:700px;height:550px;padding:10px 10px;">
  72. <div class="easyui-layout" data-options="fit:true">
  73. <div data-options="region:'center'" style="padding:1px;height:650px">
  74. <form id="ff" method="post">
  75. <div style="padding-bottom:10px;margin-top:2px">
  76. <div style="float:left">
  77. <label for="txtFunctionId">功能编号:</label>
  78. <input class="easyui-combotree" id="txtFunctionId" name="txtFunctionId" data-options="url:'/SystemModule/GetFunctionForEasyUITree',method:'post',loadFilter: function (rows) {
  79. return convert(rows);
  80. },required:false,
  81. onClick: function (node) {
  82. }" style="width:450px;height:22px" />
  83. </div>
  84. </div>
  85. <div style="padding-bottom:10px;margin-top:10px">
  86. <div style="float:left;">
  87. <label for="txtHelpTitle">标题:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  88. <input class="easyui-textbox" type="text" id="txtHelpTitle" name="txtHelpTitle" data-options="required:true" style="width:450px;height:22px" />
  89. </div>
  90. </div>
  91. <div style="padding-bottom:10px;margin-top:10px">
  92. <div style="float:left;">
  93. <label for="txtHelpKeyWords">关键字:</label>&nbsp;&nbsp;&nbsp;
  94. <input class="easyui-textbox" type="text" id="txtHelpKeyWords" name="txtHelpKeyWords" style="width:450px;height:22px" />
  95. </div>
  96. </div>
  97. <div style="padding-bottom:10px;margin-top:10px">
  98. <div style="float:left">
  99. <label for="txtSequence">顺序:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  100. <input class="easyui-textbox" type="text" id="txtSequence" name="txtSequence" data-options="required:true" style="width:450px;height:22px"/>
  101. </div>
  102. </div>
  103. <div style="padding-bottom:10px;margin-top:10px">
  104. <div style="float:left">
  105. <textarea id="txtHelpContent" name="txtHelpContent" class="easyui-validatebox" data-options="required:true" style="width: 550px; height: 150px;" placeholder="请输入内容"></textarea>
  106. </div>
  107. </div>
  108. </form>
  109. </div>
  110. <div data-options="region:'south',border:false" style="text-align:right;height:50px;padding-top:5px">
  111. <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save();" style="width:80px">确认</a>
  112. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winSetSysHelpesInfo').window('close');" style="width:80px">取消</a>
  113. </div>
  114. </div>
  115. </div>
  116. </section>
  117. <script>
  118. //提交
  119. function Save(type) {
  120. type = type || $("#hid_Type").val();
  121. var HelpId = type === "Edit"? $('#dgTable').datagrid('getSelections')[0].HelpId:"";
  122. $.ajax({
  123. url: "@Url.Action("SysHelpsListOper", "SystemModule")",
  124. type: "post",
  125. data: {
  126. Type: type,
  127. HelpId: HelpId,
  128. FunctionId: $("#txtFunctionId").textbox("getValue"),
  129. HelpTitle: $("#txtHelpTitle").textbox("getValue"),
  130. HelpKeyWords: $("#txtHelpKeyWords").textbox("getValue"),
  131. Sequence: $("#txtSequence").textbox("getValue"),
  132. HelpContent: $("#txtHelpContent").val()
  133. },
  134. success: function (data) {
  135. if (CheckAajxData(data) == false) {
  136. return;
  137. }
  138. var msg = JSON.parse(data);
  139. if (msg != null && msg.Success == true) {
  140. LoadTable();
  141. $('#winSetSysHelpesInfo').window('close');
  142. layer.alert("操作成功!", { icon: 1, title: '提示信息' });
  143. } else {
  144. layer.alert(msg.ErrorInfo, { icon: 2, title: '提示信息' });
  145. }
  146. }
  147. });
  148. }
  149. function btn_Add() {
  150. $("#hid_Type").val("Add");
  151. $("#txtFunctionId").textbox("setValue", "");
  152. $("#txtHelpTitle").textbox("setValue", "");
  153. $("#txtHelpKeyWords").textbox("setValue", "");
  154. $("#txtSequence").textbox("setValue", "");
  155. KindEditor.html('#txtHelpContent', "");
  156. $('#winSetSysHelpesInfo').window('open');
  157. }
  158. function btn_Edit() {
  159. $("#hid_Type").val("Edit");
  160. var row = $('#dgTable').datagrid('getSelected');
  161. if (row) {
  162. $.ajax({
  163. url: "/SystemModule/GetSysHelpeByID?ran=" + Math.random(),
  164. type: "POST",
  165. dataType: "json",
  166. data: { ID: row.HelpId },
  167. success: function (data) {
  168. $("#txtFunctionId").combotree("setValue", data[0].FunctionId);
  169. $("#txtHelpTitle").textbox("setValue", data[0].HelpTitle);
  170. $("#txtHelpKeyWords").textbox("setValue", data[0].HelpKeyWords);
  171. $("#txtSequence").textbox("setValue", data[0].Sequence);
  172. //$("#txtHelpContent").val(data[0].HelpContent);
  173. KindEditor.html('#txtHelpContent', data[0].HelpContent);
  174. $('#winSetSysHelpesInfo').window('open');
  175. }
  176. })
  177. $('#winSetSysHelpesInfo').window('open');
  178. } else {
  179. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  180. }
  181. }
  182. function btn_Del() {
  183. $("#hid_Type").val("Del");
  184. var row = $('#dgTable').datagrid('getSelected');
  185. if (row) {
  186. layer.confirm('确认删除这条记录?', {
  187. btn: ['确认删除', '取消'] //按钮
  188. }, function () {
  189. if (row) {
  190. $.ajax({
  191. url: "/SystemModule/SysHelpsListOper?ran=" + Math.random(),
  192. type: "POST",
  193. dataType: "json",
  194. data: { HelpId: row.HelpId, Type: 'Del', },
  195. success: function (data) {
  196. if (CheckAajxData(data) == false) {
  197. return;
  198. }
  199. var msg = data.ErrorInfo;
  200. if (data != null && data.Success == true) {
  201. LoadTable();
  202. //$('#winSetSysStatusInfo').window('close');
  203. layer.alert("操作成功!", { icon: 1, title: '提示信息' });
  204. } else {
  205. layer.alert(msg, { icon: 2, title: '提示信息' });
  206. }
  207. }
  208. })
  209. }
  210. })
  211. }
  212. }
  213. //加载表格数据
  214. function LoadTable() {
  215. $('#dgTable').datagrid({
  216. url: '@Url.Action("GetSysHelpesList", "SystemModule")'
  217. });
  218. }
  219. var editor;
  220. $(function () {
  221. //加载表格数据
  222. window.LoadTable();
  223. editor = KindEditor.create('textarea[name="txtHelpContent"]', {
  224. resizeType: 1, width: "100%", height: "500px", afterChange: function () {
  225. this.sync();
  226. }, afterBlur: function () {
  227. this.sync();
  228. }, allowUpload: true, uploadJson: '/SystemModule/UploadImage'
  229. });
  230. ////加载日历控件
  231. //laydate({
  232. // elem: '#PractiseTime',
  233. // format: "YYYY-MM-DD",
  234. // min: "1980-01-01",
  235. // event: "focus"
  236. //});
  237. });
  238. function convert(rows) {
  239. function exists(rows, parentId) {
  240. for (var i = 0; i < rows.length; i++) {
  241. if (rows[i].id == parentId) return true;
  242. }
  243. return false;
  244. }
  245. var nodes = [];
  246. // get the top level nodes
  247. for (var i = 0; i < rows.length; i++) {
  248. var row = rows[i];
  249. if (!exists(rows, row.parentId)) {
  250. nodes.push({
  251. id: row.id,
  252. text: row.name
  253. });
  254. }
  255. }
  256. var toDo = [];
  257. for (var i = 0; i < nodes.length; i++) {
  258. toDo.push(nodes[i]);
  259. }
  260. while (toDo.length) {
  261. var node = toDo.shift(); // the parent node
  262. // get the children nodes
  263. for (var i = 0; i < rows.length; i++) {
  264. var row = rows[i];
  265. if (row.parentId == node.id) {
  266. var child = { id: row.id, text: row.name };
  267. if (node.children) {
  268. node.children.push(child);
  269. } else {
  270. node.children = [child];
  271. }
  272. toDo.push(child);
  273. }
  274. }
  275. }
  276. return nodes;
  277. }
  278. </script>
  279. </body>
  280. </html>