dic_hot.html 6.8 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. <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 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/layer/3.0.3/layer.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/dic_hot/getByPage',
  41. editurl:"${ctx}/myconsole/dic_hot/saveOrUpdate2",
  42. mtype : "POST",
  43. datatype : "json",
  44. prmNames:{id:"keyid"},
  45. caption:'热词管理',
  46. colModel : [ {
  47. label : '任务编号',
  48. name : 'keyid',
  49. hidden : true,
  50. key : true,
  51. width : 50,
  52. }, {
  53. label : '热词',
  54. name : 'tname',
  55. editable: true,
  56. width : 80
  57. }, {
  58. label : '搜索量',
  59. name : 'searchnum',
  60. editable: true,
  61. edittype: "text",
  62. width : 50,
  63. editrules:{
  64. edithidden:true,
  65. custom:true, 
  66. custom_func: function(strFieldValue, strFieldName){
  67. var strFloat = /^([-\+]?(((\d+)(\.\d+))|(\.\d+)|(\d*)))?$/;
  68.  if(!strFloat.test(strFieldValue)){
  69.    return [false, strFieldName+"应该为实数"];
  70.   }
  71. else
  72. {
  73.   return [true,""];
  74. }
  75. }
  76. },
  77. editoptions: {
  78. dataInit: function(elem){
  79. $(elem).width(218);
  80. },
  81. maxlength: 50
  82. }
  83. } , {
  84. label : '是否显示',
  85. name : 'tstate',
  86. editable: true,
  87. formatter:"select",
  88. edittype: "select",
  89. editoptions: {
  90. value: "true:显示;false:不显示"
  91. },
  92. stype:"select",
  93. searchoptions:{
  94. value: "显示:显示;不显示:不显示"
  95. },
  96. width : 80,
  97. }, {
  98. label : '生成时间',
  99. name : 'recordtime',
  100. editable: false,
  101. width : 80
  102. },{
  103. label : '操作',
  104. name:'operMod',
  105. index:'operMod',
  106. align:"center",
  107. width:"80",
  108. formatter: function (cellvalue, options, rowdata) {
  109. var html = "<button class='btn btn-success radius size-S' onclick=edit('"+rowdata.tname+"')>置顶</button>";
  110. return html;
  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 : false,
  127. search : true,
  128. refresh : true,
  129. view : false,
  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. serializeEditData: function(postdata) {
  142. //myconsole.log(postdata);
  143. $.each(postdata,function (index, value) {
  144. //myconsole.log(index);
  145. if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
  146. modifyJosnKey(postdata,index,"dIC_hot."+index);
  147. }
  148. if(index=="keyid"){
  149. postdata["dIC_hot."+index]=value
  150. }
  151. })
  152. //myconsole.log(postdata);
  153. return postdata;
  154. },
  155. afterSubmit: function (response, postdata) {
  156. // console.log(response);
  157. var res=eval('(' + response.responseText + ')');
  158. // layer.msg(res.msg);
  159. return [res.state,res.msg,''];
  160. },
  161. errorTextFormat : function(data) {
  162. return 'Error: ' + data.responseText
  163. }
  164. },
  165. // options for the Add Dialog
  166. {
  167. closeAfterAdd : true,
  168. recreateForm : true,
  169. beforeSubmit: function(postdata, formid){
  170. $.each(postdata,function (index, value) {
  171. if(index!="jqGrid_id" && index!="oper"){
  172. modifyJosnKey(postdata,index,"dIC_hot."+index);
  173. }
  174. })
  175. return[true,''];
  176. },
  177. afterSubmit: function (response, postdata) {
  178. //console.log(response);
  179. var res=eval('(' + response.responseText + ')');
  180. layer.msg(res.msg);
  181. return [res.state,res.msg,''];
  182. },
  183. errorTextFormat : function(data) {
  184. return 'Error: ' + data.responseText
  185. }
  186. },
  187. // options for the Delete Dailog
  188. {
  189. errorTextFormat : function(data) {
  190. return 'Error: ' + data.responseText
  191. }
  192. },{
  193. // search options 这里支持多条件查询
  194. multipleSearch: true,
  195. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  196. afterSubmit: function(r, data) {
  197. var messageString = r.responseText;
  198. var mesObj = eval('(' + messageString + ')');
  199. return [mesObj.state, mesObj.message];
  200. }
  201. }
  202. );
  203. })
  204. function edit(hotWord){
  205. $.post("${ctx}/myconsole/dic_hot/set",{"hotWord":hotWord},function(data){
  206. layer.layer.msg(data);
  207. $("#jqGrid").trigger("reloadGrid");
  208. })
  209. }
  210. </script>
  211. <title>我的桌面</title>
  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>