bf1b322772b2a6aeeaa824b7e09e18a085f58a5c.svn-base 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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. /**私有方法**/
  18. /***新增信息***/
  19. _this.addForm = function(){
  20. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventAddEdit.jsp?fd_id=");
  21. };
  22. var real_name = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  23. /***修改信息***/
  24. _this.editForm = function(){
  25. var rows = _this.listGrid.getSelectedRows();
  26. var rowsLength = rows.length;
  27. if (rowsLength == 0) {
  28. top.Dialog.alert("请选中要修改的记录!");
  29. return;
  30. } else if (rowsLength > 1) {
  31. top.Dialog.alert("请选中一条要修改的记录!");
  32. return;
  33. } else if (real_name!=rows[0].WRITER_394) {
  34. top.Dialog.alert("不是本人填报的,不能修改!");
  35. return;
  36. } else {
  37. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID394;
  38. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventAddEdit.jsp?fd_id="+fd_id);
  39. }
  40. };
  41. /***绑定***/
  42. _this.binding = function(){
  43. //取得选中的Grid行
  44. var rows = _this.listGrid.getSelectedRows();
  45. //选中的行数
  46. var rowsLength = rows.length;
  47. if (rowsLength == 0) {
  48. top.Dialog.alert("请选中要绑定的记录!");
  49. return;
  50. }else if (real_name!=rows[0].WRITER_394) {
  51. top.Dialog.alert("不是本人填报的,不能绑定!");
  52. return;
  53. }else if(rowsLength > 1){
  54. top.Dialog.alert("一次只能对一条记录进行绑定操作!");
  55. return;
  56. }
  57. var id = rows[0].FD_OBJECTID394;
  58. // var name = encodeURI(encodeURI(rows[0].EVENT_NAME_394));
  59. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventBinding.jsp?fd_id="+id);
  60. };
  61. /***删除信息***/
  62. _this.del = function(){
  63. var rows = _this.listGrid.getSelectedRows();
  64. var rowsLength = rows.length;
  65. if (rowsLength == 0) {
  66. top.Dialog.alert("请选中要删除的记录!");
  67. return;
  68. }if (real_name!=rows[0].WRITER_394) {
  69. top.Dialog.alert("不是本人填报的,不能删除!");
  70. return;
  71. }
  72. var ids = "";
  73. for ( var i = 0; i < rowsLength; i++) {
  74. ids += rows[i].FD_OBJECTID394 + ",";
  75. }
  76. if(ids!=""){
  77. ids = ids.substring(0,ids.length-1);
  78. }
  79. // var url = $.pathname() +"/ws/crud/CRUDService/delete/";
  80. var url = $.pathname() +"/ws/EventService/EventService/deleteEvent/";
  81. var params = {
  82. objectIDs : ids,
  83. classid : 394
  84. };
  85. top.Dialog.confirm("确定要删除吗?|删除", function() {
  86. $.request.del(url,params,function(result){
  87. if (result.Msg.sucsess == true) {
  88. top.Dialog.alert("删除成功!");
  89. var backCondition=_this.loadParams.condition;
  90. _this.listGrid.rend();//加载数据
  91. _this.loadParams.condition= backCondition;
  92. } else {
  93. top.Dialog.alert("删除失败!");
  94. }
  95. });
  96. });
  97. };
  98. /****查看详细信息****/
  99. _this.showInfo = function(){
  100. var rows = _this.listGrid.getSelectedRows();
  101. var rowsLength = rows.length;
  102. if (rowsLength == 0) {
  103. top.Dialog.alert("请选中要查看的记录!");
  104. return;
  105. } else if (rowsLength > 1) {
  106. top.Dialog.alert("请选中一条要查看的记录!");
  107. return;
  108. } else {
  109. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID394;
  110. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventInfo.jsp?fd_id="+fd_id);
  111. }
  112. };
  113. //导出excel
  114. _this.exportData = function(){
  115. excelExport(394,_this.exportParams,"交接班管理",['IS_DEL']);
  116. };
  117. //查询
  118. function search(obj){
  119. $queryForm = $("#queryForm");
  120. if($("#EVENT_NAME_394").val()=="事件名称"){
  121. $("#EVENT_NAME_394").val("");
  122. }
  123. $queryForm.serialize();
  124. //获取选中的值
  125. var searchCondition = getSelectCon(conditionData);
  126. var queryParams = getQueryFormParams($queryForm);
  127. var params=$.extend({},_this.loadParams,queryParams);
  128. //与之前参数条件拼接
  129. params.condition = searchCondition.condition + params.condition;
  130. _this.listGrid.setOptions({"params":params});
  131. //加载数据
  132. _this.listGrid.rend();
  133. //_this.loadParams.condition= backCondition;
  134. }
  135. //更多
  136. function more(){
  137. $('#moreTable').toggle();
  138. }
  139. return {
  140. init : function() {
  141. $("#EVENT_NAME_394").keydown(function(event){
  142. if(event.keyCode == 13){
  143. search();
  144. }
  145. });
  146. $queryForm = $("#queryForm");
  147. /**绑定查询面板的按钮点击事件**/
  148. $searchButt = $("#searchButt");//查询按钮
  149. $searchButt.bind('click',function(){
  150. search();
  151. });
  152. $searchButt.live('click',function(){
  153. search();
  154. });
  155. /**绑定更多的按钮点击事件*/
  156. $more = $("#more"); //更多按钮
  157. $more.bind('click',function(){
  158. more();
  159. });
  160. //列表加载参数
  161. _this.loadParams = {
  162. listId : '394',
  163. condition : 'is_del=0',
  164. direction:'DESC',
  165. sort: 'UPDATEDATE'
  166. };
  167. _this.exportParams = _this.loadParams;
  168. var grid_option={
  169. columns : [
  170. {name : 'FD_OBJECTID394',display : '主键',align : 'center',hide : true},
  171. {name : 'EVENT_NAME_394',display : '事件名称',align : 'center',width : "30%",isPrimaryKey:true,
  172. render:function(rowdata, rowindex, value, column){
  173. return "<div><a href='javascript:void(0)' onclick='showPrimaryKey(\""+rowdata.FD_OBJECTID394+"\")'>" + value + "</a></div>";
  174. }
  175. },
  176. {name : 'TYPE_394_SHOW',display : '事件类型',align : 'center', width: "20%"},
  177. {name : 'LEVEL_394_SHOW',display : '事件级别',align : 'center', width: "15%"},
  178. {name : 'WRITER_394',display : '填报人',align : 'center', width: "15%"},
  179. {name : 'AREA_394',display : '属地',align : 'center', width: "20%"}],
  180. usePager:true,
  181. checkbox : true,
  182. /* width : '99.5%', */
  183. pageSize : 10,
  184. percentWidthMode : true,
  185. rownumbers:true,
  186. };
  187. //查询出该角色权限下的所有按钮ID roleButtonArr()方法需引入/nwyj/scripts/freamwork/com/sinosoft/common/common.js
  188. var roleCons = roleButtonArr();
  189. var toolBarOpt={
  190. items: [{
  191. text : '新增',
  192. click : "addForm",
  193. iconClass : 'add2_tem'
  194. }, {
  195. text : '删除',
  196. click : "del",
  197. iconClass : 'delete_tem'
  198. }, {
  199. text : '修改',
  200. click : "editForm",
  201. iconClass : 'update_tem'
  202. }, /*{
  203. text : '查看',
  204. click : "showInfo",
  205. iconClass : 'view_tem'
  206. }, */{
  207. text : '绑定',
  208. click : "binding",
  209. iconClass : 'binding_tem'
  210. }],
  211. roleCons:""};//将角色id传参到gridroleCons:roleCons
  212. var options={
  213. url :'/nwyj/ws/crud/CRUDService/queryQui',
  214. params:_this.loadParams,
  215. width:960,
  216. gridOptions:grid_option,
  217. singleRecodeOptions:{a:"aa"},
  218. paperOpration:{showInput:"true"},
  219. toolBarOptions:toolBarOpt
  220. };
  221. /**grid载入数据**/
  222. /*_this.listGrid = $("#dataGrid").quiGrid(gridOptions);*/
  223. gridAndSingleRecode = _this.listGrid = $("#dataGrid").quickgridAndSingleRecode(options);
  224. }
  225. };
  226. }();
  227. $(function() {
  228. EventManager.init();
  229. });
  230. function showPrimaryKey(fd_id){
  231. if(typeof fd_id =="object"){
  232. fd_id = fd_id.FD_OBJECTID394;
  233. }
  234. var url = $.pathname()+"/page/business/em/event/EventAllInfo.jsp?fd_id="+fd_id;
  235. window.open(url);
  236. }