123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612 |
- /**
- * 功能:应急响应单解除
- *
- *
- * @author HXB
- * @date 2015/09/23
- */
- WarningRelieve = function() {
- /**定义变量**/
- var _this = this;
- var isState = 0;
- var nowTime="";
- /**私有方法**/
- //_this.DateTime = function(){
- $.ajax({//后台获取系统当前时间
- url:$.pathname()+ '/ws/response/responseService/getNowTime',
- // data : {},
- type : 'post',
- dataType : 'text',
- async : false,
- timeout : 6000,
- success : function(result){
- nowTime=result;
- },error : function(e){
- top.Dialog.alert("获取后台时间失败!");
- return;
- }
- });
- // };
-
- /***新增信息***/
- _this.save = function(){
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});//表单验证
- if(valid ){//
- //$("#RELEASE_RELIEVE_DATE_365").val(nowTime);//先设置系统时间
- var fbTime = $("#RELEASE_RELIEVE_DATE_365").val();//发布时间
- var jcTime = $("#RELIEVE_DATE_365").val();//解除时间
- var a = fbTime.substring(0,16).split(" ")[1];//【发布时间】
- var b = jcTime.split(" ")[1];//【解除时间】
- var c = fbTime.split(" ")[0];//【发布日期】
- var d = jcTime.split(" ")[0];//【解除日期】
- if(c > d || (c==d && a>b)){//【发布日期大于解除日期】或者【发布日期等于解除日期并且发布时间大于解除时间】
- top.Dialog.alert("解除时间不能早于发布时间,请重新选择!");
- return;
- };
-
-
- //判断是否有附件存在
- //var file = $("#uploaderFileName").val();
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- //$("#RELEASE_UNIT_365").val($("#unitId").attr("relValue"));
- $("#IS_SEND_365").val(0); //待发送状态
- // $("#IS_LAST_ID_365").val(fd_id); //上次预警编号
- $('#classid').val(365);
- // $("#WRITER_365").val($("#CHECKCK").val()); //填报人
- // $("#WRITE_DEPT_365").val($("#unitId").attr("relValue"));
- $("#EARLY_WARNING_AREA_NAME_365").val($("#EARLY_WARNING_AREA_NAME_365_show").val());//响应范围
- $("#CHECK_STATUS_365").val(43); // 解除操作
- $("#EARLY_WARNING_PROPERTY_365").val(51); //预警性质 解除
- if(isUpdate != null && isUpdate == 1){//新增
- $("#FD_OBJECTID365").val('');
- }
- isState = 0;
- fileToSave($form,null,null,url);
- }else{
- top.Dialog.alert("请检查标红输入框!");
- }
-
- };
- _this.is_Send = function(){
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});//表单验证
- if(valid ){//解除
- //$("#RELEASE_RELIEVE_DATE_365").val(nowTime);//先设置系统时间
- var fbTime = $("#RELEASE_RELIEVE_DATE_365").val();//发布时间
- var jcTime = $("#RELIEVE_DATE_365").val();//解除时间
- var a = fbTime.substring(0,16).split(" ")[1];
- var b = jcTime.split(" ")[1];
- var c = fbTime.split(" ")[0];
- var d = jcTime.split(" ")[0];
- if(c > d || (c==d && a>b)){
- top.Dialog.alert("解除时间不能早于发布时间,请重新选择!");
- return;
- };
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- //$("#RELEASE_UNIT_365").val($("#unitId").attr("relValue"));
- $("#IS_SEND_365").val(0); //待发送状态
- // $("#IS_LAST_ID_365").val(fd_id); //上次预警编号
- $('#classid').val(365);
- //$("#WRITER_365").val($("#CHECKCK").val()); //填报人
- //$("#WRITE_DEPT_365").val($("#unitId").attr("relValue"));
- $("#CHECK_STATUS_365").val(43); // 解除操作
- $("#EARLY_WARNING_PROPERTY_365").val(51); //预警性质 解除
- //$("#EARLY_WARNING_AREA_ID_365").val($("#EARLY_WARNING_AREA_NAME_365").val());//预警范围ID
- $("#EARLY_WARNING_AREA_NAME_365").val($("#EARLY_WARNING_AREA_NAME_365_show").val());//预警范围NAME
- //$("#RELEASE_UNIT_365").val($("#WRITE_DEPT_365").attr("relValue"));//发布单位
- if(isUpdate != null && isUpdate == 1){//新增
- $("#FD_OBJECTID365").val('');
- }
- isState = 1;
- fileToSave($form,null,null,url,isState);
- }else{
- top.Dialog.alert("请检查标红输入框!");
- }
- };
- _this.is_Issue = function(){
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});//表单验证
- if(valid ){//解除
- //$("#RELEASE_RELIEVE_DATE_365").val(nowTime);//先设置系统时间
- var fbTime = $("#RELEASE_RELIEVE_DATE_365").val();//发布时间
- var jcTime = $("#RELIEVE_DATE_365").val();//解除时间
- var a = fbTime.substring(0,16).split(" ")[1];
- var b = jcTime.split(" ")[1];
- var c = fbTime.split(" ")[0];
- var d = jcTime.split(" ")[0];
- if(c > d || (c==d && a>b)){
- top.Dialog.alert("解除时间不能早于发布时间,请重新选择!");
- return;
- };
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- $("#IS_SEND_365").val(0); //待发送状态
- // $("#IS_LAST_ID_365").val(fd_id); //上次预警编号
- $('#classid').val(365);
- //$("#WRITER_365").val($("#CHECKCK").val()); //填报人
- //$("#WRITE_DEPT_365").val($("#unitId").attr("relValue"));
- $("#CHECK_STATUS_365").val(43); // 解除操作
- $("#EARLY_WARNING_PROPERTY_365").val(51); //预警性质 解除
- //$("#EARLY_WARNING_AREA_ID_365").val($("#EARLY_WARNING_AREA_NAME_365").val());//预警范围ID
- $("#EARLY_WARNING_AREA_NAME_365").val($("#EARLY_WARNING_AREA_NAME_365_show").val());//预警范围NAME
- // $("#RELEASE_UNIT_365").val($("#unitId").attr("relValue"));
- if(hasFile()){
- var params = {
- classid : "365",
- FD_OBJECTID365 :$("#FD_OBJECTID365").val(),
- RELIEVE_DATE_365:getDateTime(),
- IS_SEND_365 : "6"
- };
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/updateWarning/',
- type : 'post',
- // async: false,
- timeout : 15000,
- data : params,
- async : false,
- dataType : 'json',
- success : function(data) {
- var preAlertNum = $("#EARLY_WARNING_ID_365").val(); //上次预警编号
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids(); //部门ID
- var CorpArea = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
-
- // 结束报表填报
- finishPlan(preAlertNum,CorpArea);
- },
- error : function(e) {
- $.messager.alert('系统提示信息!');
- }
- });
-
- $("#IS_SEND_365").val(6);
- //$("#RELEASE_UNIT_365").val($("#unitId").attr("relValue"));
- $("#RELEASE_RELIEVE_DATE_365").val(getDateTime());
- }
- if(isUpdate != null && isUpdate == 1){//新增
- $("#FD_OBJECTID365").val('');
- }
- isState = 2;
- fileToSave($form,null,null,url,isState);
- }else{
- top.Dialog.alert("请检查标红输入框!");
- }
- };
-
-
-
- /**
- * 结束报表填报计划
- */
- function finishPlan(alertNum,companyId){
- var params = {WARNING_NUMBER:alertNum,COMP_ID:companyId,IS_ALERT:'1'};
- $.ajax({
- url : $.pathname() + '/ws/getPlanRequires/getPlanRequireService/releasePlan',
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'text',
- success : function(data) {
- }
- });
- }
- function fileToSave($form,listGrid,msg,url){
- // var flag = 1;//是否发布接口的开关
-
- $("body").eq(0).showLoading();
- //表单异步提交处理
- var formValue = $form.serialize();
- if(isState == 1){ //发送
- send(url,formValue);
- }else{
- $.request.add(url,formValue,function(data){
- //解除成功后,新增一条解除性质的记录,当前记录的IS_RELIEVE状态改为1(已进入解除流程)
- relieveCurrentRecord(fd_id);
- $("body").eq(0).hideLoading();
- if(isState == 0){ //保存
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
- }else if(isState == 2){
- $.ajax({//发布通知单时,右下角弹框提示发布单位的下级和本级的应急办成员
- url : $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/tzdIssueDwr/',
- data : { fd_id : data.Msg.objectID },//参数为发布的通知单的ID
- type : 'post',
- timeout : 15000,
- dataType : 'text',
- async : false,
- success : function(data) {
-
- },error : function(e) {
- top.Dialog.alert("系统错误!");
- }
- });
-
-
- var params = {
- classid : "365",
- FD_OBJECTID365 : $('#IS_LAST_ID_365').val(),
- RELIEVE_DATE_365:getDateTime(),
- IS_SEND_365 : "6"
- };
-
-
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/update/',
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- async:false,
- success : function(data) {
- // top.Dialog.alert('发布通过!', null, null, null, -1);
- var event_id = $("#EVENT_ID_365").attr("relvalue");
- var event_unit_id = queryEventInfo(event_id);
- if(event_unit_id==CorpArea){
- var event_name = $("#EVENT_ID_365").attr("reltext");
- top.Dialog.confirm("发布通过,是否结束"+event_name+"事件?",function(){
- finishedEvent(event_id,event_name);
-
- },function(){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
- });
- }else{
- top.Dialog.alert('发布通过!', null, null, null, -1);
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
- }
-
- },error : function(e) {
- $.messager.alert('系统提示信息!');
- }
- });
-
- $.ajax({//发布以后,用推送的方式,调用首页的方法,更新首页导航下方滚动的预警通知单信息(不需要传参数)
- url : $.pathname() + '/ws/alertToImpl/AlertToImplService/updadeWarningMsgOfMainPage/',
- type : 'post',
- timeout : 15000,
- // data : params,
- dataType : 'text',
- success : function(data) {
-
- },error : function(e) {
- // $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
-
- /***
- *TODO
- * 为了测试接口,将此处的:if(flag == 2)
- * 修改为 :if(flag != 2)
- * 后续需要根据业务需要将此处梳理清楚。
- * 徐威 2017-07-17
- * **/
- // if(flag != 2){ //暂时接口走不通20160705,所以暂时关掉
- var planName = $("#MEET_EMERGENCIES_PLAN_365").attr("relText");
- var earlyWarningAreaId = $("#EARLY_WARNING_AREA_ID_365").val();
- var lastLevel = $("#PREV_ER_LEVEL_365").val();
- var currentLevel = $("#CURRENT_ER_LEVEL_365").val();
-
- var params = {
- classid : "365",
- FD_OBJECTID365 : data.Msg.objectID,
- RELIEVE_DATE_365 : getDateTime(),
- IS_SEND_365 : "6",
- PLAN_NAME : planName,
- EARLY_WARNING_AREA_ID : earlyWarningAreaId,
- LAST_LEVEL : lastLevel,
- CURRENT_LEVEL : currentLevel
- };
- $.ajax({//接口
- url : $.pathname() + '/ws/alertToImpl/AlertToImplService/responseRelieveIssue/',
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- success : function(data) {
- },
- error : function(e) {
- // $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
-
- // }else{
- // $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
- // };
-
- //$('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
- }
- //$('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
- });
- }
- }
- function send(url,formValue){
- var diag = new top.Dialog();
- diag.Title = '组织人员';
- //diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitSend.jsp?fd_id='+fd_id; //修改对应的路径的编辑界面
- diag.URL = $.pathname() + '/page/business/em/alert/warning/WarningaddUnitTest.jsp?fd_id=' + fd_id + '&isSend=1';
- diag.OkButtonText = '发送';
- diag.OKEvent = function(){
- $.request.add(url,formValue,function(data){
- $("body").eq(0).hideLoading();
- var fd_id = data.Msg.objectID;
- _this.sendSave(diag,fd_id);
- });
- };
- diag.CancelEvent = function(){
- $("body").eq(0).hideLoading();
- diag.close();
- };
- diag.Width = 500; //宽度
- // diag.Height = 150; //高度
- diag.ButtonAlign = 'center';//发送和取消按钮的位置
- diag.show();
- }
- /**新增方法**/
- _this.sendSave = function(diag,fd_id){
- //_this.DateTime()
- var a = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").val();//弹框页面的下一节点人的id
- var c = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().html();//弹框页面的下一节点人的NAME
- var d = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().next().val();//弹框页面的下一节点人的电话
- var e = diag.innerFrame.contentWindow.$("#msgRemind").attr("checked");//短信是否被勾选
- var f = diag.innerFrame.contentWindow.$("#appRemind").attr("checked");//app是否被勾选
- var g = '您有新的通知单任务,请及时处理!';//短信内容
- var h = nowTime;//系统时间
- var i = getSysTime();//系统时间:年月日时分秒
-
- if(a==undefined || a=='' || a==null){
- top.Dialog.alert("请选择人员!");
- return;
- }
-
- if(e=='checked'){//短信被勾选
- //alert("短信提醒");
- if(a == undefined){
- top.Dialog.alert("请选择短信接收人!");
- return;
- }
- var url0 = $.pathname() + '/ws/sendsms/SendSmsService/saveMessage';
- var params = {
- realName : realName,//发送人真实姓名
- smsRecTel : d,//接收电话
- smsTime : h,//系统时间
- smsContent : g,//短信内容
- smsSendId : realName_ID,//发送人Id
- smsPeople : a,//接收人员id
- type:"短信发送"
- };
- //alert("realName="+realName+"电话:"+d+"系统时间:"+h+"短信内容:"+g+"发送人ID:"+realName_ID+"接收人ID:"+a);
- //return;
- $.ajax({
- type : 'post',
- url : url0,
- data : params,
- async:false,
- dataType : 'json',
- success : function (data){
- //alert(JSON.stringify(data));
- },
- error : function(e){
- $.messager.alert('系统提示信息!');
- }
- });
- }
- if(f=='checked'){
- top.Dialog.alert('应急app提醒!');
- }
-
- ////修改通知单表的IS_SEEN字段为【下一处理人ID,0 ,处理人ID】 ===========20170117
- $.ajax({
- url : $.pathname() + '/ws/sendsms/SendSmsService/updateIs_Seen',
- data : { tableName : "ECM_EM_PUBLISH_ALERT_NOTICE" , //表名
- fdId : fd_id , //id
- nextPeopId : a , //下一处理人ID
- userId : realName_ID//处理人ID
- },
- type : 'post',
- dataType : 'json',
- async:false,
- success : function (data){
-
- },error : function(e){
- top.Dialog.alert("系统提示信息!");
- }
- });
-
- var params = {classid :"365",FD_OBJECTID365:fd_id,IS_SEND_365 :"1", SENT_TIME_365:i};
- var params1 = {
- classid:"378",
- PERSON_ID_378:a,
- PERSON_NAME_378:c,
- BUSINESS_ID_378:fd_id,
- STATUES_378:"1",
- DISPOSE_378:"0"
- };
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/updateWarning/',
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- async : false,
- success : function(data) {
- var url = $.pathname() + '/ws/crud/CRUDService/create/';
- $.request.add(url,params1,function(data){
- diag.innerFrame.contentWindow.top.Dialog.close();//关闭弹框
- top.Dialog.alert('发送成功!');
-
-
- /** 代办右上角红色圈里面数字的改变 **/
- var url = $.pathname() + '/ws/xianlutingyun/XianlutingyunService/WarningTask';
- // var compId = top.com.sinosoft.lz.system.user.LoginInfo.getCompany_id();
- var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- // var roleid = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
- var paramsWaitdo = {
- // userId : user_id,//
- netx_id : a//,//
- // isRole : ,//
- // company_id : compId,//
- // role_id : roleid//
- };
- $.ajax({//代办处理
- url : url,
- data : paramsWaitdo,
- type : 'post',
- dataType : 'text',
- timeout : 15000,
- // async : false,
- success : function(data){
- // top.Dialog.alert('发送成功!', null, null, null, -1);
- // top.Dialog.alert('成功!');
- },error : function (e){
- // top.Dialog.alert('系统错误!');
- }
- });
-
- // 跳转到列表页
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
- });
- },
- error : function(e) {
- $.messager.alert('系统提示信息!');
- }
- });
-
- };
-
- //解除成功后,新增一条解除性质的记录,当前记录的IS_RELIEVE状态改为1(已进入解除流程)
- function relieveCurrentRecord(fd_id){
- var params = {classid :"365",FD_OBJECTID365:fd_id,IS_RELIEVE_365 :"1"};
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/updateWarning/',
- data : params,
- type : 'post',
- dataType : 'json',
- timeout : 15000,
- success : function(data) {
- // alert("****************"+JSON.stringify(data));
- },
- error : function(e) {
- // $.messager.alert('访问服务失败!55');
- }
- });
- }
-
- return {
- init : function() {
- $('#save').bind('click',function(){
- _this.save();
- });
- $('#back').bind('click',function(){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
- });
- $("#is_Send").bind('click',function(){
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});//表单验证
-
- if($("#EARLY_WARNING_AREA_NAME_365").val()==""){
- top.Dialog.alert("请选择预警范围(预警范围)!");
- return ;
- }
- if(!valid){
- top.Dialog.alert("请检查标红输入框!");
- return ;
- }
- top.Dialog.confirm("是否要发送?|预警",function(){//点击确定fileDiv
- _this.is_Send();
- },function(){//点击取消
- //$('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/alert/warning/Warning.jsp");
- });
- });
-
- //发布按钮绑定点击事件
- $("#is_Issue").bind('click',function(){
- $form = $('#editForm');
- var valid = $form.validationEngine({returnIsValid: true});//表单验证
- if($("#EARLY_WARNING_AREA_NAME_365").val()==""){
- top.Dialog.alert("请选择预警范围(预警范围)!");
- return;
- }
- if(!valid){
- top.Dialog.alert("请检查标红输入框!");
- return;
- }if(!hasFile()){
- top.Dialog.alert("附件不能为空!请选择并上传附件");
- return;
- }
- top.Dialog.confirm("是否要发布?|响应",function(){//点击确定
- _this.is_Issue();
- },function(){//点击取消
- });
- });
- }
- };
- }();
- $(function() {
- WarningRelieve.init();
- });
- //获得当前系统时间:年月日时分秒
- function getSysTime(){
- var s="";
- var d = allGetServerTime();
- var vYear = d.getFullYear();
- var vMon = d.getMonth() + 1;
- var vDay = d.getDate();
- var h = d.getHours();
- var m = d.getMinutes();
- var se = d.getSeconds();
- 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);
- return s;
- }
- /****
- * 根据id查询事件信息
- */
- function queryEventInfo(event_id){
- var unit_id = "";
- var url = $.pathname() + '/ws/crud/CRUDService/getDataById/';
- var params = {
- classid : '363',
- objectID : event_id
- };
- $.ajax({
- url : url,
- type : 'post',
- data : params,
- dataType : 'json',
- async:false,
- success : function(data) {
- unit_id = data.ISSUE_UNITE_ID_363;
- },
- error : function(e) {
- // $.messager.alert('访问服务失败!55', 'error');
- }
- });
- return unit_id;
- }
- /****
- * 根据id结束事件
- */
- function finishedEvent(event_id,event_name){
- var params = {
- classid : "363",
- FD_OBJECTID363 : event_id,
- EVENT_STATE_363 : "1"
- };
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/update/',
- type : 'post',
- data : params,
- dataType : 'json',
- success : function(data) {
- top.Dialog.alert(event_name+'事件已经结束!', null, null, null, -1);
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/response/emergencyResponse/Warning.jsp");
- },
- error : function(e) {
- $.messager.alert('结束事件失败!');
- }
- });
- }
|