selectrelating.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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" href="${ctx}/assets/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" >
  21. <script type="text/javascript" src="${ctx}/assets/lib/My97DatePicker/WdatePicker.js"></script>
  22. <script type="text/ecmascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.js"></script>
  23. <script type="text/javascript" src="${ctx}/assets/lib/layer/3.0.3/layer.js"></script>
  24. <script type="text/javascript" src="${ctx}/assets/static/h-ui/js/H-ui.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. <script type="text/javascript" src="${ctx}/assets/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
  32. <!--[if IE 6]>
  33. <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
  34. <script>DD_belatedPNG.fix('*');</script>
  35. <![endif]-->
  36. <script type="text/javascript">
  37. $(function() {
  38. $.ajax({
  39. async: false,
  40. type : "POST",
  41. url : "${ctx}/myconsole/webinfo/getColumnOptionsBySite",
  42. dataType : 'text',
  43. success : function(data) {
  44. $("#columnID").append(data);
  45. }
  46. });
  47. $(window).resize(function(){
  48. $("#jqGrid").setGridWidth($(window).width()-41); 
  49. });
  50. $("#jqGrid").jqGrid({
  51. url : '${ctx}/myconsole/webinfo/getRelatingInfo',
  52. mtype : "POST",
  53. datatype : "json",
  54. postData : {'KeyID':'${KeyID}','columnID':$('#columnID').val(),'KeyWord':$('#KeyWord').val(),'BeginDate':$('#BeginDate').val(),'EndDate':$('#EndDate').val()},
  55. multiselect: true,
  56. caption:'信息管理',
  57. prmNames : { //定义表单的主键 // Default valuesprmNames: {page:“page”,rows:“rows”, sort: “sidx”,order: “sord”, search:“_search”, nd:“nd”, npage:null} 当参数为null时不会被发到服务器端
  58. id: "keyid", 
  59. oper:"oper",    
  60. addoper:"add",
  61. editoper:"edit",
  62. deloper:"del" 
  63. },
  64. colModel : [ {
  65. label : '数据编号',
  66. name : 'keyid',
  67. key : true,
  68. editable: false,
  69. hidden:true
  70. }, {
  71. label : '标题',
  72. name : 'title',
  73. width : 200,
  74. formatter: function (cellvalue, options, rowdata) {
  75. var html = "<a href='"+rowdata.url+"' target='_blank' title='"+cellvalue+"' >"+cellvalue+"</a>";
  76. return html;
  77. }
  78. }, {
  79. label : '信息序号',
  80. hidden : true,
  81. name : 'infoserial',
  82. width : 50,
  83. },{
  84. label : '发布人',
  85. name : 'releasename',
  86. width : 50,
  87. }, {
  88. label : '发布时间',
  89. name : 'releasetime',
  90. width : 100,
  91. }],
  92. rownumbers : true,//添加左侧行号
  93. viewrecords : true,//是否在浏览导航栏显示记录总数
  94. rowNum : 10,//每页显示记录数
  95. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  96. autowidth : true,
  97. sortname : 'sortID',
  98. sortorder : 'asc',
  99. height : 'auto',
  100. pager : "#jqGridPager",
  101. //屏蔽点击任意单元格选中checkbox的问题
  102. beforeSelectRow: function (rowid, e) {
  103. var $myGrid = $(this),
  104. i = $.jgrid.getCellIndex($(e.target).closest('td')[0]),
  105. cm = $myGrid.jqGrid('getGridParam', 'colModel');
  106. return (cm[i].name === 'cb');
  107. }
  108. });
  109. //拖动排序
  110. $('#jqGrid').jqGrid('sortableRows', {
  111. update:function(ev, ui){
  112. var item = ui.item[0], ri = item.rowIndex, itemId = item.id;
  113. var array = $('#jqGrid').jqGrid('getDataIDs');
  114. var options = 'next';//标识参照ID 是取得当前元素的后一个
  115. if(ri == array.length){//说明在列表最末尾,拿他当前一行数据作为参照物
  116. ri -=2;
  117. options = 'pre';//标识参照ID 是取得当前元素的前一个
  118. }
  119. alert(itemId);
  120. alert(array[ri]);
  121. $.post("${ctx}/myconsole/webinfo/sort/", {
  122. KeyID: itemId,
  123. ReferKeyID: array[ri],
  124. OptionType: options
  125. });
  126. }
  127. });
  128. //切换资源状态时,动态刷新数据;同时判断发布和撤稿按钮是否可用
  129. $('#TState').change(reload);
  130. });
  131. //选择数据状态下拉列表重新取数据
  132. function query()
  133. {
  134. $("#jqGrid").jqGrid('setGridParam', {
  135. datatype : "json",
  136. postData : {'KeyID':'${KeyID}','columnID':$('#columnID').val(),'KeyWord':$('#KeyWord').val(),'BeginDate':$('#BeginDate').val(),'EndDate':$('#EndDate').val()}
  137. }).trigger('reloadGrid');
  138. }
  139. //设置关联信息2016-12-12
  140. function setRelating(){
  141. var data = jQuery('#jqGrid').jqGrid('getGridParam','selarrrow');
  142. if(data.length <=0){
  143. layer.msg('请选择要操作的数据',{icon: 5,time:1500});
  144. return false;
  145. }
  146. $.getJSON("${ctx}/myconsole/webinfo/getRelating", {
  147. KeyID : '${KeyID}',
  148. keyids : data+""
  149. }, function(json){
  150. if(json.status == 'y'){
  151. opener.$("#relatinginfoid").val(json.relatinginfoid);
  152. layer.alert(json.message, {
  153. skin: 'layui-layer-molv' //样式类名
  154. ,closeBtn: 0
  155. }, function(){window.close();});
  156. }else{
  157. layer.alert(json.message, {
  158. skin: 'layui-layer-molv' //样式类名
  159. ,closeBtn: 0
  160. }, function(){});
  161. }
  162. });
  163. }
  164. </script>
  165. <title>我的桌面</title>
  166. </head>
  167. <body>
  168. <div>
  169. <div class="page-container">
  170. <div class="cl pd-5 bg-1 bk-gray">
  171. <span class="l">
  172. <span style="width: 100px" >
  173. 标题关键字:
  174. </span>
  175. <span class="select-box" style="width: 140px" >
  176. <input type="text" class="input-text required" size=20 placeholder="" id="KeyWord" name="KeyWord">
  177. </span>
  178. <span style="width: 100px" >
  179. 栏目:
  180. </span>
  181. <span class="select-box" style="width: 493px" >
  182. <select id="columnID" name="columnID" > </select>
  183. </span>
  184. <br>
  185. <span style="width: 100px" >
  186. 发布日期从:
  187. </span>
  188. <span class="select-box" style="width: 140px" >
  189. <input type="text" size=20 placeholder="" onfocus="WdatePicker()" id="BeginDate" name="BeginDate" class="input-text Wdate readyonly">
  190. </span>
  191. <span style="width: 50px" >
  192. 到:
  193. </span>
  194. <span class="select-box" style="width: 140px" >
  195. <input type="text" class="input-text required" size=20 placeholder="" onfocus="WdatePicker()" id="EndDate" name="EndDate" class="input-text Wdate readyonly">
  196. </span>
  197. <span style="width: 80px" >
  198. <a class="btn btn-primary radius query" onclick="query()" href="javascript:;">
  199. <i class="Hui-iconfont">&#xe6f1;</i> 检索
  200. </a>
  201. <a class="btn btn-danger radius deletec" href="javascript:;" onclick="setRelating()">
  202. <i class="Hui-iconfont">&#xe604;</i> 设置为关联信息
  203. </a>
  204. </span>
  205. </span>
  206. </div>
  207. <table id="jqGrid"></table>
  208. <div id="jqGridPager"></div>
  209. </div>
  210. </div>
  211. </body>
  212. </html>