7693f0e3f8526274d591dd8ed162e45aac2a5070.svn-base 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  19. var realName_ID = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  20. //部门id
  21. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  22. //部门名称
  23. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  24. //父部门id
  25. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  26. /**私有方法**/
  27. /***新增信息***/
  28. _this.addForm = function(){
  29. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventAddEdit.jsp?fd_id=");
  30. };
  31. /***修改信息***/
  32. _this.editForm = function(){
  33. var rows = _this.listGrid.getSelectedRows();
  34. var rowsLength = rows.length;
  35. if (rowsLength == 0) {
  36. top.Dialog.alert("请选中要修改的记录!");
  37. return;
  38. } else if (rowsLength > 1) {
  39. top.Dialog.alert("请选中一条要修改的记录!");
  40. return;
  41. } else if (realName_ID!=rows[0].INPUT_PER_ID_363) {
  42. top.Dialog.alert("不是本人填报的,不能修改!");
  43. return;
  44. } else {
  45. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID363;
  46. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventAddEdit.jsp?fd_id="+fd_id);
  47. }
  48. };
  49. /***绑定***/
  50. _this.binding = function(){
  51. //取得选中的Grid行
  52. var rows = _this.listGrid.getSelectedRows();
  53. //选中的行数
  54. var rowsLength = rows.length;
  55. if (rowsLength == 0) {
  56. top.Dialog.alert("请选中要绑定的记录!");
  57. return;
  58. }else if (realName_ID!=rows[0].INPUT_PER_ID_363) {
  59. top.Dialog.alert("不是本人填报的,不能绑定!");
  60. return;
  61. }else if(rowsLength > 1){
  62. top.Dialog.alert("一次只能对一条记录进行绑定操作!");
  63. return;
  64. }
  65. var id = rows[0].FD_OBJECTID363;
  66. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/event/EventBinding.jsp?fd_id="+id);
  67. };
  68. /***删除信息***/
  69. _this.del = function(){
  70. var rows = _this.listGrid.getSelectedRows();
  71. var rowsLength = rows.length;
  72. if (rowsLength == 0) {
  73. top.Dialog.alert("请选中要删除的记录!");
  74. return;
  75. }if (realName_ID!=rows[0].INPUT_PER_ID_363) {
  76. top.Dialog.alert("不是本人填报的,不能删除!");
  77. return;
  78. }
  79. var ids = "";
  80. for ( var i = 0; i < rowsLength; i++) {
  81. ids += rows[i].FD_OBJECTID363 + ",";
  82. }
  83. if(ids!=""){
  84. ids = ids.substring(0,ids.length-1);
  85. }
  86. var url = $.pathname() +"/ws/EventService/EventService/deleteEvent/";
  87. var params = {
  88. objectIDs : ids,
  89. classid : 363
  90. };
  91. top.Dialog.confirm("确定要删除吗?|删除", function() {
  92. $.request.del(url,params,function(result){
  93. if (result.Msg.sucsess == true) {
  94. top.Dialog.alert("删除成功!");
  95. var backCondition=_this.loadParams.condition;
  96. _this.listGrid.rend();//加载数据
  97. _this.loadParams.condition= backCondition;
  98. } else {
  99. top.Dialog.alert("删除失败!");
  100. }
  101. });
  102. });
  103. };
  104. /****查看详细信息****/
  105. _this.showInfo = function(){
  106. var rows = _this.listGrid.getSelectedRows();
  107. var rowsLength = rows.length;
  108. if (rowsLength == 0) {
  109. top.Dialog.alert("请选中要查看的记录!");
  110. return;
  111. } else if (rowsLength > 1) {
  112. top.Dialog.alert("请选中一条要查看的记录!");
  113. return;
  114. } else {
  115. var fd_id = _this.listGrid. getSelectedRow().FD_OBJECTID363;
  116. $.indexOpenNextWindow($.pathname()+"/page/business/em/event/EventInfo.jsp?fd_id="+fd_id);
  117. }
  118. };
  119. /****调整为发布****/
  120. _this.toRelease = function(){
  121. var rows = _this.listGrid.getSelectedRows();
  122. var rowsLength = rows.length;
  123. if (rowsLength == 0) {
  124. top.Dialog.alert("请选中要调整的记录!");
  125. return;
  126. } else if (rowsLength > 1) {
  127. top.Dialog.alert("请选中一条要调整的记录!");
  128. return;
  129. }
  130. var fd_id = _this.listGrid. getSelectedRow().FD_OBJECTID363;
  131. var url = $.pathname() + '/ws/crud/CRUDService/update/';
  132. var params = {
  133. classid : "363",
  134. FD_OBJECTID363 : fd_id,
  135. EVENT_STATE_363 : "1"
  136. };
  137. top.Dialog.confirm("确定调整为发布吗", function() {
  138. $.request.del(url,params,function(result){
  139. if (result.Msg.sucsess == true) {
  140. top.Dialog.alert("发布成功!");
  141. _this.listGrid.rend();//加载数据
  142. } else {
  143. top.Dialog.alert("发布失败!");
  144. }
  145. });
  146. });
  147. };
  148. /****结束****/
  149. _this.toFinish = function(){
  150. var rows = _this.listGrid.getSelectedRows();
  151. var rowsLength = rows.length;
  152. if (rowsLength == 0) {
  153. top.Dialog.alert("请选中要结束的记录!");
  154. return;
  155. } else if (rowsLength > 1) {
  156. top.Dialog.alert("请选中一条要结束的记录!");
  157. return;
  158. }
  159. var fd_id = _this.listGrid. getSelectedRow().FD_OBJECTID363;
  160. var url = $.pathname() + '/ws/crud/CRUDService/update/';
  161. var params = {
  162. classid : "363",
  163. FD_OBJECTID363 : fd_id,
  164. EVENT_STATE_363 : "2"
  165. };
  166. top.Dialog.confirm("确定结束事件吗", function() {
  167. $.request.del(url,params,function(result){
  168. if (result.Msg.sucsess == true) {
  169. top.Dialog.alert("事件已结束!");
  170. _this.listGrid.rend();//加载数据
  171. } else {
  172. console.log("结束事件失败!");
  173. }
  174. });
  175. });
  176. };
  177. //导出excel
  178. _this.exportData = function(){
  179. excelExport(363,_this.exportParams,"事件列表",['IS_DEL']);
  180. };
  181. //查询
  182. function search(obj){
  183. $queryForm = $("#queryForm");
  184. if($("#EVENT_NAME_363").val()=="事件名称"){
  185. $("#EVENT_NAME_363").val("");
  186. }
  187. $queryForm.serialize();
  188. //获取选中的值
  189. var searchCondition = getSelectCon(conditionData);
  190. var queryParams = getQueryFormParams($queryForm);
  191. var params=$.extend({},_this.loadParams,queryParams);
  192. //与之前参数条件拼接
  193. params.condition = searchCondition.condition + params.condition;
  194. _this.listGrid.setOptions({"params":params});
  195. //加载数据
  196. _this.listGrid.rend();
  197. }
  198. //更多
  199. function more(){
  200. $('#moreTable').toggle();
  201. }
  202. return {
  203. init : function() {
  204. $("#EVENT_NAME_363").keydown(function(event){
  205. if(event.keyCode == 13){
  206. search();
  207. }
  208. });
  209. $queryForm = $("#queryForm");
  210. /**绑定查询面板的按钮点击事件**/
  211. $searchButt = $("#searchButt");//查询按钮
  212. $searchButt.bind('click',function(){
  213. search();
  214. });
  215. $searchButt.live('click',function(){
  216. search();
  217. });
  218. /**绑定更多的按钮点击事件*/
  219. $more = $("#more"); //更多按钮
  220. $more.bind('click',function(){
  221. more();
  222. });
  223. //列表加载参数
  224. _this.loadParams = {
  225. listId : '363',
  226. condition : "is_del=0 and ISSUE_UNITE_ID='"+deptId+"' ",
  227. direction:'DESC',
  228. sort: 'UPDATEDATE'
  229. };
  230. _this.exportParams = _this.loadParams;
  231. var grid_option={
  232. columns : [
  233. {name : 'EVENT_NAME_363',display : '事件名称',align : 'center',width : "20%",isPrimaryKey:true,
  234. render:function(rowdata, rowindex, value, column){
  235. return "<div><a href='javascript:void(0)' onclick='showPrimaryKey(\""+rowdata.FD_OBJECTID363+"\")'>" + value + "</a></div>";
  236. }
  237. },
  238. {name : 'EVENT_TYPE_363_SHOW',display : '事件类型',align : 'center', width: "20%"},
  239. {name : 'INPUT_PER_NAME_363',display : '录入人',align : 'center', width: "20%"},
  240. {name : 'EVENT_PLACE_363',display : '属地',align : 'center', width: "20%"},
  241. {name : 'EVENT_STATE_363_SHOW',display : '状态',align : 'center', width: "20%"}],
  242. usePager:true,
  243. checkbox : true,
  244. pageSize : 10,
  245. percentWidthMode : true,
  246. rownumbers:true
  247. };
  248. //查询出该角色权限下的所有按钮ID roleButtonArr()方法需引入/nwyj/scripts/freamwork/com/sinosoft/common/common.js
  249. var roleCons = roleButtonArr();
  250. var toolBarOpt={
  251. items: [{
  252. text : '新增',
  253. click : "addForm",
  254. iconClass : 'add2_tem'
  255. }, {
  256. text : '删除',
  257. click : "del",
  258. iconClass : 'delete_tem'
  259. }, {
  260. text : '修改',
  261. click : "editForm",
  262. iconClass : 'update_tem'
  263. }, {
  264. text : '事件关联',
  265. click : "binding",
  266. iconClass : 'binding_tem'
  267. }, {
  268. text : '调整为发布',
  269. click : "toRelease",
  270. iconClass : 'release_tem'
  271. }, {
  272. text : '结束事件',
  273. click : "toFinish",
  274. iconClass : 'end_tem'
  275. }],
  276. roleCons:""};//将角色id传参到gridroleCons:roleCons
  277. var options={
  278. url :'/nwyj/ws/crud/CRUDService/queryQui',
  279. params:_this.loadParams,
  280. width:960,
  281. gridOptions:grid_option,
  282. singleRecodeOptions:{a:"aa"},
  283. paperOpration:{showInput:"true"},
  284. toolBarOptions:toolBarOpt
  285. };
  286. /**grid载入数据**/
  287. /*_this.listGrid = $("#dataGrid").quiGrid(gridOptions);*/
  288. gridAndSingleRecode = _this.listGrid = $("#dataGrid").quickgridAndSingleRecode(options);
  289. }
  290. };
  291. }();
  292. $(function() {
  293. EventManager.init();
  294. });
  295. function showPrimaryKey(fd_id){
  296. if(typeof fd_id =="object"){
  297. fd_id = fd_id.FD_OBJECTID363;
  298. }
  299. var url = $.pathname()+"/page/business/em/event/EventAllInfo.jsp?fd_id="+fd_id;
  300. $.indexOpenNextWindow(url);
  301. }