1e689f600cfce5ceecab501c6dc165ee5e390908.svn-base 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. /**
  2. * 功能:应急预警报告添加及修改
  3. *
  4. *
  5. * @author HXB
  6. * @date 2015/10/14
  7. */
  8. TeamDemandAudit = function() {
  9. var passOrRock = 0;//判断是 “同意” 还是 “退回”(同意为1 退回未2)
  10. /**定义变量**/
  11. var _this = this;
  12. _this.listGrid = null;// 预警数据列表
  13. var flag=false;
  14. var isNew=false; //是否是新增记录
  15. var editingRow; // 双击的当前编辑行
  16. var index = 0;
  17. var allUnitsMsg = "";//无附件时存储 角色id,状态,调拨单位id;... (最后的分号没有去掉)
  18. /**私有方法**/
  19. /***新增信息***/
  20. _this.save = function(diag,fd_id){
  21. var rangeUniteName = $("#RANGE_UNITS_ID_391").attr("relText");
  22. $("#RANGE_UNITS_NAME_391").val(rangeUniteName);
  23. $form1 = $('#editForm1');
  24. var valid1 = $form1.validationEngine({returnIsValid: true});
  25. if(valid1){
  26. var n = $(".companyContent").length;
  27. for(var i=0;i<n;i++){
  28. var companyContent = $(".companyContent").eq(i).val();
  29. if(companyContent == "请分配队伍详情"){
  30. top.Dialog.alert('请填写调拨描述!');
  31. diag.close();//关闭弹框
  32. }
  33. }
  34. if($("#RANGE_UNITS_ID_391").attr("relValue") == '' && $("#EXPLAIN_378").val() == ''){
  35. top.Dialog.alert('请选择调拨单位!', null, null, null, -1);
  36. return;
  37. }
  38. var params = "";
  39. if(passOrRock == 1){//==========同意
  40. if(true){//无附件,调拨完还需要本级应急办主任或副主任审核
  41. var rangUnits = $("#RANGE_UNITS_ID_391").attr("relValue");//调拨单位的ID
  42. var rangUnits2 = $("#RANGE_UNITS_ID_391").attr("relText");//调拨单位的NAMAE
  43. rangUnits = rangUnits.split(",");
  44. rangUnits2 = rangUnits2.split(",");
  45. for(var i=0;i<rangUnits.length;i++){
  46. allUnitsMsg += "R002105430205,138,"+rangUnits[i]+";";
  47. }
  48. $("#ALLOT_UNITS_MSG_391").val(allUnitsMsg);
  49. var valid = diag.innerFrame.contentWindow.$("#ideaForm").validationEngine({returnIsValid: true});//弹框页面的非空验证
  50. if(!valid){
  51. top.Dialog.alert("请检查红色输入框!");
  52. return;
  53. };
  54. $("body").eq(0).showLoading();//遮罩
  55. var a = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").val();//弹框页面的下一节点人的id
  56. var b = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().html();//弹框页面的下一节点人的NAME
  57. var c = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().next().val();//弹框页面的下一节点人的电话
  58. var d = diag.innerFrame.contentWindow.$("#msgRemind").attr("checked");//短信是否被勾选
  59. var e = diag.innerFrame.contentWindow.$("#appRemind").attr("checked");//app是否被勾选
  60. var role_name = diag.innerFrame.contentWindow.$("#PERSON_ID").val();
  61. var corpName = $("#SUPPORT_UNIT_ID_391").text();
  62. var war_name=$("#TASK_NAME_391").val().split('_')[0];
  63. var level = diag.innerFrame.contentWindow.$("#PERSON_ID").attr("relValue").replace("应急办","");
  64. var realMobile = top.com.sinosoft.lz.system.user.LoginInfo.getMobile();
  65. if(realMobile==null || realMobile=="null" || realMobile==""){
  66. realMobile = "暂无电话";
  67. }
  68. //var g = '您有新的审核通过的队伍调拨单,请您及时处理!';//短信内容
  69. //g=b+role_name+',您好。'+corpName+'在'+war_name+'响应事件中,应急队伍需求较大,队伍调拨需求单经我局应急办研究通过,请上级领导调拨队伍,支援我局。';
  70. var g=b+level+',您好!'+corpName+'应急队伍需求较大,队伍调拨令已经过应急办制定,请您登陆应急指挥平台进行审核。\n'+realName+","+realMobile;
  71. var h = getDateTime();//系统时间
  72. if(a == undefined){
  73. top.Dialog.alert("请选择下一处理人!");
  74. return;
  75. }
  76. if(d=='checked'){//短信被勾选
  77. //alert("短信提醒");
  78. if(a == undefined){
  79. top.Dialog.alert("请选择短信接收人!");
  80. return;
  81. }
  82. var url0 = $.pathname() + '/ws/sendsms/SendSmsService/saveMessage';
  83. var param = {
  84. realName : realName,//发送人真实姓名
  85. smsRecTel : c,//接收电话
  86. smsTime : h,//系统时间
  87. smsContent : g,//短信内容
  88. smsSendId : realName_ID,//发送人Id
  89. smsPeople : b/*a*/,//接收人员id?还是name?
  90. type:"短信发送"
  91. };
  92. $.ajax({
  93. type : 'post',
  94. url : url0,
  95. data : param,
  96. async:false,
  97. dataType : 'json',
  98. success : function (data){
  99. //alert(JSON.stringify(data));
  100. },
  101. error : function(e){
  102. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  103. }
  104. });
  105. }
  106. if(e=='checked'){
  107. alert("应急app提醒!");
  108. }
  109. diag.innerFrame.contentWindow.top.Dialog.close();//关闭弹框
  110. $.ajax({////修改装备需求表的IS_SEEN字段为【下一处理人ID,0 ,处理人ID】
  111. url : $.pathname() + '/ws/sendsms/SendSmsService/updateIs_Seen',
  112. data : { tableName : "ECM_EM_TEAM_WRR" ,
  113. fdId : fd_id ,
  114. nextPeopId : a ,
  115. userId : realName_ID},
  116. type : 'post',
  117. dataType : 'json',
  118. async:false,
  119. success : function (data){
  120. },error : function(e){
  121. top.Dialog.alert("系统提示信息!");
  122. }
  123. });
  124. //保存下一节点处理人到378表
  125. $("#PERSON_ID_378").val(a);
  126. $("#PERSON_NAME_378").val(b);
  127. $("#BUSINESS_ID_378").val(fd_id);
  128. $("#STATUES_378").val("138");
  129. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  130. var formValue = $("#editForm1").serialize();
  131. $.request.add(url,formValue,function(data){
  132. closeProgress();
  133. });
  134. var tempTr = $("#companyNum tr");
  135. var contentStr = "";
  136. for(var i = 0;i < tempTr.length;i++){
  137. var tempTd = $(tempTr).eq(i);
  138. var id = $(tempTd).find('.companyId').text();
  139. var name = $(tempTd).find('.companyName').text();
  140. var content = $(tempTd).find('.companyContent').val();
  141. contentStr += id + ";"+name+";"+content+"|";
  142. }
  143. params = {
  144. classid : "391",
  145. FD_OBJECTID391 : $("#FD_OBJECTID391").val(),
  146. // STATE_391 : $("#STATE_391").val(),//138
  147. STATE_391 : "138",
  148. RANGE_UNITS_ID_391:$("#RANGE_UNITS_ID_391").attr("relValue"),
  149. RANGE_UNITS_NAME_391:$("#RANGE_UNITS_NAME_391").val(),
  150. UNITS_CONTENT_391:contentStr,
  151. ALLOT_UNITS_MSG_391:$("#ALLOT_UNITS_MSG_391").val()
  152. };
  153. }else{//有附件,直接调拨
  154. $("body").eq(0).showLoading();//遮罩
  155. /** 队伍调拨加到调拨单位下的应急办成员的代办中 start **/
  156. var rangUnits = $("#RANGE_UNITS_ID_391").attr("relValue");//调拨单位的ID
  157. var rangUnits2 = $("#RANGE_UNITS_ID_391").attr("relText");//调拨单位的NAMAE
  158. rangUnits = rangUnits.split(",");
  159. rangUnits2 = rangUnits2.split(",");
  160. for(var i=0;i<rangUnits.length;i++){
  161. $("#COMPANY_ID_378").val(rangUnits[i]);
  162. $("#ROLE_ID_378").val("R002105430205");//应急办成员 R002105430205(表 SYS_ROLE)
  163. $("#BUSINESS_ID_378").val(fd_id);
  164. $("#STATUES_378").val("135");
  165. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  166. var formValue = $("#editForm1").serialize();
  167. $.request.add(url,formValue,function(data){
  168. closeProgress();
  169. });
  170. }
  171. /** 队伍调拨加到调拨单位下的应急办成员的代办中 end **/
  172. var tempTr = $("#companyNum tr");
  173. var contentStr = "";
  174. for(var i = 0;i < tempTr.length;i++){
  175. var tempTd = $(tempTr).eq(i);
  176. var id = $(tempTd).find('.companyId').text();
  177. var name = $(tempTd).find('.companyName').text();
  178. var content = $(tempTd).find('.companyContent').val();
  179. contentStr += id + ";"+name+";"+content+"|";
  180. }
  181. params = {
  182. classid : "391",
  183. FD_OBJECTID391 : $("#FD_OBJECTID391").val(),
  184. // STATE_391 : $("#STATE_391").val(),//138
  185. STATE_391 : "135",
  186. RANGE_UNITS_ID_391:$("#RANGE_UNITS_ID_391").attr("relValue"),
  187. RANGE_UNITS_NAME_391:$("#RANGE_UNITS_NAME_391").val(),
  188. UNITS_CONTENT_391:contentStr
  189. };
  190. }
  191. }else if(passOrRock == 2){//==========退回
  192. $("body").eq(0).showLoading();//遮罩
  193. var tianBaoRenNAME = $("#FORM_NAME_391").val();
  194. var tianBaoRenID = $("#USER_ID_391").val();
  195. $.ajax({
  196. url : $.pathname() + '/ws/sendsms/SendSmsService/getLastPersonMsg',
  197. data : {
  198. fd_id : $("#BUSINESS_ID_378").val(),
  199. STATE : 132
  200. },
  201. type : 'post',
  202. dataType : 'json',
  203. async : false,
  204. timeout : 66666,
  205. success : function(resultData){
  206. tianBaoRenNAME = resultData.name;
  207. tianBaoRenID = resultData.id;
  208. },error : function(e){
  209. top.Dialog.alert("系统错误!");
  210. }
  211. });
  212. $("#PERSON_ID_378").val(tianBaoRenID);//该条记录的填报人ID
  213. $("#PERSON_NAME_378").val(tianBaoRenNAME);//该条记录的填报人NAME
  214. //$("#BUSINESS_ID_378").val(fd_id);
  215. //$("#STATUES_378").val("134");
  216. $("#STATUES_378").val("132");
  217. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  218. var formValue = $("#editForm1").serialize();
  219. $.request.add(url,formValue,function(data){
  220. closeProgress();
  221. });
  222. params = {
  223. classid : "391",
  224. FD_OBJECTID391 : $("#FD_OBJECTID391").val(),
  225. // STATE_391 : $("#STATE_391").val(),
  226. //STATE_391 : "134"//审核未通过
  227. STATE_391 : "132"//审核通过
  228. /*,
  229. RANGE_UNITS_ID_391:$("#RANGE_UNITS_ID_391").attr("relValue"),
  230. RANGE_UNITS_NAME_391:$("#RANGE_UNITS_NAME_391").val(),
  231. UNITS_CONTENT_391:contentStr*/
  232. };
  233. }
  234. $.ajax({
  235. url : $.pathname() + '/ws/crud/CRUDService/update/',
  236. type : 'post',
  237. timeout : 15000,
  238. data : params,
  239. dataType : 'json',
  240. success : function(data) {
  241. closeProgress();
  242. if(passOrRock == 2){
  243. //top.Dialog.alert('调拨令未制定成功!', null, null, null, -1);
  244. top.Dialog.alert('调拨令回退成功!', null, null, null, -1);
  245. }else if(passOrRock == 1){
  246. top.Dialog.alert('调拨令制定成功!', null, null, null, -1);
  247. }
  248. if(isWaitDo == 1){
  249. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  250. }else{
  251. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
  252. }
  253. //$('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
  254. },error : function(e) {
  255. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  256. }
  257. });
  258. }else{
  259. if(passOrRock == 1){
  260. top.Dialog.alert('请填写调拨描述!');
  261. diag.close();//关闭弹框
  262. }else if(passOrRock == 2){
  263. top.Dialog.alert('请填写回退说明!');
  264. }
  265. }
  266. /** 代办右上角红色圈里面数字的改变 **/
  267. var url = $.pathname() + '/ws/xianlutingyun/XianlutingyunService/WarningTask';
  268. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  269. var compId = $("#RANGE_UNITS_ID_391").attr("relValue");
  270. var roleid = $("#ROLE_ID_378").val();
  271. var params = "";
  272. if(passOrRock == 1){//同意
  273. params = {
  274. userId : user_id,//处理人ID(系统登录人)
  275. // netx_id : b,//下一节点处理人ID
  276. isRole : "1",//
  277. company_id : compId,//
  278. role_id : roleid//
  279. };
  280. }else if(passOrRock == 1){//退回
  281. params = {userId : user_id};
  282. }
  283. $.ajax({//代办处理
  284. url : url,
  285. data : params,
  286. type : 'post',
  287. dataType : 'text',
  288. timeout : 15000,
  289. // async : false,
  290. success : function(data){
  291. // top.Dialog.alert('发送成功!', null, null, null, -1);
  292. },error : function (e){
  293. // top.Dialog.alert('系统错误!');
  294. }
  295. });
  296. };
  297. return {
  298. init : function() {
  299. var temp = {"pager.pageNo":0,"pager.totalRows":0,"rows":[],listId:'331'};
  300. /** grid载入数据* */
  301. _this.listGrid = $("#maingrid").quiGrid( {
  302. //title : "预警接收管理数据列表",
  303. columns : [
  304. { display: '队伍类型', name: 'ANSWER_CODE_331', align: 'center', width: "45%",editor: { type: 'text' }},
  305. { display: '需求人数', name: 'THIS_ANSWER_GRADE_331', align: 'center', width: "45%",editor: { type: 'text' }}/*,
  306. { display: '操作', isSort: false, align: 'center', width: "30%",render:function (rowdata, rowindex, value){
  307. var h = "";
  308. //h += "<a onclick='endEdit("+rowindex+")'><span class='icon_edit'>确认</span></a> ";
  309. //h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>取消</span></a> ";
  310. return h;
  311. }}*/
  312. ],
  313. //url : $.pathname() + '/ws/crud/CRUDService/queryQui',
  314. params:temp,
  315. width : "100%",
  316. rownumbers:true,
  317. percentWidthMode : true,
  318. usePager:false
  319. });
  320. var fd_id = (window.location.href).split('?')[1];//获取记录id
  321. var ids = fd_id.split("=")[1].split("&");
  322. $.post($.pathname() + '/ws/crud/CRUDService/getDataById/',{classid : '391',objectID : ids[0]},function(data){
  323. var test = {"pager.pageNo":1,"pager.totalRows":3,"rows":JSON.parse(data.TROOPS_391)};
  324. _this.listGrid.loadData(test);
  325. });
  326. $('#pass').bind('click',function(){
  327. passOrRock = 1;
  328. $("#EXPLAIN_378").val('');//清空回退说明
  329. $("#companyNum").show();//显示调拨描述
  330. var is_audit = $("#is_audit").val();
  331. if(is_audit == 0){//审核
  332. $(".person").show();
  333. $("#PERSON_ID_378").attr("class","validate[required]");
  334. $("#remark").hide();
  335. $("#EXPLAIN_378").attr("class","");
  336. $("#is_pass").val("0");
  337. }else{//二审----制定调拨令
  338. $("#remark").hide();
  339. $("#EXPLAIN_378").attr("class","");
  340. $("#PERSON_ID_378").attr("class","");
  341. $("#unitId").show();
  342. }
  343. $("#sub").show();
  344. // $("#STATE_391").val("135");
  345. $("#STATE_391").val("138");
  346. $(top.document.body).find('#frmright').height($(window.document.body).height());
  347. });
  348. function dialogDemo(){
  349. var fdid = (window.location.href).split('=')[1];//获取记录id(1)
  350. var fd_id = fdid.split('&')[0];//获取记录id(2)
  351. var CorpID = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  352. var diag = new top.Dialog();
  353. diag.Title = '审核意见';
  354. diag.URL = $.pathname() + '/page/business/em/response/team/TeamNextRole.jsp?fd_id='+fd_id+'&ershen=0&deptId='+CorpID;
  355. diag.OkButtonText = '提交';
  356. diag.OKEvent = function(){
  357. _this.save(diag,fd_id);
  358. // _this.save();
  359. };
  360. diag.Width = 500; //宽度
  361. diag.Height = 340; //高度
  362. diag.ButtonAlign = 'center';
  363. diag.show();
  364. };
  365. $('#rock').bind('click',function(){
  366. passOrRock = 2;
  367. // $("#companyNum").replaceWith("<table id='companyNum' class='tableStyle' width='85%' align='center'></table>");//清空调拨描述
  368. $("#companyNum").empty();//效果同上
  369. $(".remark").show();
  370. $("#person").hide();
  371. $("#PERSON_ID_378").attr("class","");
  372. $("#EXPLAIN_378").attr("class","validate[required]");
  373. $("#is_pass").val("1");
  374. //$("#STATE_391").val("134");//审核未通过
  375. $("#STATE_391").val("132");//审核通过
  376. $("#unitId").hide();
  377. $("#RANGE_UNITS_ID_391").attr("relValue","");//清空调拨单位的值
  378. $(top.document.body).find('#frmright').height($(window.document.body).height());
  379. var position = 0;
  380. var txtFocus = document.getElementById("EXPLAIN_378");
  381. if($.browser.mise){
  382. var range = txtFocus.createTextRange();
  383. range.move("character",position);
  384. range.select();
  385. }else{
  386. txtFocus.setSelectionRange(position,position);
  387. txtFocus.focus();
  388. }
  389. });
  390. $('#save').bind('click',function(){
  391. if(passOrRock==1){
  392. dialogDemo(passOrRock);
  393. }else{
  394. _this.save(null,null);
  395. }
  396. });
  397. $('#back').bind('click',function(){
  398. if(isWaitDo == 1){
  399. $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
  400. }else{
  401. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
  402. }
  403. //$('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
  404. });
  405. }
  406. };
  407. }();
  408. $(function() {
  409. TeamDemandAudit.init();
  410. });