123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- /**
- * 功能:应急预警报告添加及修改
- *
- *
- * @author HXB
- * @date 2015/10/14
- */
- TeamDemandAudit = function() {
- var passOrRock = 0;//判断是 “同意” 还是 “退回”(同意为1 退回未2)
- /**定义变量**/
- var _this = this;
- _this.listGrid = null;// 预警数据列表
- var flag=false;
- var isNew=false; //是否是新增记录
- var editingRow; // 双击的当前编辑行
- var index = 0;
- var allUnitsMsg = "";//无附件时存储 角色id,状态,调拨单位id;... (最后的分号没有去掉)
- /**私有方法**/
- /***新增信息***/
- _this.save = function(diag,fd_id){
- var rangeUniteName = $("#RANGE_UNITS_ID_391").attr("relText");
- $("#RANGE_UNITS_NAME_391").val(rangeUniteName);
- $form1 = $('#editForm1');
- var valid1 = $form1.validationEngine({returnIsValid: true});
- if(valid1){
- var n = $(".companyContent").length;
- for(var i=0;i<n;i++){
- var companyContent = $(".companyContent").eq(i).val();
- if(companyContent == "请分配队伍详情"){
- top.Dialog.alert('请填写调拨描述!');
- diag.close();//关闭弹框
- }
- }
-
- if($("#RANGE_UNITS_ID_391").attr("relValue") == '' && $("#EXPLAIN_378").val() == ''){
- top.Dialog.alert('请选择调拨单位!', null, null, null, -1);
- return;
- }
- var params = "";
- if(passOrRock == 1){//==========同意
- if(true){//无附件,调拨完还需要本级应急办主任或副主任审核
- var rangUnits = $("#RANGE_UNITS_ID_391").attr("relValue");//调拨单位的ID
- var rangUnits2 = $("#RANGE_UNITS_ID_391").attr("relText");//调拨单位的NAMAE
- rangUnits = rangUnits.split(",");
- rangUnits2 = rangUnits2.split(",");
- for(var i=0;i<rangUnits.length;i++){
- allUnitsMsg += "R002105430205,138,"+rangUnits[i]+";";
- }
- $("#ALLOT_UNITS_MSG_391").val(allUnitsMsg);
- var valid = diag.innerFrame.contentWindow.$("#ideaForm").validationEngine({returnIsValid: true});//弹框页面的非空验证
- if(!valid){
- top.Dialog.alert("请检查红色输入框!");
- return;
- };
-
- $("body").eq(0).showLoading();//遮罩
-
- var a = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").val();//弹框页面的下一节点人的id
- var b = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().html();//弹框页面的下一节点人的NAME
- var c = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().next().val();//弹框页面的下一节点人的电话
- var d = diag.innerFrame.contentWindow.$("#msgRemind").attr("checked");//短信是否被勾选
- var e = diag.innerFrame.contentWindow.$("#appRemind").attr("checked");//app是否被勾选
- var role_name = diag.innerFrame.contentWindow.$("#PERSON_ID").val();
- var corpName = $("#SUPPORT_UNIT_ID_391").text();
- var war_name=$("#TASK_NAME_391").val().split('_')[0];
- var level = diag.innerFrame.contentWindow.$("#PERSON_ID").attr("relValue").replace("应急办","");
- var realMobile = top.com.sinosoft.lz.system.user.LoginInfo.getMobile();
- if(realMobile==null || realMobile=="null" || realMobile==""){
- realMobile = "暂无电话";
- }
- //var g = '您有新的审核通过的队伍调拨单,请您及时处理!';//短信内容
- //g=b+role_name+',您好。'+corpName+'在'+war_name+'响应事件中,应急队伍需求较大,队伍调拨需求单经我局应急办研究通过,请上级领导调拨队伍,支援我局。';
- var g=b+level+',您好!'+corpName+'应急队伍需求较大,队伍调拨令已经过应急办制定,请您登陆应急指挥平台进行审核。\n'+realName+","+realMobile;
- var h = getDateTime();//系统时间
- if(a == undefined){
- top.Dialog.alert("请选择下一处理人!");
- return;
- }
- if(d=='checked'){//短信被勾选
- //alert("短信提醒");
- if(a == undefined){
- top.Dialog.alert("请选择短信接收人!");
- return;
- }
- var url0 = $.pathname() + '/ws/sendsms/SendSmsService/saveMessage';
- var param = {
- realName : realName,//发送人真实姓名
- smsRecTel : c,//接收电话
- smsTime : h,//系统时间
- smsContent : g,//短信内容
- smsSendId : realName_ID,//发送人Id
- smsPeople : b/*a*/,//接收人员id?还是name?
- type:"短信发送"
- };
- $.ajax({
- type : 'post',
- url : url0,
- data : param,
- async:false,
- dataType : 'json',
- success : function (data){
- //alert(JSON.stringify(data));
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
- if(e=='checked'){
- alert("应急app提醒!");
- }
-
- diag.innerFrame.contentWindow.top.Dialog.close();//关闭弹框
-
-
- $.ajax({////修改装备需求表的IS_SEEN字段为【下一处理人ID,0 ,处理人ID】
- url : $.pathname() + '/ws/sendsms/SendSmsService/updateIs_Seen',
- data : { tableName : "ECM_EM_TEAM_WRR" ,
- fdId : fd_id ,
- nextPeopId : a ,
- userId : realName_ID},
- type : 'post',
- dataType : 'json',
- async:false,
- success : function (data){
-
- },error : function(e){
- top.Dialog.alert("系统提示信息!");
- }
- });
-
-
-
- //保存下一节点处理人到378表
- $("#PERSON_ID_378").val(a);
- $("#PERSON_NAME_378").val(b);
- $("#BUSINESS_ID_378").val(fd_id);
- $("#STATUES_378").val("138");
- var url = $.pathname() + '/ws/crud/CRUDService/create/';
- var formValue = $("#editForm1").serialize();
- $.request.add(url,formValue,function(data){
- closeProgress();
- });
-
-
- var tempTr = $("#companyNum tr");
- var contentStr = "";
- for(var i = 0;i < tempTr.length;i++){
- var tempTd = $(tempTr).eq(i);
- var id = $(tempTd).find('.companyId').text();
- var name = $(tempTd).find('.companyName').text();
- var content = $(tempTd).find('.companyContent').val();
- contentStr += id + ";"+name+";"+content+"|";
- }
- params = {
- classid : "391",
- FD_OBJECTID391 : $("#FD_OBJECTID391").val(),
- // STATE_391 : $("#STATE_391").val(),//138
- STATE_391 : "138",
- RANGE_UNITS_ID_391:$("#RANGE_UNITS_ID_391").attr("relValue"),
- RANGE_UNITS_NAME_391:$("#RANGE_UNITS_NAME_391").val(),
- UNITS_CONTENT_391:contentStr,
- ALLOT_UNITS_MSG_391:$("#ALLOT_UNITS_MSG_391").val()
- };
- }else{//有附件,直接调拨
- $("body").eq(0).showLoading();//遮罩
-
- /** 队伍调拨加到调拨单位下的应急办成员的代办中 start **/
- var rangUnits = $("#RANGE_UNITS_ID_391").attr("relValue");//调拨单位的ID
- var rangUnits2 = $("#RANGE_UNITS_ID_391").attr("relText");//调拨单位的NAMAE
- rangUnits = rangUnits.split(",");
- rangUnits2 = rangUnits2.split(",");
- for(var i=0;i<rangUnits.length;i++){
- $("#COMPANY_ID_378").val(rangUnits[i]);
- $("#ROLE_ID_378").val("R002105430205");//应急办成员 R002105430205(表 SYS_ROLE)
- $("#BUSINESS_ID_378").val(fd_id);
- $("#STATUES_378").val("135");
- var url = $.pathname() + '/ws/crud/CRUDService/create/';
- var formValue = $("#editForm1").serialize();
- $.request.add(url,formValue,function(data){
- closeProgress();
- });
- }
- /** 队伍调拨加到调拨单位下的应急办成员的代办中 end **/
- var tempTr = $("#companyNum tr");
- var contentStr = "";
- for(var i = 0;i < tempTr.length;i++){
- var tempTd = $(tempTr).eq(i);
- var id = $(tempTd).find('.companyId').text();
- var name = $(tempTd).find('.companyName').text();
- var content = $(tempTd).find('.companyContent').val();
- contentStr += id + ";"+name+";"+content+"|";
- }
- params = {
- classid : "391",
- FD_OBJECTID391 : $("#FD_OBJECTID391").val(),
- // STATE_391 : $("#STATE_391").val(),//138
- STATE_391 : "135",
- RANGE_UNITS_ID_391:$("#RANGE_UNITS_ID_391").attr("relValue"),
- RANGE_UNITS_NAME_391:$("#RANGE_UNITS_NAME_391").val(),
- UNITS_CONTENT_391:contentStr
- };
- }
- }else if(passOrRock == 2){//==========退回
- $("body").eq(0).showLoading();//遮罩
-
- var tianBaoRenNAME = $("#FORM_NAME_391").val();
- var tianBaoRenID = $("#USER_ID_391").val();
-
- $.ajax({
- url : $.pathname() + '/ws/sendsms/SendSmsService/getLastPersonMsg',
- data : {
- fd_id : $("#BUSINESS_ID_378").val(),
- STATE : 132
- },
- type : 'post',
- dataType : 'json',
- async : false,
- timeout : 66666,
- success : function(resultData){
- tianBaoRenNAME = resultData.name;
- tianBaoRenID = resultData.id;
- },error : function(e){
- top.Dialog.alert("系统错误!");
- }
- });
-
-
-
- $("#PERSON_ID_378").val(tianBaoRenID);//该条记录的填报人ID
- $("#PERSON_NAME_378").val(tianBaoRenNAME);//该条记录的填报人NAME
- //$("#BUSINESS_ID_378").val(fd_id);
- //$("#STATUES_378").val("134");
- $("#STATUES_378").val("132");
- var url = $.pathname() + '/ws/crud/CRUDService/create/';
- var formValue = $("#editForm1").serialize();
- $.request.add(url,formValue,function(data){
- closeProgress();
- });
-
- params = {
- classid : "391",
- FD_OBJECTID391 : $("#FD_OBJECTID391").val(),
- // STATE_391 : $("#STATE_391").val(),
- //STATE_391 : "134"//审核未通过
- STATE_391 : "132"//审核通过
- /*,
- RANGE_UNITS_ID_391:$("#RANGE_UNITS_ID_391").attr("relValue"),
- RANGE_UNITS_NAME_391:$("#RANGE_UNITS_NAME_391").val(),
- UNITS_CONTENT_391:contentStr*/
- };
- }
-
- $.ajax({
- url : $.pathname() + '/ws/crud/CRUDService/update/',
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- success : function(data) {
- closeProgress();
- if(passOrRock == 2){
- //top.Dialog.alert('调拨令未制定成功!', null, null, null, -1);
- top.Dialog.alert('调拨令回退成功!', null, null, null, -1);
- }else if(passOrRock == 1){
- top.Dialog.alert('调拨令制定成功!', null, null, null, -1);
- }
- if(isWaitDo == 1){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
- }else{
- $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
- }
- //$('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
- },error : function(e) {
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }else{
- if(passOrRock == 1){
- top.Dialog.alert('请填写调拨描述!');
- diag.close();//关闭弹框
- }else if(passOrRock == 2){
- top.Dialog.alert('请填写回退说明!');
- }
- }
-
- /** 代办右上角红色圈里面数字的改变 **/
- var url = $.pathname() + '/ws/xianlutingyun/XianlutingyunService/WarningTask';
- var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var compId = $("#RANGE_UNITS_ID_391").attr("relValue");
- var roleid = $("#ROLE_ID_378").val();
- var params = "";
- if(passOrRock == 1){//同意
- params = {
- userId : user_id,//处理人ID(系统登录人)
- // netx_id : b,//下一节点处理人ID
- isRole : "1",//
- company_id : compId,//
- role_id : roleid//
- };
- }else if(passOrRock == 1){//退回
- params = {userId : user_id};
- }
- $.ajax({//代办处理
- url : url,
- data : params,
- type : 'post',
- dataType : 'text',
- timeout : 15000,
- // async : false,
- success : function(data){
- // top.Dialog.alert('发送成功!', null, null, null, -1);
- },error : function (e){
- // top.Dialog.alert('系统错误!');
- }
- });
- };
- return {
- init : function() {
- var temp = {"pager.pageNo":0,"pager.totalRows":0,"rows":[],listId:'331'};
- /** grid载入数据* */
- _this.listGrid = $("#maingrid").quiGrid( {
- //title : "预警接收管理数据列表",
- columns : [
- { display: '队伍类型', name: 'ANSWER_CODE_331', align: 'center', width: "45%",editor: { type: 'text' }},
- { display: '需求人数', name: 'THIS_ANSWER_GRADE_331', align: 'center', width: "45%",editor: { type: 'text' }}/*,
- { display: '操作', isSort: false, align: 'center', width: "30%",render:function (rowdata, rowindex, value){
- var h = "";
- //h += "<a onclick='endEdit("+rowindex+")'><span class='icon_edit'>确认</span></a> ";
- //h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>取消</span></a> ";
- return h;
- }}*/
-
- ],
- //url : $.pathname() + '/ws/crud/CRUDService/queryQui',
- params:temp,
- width : "100%",
- rownumbers:true,
- percentWidthMode : true,
- usePager:false
- });
- var fd_id = (window.location.href).split('?')[1];//获取记录id
- var ids = fd_id.split("=")[1].split("&");
-
- $.post($.pathname() + '/ws/crud/CRUDService/getDataById/',{classid : '391',objectID : ids[0]},function(data){
- var test = {"pager.pageNo":1,"pager.totalRows":3,"rows":JSON.parse(data.TROOPS_391)};
- _this.listGrid.loadData(test);
- });
- $('#pass').bind('click',function(){
- passOrRock = 1;
- $("#EXPLAIN_378").val('');//清空回退说明
- $("#companyNum").show();//显示调拨描述
- var is_audit = $("#is_audit").val();
- if(is_audit == 0){//审核
- $(".person").show();
- $("#PERSON_ID_378").attr("class","validate[required]");
- $("#remark").hide();
- $("#EXPLAIN_378").attr("class","");
- $("#is_pass").val("0");
- }else{//二审----制定调拨令
- $("#remark").hide();
- $("#EXPLAIN_378").attr("class","");
- $("#PERSON_ID_378").attr("class","");
- $("#unitId").show();
- }
- $("#sub").show();
- // $("#STATE_391").val("135");
- $("#STATE_391").val("138");
- $(top.document.body).find('#frmright').height($(window.document.body).height());
- });
-
- function dialogDemo(){
- var fdid = (window.location.href).split('=')[1];//获取记录id(1)
- var fd_id = fdid.split('&')[0];//获取记录id(2)
- var CorpID = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var diag = new top.Dialog();
- diag.Title = '审核意见';
- diag.URL = $.pathname() + '/page/business/em/response/team/TeamNextRole.jsp?fd_id='+fd_id+'&ershen=0&deptId='+CorpID;
- diag.OkButtonText = '提交';
- diag.OKEvent = function(){
- _this.save(diag,fd_id);
- // _this.save();
- };
- diag.Width = 500; //宽度
- diag.Height = 340; //高度
- diag.ButtonAlign = 'center';
- diag.show();
- };
-
- $('#rock').bind('click',function(){
- passOrRock = 2;
- // $("#companyNum").replaceWith("<table id='companyNum' class='tableStyle' width='85%' align='center'></table>");//清空调拨描述
- $("#companyNum").empty();//效果同上
- $(".remark").show();
- $("#person").hide();
- $("#PERSON_ID_378").attr("class","");
- $("#EXPLAIN_378").attr("class","validate[required]");
- $("#is_pass").val("1");
- //$("#STATE_391").val("134");//审核未通过
- $("#STATE_391").val("132");//审核通过
- $("#unitId").hide();
- $("#RANGE_UNITS_ID_391").attr("relValue","");//清空调拨单位的值
- $(top.document.body).find('#frmright').height($(window.document.body).height());
-
- var position = 0;
- var txtFocus = document.getElementById("EXPLAIN_378");
- if($.browser.mise){
- var range = txtFocus.createTextRange();
- range.move("character",position);
- range.select();
- }else{
- txtFocus.setSelectionRange(position,position);
- txtFocus.focus();
- }
-
- });
- $('#save').bind('click',function(){
- if(passOrRock==1){
- dialogDemo(passOrRock);
- }else{
- _this.save(null,null);
- }
- });
- $('#back').bind('click',function(){
- if(isWaitDo == 1){
- $('#frmright',window.parent.document).attr('src',$.pathname()+"/page/business/em/waitdo/waitDo.html");
- }else{
- $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
- }
- //$('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
- });
- }
- };
- }();
- $(function() {
- TeamDemandAudit.init();
- });
|