067174d5af91ce1cfba68b741f048bfe99a6aa48.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author LJP
  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. //部门id
  18. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  19. var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  20. /** 私有方法* */
  21. /** *新增信息** */
  22. _this.addForm = function() {
  23. $('#frmright', window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/report/reportInput/ReportInputAddEdit.jsp?fd_id=");
  24. };
  25. /** *修改信息** */
  26. _this.editForm = function() {
  27. var rows = _this.listGrid.getSelectedRows();
  28. var rowsLength = rows.length;
  29. if (rowsLength == 0) {
  30. top.Dialog.alert("请选中要修改的记录!");
  31. return;
  32. } else if (rowsLength > 1) {
  33. top.Dialog.alert("请选中一条要修改的记录!");
  34. return;
  35. } else {
  36. var row = _this.listGrid.getSelectedRow();
  37. // 判断选中的记录是否已经发布过
  38. if (row.IS_RELEASE_321 == 1) {
  39. top.Dialog.alert("选中的记录已经发布,请重新选择!");
  40. return;
  41. }
  42. if (row.OPR_STATE_321 == 1) {
  43. top.Dialog.alert("选中的记录已经上报,请重新选择!");
  44. return;
  45. }
  46. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID321;
  47. $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/alert/report/reportInput/ReportInputAddEdit.jsp?fd_id='+fd_id);
  48. }
  49. };
  50. /** *发布** */
  51. _this.release = function() {
  52. // 取得选中的Grid行
  53. var rows = _this.listGrid.getSelectedRows();
  54. // 选中的行数
  55. var rowsLength = rows.length;
  56. if (rowsLength == 0) {
  57. top.Dialog.alert("请选中要发布的记录!");
  58. return;
  59. } else if (rowsLength > 1) {
  60. top.Dialog.alert('请选中一条要发布的记录!');
  61. return;
  62. } else {
  63. var row = _this.listGrid.getSelectedRow();
  64. /*if (row.OPR_STATE_321 == 4) {
  65. top.Dialog.alert("选中的记录已经回退,请修改后再发布!");
  66. return;
  67. }
  68. */ // 判断选中的记录是否已经发布过
  69. if (row.IS_RELEASE_321 == 1) {
  70. top.Dialog.alert("选中的记录已经发布过的,请重新选择!");
  71. return;
  72. }
  73. var fd_id = row.FD_OBJECTID321; //
  74. var params = {
  75. classid : "321",
  76. FD_OBJECTID321 : fd_id,
  77. IS_RELEASE_321 : "1"
  78. };
  79. var alertmsg = "确定要发布吗?|发布";
  80. top.Dialog.confirm(alertmsg, function(){
  81. $.ajax({
  82. url : $.pathname() + '/ws/crud/CRUDService/update/',
  83. type : 'post',
  84. timeout : 15000,
  85. data : params,
  86. dataType : 'json',
  87. success : function(data) {
  88. top.Dialog.alert('发布成功!', null, null, null, -1);
  89. _this.listGrid.rend();
  90. },
  91. error : function(e) {
  92. $.messager.alert('发布失败');
  93. }
  94. });
  95. },function(){return;}
  96. );
  97. }
  98. };
  99. /**上报**/
  100. _this.reported = function() {
  101. // 取得选中的Grid行
  102. var rows = _this.listGrid.getSelectedRows();
  103. // 选中的行数
  104. var rowsLength = rows.length;
  105. if (rowsLength == 0) {
  106. top.Dialog.alert("请选中要上报的记录!");
  107. return;
  108. } else if (rowsLength > 1) {
  109. top.Dialog.alert('请选中一条要上报的记录!');
  110. return;
  111. } else {
  112. var row = _this.listGrid.getSelectedRow();
  113. /*if (row.OPR_STATE_321 == 4) {
  114. top.Dialog.alert("选中的记录已经回退,请修改后再上报!");
  115. return;
  116. }*/
  117. // 判断选中的记录是否已经上报过
  118. if (row.OPR_STATE_321 == 1) {
  119. top.Dialog.alert("选中的记录已经上报,请重新选择!");
  120. return;
  121. }
  122. var fd_id = row.FD_OBJECTID321; //
  123. var params = {
  124. classid : "321",
  125. FD_OBJECTID321 : fd_id,
  126. OPR_STATE_321:"1",
  127. IS_RELEASE_321 : "1"
  128. };
  129. var alertmsg = "确定要上报吗?|上报";
  130. if(row.IS_RELEASE_321 == 0){//未发布
  131. alertmsg = "该报告尚未发布,是否发布并上报?|上报";
  132. }/*else if(row.OPR_STATE_321 != 2 ){//已发布,未报送
  133. alertmsg = "该报告尚未报送,是否报送并上报?|上报";
  134. }*/
  135. if(row.INPUT_NAME_ID_321 != userId){//未发布
  136. top.Dialog.alert('非本人填报的报告,不能上报!', null, null, null, -1);
  137. return;
  138. }
  139. /*if(checkIsRelease(row.PLAN_ID_321,row.INPUT_UNIT_321)){
  140. alertmsg = "同时段,该填报要求响应报告已上报过,是否继续上报覆盖之前的报告?";
  141. }*/
  142. $.ajax({
  143. url : $.pathname() + '/ws/qrps/QueryReportProgrammeService/loadReportInputByDeptAndTaskId',
  144. type : 'post',
  145. timeout : 15000,
  146. data : {
  147. planId : row.PLAN_ID_321,
  148. deptId : row.INPUT_UNIT_321,
  149. reportType:"1"
  150. },
  151. ansyc:false,
  152. dataType : 'text',
  153. success : function(data) {
  154. if(data=="true"){
  155. top.Dialog.confirm("同时段,该填报要求预警行动信息报告已上报过,是否继续上报覆盖之前的报告?", function(){
  156. $.ajax({
  157. url : $.pathname() + '/ws/crud/CRUDService/updateWarning/',
  158. type : 'post',
  159. timeout : 15000,
  160. data : params,
  161. dataType : 'json',
  162. async:false,
  163. success : function(data) {
  164. top.Dialog.alert('上报成功!', null, null, null, -1);
  165. _this.listGrid.rend();
  166. },
  167. error : function(e) {
  168. $.messager.alert('上报失败');
  169. }
  170. });
  171. },
  172. function(){return;}
  173. );
  174. }else{
  175. top.Dialog.confirm(alertmsg, function(){
  176. $.ajax({
  177. url : $.pathname() + '/ws/crud/CRUDService/updateWarning/',
  178. type : 'post',
  179. timeout : 15000,
  180. data : params,
  181. dataType : 'json',
  182. async:false,
  183. success : function(data) {
  184. top.Dialog.alert('上报成功!', null, null, null, -1);
  185. _this.listGrid.rend();
  186. },
  187. error : function(e) {
  188. $.messager.alert('上报失败');
  189. }
  190. });
  191. },
  192. function(){return;}
  193. );
  194. }
  195. },
  196. error : function(e) {
  197. $.messager.alert('上报失败');
  198. }
  199. });
  200. }
  201. };
  202. function shangbao(params){
  203. }
  204. /**报送**/
  205. _this.submission = function() {
  206. // 取得选中的Grid行
  207. var rows = _this.listGrid.getSelectedRows();
  208. // 选中的行数
  209. var rowsLength = rows.length;
  210. if (rowsLength == 0) {
  211. top.Dialog.alert("请选中要报送的记录!");
  212. return;
  213. } else if (rowsLength > 1) {
  214. top.Dialog.alert('请选中一条要报送的记录!');
  215. return;
  216. } else {
  217. var row = _this.listGrid.getSelectedRow();
  218. if (row.OPR_STATE_321 == 4) {
  219. top.Dialog.alert("选中的记录已经回退,请修改后再报送!");
  220. return;
  221. }
  222. // 判断选中的记录是否已经上报过
  223. if (row.OPR_STATE_321 == 1) {
  224. top.Dialog.alert("选中的记录已经上报,请重新选择!");
  225. return;
  226. }else if(row.OPR_STATE_321 == 2) {
  227. top.Dialog.alert("选中的记录已经报送,请重新选择!");
  228. return;
  229. }
  230. var fd_id = row.FD_OBJECTID321; //
  231. var params = {
  232. classid : "321",
  233. FD_OBJECTID321 : fd_id,
  234. OPR_STATE_321:"2",
  235. IS_RELEASE_321 : "1"
  236. };var alertmsg = "确定要报送吗?|报送";
  237. if(row.IS_RELEASE_321 == 0){//未发布
  238. alertmsg = "该报告尚未发布,是否发布并报送?|报送";
  239. }
  240. top.Dialog.confirm(alertmsg, function() {
  241. $.ajax({
  242. url : $.pathname() + '/ws/crud/CRUDService/update/',
  243. type : 'post',
  244. timeout : 15000,
  245. data : params,
  246. dataType : 'json',
  247. success : function(data) {
  248. top.Dialog.alert('报送成功!', null, null, null, -1);
  249. _this.listGrid.rend();
  250. },
  251. error : function(e) {
  252. $.messager.alert('报送失败');
  253. }
  254. });
  255. },function(){return;});
  256. }
  257. };
  258. /**撤回**/
  259. _this.recall = function() {
  260. // 取得选中的Grid行
  261. var rows = _this.listGrid.getSelectedRows();
  262. // 选中的行数
  263. var rowsLength = rows.length;
  264. if (rowsLength == 0) {
  265. top.Dialog.alert("请选中要撤回的记录!");
  266. return;
  267. } else if (rowsLength > 1) {
  268. top.Dialog.alert('请选中一条要撤回的记录!');
  269. return;
  270. } else {
  271. var row = _this.listGrid.getSelectedRow();
  272. // 判断选中的记录是否已经发布过
  273. if (row.IS_RELEASE_321 == 0) {
  274. top.Dialog.alert("选中的记录尚未发布,请重新选择!");
  275. return;
  276. }
  277. if (row.OPR_STATE_321 != 1) {
  278. top.Dialog.alert("选中的记录未上报,请重新选择!");
  279. return;
  280. }
  281. if (row.OPR_STATE_321 == 4) {
  282. top.Dialog.alert("选中的记录已经回退,请修改后再操作!");
  283. return;
  284. }
  285. // 判断选中的记录是否已经发布过
  286. if (row.OPR_STATE_321 == 3) {
  287. top.Dialog.alert("选中的记录已经撤回,请重新选择!");
  288. return;
  289. }
  290. if (row.INPUT_UNIT_321 != deptId) {
  291. top.Dialog.alert("该记录为下级单位上报,请重新选择!");
  292. return;
  293. }
  294. var fd_id = row.FD_OBJECTID321; //
  295. var params = {
  296. classid : "321",
  297. FD_OBJECTID321 : fd_id,
  298. OPR_STATE_321:"3",
  299. IS_RELEASE_321 : "0"
  300. };
  301. top.Dialog.confirm("确定要撤回吗?|撤回", function() {
  302. $.ajax({
  303. url : $.pathname() + '/ws/crud/CRUDService/update/',
  304. type : 'post',
  305. timeout : 15000,
  306. data : params,
  307. dataType : 'json',
  308. success : function(data) {
  309. top.Dialog.alert('撤回成功!', null, null, null, -1);
  310. _this.listGrid.rend();
  311. },
  312. error : function(e) {
  313. $.messager.alert('撤回失败');
  314. }
  315. });
  316. });
  317. }
  318. };
  319. /**回退**/
  320. _this.rollback = function() {
  321. // 取得选中的Grid行
  322. var rows = _this.listGrid.getSelectedRows();
  323. // 选中的行数
  324. var rowsLength = rows.length;
  325. if (rowsLength == 0) {
  326. top.Dialog.alert("请选中要回退的记录!");
  327. return;
  328. } else if (rowsLength > 1) {
  329. top.Dialog.alert('请选中一条要回退的记录!');
  330. return;
  331. } else {
  332. var row = _this.listGrid.getSelectedRow();
  333. if (row.INPUT_NAME_ID_321 == userId) {
  334. top.Dialog.alert("不能回退自己填写的报告,请重新选择!");
  335. return;
  336. }
  337. if (row.INPUT_UNIT_321 == deptId) {
  338. top.Dialog.alert("不能回退本单位填写的报告,请重新选择!");
  339. return;
  340. }
  341. var fd_id = row.FD_OBJECTID321; //
  342. $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/alert/report/reportInput/rollbackReportInput.jsp?fd_id='+fd_id);
  343. }
  344. };
  345. /** *删除信息** */
  346. _this.del = function() {
  347. var rows = _this.listGrid.getSelectedRows();
  348. var rowsLength = rows.length;
  349. if (rowsLength == 0) {
  350. top.Dialog.alert("请选中要删除的记录!");
  351. return;
  352. }
  353. var ids = "";
  354. for (var i = 0; i < rowsLength; i++) {
  355. ids += rows[i].FD_OBJECTID321 + ",";
  356. var row = rows[i];
  357. if (row.IS_RELEASE_321 == 1) {
  358. top.Dialog.alert("选中的记录有已发布,请重新选择!");
  359. return;
  360. }
  361. if (row.OPR_STATE_321 == 1) {
  362. top.Dialog.alert("选中的记录有已上报,请重新选择!");
  363. return;
  364. }
  365. }
  366. var url = $.pathname() + "/ws/crud/CRUDService/delete/";
  367. var params = {
  368. objectIDs : ids,
  369. classid : 321
  370. };
  371. top.Dialog.confirm("确定要删除吗?|删除", function() {
  372. $.request.del(url, params, function(result) {
  373. if (result.Msg.sucsess == true) {
  374. top.Dialog.alert("删除成功!");
  375. // 刷新表格数据
  376. _this.listGrid.rend();
  377. } else {
  378. top.Dialog.alert("删除失败!");
  379. }
  380. });
  381. });
  382. };
  383. /** **查看详细信息*** */
  384. _this.show = function(fdId) {
  385. if(fdId){
  386. $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/alert/report/reportInput/detailReportInput.jsp?fd_id='+fdId);
  387. }else{
  388. var rows = _this.listGrid.getSelectedRows();
  389. var rowsLength = rows.length;
  390. if (rowsLength == 0) {
  391. top.Dialog.alert("请选中要查看的记录!");
  392. return;
  393. } else if (rowsLength > 1) {
  394. top.Dialog.alert("请选中一条要查看的记录!");
  395. return;
  396. } else {
  397. var fd_id = _this.listGrid.getSelectedRow().FD_OBJECTID321;
  398. $('#frmright', window.parent.document).attr('src',$.pathname()+ '/page/business/em/alert/report/reportInput/detailReportInput.jsp?fd_id='+fd_id);
  399. }
  400. }
  401. };
  402. //检查是否已上报过
  403. function checkIsRelease(planId,deptId){
  404. var flag = false;
  405. $.ajax({
  406. url : $.pathname() + '/ws/qrps/QueryReportProgrammeService/loadReportInputByDeptAndTaskId',
  407. type : 'post',
  408. timeout : 15000,
  409. data : {
  410. planId : planId,
  411. deptId : deptId
  412. },
  413. ansyc:false,
  414. dataType : 'text',
  415. success : function(data) {
  416. alert(data);
  417. if(data=="true"){
  418. flag = true;
  419. }else{
  420. flag = false;
  421. }
  422. },
  423. error : function(e) {
  424. $.messager.alert('上报失败');
  425. }
  426. });
  427. return flag ;
  428. }
  429. // 查询
  430. function search(obj) {
  431. //去掉水印
  432. if($("#REPORT_NAME_321").val().trim()=="报告名称" || $("#REPORT_NAME_321").val().trim()==""){
  433. $("#REPORT_NAME_321").val("");
  434. }
  435. $queryForm.serialize();
  436. //获取选中的值
  437. var searchCondition = getSelectCon(conditionData);
  438. var queryParams = getQueryFormParams($queryForm);
  439. var params=$.extend({},_this.loadParams,queryParams);
  440. //与之前参数条件拼接
  441. params.condition = searchCondition.condition + params.condition;
  442. _this.listGrid.setOptions({"params":params});
  443. //加载数据
  444. // _this.listGrid.setNewPage(1);
  445. _this.listGrid.rend();
  446. }
  447. function more(){
  448. $('#moreDiv').toggle(200,function(){
  449. $("#emptyCondition").click();/*
  450. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);*/
  451. });
  452. }
  453. return {
  454. init : function() {
  455. $queryForm = $("#queryForm");
  456. /** 绑定查询面板的按钮点击事件* */
  457. $searchButt = $("#searchButt");// 更多查询按钮
  458. $searchButt.live('click', function() {
  459. search();
  460. });
  461. $searchOne = $("#searchOne");//查询图标绑定查询事件
  462. $searchOne.bind('click', function() {
  463. search();
  464. });
  465. $("#REPORT_NAME_321").keydown(function(event){
  466. if(event.which == "13")
  467. $searchOne.click();
  468. });
  469. /** 绑定更多的按钮点击事件 */
  470. $more = $("#more"); // 更多按钮
  471. $more.bind('click', function() {
  472. more();
  473. });
  474. $(".l-grid-body-table .isPrimaryKey").live("click",function(){
  475. var rowdata = $(this).find("a").data("rowdata");
  476. if(rowdata){
  477. var fdId = rowdata.FD_OBJECTID321;
  478. show(fdId);
  479. }
  480. });
  481. // 获得面板对象
  482. _this.searchPanel = $("#searchPanel");
  483. // 列表加载参数
  484. _this.loadParams = {
  485. listId : '321',
  486. condition : "is_del=0 AND REPORT_TYPE LIKE '%1%' and is_alert=0 AND ((IS_RELEASE=1 AND INPUT_UNIT='"+deptId+"') or INPUT_NAME_ID='"+userId+"' or (OPR_STATE=1 and PARENT_DEPT_ID='"+deptId+"'))",
  487. direction : 'desc', // 排序方式
  488. sort : 'UPDATEDATE'
  489. };
  490. /** grid载入数据* */
  491. /* _this.listGrid = $("#dataGrid").quiGrid({*/
  492. var grid_option={
  493. columns : [ {
  494. display : '报告名称',
  495. name : 'REPORT_NAME_321',
  496. width : "20%",
  497. isSort : false,
  498. isPrimaryKey:true,
  499. render:function(rowdata, rowindex, value, column){
  500. value = "<a href='javascript:;' data-rowdata='"+JSON.stringify(rowdata)+"' title='"+value+"'>"+value+"</a>";
  501. return value;
  502. }
  503. },{
  504. display : '应急预警编号',
  505. name : 'EARLY_ID_321',
  506. showTitle:true,
  507. width : "15%"
  508. },{
  509. display : '填报角色',
  510. name : 'INPUT_ROLE_ID_321_SHOW',
  511. showTitle:true,
  512. width : "15%"
  513. }, {
  514. display : '填报单位',
  515. name : 'INPUT_UNIT_321_SHOW',
  516. showTitle:true,
  517. width : "8%"
  518. }, {
  519. display : '填报人',
  520. name : 'INPUT_NAME_321',
  521. showTitle:true,
  522. width : "5%"
  523. }, {
  524. display : '填报时间',
  525. name : 'INPUT_DATE_321',
  526. showTitle:true,
  527. width : "13%"
  528. }, {
  529. display : '要求填报时间',
  530. name : 'PLAN_TIME_321',
  531. showTitle:true,
  532. width : "10%"
  533. }, {
  534. display : '上报状态',
  535. name : 'OPR_STATE_321_SHOW',
  536. width : "5%"
  537. }, {
  538. display : '发布状态',
  539. name : 'IS_RELEASE_321_SHOW',
  540. width : "5%"
  541. } ],
  542. rownumbers : true,
  543. checkbox : true,
  544. pageSize : 10,
  545. percentWidthMode : true};
  546. var roleCons = roleButtonArr();
  547. var toolBarOpt={
  548. items : [ {
  549. text : '新增',
  550. click : 'addForm',
  551. iconClass : 'add1_tem',
  552. id : '25tj'
  553. },{
  554. text : '删除',
  555. click : 'del',
  556. iconClass : 'delete_tem',
  557. id : '25sc'
  558. }, {
  559. text : '修改',
  560. click : 'editForm',
  561. iconClass : 'update_tem',
  562. id : '25xg'
  563. }, /*{
  564. text : '查看',
  565. click : 'show',
  566. iconClass : 'view_tem'
  567. },*/ {
  568. text : '发布',
  569. click : 'release',
  570. iconClass : 'release_tem',
  571. id : '25fb'
  572. }/*,{
  573. text : '报送',
  574. click : 'submission',
  575. iconClass : 'sendreport_tem'
  576. }*/, {
  577. text : '上报',
  578. click : 'reported',
  579. iconClass : 'sendup_tem',
  580. id : '25sb'
  581. }, {
  582. text : '撤回',
  583. click : 'recall',
  584. iconClass : 'retract_tem',
  585. id : '25ch'
  586. }, {
  587. text : '回退',
  588. click : 'rollback',
  589. iconClass : 'rollback_tem',
  590. id : '25ht'
  591. } ],
  592. roleCons:roleCons
  593. };
  594. var options={
  595. url :'/nwyj/ws/crud/CRUDService/queryQui',
  596. params: _this.loadParams,
  597. width:960,
  598. gridOptions:grid_option,
  599. paperOpration:{showInput:"true"},
  600. toolBarOptions:toolBarOpt
  601. };
  602. /**grid载入数据(定义数据列表)**/
  603. _this.listGrid = gridAndSingleRecode=$("#dataGrid").quickgridAndSingleRecode(options);
  604. /* });*/
  605. }
  606. };
  607. }();
  608. $(function() {
  609. ReportInput.init();
  610. });
  611. function showPrimaryKey(row,index){//row为整条数据,index为第几字段,index是从0开始的
  612. var fdId = row.FD_OBJECTID321;
  613. show(fdId);
  614. }