xtggList.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. var xtgg = new Object();
  2. xtgg.loadSearchModule = function(p) {
  3. var $div = $("#" + p.id);
  4. if ($div.length > 0) {
  5. $div.load('xtggSearchModule.htm', {
  6. from : p.from,
  7. callBackFunName : p.callBackFunName,
  8. 'xtggSearchGrid' : $("#xtggSearchModule").val()
  9. }, function() {
  10. });
  11. }
  12. };
  13. /**
  14. * 加载系统公告查询模块
  15. */
  16. xtgg.loadSearchModule({
  17. id : 'xtggSearchModule',
  18. from : 'xtgg',
  19. callBackFunName : 'searchXtggCallBack'
  20. });
  21. /**
  22. * 搜索条件回调函数
  23. *
  24. * @param {搜索条件对象}
  25. * data
  26. * @param {分隔符}
  27. * fgf
  28. */
  29. function searchXtggCallBack(data, fgf) {
  30. huimv.searchGrid("xtggGrid", {
  31. url : 'getXtggList.htm',
  32. params : [{
  33. name : 'param',
  34. value : data
  35. }, {
  36. name : 'fgf',
  37. value : fgf
  38. }]
  39. }, '<b>系统公告搜索结果</b>');
  40. }
  41. /**
  42. * 加载系统公告列表数据
  43. */
  44. function loadXtggGrid(xtggSearchGrid) {
  45. var xxtz_xtgg_fb = $("#xxtz_xtgg_fb").val();
  46. jQuery("#xtggGrid").flexigrid({
  47. url : 'getXtggList.htm',
  48. dataType : 'json',
  49. method : 'post',
  50. params : [{
  51. name : 'xtggSearchGrid',
  52. value : $('#xtggSearchGrid').val()
  53. },{
  54. name : 'from',
  55. value : $("#from").val()
  56. }],
  57. title : '<b>公告浏览</b>',
  58. usepager : true,
  59. useRp : true,
  60. rp : 10,
  61. singleSelect : true,
  62. hidehead : false,
  63. showInputPage : true,
  64. showSelectRp : false,
  65. showTableToggleBtn : false,
  66. width : '790',
  67. resizable : false,
  68. nowrap : true,
  69. height : '335',
  70. cache : false,// 清除缓存
  71. colModel : [{
  72. display : '行号',
  73. name : 'hh',
  74. width : 25,
  75. sortable : false,
  76. align : 'center',
  77. process : function(col, record, d) {
  78. jQuery(col).html(d + 1);
  79. }
  80. }, {
  81. display : '标题',
  82. name : '',
  83. width : 180,
  84. sortable : false,
  85. align : 'left',
  86. process : function(col, record, postion, pid) {
  87. jQuery(col).addClass('s');
  88. jQuery(col).html('<a onclick="viewXtgg(' + record.id + ');">' + record.bt + '</a>');
  89. }
  90. }, {
  91. display : '描述',
  92. name : 'ms',
  93. width : 270,
  94. sortable : false,
  95. align : 'left'
  96. }, {
  97. display : '发布时间',
  98. name : 'fbsj',
  99. width : 120,
  100. sortable : true,
  101. align : 'center'
  102. }, {
  103. display : '发布状态',
  104. name : 'fbzt',
  105. width : 60,
  106. sortable : true,
  107. align : 'center',
  108. process : function(col, record, postion, pid) {
  109. jQuery(col).addClass('s');
  110. var str = '';
  111. if (record.fbzt == 1) {
  112. str += '<span>' + "已发布" + '</span>';
  113. } else {
  114. str += '<span>' + "未发布" + '</span>';
  115. }
  116. jQuery(col).html(str);
  117. }
  118. }, {
  119. display : '操作',
  120. name : '',
  121. width : 60,
  122. sortable : true,
  123. align : 'center',
  124. process : function(col, record, postion, pid) {
  125. jQuery(col).addClass('s');
  126. if (record.fbzt != 1 && xxtz_xtgg_fb == "true") {
  127. jQuery(col).html('<a onclick="fbXtgg(' + record.id + ');">' + "发布" + '</a>');
  128. }
  129. }
  130. }]
  131. });
  132. }
  133. loadXtggGrid($('#xtggSearchGrid'));
  134. /**
  135. * 发布系统公告
  136. * @param id
  137. */
  138. function fbXtgg(id) {
  139. huimv.showProcessModel('发布中...');
  140. jQuery.ajax({
  141. url : 'fbXtgg.htm',
  142. dataType : 'json',
  143. type : 'post',
  144. cache : false,
  145. data : {
  146. "id" : id
  147. },
  148. success : function(data) {
  149. huimv.hideProcessModel();
  150. huimv.reloadGrid('xtggGrid');
  151. },
  152. error : function(data) {
  153. huimv.showError(data.responseText);
  154. }
  155. });
  156. }
  157. /**
  158. * 加载系统公告查看页面
  159. * @param id
  160. */
  161. function viewXtgg(id) {
  162. huimv.loadPage('xtggRight', 'viewXtgg.htm', {
  163. "id" : id
  164. });
  165. }
  166. /**
  167. * 加载系统公告编辑页面
  168. * @param id
  169. */
  170. function editXtgg(id, from) {
  171. huimv.loadPage('xtggRight', 'editXtgg.htm', {
  172. "id" : id,
  173. "from" : from
  174. });
  175. }
  176. /**
  177. * 编辑完成后回调函数
  178. *
  179. * @param {} lx
  180. * @param {} data
  181. */
  182. function processAfterEditXtgg() {
  183. Dialogs.close();
  184. huimv.reloadGrid('xtggGrid');
  185. }
  186. /**
  187. * 作废公告
  188. * @param id
  189. */
  190. function disableXtgg(id, from) {
  191. Dialogs.alert("确定作废系统公告?", {
  192. title : '提示信息',
  193. width : 250,
  194. height : 80,
  195. top : 150,
  196. button : {
  197. ok : ['确定',function(){
  198. this.close();
  199. huimv.showProcessModel('处理数据中');
  200. jQuery.ajax({
  201. url : 'disableXtgg.htm',
  202. dataType : 'json',
  203. type : 'post',
  204. cache : false,
  205. data : {"id" : id},
  206. success : function(data) {
  207. huimv.hideProcessModel();
  208. if (data.returnCode > 0) {
  209. if (from == 'list') {
  210. huimv.reloadGrid('xtggGrid');
  211. } else if (from == 'view') {
  212. loadXtggList();
  213. }
  214. } else {
  215. Dialogs.alert("传入参数有误!", {
  216. width : 300,
  217. height : 50
  218. });
  219. }
  220. },
  221. error : function(data) {
  222. huimv.showError(data.responseText);
  223. }
  224. });
  225. }],
  226. cancel : ['取消',function(){
  227. this.close();
  228. }]
  229. }
  230. });
  231. }