49377331c3356c5528c5528fd3ddd41cea0ac7bd.svn-base 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author HXB
  6. * @date 2015/09/18
  7. */
  8. ReportInput = function() {
  9. /** 定义变量* */
  10. var _this = this;
  11. _this.listGrid = null;// 数据列表
  12. _this.searchPanel = null; // 查询面板
  13. $queryForm = null;// 查询区域表单
  14. $searchButt = null;// 查询按钮
  15. $more = null; // 更多
  16. _this.loadParams = null;// 列表加载参数
  17. var currDate = getNowFormatDate();
  18. // 部门id
  19. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  20. var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  21. //登陆用户的单位名称
  22. var corp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  23. /** 私有方法* */
  24. /** *修改信息** */
  25. _this.editForm = function() {
  26. var rows = _this.listGrid.getSelectedRows();
  27. var rowsLength = rows.length;
  28. if (rowsLength == 0) {
  29. top.Dialog.alert("请选中要修改的记录!");
  30. return;
  31. } else if (rowsLength > 1) {
  32. top.Dialog.alert("请选中一条要修改的记录!");
  33. return;
  34. } else {
  35. var row = _this.listGrid.getSelectedRow();
  36. if (row.TASK_STATE_610 == 1) {
  37. top.Dialog.alert("选中的记录已经发布过,不能再修改!");
  38. return;
  39. }
  40. var fd_id = row.FD_OBJECTID610;
  41. $('#frmright', window.parent.document).attr('src', $.pathname() + '/page/business/gps/taskManagement/taskManagementUpdate.jsp?fd_id=' + fd_id);
  42. }
  43. };
  44. /** *导入** */
  45. _this.import_task = function() {
  46. var diag = new top.Dialog();
  47. diag.Title = "导入保供电任务";
  48. diag.Width=700;
  49. diag.Height=300;
  50. diag.URL = "/nwyj/page/business/gps/taskManagement/bgd_task_import.jsp";
  51. diag.show();
  52. };
  53. /** *发布** */
  54. _this.release = function() {
  55. // 取得选中的Grid行
  56. var rows = _this.listGrid.getSelectedRows();
  57. // 选中的行数
  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 {
  66. var row = _this.listGrid.getSelectedRow();
  67. // 判断选中的记录是否已经发布过
  68. if (row.TASK_STATE_610 == 1) {
  69. top.Dialog.alert("选中的记录已经发布过的,请重新选择!");
  70. return;
  71. }
  72. var fd_id = row.FD_OBJECTID610; //
  73. var areas = row.GPS_AREA_ID_610;
  74. var bgdname=row.PROGRAM_NAME_610;
  75. /*alert(areas);
  76. return;*/
  77. var corp_ids = row.GPS_AREA_ID_610;
  78. var params = {
  79. classid : "610",
  80. FD_OBJECTID610 : fd_id,
  81. TASK_STATE_610 : "1",
  82. ISSUE_TIME_610:currDate,
  83. ISSUE_DEPT_610:deptId,
  84. //taskPublish:true
  85. };
  86. var receiver = '';//短信功能的“接收人”
  87. var telephine= '';//短信功能的“电话”
  88. var alertmsg = "确定要发布吗?|发布";
  89. top.Dialog.confirm(alertmsg, function() {
  90. var flag = 1;
  91. $.ajax({
  92. url : $.pathname() + '/ws/crud/CRUDService/update/',
  93. type : 'post',
  94. timeout : 15000,
  95. data : params,
  96. dataType : 'json',
  97. success : function(data) {
  98. //top.Dialog.alert('发布成功!', null, null, null, -1);
  99. _this.listGrid.rend();
  100. $.post($.pathname() + "/ws/sendmenu/SendMsgService/dwrMsg",{method:"sendMessage",msg:"最新发布保供电任务:"+bgdname,url:"'http://localhost:8080/nwyj/page/frameWork.html'"},function(){},"json");
  101. top.Dialog.confirm("发布成功,是否发送短信通知?|提醒", function() {//参考保供电值班安排表发布后的短信
  102. //短信
  103. $.ajax({
  104. url : $.pathname() + '/ws/bgd_duty/BgdDutyService/getTaskInfos/',
  105. type : 'post',
  106. data : areas,//要传的参数---------------------------------------------------保供电范围
  107. async:false,
  108. dataType : 'json',
  109. success : function(data){
  110. for(var i=0;i<data.length;i++){
  111. //alert(data[i].USER_ID+" data[i].MOBILE="+data[i].MOBILE);
  112. if(data[i] != null && data[i].USER_ID!='' && data[i].USER_ID!=null && data[i].MOBILE!='' && data[i].MOBILE!=null){
  113. receiver+=data[i].USER_ID+";";
  114. telephine+=data[i].MOBILE+";";
  115. }
  116. };
  117. //alert(receiver+"telephine="+telephine);
  118. addMsg(
  119. receiver,//data.list.split("|")[0],//要发送的人
  120. telephine,//data.list.split("|")[1],//要发送的手机号
  121. "新发布了一个保供电任务,请及时查看!"//要发送的信息内容
  122. );
  123. /*
  124. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/sendMsgForMuchDwr/';
  125. var msg = "<a href=\"javascript:void(0)\" onclick=\"openY('/nwyj/page/business/gps/taskManagement/detailTaskManagement.jsp?fd_id="+fd_id+"')\">"+corp_name+"发布的保供电任务</a>";
  126. var params = {
  127. parentDeptName:corp_ids,
  128. msg:msg
  129. };
  130. $.ajax({
  131. url : url,
  132. type : 'post',
  133. data : params,
  134. dataType : 'text',
  135. timeout : 60000,
  136. success : function(data){
  137. },
  138. error : function(){
  139. $.messager.alert('操作失败');
  140. }
  141. });*/
  142. },
  143. error : function(e){
  144. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  145. }
  146. });
  147. /*$.ajax({
  148. url : $.pathname()+ '/ws/qrps/QueryReportProgrammeService/reportPlanSendMsg',
  149. type : 'post',
  150. data : {
  151. 'fd_id' : ids,
  152. 'userId':userId,
  153. 'comp_id':comp_id
  154. },
  155. async:false,
  156. dataType : 'json',
  157. success : function(data) {
  158. // addMsg('','',"新发布了一个保供电值班安排表,请及时填报!");
  159. addMsg(
  160. data.list.split("|")[0],//要发送的人
  161. data.list.split("|")[1],//要发送的手机号
  162. "新发布了一个保供电值班安排表,请及时填报!"//要发送的信息内容
  163. );
  164. },
  165. error : function(e) {
  166. $.messager.alert('访问服务失败!', 'error');
  167. }
  168. });*/
  169. });
  170. if(flag==1){//接口
  171. $.ajax({
  172. url : $.pathname() + '/ws/alertToImpl/AlertToImplService/taskReleaseSupply/',
  173. type : 'post',
  174. timeout : 15000,
  175. data : {
  176. fd_objectid : fd_id
  177. },
  178. dataType : 'json',
  179. success : function(result) {
  180. },error : function(e) {
  181. /*$.messager.alert('发布接口失败!');*/
  182. }
  183. });
  184. }
  185. },
  186. error : function(e) {
  187. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  188. }
  189. });
  190. });
  191. }
  192. };
  193. /** *删除信息** */
  194. _this.del = function() {
  195. var rows = _this.listGrid.getSelectedRows();
  196. var rowsLength = rows.length;
  197. if (rowsLength == 0) {
  198. top.Dialog.alert("请选中要删除的记录!");
  199. return;
  200. }
  201. var ids = "";
  202. for (var i = 0; i < rowsLength; i++) {
  203. ids += rows[i].FD_OBJECTID610 + ",";
  204. var row = rows[i];
  205. if (row.TASK_STATE_610 == 1) {
  206. top.Dialog.alert("选中的记录有已发布,请重新选择!");
  207. return;
  208. }
  209. }
  210. var url = $.pathname() + "/ws/bgd_duty/BgdDutyService/deleteTask/";
  211. var params = {
  212. objectIDs : ids,
  213. classid : 610
  214. };
  215. /*top.Dialog.confirm("确定要删除吗?|删除", function() {
  216. $.request.del(url, params, function(result) {
  217. if (result.Msg.sucsess == true) {
  218. top.Dialog.alert("删除成功!");
  219. // 刷新表格数据
  220. _this.listGrid.rend();
  221. } else {
  222. top.Dialog.alert("删除失败!");
  223. }
  224. });
  225. });*/
  226. top.Dialog.confirm("确定要删除吗?|删除", function() {
  227. $.ajax({
  228. url : url,
  229. type : 'post',
  230. data : params,
  231. dataType : 'json',
  232. success : function(data) {
  233. top.Dialog.alert("删除成功!");
  234. // 刷新表格数据
  235. _this.listGrid.rend();
  236. },
  237. error : function(e){
  238. $.messager.alert('删除失败', '访问服务失败!', 'error');
  239. }
  240. });
  241. });
  242. };
  243. _this.rollback = function(){
  244. // 取得选中的Grid行
  245. var rows = _this.listGrid.getSelectedRows();
  246. // 选中的行数
  247. var rowsLength = rows.length;
  248. if (rowsLength == 0) {
  249. top.Dialog.alert("请选中要撤销的记录!");
  250. return;
  251. } else if (rowsLength > 1) {
  252. top.Dialog.alert('请选中一条要撤销的记录!');
  253. return;
  254. } else {
  255. var row = _this.listGrid.getSelectedRow();
  256. // 判断选中的记录是否已经发布过
  257. if (row.TASK_STATE_610 != 1) {
  258. top.Dialog.alert("选中的记录未发布,不需要撤销,请重新选择!");
  259. return;
  260. }
  261. if(row.INPUT_NAME_ID_610!=userId){
  262. top.Dialog.alert("只有填写人本人才能执行撤销操作!");
  263. return;
  264. }
  265. var fd_id = row.FD_OBJECTID610; //
  266. var params = {
  267. classid : "610",
  268. FD_OBJECTID610 : fd_id,
  269. TASK_STATE_610 : "0",
  270. ISSUE_TIME_610:""
  271. };
  272. var alertmsg = "确定要撤销吗?";
  273. top.Dialog.confirm(alertmsg, function() {
  274. $.ajax({
  275. url : $.pathname() + '/ws/crud/CRUDService/update/',
  276. type : 'post',
  277. timeout : 15000,
  278. data : params,
  279. dataType : 'json',
  280. success : function(data) {
  281. //top.Dialog.alert('发布成功!', null, null, null, -1);
  282. _this.listGrid.rend();
  283. },
  284. error : function(e) {
  285. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  286. }
  287. });
  288. });
  289. }
  290. }
  291. // 打开保供电任务信息页面
  292. _this.openDetail = function(rowindex) {
  293. var row = _this.listGrid.getRow(rowindex);
  294. var fd_id = row.FD_OBJECTID610;
  295. $('#frmright', window.parent.document).attr('src',$.pathname()+
  296. '/page/business/gps/taskManagement/taskAllmsg.jsp?fd_id='+fd_id);
  297. // window.open($.pathname() + '/page/business/gps/taskManagement/taskAllmsg.jsp?fd_id=' + fd_id, "保供电任务信息")
  298. };
  299. /** **查看详细信息*** */
  300. _this.show = function() {
  301. var rows = _this.listGrid.getSelectedRows();
  302. var rowsLength = rows.length;
  303. if (rowsLength == 0) {
  304. top.Dialog.alert("请选中要查看的记录!");
  305. return;
  306. } else if (rowsLength > 1) {
  307. top.Dialog.alert("请选中一条要查看的记录!");
  308. return;
  309. } else {
  310. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID610;
  311. $('#frmright', window.parent.document).attr('src', $.pathname() + '/page/business/gps/taskManagement/detailTaskManagement.jsp?fd_id=' + fd_id);
  312. }
  313. };
  314. // 查询
  315. function search(obj) {
  316. if($("#PROGRAM_NAME_610").val() == "任务名称") {
  317. $("#PROGRAM_NAME_610").val("");
  318. }
  319. $queryForm.serialize();
  320. //获取选中的值
  321. var searchCondition = getSelectCon(conditionData);
  322. var queryParams = getQueryFormParams($queryForm);
  323. var params=$.extend({},_this.loadParams,queryParams);
  324. //与之前参数条件拼接
  325. params.condition = searchCondition.condition + params.condition;
  326. _this.listGrid.setOptions({"params":params});
  327. //加载数据
  328. // _this.listGrid.setNewPage(1);
  329. _this.listGrid.rend();
  330. }
  331. // 更多
  332. function more() {
  333. $('#moreDiv').toggle();
  334. document.getElementById("queryForm").reset(); // 重置一下表单
  335. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  336. }
  337. /*// 更多
  338. function more() {
  339. $('#moreDiv').toggle(200,function(){
  340. $("#emptyCondition").click();
  341. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  342. });
  343. }*/
  344. return {
  345. init : function() {
  346. /*$("#PROGRAM_NAME_610").keydown(function(event){
  347. if(event.keyCode == 13){
  348. search();
  349. }
  350. });*/
  351. getCompName();//查询里面的单位
  352. $queryForm = $("#queryForm");
  353. /** 绑定查询面板的按钮点击事件* */
  354. $searchButt = $("#searchButt");// 查询按钮
  355. $searchButt.live({
  356. click: function() {
  357. // do something on click
  358. search();
  359. }
  360. });
  361. /*$("#PROGRAM_NAME_610").bind('keydown', function() {
  362. if(event.keyCode==13){search();};
  363. });*/
  364. /*$searchButt.bind('click', function() {
  365. search();
  366. });*/
  367. $("#PROGRAM_NAME_610").bind('enter', function() {
  368. search();
  369. });
  370. /** 绑定更多的按钮点击事件 */
  371. $more = $("#more"); // 更多按钮
  372. $more.bind('click', function() {
  373. more();
  374. });
  375. // 获得面板对象
  376. _this.searchPanel = $("#searchPanel");
  377. // 列表加载参数
  378. _this.loadParams = {
  379. listId : '610',
  380. condition : " (((INPUT_UNIT_ID='"+deptId+"' or GPS_AREA_ID like '%"+deptId+"%') AND TASK_STATE=1) OR (INPUT_NAME_ID='"+userId+"')) and IS_DEL=0 and PROGRAM_STATE = '1' ", //and TASK_STATE!='null'
  381. direction : 'desc', // 排序方式
  382. sort : 'UPDATEDATE'
  383. };
  384. /** grid载入数据* */
  385. /* _this.listGrid = $("#dataGrid").quiGrid({ */
  386. var grid_option={
  387. columns : [ {
  388. display : '任务名称',
  389. name : 'PROGRAM_NAME_610',
  390. showTitle:true,
  391. width : "8%",
  392. isSort : false,
  393. isPrimaryKey:true,
  394. render : function(rowdata, rowindex, value, column) {
  395. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
  396. }
  397. },{
  398. display : '任务编号',
  399. name : 'GPS_TASK_NUMBER_610',
  400. showTitle:true,
  401. width : "3%"
  402. }/*,{
  403. display : '填报单位',
  404. name : 'INPUT_UNIT_NAME_610',
  405. showTitle:true,
  406. width : "8%"
  407. }*/,{
  408. /*display : '任务属性',
  409. columns :[{*/
  410. display : '任务性质',
  411. name : 'GPS_TASK_PROPERTY_610_SHOW',
  412. showTitle:true,
  413. width : "8%"
  414. },{
  415. display : '任务级别',
  416. name : 'GPS_LEVEL_610_SHOW',
  417. showTitle:true,
  418. width : "5%"
  419. },{
  420. display : '任务类别',
  421. name : 'GPS_TASK_TYPE_610_SHOW',
  422. showTitle:true,
  423. width : "8%"
  424. },{
  425. display : '任务来源',
  426. name : 'GPS_SIREL_610_SHOW',
  427. showTitle:true,
  428. width : "10%"
  429. },{
  430. display : '计划性',
  431. name : 'GPS_TASK_PLAN_TYPE_610_SHOW',
  432. showTitle:true,
  433. width : "8%"
  434. /*}]*/
  435. },{/*
  436. display : '保供电任务时间',
  437. columns :[{*/
  438. display : '开始日期',
  439. name : 'START_TIME_610',
  440. showTitle : true,
  441. width : "5%"
  442. }, {
  443. display : '结束日期',
  444. name : 'END_TIME_610',
  445. showTitle : true,
  446. width : "5%"
  447. /*}, {
  448. display : '持续时间',
  449. name : 'GPS_CONTINATION_TIME_610',
  450. showTitle : true,
  451. width : "8%"
  452. }]*/
  453. }, /*{
  454. display : '保供电资源投入',
  455. columns :[{
  456. display : '应急发电车(UPS电源)',
  457. columns :[{
  458. display : '单日最大用量/台',
  459. name : 'GPS_TASK_FDC_DAY_610',
  460. showTitle : true,
  461. width : "8%"
  462. }, {
  463. display : '投入总量/台次',
  464. name : 'GPS_TASK__FDC_TOTAL_610',
  465. showTitle : true,
  466. width : "8%"
  467. }]
  468. }, {
  469. display : '应急发电机(UPS电源)',
  470. columns :[{
  471. display : '单日最大用量/台',
  472. name : 'GPS_TASK_FDJ_DAY_610',
  473. showTitle : true,
  474. width : "8%"
  475. }, {
  476. display : '投入总量/台次',
  477. name : 'GPS_TASK_FDJ_TOTAL_610',
  478. showTitle : true,
  479. width : "8%"
  480. }]
  481. }, {
  482. display : '车辆/辆次',
  483. name : 'GPS_TASK_CAR_610',
  484. showTitle : true,
  485. width : "8%"
  486. }]
  487. }, {
  488. display : '保供电人员投入',
  489. columns :[{
  490. display : '值班指挥管理人员/人日',
  491. name : 'GPS_TASK_ZBZHGLRY_610',
  492. showTitle : true,
  493. width : "8%"
  494. }, {
  495. display : '本单位班组人员/人日',
  496. name : 'GPS_TASK_BDWBZRY_610',
  497. showTitle : true,
  498. width : "8%"
  499. }, {
  500. display : '安保人员/人日',
  501. name : 'GPS_TASK_ABRY_610',
  502. showTitle : true,
  503. width : "8%"
  504. }, {
  505. display : '外委生产人员/人日',
  506. name : 'GPS_TASK_WWSCRY_610',
  507. showTitle : true,
  508. width : "8%"
  509. }]
  510. },*/{
  511. display : '保供电区域',
  512. name : 'GPS_AREA_CITY_610',
  513. showTitle:true,
  514. width : "5%"
  515. }, {
  516. display : '保供电实施单位',
  517. name : 'GPS_AREA_NAME_610',
  518. showTitle:true,
  519. width : "12%"
  520. }, {
  521. display : '下达状态',
  522. name : 'TASK_STATE_610_SHOW',
  523. width : "3%"
  524. }, {
  525. display : '执行状态',
  526. name : 'GPS_ZX_STATE_610',
  527. width : "3%",
  528. render : function(rowdata, rowindex, value, column) {
  529. var value = "";
  530. if(rowdata.TASK_STATE_610=='0'){
  531. value = "未执行";
  532. }else{
  533. if(getDateTime()>rowdata.END_TIME_610){
  534. value = "已结束";
  535. }else {
  536. value = "执行中";
  537. }
  538. }
  539. return value;
  540. }
  541. } ],
  542. rownumbers : true,
  543. checkbox : true,
  544. pageSize : 10,
  545. percentWidthMode : true
  546. };
  547. var roleCons = roleButtonArr();
  548. var toolBarOpt = {
  549. items : [ {
  550. text : '删除',
  551. click : 'del',
  552. iconClass : 'delete_tem',
  553. disabled: false,
  554. id:"bgdsc"
  555. }, {
  556. text : '修改',
  557. click : 'editForm',
  558. iconClass : 'update_tem',
  559. disabled: false,
  560. id:"bgdxg"
  561. }, {
  562. text : '查看',
  563. click : 'show',
  564. iconClass : 'view_tem',
  565. id:'bgdck'
  566. }, {
  567. text : '发布',
  568. click : 'release',
  569. iconClass : 'release_tem',
  570. disabled: false,
  571. id:'bgdfb'
  572. }, {
  573. text : '撤销',
  574. click : 'rollback',
  575. iconClass : 'retract_tem',
  576. disabled: false,
  577. id:'bgdfb'
  578. } , {
  579. text : '导入',
  580. click : 'import_task',
  581. iconClass : 'import_tem',
  582. disabled: false,
  583. id:'bgdfb'
  584. }],
  585. roleCons : roleCons
  586. };
  587. var options = {
  588. url : '/nwyj/ws/crud/CRUDService/queryQui',
  589. params : _this.loadParams,
  590. width : 960,
  591. gridOptions : grid_option,
  592. paperOpration : {
  593. showInput : "true"
  594. },
  595. toolBarOptions : toolBarOpt
  596. };
  597. /** grid载入数据(定义数据列表)* */
  598. _this.listGrid = gridAndSingleRecode = $("#dataGrid").quickgridAndSingleRecode(options);
  599. /* }); */
  600. }
  601. };
  602. }();
  603. $(function() {
  604. ReportInput.init();
  605. });
  606. function showPrimaryKey(obj,index){
  607. var fd_id = obj.FD_OBJECTID610;
  608. $('#frmright', window.parent.document).attr('src',$.pathname()+
  609. '/page/business/gps/taskManagement/taskAllmsg.jsp?fd_id='+fd_id);
  610. }
  611. //获得当前系统时间:年月日时分
  612. function getDateTime(){
  613. var s="";
  614. var d = allGetServerTime();
  615. var vYear = d.getFullYear();
  616. var vMon = d.getMonth() + 1;
  617. var vDay = d.getDate();
  618. var h = d.getHours();
  619. var m = d.getMinutes();
  620. var se = d.getSeconds();
  621. s=vYear+"-"+(vMon<10 ? "0" + vMon : vMon)+"-"+(vDay<10 ? "0"+ vDay : vDay)+" "+(h<10 ? "0"+ h : h)+":"+(m<10 ? "0" + m : m)+":"+(se<10 ? "0" +se : se);
  622. return s;
  623. }