widget.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" >
  21. <script type="text/ecmascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.js"></script>
  22. <script type="text/javascript" src="${ctx}/assets/static/h-ui/js/H-ui.js"></script>
  23. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqueryui/jquery-ui.css" />
  24. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqgrid/css/ui.jqgrid.css" />
  25. <script type="text/ecmascript" src="${ctx}/assets/lib/jqueryui/jquery-ui.js"></script>
  26. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/i18n/grid.locale-cn.js"></script>
  27. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/jquery.jqGrid.min.js"></script>
  28. <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
  29. <script type="text/javascript" src="${ctx}/assets/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
  30. <!--[if IE 6]>
  31. <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
  32. <script>DD_belatedPNG.fix('*');</script>
  33. <![endif]-->
  34. <script type="text/javascript">
  35. $(function() {
  36. $(window).resize(function(){
  37. $("#jqGrid").setGridWidth($(window).width()-40); 
  38. });
  39. $("#jqGrid").jqGrid({
  40. url : '${ctx}/myconsole/widget/getByPage',
  41. editurl:"${ctx}/myconsole/widget/saveOrUpdate",
  42. mtype : "POST",
  43. datatype : "json",
  44. caption:'控件管理',
  45. prmNames : {
  46. id: "keyid", 
  47. oper:"oper",    
  48. addoper:"add",
  49. editoper:"edit",
  50. deloper:"del" 
  51. },
  52. colModel : [ {
  53. label : '用户编号',
  54. name : 'keyid',
  55. hidden : true,
  56. key : true,
  57. width : 50,
  58. },{
  59. label : '控件名称',
  60. name : 'widgetname',
  61. editable: true,
  62. formoptions:{
  63. elmsuffix:'*'
  64. },
  65. editrules:{required:true},
  66. width : 80,
  67. }, {
  68. label : '控件分类',
  69. name : 'widgettype',
  70. editable: true,
  71. formatter:"select",
  72. edittype: "select",
  73. editoptions: {
  74. value: "${widgetType}"
  75. },
  76. stype:"select",
  77. searchoptions:{
  78. value: "${widgetType}"
  79. },
  80. width : 80,
  81. }, {
  82. label : '控件描述',
  83. name : 'widgetdesc',
  84. editable: true,
  85. edittype : "textarea",
  86. editoptions: {
  87. rows:"5",
  88. cols:"40"
  89. }
  90. }, {
  91. label : '控件代码',
  92. name : 'widgetcode',
  93. editable: true,
  94. hidden :true,
  95. editrules:{edithidden:true},
  96. edittype : "textarea",
  97. editoptions: {
  98. rows:"5",
  99. cols:"40"
  100. }
  101. }, {
  102. label : '控件属性',
  103. name : 'widgetconfig',
  104. editable: true,
  105. hidden :true,
  106. editrules:{edithidden:true},
  107. edittype : "textarea",
  108. editoptions: {
  109. rows:"5",
  110. cols:"40"
  111. }
  112. }],
  113. rownumbers : true,//添加左侧行号
  114. viewrecords : true,//是否在浏览导航栏显示记录总数
  115. rowNum : 10,//每页显示记录数
  116. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  117. autowidth : true,
  118. height : 'auto',
  119. pager : "#jqGridPager"
  120. });
  121. $('#jqGrid').navGrid('#jqGridPager',
  122. // the buttons to appear on the toolbar of the grid
  123. {
  124. edit : true,
  125. add : true,
  126. del : true,
  127. search : true,
  128. refresh : true,
  129. view : true,
  130. position : "left",
  131. cloneToTop : true
  132. },
  133. // options for the Edit Dialog
  134. {
  135. recreateForm : true,
  136. checkOnUpdate : true,
  137. checkOnSubmit : true,
  138. closeAfterEdit : true,
  139. onInitializeForm:function(formid) {
  140. },
  141. beforeShowForm:function(formid){
  142. },
  143. afterShowForm: function (formid){
  144. },
  145. serializeEditData: function(postdata) {
  146. //myconsole.log(postdata);
  147. $.each(postdata,function (index, value) {
  148. //myconsole.log(index);
  149. if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
  150. modifyJosnKey(postdata,index,"widget."+index);
  151. }
  152. if(index=="keyid"){
  153. postdata["widget."+index]=value
  154. }
  155. })
  156. //myconsole.log(postdata);
  157. return postdata;
  158. },
  159. errorTextFormat : function(data) {
  160. return 'Error: ' + data.responseText
  161. }
  162. },
  163. // options for the Add Dialog
  164. {
  165. closeAfterAdd : true,
  166. recreateForm : true,
  167. onInitializeForm:function(formid) {
  168. },
  169. beforeSubmit: function(postdata, formid){
  170. $.each(postdata,function (index, value) {
  171. if(index!="jqGrid_id" && index!="oper"){
  172. modifyJosnKey(postdata,index,"widget."+index);
  173. }
  174. })
  175. return[true,''];
  176. },
  177. errorTextFormat : function(data) {
  178. return 'Error: ' + data.responseText
  179. }
  180. },
  181. // options for the Delete Dailog
  182. {
  183. errorTextFormat : function(data) {
  184. return 'Error: ' + data.responseText
  185. }
  186. },{
  187. // search options 这里支持多条件查询
  188. multipleSearch: true,
  189. closeAfterSearch: true,
  190. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  191. afterSubmit: function(r, data) {
  192. var messageString = r.responseText;
  193. var mesObj = eval('(' + messageString + ')');
  194. return [mesObj.state, mesObj.message];
  195. }
  196. }
  197. );
  198. })
  199. </script>
  200. <title>我的桌面</title>
  201. <style type="text/css">
  202. ul.ztree {
  203. background: #f0f6e4 none repeat scroll 0 0;
  204. border: 1px solid #617775;
  205. height: 360px;
  206. margin-top: 10px;
  207. overflow-x: auto;
  208. overflow-y: scroll;
  209. width: 220px;
  210. }
  211. </style>
  212. </head>
  213. <body>
  214. <div class="page-container">
  215. <table id="jqGrid"></table>
  216. <div id="jqGridPager"></div>
  217. </div>
  218. <footer class="footer mt-20">
  219. <div class="container">
  220. <p></p>
  221. </div>
  222. </footer>
  223. </body>
  224. </html>