xxtzList.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. var xxtz = new Object();
  2. xxtz.loadSearchModule = function(p) {
  3. var $div = $("#" + p.id);
  4. if ($div.length > 0) {
  5. $div.load('xxtzSearchModule.htm', {
  6. from : p.from,
  7. callBackFunName : p.callBackFunName,
  8. 'xxtzSearchGrid' : $("#xxtzSearchModule").val()
  9. }, function() {
  10. });
  11. }
  12. };
  13. /**
  14. * 加载消息查询模块
  15. */
  16. xxtz.loadSearchModule({
  17. id : 'xxtzSearchModule',
  18. from : 'xxtz',
  19. callBackFunName : 'searchXxtzCallBack'
  20. });
  21. /**
  22. * 搜索条件回调函数
  23. *
  24. * @param {搜索条件对象}
  25. * data
  26. * @param {分隔符}
  27. * fgf
  28. */
  29. function searchXxtzCallBack(data, fgf) {
  30. huimv.searchGrid("xxtzGrid", {
  31. url : 'getXxtzList.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 loadXxtzGrid(xxtzSearchGrid) {
  45. var xxtz_xxtz_delete = $("#xxtz_xxtz_delete").val();
  46. var xxtz_xxtz_operate = $("#xxtz_xxtz_operate").val();
  47. jQuery("#xxtzGrid").flexigrid({
  48. url : 'getXxtzList.htm',
  49. dataType : 'json',
  50. method : 'post',
  51. params : [{
  52. name : 'xxtzSearchGrid',
  53. value : $('#xxtzSearchGrid').val()
  54. },{
  55. name : 'from',
  56. value : $("#from").val()
  57. }],
  58. title : '<b>消息浏览</b>',
  59. usepager : true,
  60. useRp : true,
  61. rp : 10,
  62. singleSelect : true,
  63. hidehead : false,
  64. showInputPage : true,
  65. showSelectRp : false,
  66. showTableToggleBtn : false,
  67. width : '790',
  68. height : '335',
  69. nowrap : true,
  70. resizable : false,
  71. cache : false,// 清除缓存
  72. colModel : [{
  73. display : '行号',
  74. name : 'hh',
  75. width : 25,
  76. sortable : false,
  77. align : 'center',
  78. process : function(col, record, d) {
  79. jQuery(col).html(d + 1);
  80. }
  81. }, {
  82. display : '故障级别',
  83. name : 'xxbz',
  84. width : 50,
  85. sortable : true,
  86. align : 'center',
  87. process : function(col, record, d) {
  88. if (record.xxbz == 1) {
  89. jQuery(col).html("<font color=black>一般</font>");
  90. } else if (record.xxbz == 2) {
  91. jQuery(col).html("<font color=rgb(237,179,37)>警告</font>");
  92. } else if (record.xxbz == 3) {
  93. jQuery(col).html("<font color=red>严重</font>");
  94. }
  95. }
  96. }, {
  97. display : '处理状态',
  98. name : 'clzt',
  99. width : 50,
  100. sortable : true,
  101. align : 'center',
  102. process : function(col, record, d) {
  103. if (record.clzt == 1) {
  104. jQuery(col).html("<font color=red>未处理</font>");
  105. } else if (record.clzt == 2) {
  106. jQuery(col).html("<font color=rgb(111,222,111)>处理中</font>");
  107. } else if (record.clzt == 3) {
  108. jQuery(col).html("<font color=black>已处理</font>");
  109. }
  110. }
  111. }, {
  112. display : '标题',
  113. name : '',
  114. width : 200,
  115. sortable : false,
  116. align : 'left',
  117. process : function(col, record, postion, pid) {
  118. var s = record.bt;
  119. if (s.length > 22) {
  120. s = s.substring(0, 20) + "...";
  121. }
  122. jQuery(col).addClass('s');
  123. jQuery(col).html('<a onclick="viewXxtz(' + record.id + '); " title="' + record.bt + '">' + s + '</a>');
  124. }
  125. }, {
  126. display : '消息来源',
  127. name : 'xxlxmc',
  128. width : 60,
  129. sortable : false,
  130. align : 'center'
  131. }, {
  132. display : '作者',
  133. name : 'zz',
  134. width : 100,
  135. sortable : false,
  136. align : 'center'
  137. }, {
  138. display : '发布时间',
  139. name : 'fbsj',
  140. width : 115,
  141. sortable : true,
  142. align : 'center'
  143. }, {
  144. display : '操作',
  145. width : 90,
  146. sortable : false,
  147. align : 'center',
  148. process : function(col, record, postion, pid) {
  149. var s = "";
  150. if (record.clzt == 1 && xxtz_xxtz_operate == "true") {
  151. s += '<a onclick="updateXxtz(\'' + record.id + '\' , \'' + record.clzt + '\')">开始处理</a>';
  152. s += '&nbsp;&nbsp;';
  153. } else if (record.clzt == 2 && xxtz_xxtz_operate == "true") {
  154. s += '<a onclick="updateXxtz(\'' + record.id + '\' , \'' + record.clzt + '\')">处理完成</a>';
  155. s += '&nbsp;&nbsp;';
  156. }
  157. if (xxtz_xxtz_delete == "true" && record.clzt != '3') {
  158. s += '<a onclick="disableXxtz(\'' + record.id + '\' , \'list\');">删除</a>';
  159. }
  160. jQuery(col).addClass('s');
  161. jQuery(col).html(s);
  162. }
  163. }]
  164. });
  165. }
  166. loadXxtzGrid($('#xxtzSearchGrid'));
  167. /**
  168. * 加载消息查看页面
  169. * @param id
  170. */
  171. function viewXxtz(id) {
  172. huimv.loadPage('xxtzRight', 'viewXxtz.htm', {
  173. "id" : id
  174. });
  175. }
  176. /**
  177. * 加载消息编辑页面
  178. * @param id
  179. */
  180. function editXxtz(id, from) {
  181. huimv.loadPage('xxtzRight', 'editXxtz.htm', {
  182. "id" : id,
  183. "from" : from
  184. });
  185. }
  186. /**
  187. * 编辑完成后回调函数
  188. *
  189. * @param {} lx
  190. * @param {} data
  191. */
  192. function processAfterEditXxtz() {
  193. Dialogs.close();
  194. huimv.reloadGrid('xxtzGrid');
  195. }
  196. /**
  197. * 作废消息
  198. * @param id
  199. */
  200. function disableXxtz(id, from) {
  201. Dialogs.alert("确定作废消息?", {
  202. title : '提示信息',
  203. width : 250,
  204. height : 80,
  205. top : 150,
  206. button : {
  207. ok : ['确定',function(){
  208. this.close();
  209. huimv.showProcessModel('处理数据中');
  210. jQuery.ajax({
  211. url : 'disableXxtz.htm',
  212. dataType : 'json',
  213. type : 'post',
  214. cache : false,
  215. data : {"id" : id},
  216. success : function(data) {
  217. huimv.hideProcessModel();
  218. if (data.returnCode > 0) {
  219. if (from == 'list') {
  220. huimv.reloadGrid('xxtzGrid');
  221. } else if (from == 'view') {
  222. loadXxtzList();
  223. }
  224. } else {
  225. Dialogs.alert("传入参数有误!", {
  226. width : 300,
  227. height : 50
  228. });
  229. }
  230. },
  231. error : function(data) {
  232. huimv.showError(data.responseText);
  233. }
  234. });
  235. }],
  236. cancel : ['取消',function(){
  237. this.close();
  238. }]
  239. }
  240. });
  241. }
  242. /**
  243. * 修改状态
  244. * @param id
  245. */
  246. function updateXxtz(id, clzt) {
  247. Dialogs.alert("确定处理消息?", {
  248. title : '提示信息',
  249. width : 250,
  250. height : 80,
  251. top : 150,
  252. button : {
  253. ok : ['确定',function(){
  254. this.close();
  255. huimv.showProcessModel('处理数据中');
  256. jQuery.ajax({
  257. url : 'updateXxtz.htm',
  258. dataType : 'json',
  259. type : 'post',
  260. cache : false,
  261. data : {"id" : id, "clzt" : clzt},
  262. success : function(data) {
  263. huimv.hideProcessModel();
  264. if (data.returnCode > 0) {
  265. huimv.reloadGrid("xxtzGrid");
  266. } else {
  267. Dialogs.alert("传入参数有误!", {
  268. width : 300,
  269. height : 50
  270. });
  271. }
  272. },
  273. error : function(data) {
  274. huimv.showError(data.responseText);
  275. }
  276. });
  277. }],
  278. cancel : ['取消',function(){
  279. this.close();
  280. }]
  281. }
  282. });
  283. }