link.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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. <script type ="text/ecmascript" src ="${ctx}/assets/lib/jquery.ajaxfileupload.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. <title>Insert title here</title>
  36. <script type="text/javascript">
  37. $(function(){
  38. $("window").resize(function(){
  39. $("#jqGrid").setGridWidth($(window).width()-40);
  40. });
  41. $("#jqGrid").jqGrid({
  42. url:'${ctx}/myconsole/link/getByPage',
  43. editurl:"${ctx}/myconsole/link/saveOrUpdate",
  44. mtype:"POST",
  45. datatype:"json",
  46. caption:'链接类型',
  47. colModel:[{
  48. label:'链接类型编号',
  49. name:'id',
  50. hidden:true,
  51. key:true,
  52. width:50,
  53. },{
  54. label:'链接名称',
  55. name:'linkname',
  56. edittype:'text',
  57. editable:true,
  58. width:80,
  59. },{
  60. label:'链接地址',
  61. name:'linkurl',
  62. edittype:'text',
  63. editable:true,
  64. width:80,
  65. },{
  66. label : '图片上传',
  67. name : 'linkurl1',
  68. editable: true,
  69. hidden : true,
  70. edittype: "file",
  71. width : 100,
  72. editrules:{
  73. edithidden : true
  74. },
  75. editoptions: {
  76. enctype: "multipart/form-data"
  77. }
  78. },{
  79. label : '文件上传',
  80. name : 'linkurl11',
  81. editable: true,
  82. hidden : true,
  83. edittype: "file",
  84. width : 100,
  85. editrules:{
  86. edithidden : true
  87. },
  88. editoptions: {
  89. enctype: "multipart/form-data"
  90. }
  91. },{
  92. label:'链接描述',
  93. name:'linkdesc',
  94. edittype:'text',
  95. editable:true,
  96. width:80,
  97. },{
  98. label:'点击数量',
  99. name:'dotnum',
  100. edittype:'text',
  101. editable:false,
  102. width:80,
  103. },{
  104. label:'排序值',
  105. name:'sortid',
  106. edittype:'text',
  107. editable:true,
  108. width:80,
  109. }],
  110. rownumbers : true,//添加左侧行号
  111. viewrecords : true,//是否在浏览导航栏显示记录总数
  112. rowNum : 10,//每页显示记录数
  113. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  114. autowidth : true,
  115. height : 'auto',
  116. pager : "#jqGridPager"
  117. });
  118. $('#jqGrid').navGrid('#jqGridPager',
  119. {
  120. edit:true,
  121. add:true,
  122. del:true,
  123. search:true,
  124. refresh:true,
  125. view:true,
  126. position:"left",
  127. cloneToTop:true
  128. },
  129. //options for the Edit Dialog
  130. {
  131. recreateForm : true,
  132. checkOnUpdate : true,
  133. checkOnSubmit : true,
  134. closeAfterEdit : true,
  135. onInitializeForm:function(formid) {
  136. //makeTree("orgid","/myconsole/user/getOrgTree","radio");
  137. },
  138. serializeEditData: function(postdata) {
  139. //myconsole.log(postdata);
  140. $.each(postdata,function (index, value) {
  141. //myconsole.log(index);
  142. if(index!="jqGrid_id" && index!="oper" && index!="id"){
  143. modifyJosnKey(postdata,index,"link."+index);
  144. }
  145. if(index=="id"){
  146. postdata["link."+index]=value
  147. }
  148. })
  149. //myconsole.log(postdata);
  150. return postdata;
  151. },
  152. errorTextFormat : function(data) {
  153. return 'Error: ' + data.responseText
  154. }
  155. },
  156. //options for the Add Dialog
  157. {
  158. closeAfterAdd:true,
  159. recreateForm:true,
  160. onInitializeForm: function(formid) {
  161. var config;
  162. $.ajax({
  163. type:"get",
  164. dataType:"json",
  165. url:"${ctx}/myconsole/ueditor/getConfig",
  166. async:false,
  167. success:function(data){
  168. config=eval(data);
  169. //console.log(config);
  170. }
  171. });
  172. $( '#linkurl1').ajaxfileupload({
  173. action: '${ctx}/myconsole/ueditor/?action=uploadimage',
  174. validate_extensions: false,
  175. onComplete: function(response) {
  176. if(response.state == "SUCCESS"){
  177. $( '#linkurl').val(config.imageUrlPrefix+response.url);
  178. } else{
  179. alert(response.state);
  180. }
  181. }
  182. });
  183. $( '#linkurl11').ajaxfileupload({
  184. action: '${ctx}/myconsole/ueditor/?action=uploadfile',
  185. validate_extensions: false,
  186. onComplete: function(response) {
  187. if(response.state == "SUCCESS"){
  188. $( '#linkurl').val(response.url);
  189. } else{
  190. alert(response.state);
  191. }
  192. }
  193. });
  194. },
  195. beforeSubmit:function(postdata,formid){
  196. $.each(postdata,function(index,value){
  197. if(index!="jqGrid_id" && index !="oper"){
  198. modifyJosnKey(postdata,index,"link."+index);
  199. }
  200. })
  201. return[true,''];
  202. },
  203. errorTextFormat:function(data){
  204. return 'Error: ' + data.responseText
  205. }
  206. },
  207. //options for the Delete Dailog
  208. {
  209. errorTextFormat:function(data){
  210. return 'Error: ' + data.responseText
  211. }
  212. },{
  213. // search options 这里支持多条件查询
  214. multipleSearch:true,
  215. closeAfterSearch:true,
  216. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  217. afterSubmit: function(r, data) {
  218. var messageString = r.responseText;
  219. var mesObj = eval('(' + messageString + ')');
  220. return [mesObj.state, mesObj.message];
  221. }
  222. }
  223. );
  224. });
  225. </script>
  226. </head>
  227. <body>
  228. <div class="page-container">
  229. <table id="jqGrid"></table>
  230. <div id="jqGridPager"></div>
  231. </div>
  232. <footer class="footer mt-20">
  233. <div class="container">
  234. <p></p>
  235. </div>
  236. </footer>
  237. </body>
  238. </html>