link.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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. <script type="text/javascript" src="${ctx}/assets/lib/layer/3.0.3/layer.js"></script>
  23. <link type="text/css" href="${ctx}/assets/lib/codemirror/lib/codemirror.css" rel="stylesheet" />
  24. <script type="text/javascript" src="${ctx}/assets/lib/codemirror/lib/codemirror.js"></script>
  25. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqueryui/jquery-ui.css" />
  26. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqgrid/css/ui.jqgrid.css" />
  27. <script type="text/ecmascript" src="${ctx}/assets/lib/jqueryui/jquery-ui.js"></script>
  28. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/i18n/grid.locale-cn.js"></script>
  29. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/jquery.jqGrid.min.js"></script>
  30. <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
  31. <!--[if IE 6]>
  32. <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
  33. <script>DD_belatedPNG.fix('*');</script>
  34. <![endif]-->
  35. <script type="text/javascript">
  36. $(function() {
  37. $(window).resize(function(){
  38. $("#jqGrid").setGridWidth($(window).width()-40); 
  39. });
  40. $("#jqGrid").jqGrid({
  41. url : '${ctx}/myconsole/link/getByPage',
  42. editurl:"${ctx}/myconsole/link/saveOrUpdate",
  43. mtype : "POST",
  44. postData : {'columnid':'${column.columnid!}'},
  45. datatype : "json",
  46. caption:'链接管理',
  47. prmNames : {
  48. id: "keyid", 
  49. oper:"oper",    
  50. addoper:"add",
  51. editoper:"edit",
  52. deloper:"del" 
  53. },
  54. colModel : [ {
  55. label : '数据编号',
  56. name : 'keyid',
  57. hidden : true,
  58. key : true,
  59. width : 50,
  60. }, {
  61. label : '链接名称',
  62. name : 'linkname',
  63. editable: true,
  64. edittype:"text",
  65. width : 100,
  66. editoptions: {
  67. dataInit: function(elem){
  68. $(elem).width(613);
  69. },
  70. maxlength: 125
  71. },
  72. formoptions:{
  73. elmsuffix:" <span style='color:red'>*<span>",
  74. rowpos:1,
  75. colpos:1
  76. },
  77. editrules:{
  78. required: true
  79. }
  80. }, {
  81. label : '链接地址',
  82. name : 'linkurl',
  83. editable: true,
  84. edittype: "text",
  85. width : 200,
  86. editoptions: {
  87. dataInit: function(elem){
  88. $(elem).width(613);
  89. },
  90. maxlength: 125,
  91. },
  92. formoptions:{
  93. elmsuffix:" <span style='color:red'>*<span>",
  94. rowpos:2,
  95. colpos:1
  96. },
  97. editrules:{
  98. required: true
  99. }
  100. }, {
  101. label : '排序编号',
  102. name : 'sortid',
  103. editable: true,
  104. edittype: "text",
  105. width : 100,
  106. editoptions: {
  107. dataInit: function(elem){
  108. $(elem).width(225);
  109. },
  110. maxlength: 6,
  111. },
  112. editrules:{
  113. edithidden:true,
  114. required: true,
  115. custom:true, 
  116. custom_func: function(strFieldValue, strFieldName){
  117. var strFloat = /^([-\+]?(((\d+)(\.\d+))|(\.\d+)|(\d*)))?$/;
  118.  if(!strFloat.test(strFieldValue)){
  119.    return [false, strFieldName+"应该为实数"];
  120.   }
  121. else
  122. {
  123.   return [true,""];
  124. }
  125. }
  126. },
  127. formoptions:{
  128. elmsuffix:" <span style='color:red'>*<span>",
  129. rowpos:3,
  130. colpos:1
  131. }
  132. }, {
  133. label : '链接描述',
  134. name : 'linkdesc',
  135. editable: true,
  136. width : 100,
  137. edittype : "textarea",
  138. hidden : true,
  139. editrules:{
  140. edithidden : true
  141. },
  142. editoptions: {
  143. dataInit: function(elem){
  144. $(elem).width(620);
  145. },
  146. maxlength: 1000,
  147. rows:"6",
  148. cols:"80"
  149. },
  150. formoptions:{
  151. rowpos:4,
  152. colpos:1
  153. }
  154. }
  155. ],
  156. rownumbers : true,//添加左侧行号
  157. viewrecords : true,//是否在浏览导航栏显示记录总数
  158. rowNum : 10,//每页显示记录数
  159. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  160. autowidth : true,
  161. height : 'auto',
  162. pager : "#jqGridPager"
  163. });
  164. $('#jqGrid').navGrid('#jqGridPager',
  165. // the buttons to appear on the toolbar of the grid
  166. {
  167. edit : true,
  168. add : true,
  169. del : true,
  170. search : true,
  171. refresh : true,
  172. view : true,
  173. position : "left",
  174. cloneToTop : true
  175. },
  176. // options for the Edit Dialog
  177. {
  178. recreateForm : true,
  179. checkOnUpdate : true,
  180. checkOnSubmit : true,
  181. closeAfterEdit : true,
  182. width:800,
  183. onInitializeForm:function(formid) {
  184. },
  185. afterShowForm : function(formid) {
  186. },
  187. serializeEditData: function(postdata) {
  188. //myconsole.log(postdata);
  189. $.each(postdata,function (index, value) {
  190. //myconsole.log(index);
  191. if(index!="jqGrid_id" && index!="oper" && index!="id"){
  192. modifyJosnKey(postdata,index,"link."+index);
  193. }
  194. if(index=="id"){
  195. postdata["link."+index]=value
  196. }
  197. })
  198. //myconsole.log(postdata);
  199. return postdata;
  200. },
  201. afterSubmit: function(response,postdata)
  202. {
  203. var res=eval('(' + response.responseText + ')');
  204. if(res.flag)
  205. {
  206. parent.layer.alert(res.message, {
  207. skin: 'layui-layer-molv' //样式类名
  208. ,closeBtn: 0
  209. });
  210. return [true,res.message,''];
  211. }
  212. else
  213. {
  214. parent.layer.alert(res.message, {
  215. skin: 'layui-layer-molv' //样式类名
  216. ,closeBtn: 0
  217. });
  218. return [false,res.message,''];
  219. }
  220. },
  221. errorTextFormat : function(data) {
  222. return 'Error: ' + data.responseText
  223. }
  224. },
  225. // options for the Add Dialog
  226. {
  227. closeAfterAdd : true,
  228. recreateForm : true,
  229. width:800,
  230. afterShowForm : function(formid) {
  231. },
  232. beforeSubmit: function(postdata, formid){
  233. postdata["columnid"] = '${column.columnid!}';
  234. postdata["columnname"] = '${column.columnname!}';
  235. $.each(postdata,function (index, value) {
  236. if(index!="jqGrid_id" && index!="oper"){
  237. modifyJosnKey(postdata,index,"link."+index);
  238. }
  239. })
  240. return[true,''];
  241. },
  242. afterSubmit: function(response,postdata)
  243. {
  244. var res=eval('(' + response.responseText + ')');
  245. if(res.flag)
  246. {
  247. parent.layer.alert(res.message, {
  248. skin: 'layui-layer-molv' //样式类名
  249. ,closeBtn: 0
  250. });
  251. return [true,res.message,''];
  252. }
  253. else
  254. {
  255. parent.layer.alert(res.message, {
  256. skin: 'layui-layer-molv' //样式类名
  257. ,closeBtn: 0
  258. });
  259. return [false,res.message,''];
  260. }
  261. },
  262. errorTextFormat : function(data) {
  263. return 'Error: ' + data.responseText
  264. }
  265. },
  266. // options for the Delete Dailog
  267. {
  268. afterSubmit: function(response,postdata)
  269. {
  270. var res=eval('(' + response.responseText + ')');
  271. if(res.flag)
  272. {
  273. parent.layer.alert(res.message, {
  274. skin: 'layui-layer-molv' //样式类名
  275. ,closeBtn: 0
  276. });
  277. return [true,''];
  278. }
  279. else
  280. {
  281. parent.layer.alert(res.message, {
  282. skin: 'layui-layer-molv' //样式类名
  283. ,closeBtn: 0
  284. });
  285. return [true,''];
  286. }
  287. }
  288. },{
  289. // search options 这里支持多条件查询
  290. multipleSearch: true,
  291. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  292. afterSubmit: function(r, data) {
  293. var messageString = r.responseText;
  294. var mesObj = eval('(' + messageString + ')');
  295. return [mesObj.state, mesObj.message];
  296. }
  297. }
  298. );
  299. })
  300. </script>
  301. <title>我的桌面</title>
  302. </head>
  303. <body>
  304. <div class="page-container">
  305. <table id="jqGrid"></table>
  306. <div id="jqGridPager"></div>
  307. </div>
  308. <footer class="footer mt-20">
  309. <div class="container">
  310. <p></p>
  311. </div>
  312. </footer>
  313. </body>
  314. </html>