e39ee1e3a7fb738e862525bbaa385b52eb3765d3.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author
  6. * @date 2015/11/19
  7. */
  8. EventManager = function() {
  9. /**定义变量**/
  10. var _this = this;
  11. _this.listGrid = null;//数据列表
  12. $queryForm = null;//查询区域表单
  13. $searchButt = null;//查询按钮
  14. $more = null; //更多
  15. _this.loadParams = null;//列表加载参数
  16. _this.exportParams = null;//导出EXCEL参数
  17. var real_name = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  18. var CorpArea = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  19. //当前时间
  20. function getNowFormatDate() {
  21. var date = allGetServerTime();
  22. var seperator1 = "-";
  23. var seperator2 = ":";
  24. var year = date.getFullYear();
  25. var month = date.getMonth() + 1;
  26. var strDate = date.getDate();
  27. var hour=date.getHours();
  28. var minu=date.getMinutes();
  29. var sec=date.getSeconds();
  30. if (month >= 1 && month <= 9) {
  31. month = "0" + month;
  32. }
  33. if (strDate >= 0 && strDate <= 9) {
  34. strDate = "0" + strDate;
  35. }
  36. if(hour>=0 && hour<=9){
  37. hour="0"+hour;
  38. }
  39. if(minu>=0 && minu<=9){
  40. minu="0"+minu;
  41. }
  42. if(sec>=0 && sec<=9){
  43. sec="0"+sec;
  44. }
  45. var currentdate = year + seperator1 + month + seperator1 + strDate
  46. + " " + hour + seperator2 + minu;
  47. return currentdate;
  48. }
  49. var currdate = getNowFormatDate();
  50. /**私有方法**/
  51. /***新增信息***/
  52. _this.addForm = function(){
  53. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickAddEdit.jsp?fd_id=");
  54. };
  55. /***修改信息***/
  56. _this.editForm = function(){
  57. var rows = _this.listGrid.getSelectedRows();
  58. var rowsLength = rows.length;
  59. if (rowsLength == 0) {
  60. top.Dialog.alert("请选中要修改的记录!");
  61. return;
  62. } else if (rowsLength > 1) {
  63. top.Dialog.alert("请选中一条要修改的记录!");
  64. return;
  65. } else if (real_name!=rows[0].REPORTER_397) {
  66. top.Dialog.alert("不是本人填报的,不能修改!");
  67. return;
  68. } else {
  69. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID397;
  70. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickAddEdit.jsp?fd_id="+fd_id);
  71. }
  72. };
  73. /***删除信息***/
  74. _this.del = function(){
  75. var rows = _this.listGrid.getSelectedRows();
  76. var rowsLength = rows.length;
  77. if (rowsLength == 0) {
  78. top.Dialog.alert("请选中要删除的记录!");
  79. return;
  80. }if (real_name!=rows[0].REPORTER_397) {
  81. top.Dialog.alert("不是本人填报的,不能删除!");
  82. return;
  83. }
  84. var ids = "";
  85. for ( var i = 0; i < rowsLength; i++) {
  86. ids += rows[i].FD_OBJECTID397 + ",";
  87. }
  88. if(ids!=""){
  89. ids = ids.substring(0,ids.length-1);
  90. }
  91. // var url = $.pathname() +"/ws/crud/CRUDService/delete/";
  92. var url = $.pathname() +"/ws/EventService/EventService/deleteEvent/";
  93. var params = {
  94. objectIDs : ids,
  95. classid : 397
  96. };
  97. top.Dialog.confirm("确定要删除吗?|删除", function() {
  98. $.request.del(url,params,function(result){
  99. if (result.Msg.sucsess == true) {
  100. top.Dialog.alert("删除成功!");
  101. var backCondition=_this.loadParams.condition;
  102. _this.listGrid.rend();//加载数据
  103. _this.loadParams.condition= backCondition;
  104. } else {
  105. top.Dialog.alert("删除失败!");
  106. }
  107. });
  108. });
  109. };
  110. /****查看详细信息****/
  111. _this.showInfo = function(){
  112. var rows = _this.listGrid.getSelectedRows();
  113. var rowsLength = rows.length;
  114. if (rowsLength == 0) {
  115. top.Dialog.alert("请选中要查看的记录!");
  116. return;
  117. } else if (rowsLength > 1) {
  118. top.Dialog.alert("请选中一条要查看的记录!");
  119. return;
  120. } else {
  121. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID397;
  122. var comp_id = _this.listGrid.getSelectedRow().EVENT_UNIT_ID_397;
  123. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventQuickInfo_page.jsp?fd_id="+fd_id+"&comp_id="+comp_id);
  124. }
  125. };
  126. /** *发布** */
  127. _this.release = function() {
  128. // 取得选中的Grid行
  129. var rows = _this.listGrid.getSelectedRows();
  130. // 选中的行数
  131. var rowsLength = rows.length;
  132. if (rowsLength == 0) {
  133. top.Dialog.alert("请选中要发布的记录!");
  134. return;
  135. } else if (rowsLength > 1) {
  136. top.Dialog.alert('请选中一条要发布的记录!');
  137. return;
  138. }else {
  139. var row = _this.listGrid.getSelectedRow();
  140. // 判断选中的记录是否已经发布过
  141. if (row.RELEASE_STATE_397 == 1) {
  142. top.Dialog.alert("选中的记录有已经发布过的,请重新选择!");
  143. return;
  144. }
  145. var fd_id = row.FD_OBJECTID397; //
  146. var params = {classid : "397",FD_OBJECTID397:fd_id,RELEASE_STATE_397:"1"};
  147. top.Dialog.confirm("确定要发布吗?|发布", function() {
  148. $.ajax({
  149. url : $.pathname() + '/ws/crud/CRUDService/update/',
  150. type : 'post',
  151. data : params,
  152. async:false,
  153. dataType : 'json',
  154. success : function(data){
  155. top.Dialog.alert("发布成功!");
  156. _this.listGrid.rend();
  157. },
  158. error : function(e){
  159. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  160. }
  161. });
  162. });
  163. }
  164. };
  165. /********收回********/
  166. _this.handOn = function(){
  167. // 取得选中的Grid行
  168. var rows = _this.listGrid.getSelectedRows();
  169. // 选中的行数
  170. var rowsLength = rows.length;
  171. if (rowsLength == 0) {
  172. top.Dialog.alert("请选中要收回的记录!");
  173. return;
  174. } else if (rowsLength > 1) {
  175. top.Dialog.alert('请选中一条要收回的记录!');
  176. return;
  177. }else {
  178. var row = _this.listGrid.getSelectedRow();
  179. var user_id = row.REPORTER_397;
  180. if (user_id != real_name) {
  181. top.Dialog.alert("须填写人本人才能收回,您没有权限收回该记录!");
  182. return;
  183. }
  184. if (row.RELEASE_STATE_397 == 0) {
  185. top.Dialog.alert("选中的记录未发布,请重新选择!");
  186. return;
  187. }
  188. var alertMsg = "确定要收回该条记录吗?";
  189. var fd_id = row.FD_OBJECTID397; //
  190. var params = {classid : "397",FD_OBJECTID397:fd_id,RELEASE_STATE_397:"0"};
  191. top.Dialog.confirm(alertMsg, function() {
  192. $.ajax({
  193. url : $.pathname() + '/ws/crud/CRUDService/update/',
  194. type : 'post',
  195. timeout : 15000,
  196. data : params,
  197. dataType : 'json',
  198. success : function(data){
  199. top.Dialog.alert('收回记录成功!', null, null, null, -1);
  200. _this.listGrid.rend();
  201. },
  202. error : function(e){
  203. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  204. }
  205. });
  206. });
  207. }
  208. };
  209. /***绑定***/
  210. _this.binding = function(){
  211. //alert(JSON.stringify(real_name));
  212. //取得选中的Grid行
  213. var rows = _this.listGrid.getSelectedRows();
  214. //选中的行数
  215. var rowsLength = rows.length;
  216. if (rowsLength == 0) {
  217. top.Dialog.alert("请选中要绑定的记录!");
  218. return;
  219. }else if(rowsLength > 1){
  220. top.Dialog.alert("一次只能对一条记录进行绑定操作!");
  221. return;
  222. }
  223. var comp_id = _this.listGrid.getSelectedRow().EVENT_UNIT_ID_397;
  224. if(corpId != comp_id){
  225. top.Dialog.alert("绑定用户部门不一致!");
  226. return;
  227. }
  228. var fd_id = rows[0].FD_OBJECTID397;
  229. var name = rows[0].EVENT_TITLE_397;
  230. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/report/QuickReport_Add.html?fd_id="+fd_id+"?name="+name);
  231. };
  232. //打印
  233. function onPrint(){
  234. }
  235. //查询
  236. function search(obj){
  237. $queryForm = $("#queryForm");
  238. if($("#EVENT_NAME_397").val()=="事件简题"){
  239. $("#EVENT_NAME_397").val("");
  240. }
  241. $queryForm.serialize();
  242. //获取选中的值
  243. var searchCondition = getSelectCon(conditionData);
  244. var queryParams = getQueryFormParams($queryForm);
  245. var params=$.extend({},_this.loadParams,queryParams);
  246. //与之前参数条件拼接
  247. params.condition = searchCondition.condition + params.condition;
  248. _this.listGrid.setOptions({"params":params});
  249. //加载数据
  250. _this.listGrid.rend();
  251. //_this.loadParams.condition= backCondition;
  252. }
  253. //更多
  254. function more(){
  255. $('#moreTable').toggle();
  256. }
  257. return {
  258. init : function() {
  259. $("#EVENT_TITLE_397").keydown(function(event){
  260. if(event.keyCode == 13){
  261. search();
  262. }
  263. });
  264. $queryForm = $("#queryForm");
  265. /**绑定查询面板的按钮点击事件**/
  266. $searchButt = $("#searchButt");//查询按钮
  267. $searchButt.bind('click',function(){
  268. search();
  269. });
  270. $searchButt.live('click',function(){
  271. search();
  272. });
  273. /**绑定更多的按钮点击事件*/
  274. $more = $("#more"); //更多按钮
  275. $more.bind('click',function(){
  276. more();
  277. });
  278. //列表加载参数
  279. _this.loadParams = {
  280. listId : '397',
  281. condition : "is_del=0 and (EVENT_UNIT='"+CorpArea+"' or EVENT_UNIT in (select dept_id from sys_department where parent_id='"+CorpArea+"'))",
  282. direction:'DESC',
  283. sort: 'OCCURRENCE_TIME_397'
  284. };
  285. _this.exportParams = _this.loadParams;
  286. var grid_option={
  287. columns : [
  288. {name : 'FD_OBJECTID397',display : '主键',align : 'center',hide : true},
  289. {name : 'EVENT_TITLE_397',display : '事件简题',align : 'center',width : "16%",isPrimaryKey:true,
  290. render:function(rowdata, rowindex, value, column){
  291. return "<div><a href='javascript:;' onclick='showPrimaryKey(\""+rowdata.FD_OBJECTID397+"\",\""+rowdata.EVENT_UNIT_ID_397+"\")'>" + value + "</a></div>";
  292. }
  293. },
  294. {name : 'EVENT_UNIT_397_SHOW',display : '事发单位',align : 'center', width: "8%"},
  295. {name : 'EVENT_TYPE_397_SHOW',display : '事件类型',align : 'center', width: "8%"},
  296. {name : 'OCCURRENCE_TIME_397',display : '发生时间',align : 'center', width: "8%"},
  297. {name : 'EVENT_DESCRIPTION_397',display : '事件简况',align : 'center', width: "8%"},
  298. {name : 'EVENT_CAUSE_397',display : '事件原因',align : 'center', width: "8%"},
  299. {name : 'EVENT_CONSEQUENCES_397',display : '事件后果',align : 'center', width: "8%"},
  300. {name : 'DEPARTMENT_MANAGER_397',display : '部门负责人',align : 'center', width: "8%"},
  301. {name : 'REPORTER_397',display : '填报人',align : 'center', width: "8%"},
  302. {name : 'TEL_397',display : '填报人电话号码',align : 'center', width: "12%"},
  303. {name : 'RELEASE_STATE_397_SHOW',display : '发布状态',align : 'center', width: "8%"}
  304. ],
  305. usePager:true,
  306. checkbox : true,
  307. pageSize : 10,
  308. percentWidthMode : true,
  309. rownumbers:true
  310. };
  311. var toolBarOpt={
  312. items: [{
  313. text : '新增',
  314. click : "addForm",
  315. iconClass : 'add2_tem'
  316. }, {
  317. text : '删除',
  318. click : "del",
  319. iconClass : 'delete_tem'
  320. }, {
  321. text : '修改',
  322. click : "editForm",
  323. iconClass : 'update_tem'
  324. }, {
  325. text : '查看',
  326. click : "showInfo",
  327. iconClass : 'view_tem'
  328. }, {
  329. text : '发布',
  330. click :'release',
  331. iconClass : 'release_tem'
  332. }, {
  333. text : '收回',
  334. click : 'handOn',
  335. iconClass : 'delete_tem'
  336. }, {
  337. text : '绑定',
  338. click : "binding",
  339. iconClass : 'binding_tem'
  340. }/*, {
  341. text : '打印',
  342. click : "print",
  343. iconClass : 'print_tem'
  344. }*/]
  345. };
  346. var options={
  347. url :'/nwyj/ws/crud/CRUDService/queryQui',
  348. params:_this.loadParams,
  349. width:960,
  350. gridOptions:grid_option,
  351. singleRecodeOptions:{a:""},
  352. paperOpration:{showInput:"true"},
  353. toolBarOptions:toolBarOpt
  354. };
  355. /**grid载入数据**/
  356. g = gridAndSingleRecode = _this.listGrid = $("#dataGrid").quickgridAndSingleRecode(options);
  357. }
  358. };
  359. }();
  360. $(function() {
  361. EventManager.init();
  362. });
  363. function showPrimaryKey(fd_id,comp_id){
  364. if(typeof fd_id =="object"){
  365. fd_id = fd_id.FD_OBJECTID397;
  366. }
  367. $('#frmright', window.parent.document).attr('src', $.pathname()+"/page/business/em/event/EventQuickInfo_page.jsp?fd_id="+fd_id+"&comp_id="+comp_id);
  368. //window.open($.pathname()+"/page/business/em/event/EventQuickAllInfo.jsp?fd_id="+fd_id);
  369. }