menu.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <!--[if lt IE 9]>
  10. <script type="text/javascript" src="${ctx}/assets/lib/html5.js"></script>
  11. <script type="text/javascript" src="${ctx}/assets/lib/respond.min.js"></script>
  12. <script type="text/javascript" src="${ctx}/assets/lib/PIE_IE678.js"></script>
  13. <![endif]-->
  14. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui/css/H-ui.min.css" />
  15. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/H-ui.admin.css" />
  16. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/Hui-iconfont/1.0.7/iconfont.css" />
  17. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/icheck/icheck.css" />
  18. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/skin/default/skin.css" id="skin" />
  19. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/style.css" />
  20. <script type="text/ecmascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.js"></script>
  21. <script type="text/javascript" src="${ctx}/assets/static/h-ui/js/H-ui.js"></script>
  22. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqueryui/jquery-ui.css" />
  23. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqgrid/css/ui.jqgrid.css" />
  24. <script type="text/ecmascript" src="${ctx}/assets/lib/jqueryui/jquery-ui.js"></script>
  25. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/i18n/grid.locale-cn.js"></script>
  26. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/jquery.jqGrid.min.js"></script>
  27. <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
  28. <!--[if IE 6]>
  29. <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
  30. <script>DD_belatedPNG.fix('*');</script>
  31. <![endif]-->
  32. <script type="text/javascript">
  33. $(function() {
  34. $(window).resize(function(){
  35. $("#tree").setGridWidth($(window).width()-40); 
  36. });
  37. $("#tree").jqGrid({
  38. caption:'资源管理',
  39. url : '${ctx}/myconsole/menu/getByTree',
  40. editurl:"${ctx}/myconsole/menu/saveOrUpdate",
  41. mtype : "POST",
  42. hoverrows:false,
  43. viewrecords:false,
  44. gridview:true,
  45. height:"auto",
  46. rowNum:100,
  47. scrollrows:true,
  48. treeGrid:true,
  49. ExpandColumn:"menuname",
  50. treedatatype:"json",
  51. treeGridModel:"adjacency",
  52. sortorder:"asc",
  53. autowidth : true,
  54. datatype:"json",
  55. pager:"#pager",
  56. prmNames : {
  57. id: "keyid", 
  58. oper:"oper",    
  59. addoper:"add",
  60. editoper:"edit",
  61. deloper:"del" 
  62. },
  63. colModel : [ {
  64. label : '编号',
  65. name : 'keyid',
  66. hidden : true,
  67. key : true,
  68. width : 75
  69. }, {
  70. label : '资源名称',
  71. name : 'menuname',
  72. edittype:"text",
  73. editable: true,
  74. width : 100,
  75. formoptions:{
  76. elmsuffix:" <span style='color:red'>*<span>"
  77. },
  78. editrules:{required:true},
  79. editoptions: {
  80. size:50,
  81. maxlength: 60
  82. }
  83. }, {
  84. label : '资源编号',
  85. name : 'menuid',
  86. edittype:"text",
  87. editable: true,
  88. width : 100,
  89. formoptions:{
  90. elmsuffix:" <span style='color:red'>*<span>"
  91. },
  92. editrules:{required:true},
  93. editoptions: {
  94. size:50,
  95. maxlength: 60
  96. }
  97. }, {
  98. label : '资源地址',
  99. name : 'menuurl',
  100. editable: true,
  101. width : 100,
  102. edittype : "text",
  103. editoptions: {
  104. size:50,
  105. maxlength: 255
  106. }
  107. },{
  108. label : '资源类型',
  109. name : 'stype',
  110. editable: true,
  111. edittype: "select",
  112. width : 50,
  113. editrules:{
  114. edithidden : true
  115. },
  116. editoptions:{
  117. dataInit: function(elem){
  118. $(elem).width(120);
  119. },
  120. maxlength: 40,
  121. value : "menu:菜单;function:功能"
  122. }
  123. },{
  124. label : '资源描述',
  125. name : 'menudesc',
  126. editable: true,
  127. hidden:true,
  128. width : 100,
  129. edittype : "textarea",
  130. editrules:{
  131. edithidden : true
  132. },
  133. editoptions: {
  134. size:50,
  135. maxlength: 200,
  136. rows:"5",
  137. cols:"53"
  138. }
  139. }, {
  140. label : '显示标志',
  141. name : 'isshow',
  142. editable: true,
  143. width : 100,
  144. align:'center',
  145. edittype: 'checkbox',
  146. editoptions: { value: "true:false" },
  147. formatter: "checkbox", formatoptions: { disabled: true}
  148. },{
  149. label : '更新时间',
  150. name : 'updatetime',
  151. width : 100,
  152. editable: false,
  153. edittype:"text"
  154. },{
  155. label : '排序值',
  156. name : 'sortid',
  157. edittype:"text",
  158. editable: true,
  159. width : 100,
  160. editoptions: {
  161. size:50,
  162. maxlength: 50
  163. },
  164. editrules:{required:true,integer:true},
  165. formoptions:{
  166. elmsuffix:'*'
  167. },
  168. },{
  169. name:"parentid",
  170. hidden:true
  171. },{
  172. name:"treelevel",
  173. hidden:true
  174. } ],
  175. "treeReader":{
  176. "level_field":"treelevel",
  177. "leaf_field":"isleaf",
  178. "expanded_field":"expanded",
  179. "loaded":"loaded",
  180. "parent_id_field":"parentid",
  181. "icon_field":"icon"
  182. }
  183. });
  184. jQuery('#tree').jqGrid('navGrid','#pager',
  185. // the buttons to appear on the toolbar of the grid
  186. {
  187. edit : true,
  188. add : true,
  189. del : true,
  190. search : false,
  191. refresh : true,
  192. view : false,
  193. position : "left",
  194. cloneToTop : true
  195. },
  196. // options for the Edit Dialog
  197. {
  198. recreateForm : true,
  199. checkOnUpdate : true,
  200. checkOnSubmit : true,
  201. closeAfterEdit : true,
  202. serializeEditData: function(postdata) {
  203. //myconsole.log(postdata);
  204. $.each(postdata,function (index, value) {
  205. if(index!="jqGrid_id" && index!="oper" && index!="id"){
  206. modifyJosnKey(postdata,index,"menu."+index);
  207. }
  208. if(index=="id"){
  209. postdata["menu."+index]=value
  210. }
  211. })
  212. //myconsole.log(postdata);
  213. return postdata;
  214. },
  215. errorTextFormat : function(data) {
  216. return 'Error: ' + data.responseText
  217. }
  218. },
  219. // options for the Add Dialog
  220. {
  221. closeAfterAdd : true,
  222. recreateForm : true,
  223. beforeSubmit: function(postdata, formid){
  224. var selRowId = $("#tree").jqGrid ('getGridParam', 'selrow');
  225. //myconsole.log(selRowId);
  226. postdata.parentid=selRowId;
  227. $.each(postdata,function (index, value) {
  228. if(index!="jqGrid_id" && index!="oper"){
  229. modifyJosnKey(postdata,index,"menu."+index);
  230. }
  231. })
  232. return[true,''];
  233. },
  234. afterComplete : function (response, postdata, formid) {
  235. //取消选择
  236. $("#tree").jqGrid("resetSelection");
  237. //关闭对话框
  238. $(".ui-icon-closethick").trigger('click');
  239. },
  240. errorTextFormat : function(data) {
  241. return 'Error: ' + data.responseText
  242. }
  243. },
  244. // options for the Delete Dailog
  245. {
  246. errorTextFormat : function(data) {
  247. return 'Error: ' + data.responseText
  248. }
  249. });
  250. jQuery('#tree').jqGrid('bindKeys');
  251. })
  252. </script>
  253. <title>我的桌面</title>
  254. </head>
  255. <body>
  256. <div class="page-container">
  257. <table id="tree"></table>
  258. <div id="pager"></div>
  259. </div>
  260. <footer class="footer mt-20">
  261. <div class="container">
  262. <p></p>
  263. </div>
  264. </footer>
  265. </body>
  266. </html>