9983f5f8e3bbb2ef347c60fd276156a3987b3ec4.svn-base 17 KB

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