e2e460c33a65d5b845031df4a7fca18210b2294a.svn-base 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author
  6. * @date 2015/09/14
  7. */
  8. TranferManager = 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/response/tranfer/TransferAddEdit.jsp?fd_id=");
  21. };
  22. /***修改信息***/
  23. _this.editForm = function(){
  24. var rows = _this.listGrid.getSelectedRows();
  25. var rowsLength = rows.length;
  26. if (rowsLength == 0) {
  27. top.Dialog.alert("请选中要修改的记录!");
  28. return;
  29. } else if (rowsLength > 1) {
  30. top.Dialog.alert("请选中一条要修改的记录!");
  31. return;
  32. } else {
  33. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID361;
  34. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/tranfer/TransferAddEdit.jsp?fd_id="+fd_id);
  35. }
  36. };
  37. /***发布***/
  38. _this.release = function(){
  39. //取得选中的Grid行
  40. var rows = _this.listGrid.getSelectedRows();
  41. //选中的行数
  42. var rowsLength = rows.length;
  43. if (rowsLength == 0) {
  44. top.Dialog.alert("请选中要发布的记录!");
  45. return;
  46. }
  47. var ids = "";
  48. for ( var i = 0; i < rowsLength; i++) {
  49. //将选中记录的id拼到一起
  50. ids += rows[i].FD_OBJECTID361 + ",";
  51. //判断选中的记录是否已经发布过
  52. if(rows[i].DAILY_STATE_361=="2"){
  53. if(rowsLength==1){
  54. top.Dialog.alert("选中的记录已经发布");
  55. }else{
  56. top.Dialog.alert("选中的记录有已经发布过的,请确认!");
  57. }
  58. return;
  59. }
  60. }
  61. //发布方法的路径
  62. var url = $.pathname() +"/ws/transfer/TransferService/release/";
  63. //需要传递的参数
  64. var params = {
  65. objectIDs : ids
  66. };
  67. top.Dialog.confirm("确定要发布吗?|发布", function() {
  68. $.request.del(url,params,function(result){
  69. if (result.Msg.sucsess == true) {
  70. top.Dialog.alert("发布成功!");
  71. // 刷新表格数据
  72. _this.listGrid.loadData();
  73. } else {
  74. top.Dialog.alert("发布失败!");
  75. }
  76. });
  77. });
  78. }
  79. /***删除信息***/
  80. _this.del = function(){
  81. var rows = _this.listGrid.getSelectedRows();
  82. var rowsLength = rows.length;
  83. if (rowsLength == 0) {
  84. top.Dialog.alert("请选中要删除的记录!");
  85. return;
  86. }
  87. var ids = "";
  88. for ( var i = 0; i < rowsLength; i++) {
  89. ids += rows[i].FD_OBJECTID361 + ",";
  90. }
  91. var url = $.pathname() +"/ws/crud/CRUDService/delete/";
  92. var params = {
  93. objectIDs : ids,
  94. classid : 361
  95. };
  96. top.Dialog.confirm("确定要删除吗?|删除", function() {
  97. $.request.del(url,params,function(result){
  98. if (result.Msg.sucsess == true) {
  99. top.Dialog.alert("删除成功!");
  100. // 刷新表格数据
  101. _this.listGrid.loadData();
  102. } else {
  103. top.Dialog.alert("删除失败!");
  104. }
  105. });
  106. });
  107. };
  108. /****查看详细信息****/
  109. _this.showInfo = function(){
  110. var rows = _this.listGrid.getSelectedRows();
  111. var rowsLength = rows.length;
  112. if (rowsLength == 0) {
  113. top.Dialog.alert("请选中要查看的记录!");
  114. return;
  115. } else if (rowsLength > 1) {
  116. top.Dialog.alert("请选中一条要查看的记录!");
  117. return;
  118. } else {
  119. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID361;
  120. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/tranfer/TransferInfo.jsp?fd_id="+fd_id);
  121. }
  122. };
  123. //导出excel
  124. _this.exportData = function(){
  125. excelExport(361,_this.exportParams,"交接班管理",['IS_DEL']);
  126. };
  127. //查询
  128. function search(obj){
  129. var queryFormValue = $queryForm.serialize();
  130. //将查询区域的表单转成json格式
  131. var queryParams = getQueryFormParams($queryForm);
  132. //去掉水印
  133. if(queryParams.RELIEVED_MAN_361=="交班人"){
  134. queryParams.RELIEVED_MAN_361="";
  135. }
  136. //两个json合并方法
  137. var params = concatJson({}, [_this.loadParams,queryParams]);
  138. _this.exportParams = params;
  139. _this.listGrid.setOptions( {
  140. params : params
  141. });
  142. //页号重置为1
  143. _this.listGrid.setNewPage(1);
  144. _this.listGrid.loadData();//加载数据
  145. }
  146. //更多
  147. function more(){
  148. $('#moreTable').toggle();
  149. }
  150. return {
  151. init : function() {
  152. $queryForm = $("#queryForm");
  153. /**绑定查询面板的按钮点击事件**/
  154. $searchButt = $("#searchButt");//查询按钮
  155. $searchButt.bind('click',function(){
  156. search();
  157. });
  158. /**绑定更多的按钮点击事件*/
  159. $more = $("#more"); //更多按钮
  160. $more.bind('click',function(){
  161. more();
  162. });
  163. //列表加载参数
  164. _this.loadParams = {
  165. listId : '361',
  166. condition : 'is_del=0'
  167. };
  168. _this.exportParams = _this.loadParams;
  169. /**grid载入数据**/
  170. _this.listGrid = $("#dataGrid").quiGrid({
  171. //title : "交接班管理数据列表",
  172. columns : [
  173. {
  174. name : 'FD_OBJECTID361',
  175. display : '主键',
  176. align : 'center',
  177. hide : true
  178. },
  179. {
  180. name : 'RELIEVED_MAN_361',
  181. display : '交班人',
  182. align : 'center',
  183. width: "10%"
  184. },
  185. {
  186. name : 'SUCCEED_MAN_361',
  187. display : '接班人',
  188. align : 'center',
  189. width: "10%"
  190. },
  191. {
  192. name : 'DEPT_361_SHOW',
  193. display : '部门',
  194. align : 'center',
  195. width: "20%"
  196. },
  197. {
  198. name : 'RELIEVED_TIME_361',
  199. display : '交接班时间',
  200. align : 'center',
  201. width: "20%"
  202. },
  203. {
  204. name : 'EW_ACTION_SITUATION_361',
  205. display : '预警行动情况',
  206. align : 'center',
  207. width: "28%"
  208. },
  209. {
  210. name : 'DAILY_STATE_361_SHOW',
  211. display : '状态',
  212. align : 'center',
  213. width: "10%"
  214. }],
  215. url : $.pathname() + '/ws/crud/CRUDService/queryQui',
  216. params : _this.loadParams,
  217. //排序字段
  218. sortName:'UPDATEDATE',
  219. sortOrder:"DESC",
  220. rownumbers : true,
  221. checkbox : true,
  222. height : "100%",
  223. width : "100%",
  224. pageSize : 10,
  225. percentWidthMode : true,
  226. toolbar : {
  227. items : [ {
  228. text : '新增',
  229. click : _this.addForm,
  230. iconClass : 'icon_add',
  231. id:"10000"
  232. }, {
  233. line : true
  234. }, {
  235. text : '删除',
  236. click : _this.del,
  237. iconClass : 'icon_delete',
  238. id:"10002"
  239. }, {
  240. line : true
  241. }, {
  242. text : '修改',
  243. click : _this.editForm,
  244. iconClass : 'icon_edit',
  245. id:"10001"
  246. }, {
  247. line : true
  248. }, {
  249. text : '查看',
  250. click : _this.showInfo,
  251. iconClass : 'icon_view',
  252. id:"10003"
  253. }, {
  254. line : true
  255. }, {
  256. text : '导出',
  257. click : _this.exportData,
  258. iconClass : 'icon_export',
  259. id:"10006"
  260. }, {
  261. line : true
  262. }, {
  263. text : '发布',
  264. click : _this.release,
  265. iconClass : 'icon_release',
  266. id:"10102"
  267. } ]
  268. }
  269. });
  270. showButtns1(_this.listGrid);
  271. }
  272. };
  273. }();
  274. $(function() {
  275. TranferManager.init();
  276. });