123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864 |
- //获取用户Id
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- //获取用户部门Id
- var corpId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- //获取公司Id
- //var comp_id = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
- var comp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
- var _thisUrl = window.location.href;
- var role_id = getUrlParams("role_Id",_thisUrl);//top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
- var fd_id = getUrlParams("fd_id",_thisUrl);
-
- var dept_name = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- var real_name = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- //获取时间
- var relval="";
- var sysval; var equipmentval; var markval;var safeyval;var qxval;
- var systext;var equipmenttext;var marktext;var safetext;var qxtext;
- var message="应急办:" ;
-
- var tableName = "";
- var areaId = "";
- var areaName = "";
- var planType = "";
- var deptLevel = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getDeptLevel",{"comp_id":corpId},"text");
-
-
- function goback(){
- if(_thisUrl.indexOf("fd_id")>-1 && planType == '0'){
- window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+fd_id);
- }else if(_thisUrl.indexOf("fd_id")>-1 && planType == '1'){
- window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/response/emergencyResponse/WarningReleaseMatter.jsp?fd_id="+fd_id);
- }else{
- window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/report/Report_Require.jsp");
- }
-
- }
- function initComplete(){
- $("#back").hover(function(){
- $(this).attr("src","/nwyj/images/temp/back_hover.png");
- },function(){
- $(this).attr("src","/nwyj/images/temp/back.png");
- });
-
-
-
-
- $("#DEPT_337").val(dept_name);
- $("#REAL_NAME_337").val(real_name);
- $("#ROLE_ID_337").val(role_id);
- $("#COMP_ID_337").val(corpId);
- $("#USER_ID_337").val(userId);
- initTypeSel();
- var alerttUrl = $.pathname() + '/ws/xianlutingyun/XianlutingyunService/getReportWarnningNumber/';
- $.ajax({
- url:alerttUrl,
- type:'post',
- data:{unitId : dept_name,comp_id :corpId,role_id:role_id,fd_id:fd_id},
- dataType:'json',
- async:false,
- success:function(data){
- //alert(JSON.stringify(data));
- $("#WARNING_NUMBER_337").data("data",data);
- $("#WARNING_NUMBER_337").render();
- if(_thisUrl.indexOf("fd_id")>-1){
- $("#WARNING_NUMBER_337").setValue(data[0].value);
- $("#WARNING_NUMBER_337").render();
- getProjectName();
- }
- },
- error:function(){
-
- }
- });
- change('round');
- checkScreenWidth();
-
-
- $("#WRITE_DEPT_SHOW").on("mouseenter","li",function(){
- $(this).addClass("hoverli");
- });
-
- $("#WRITE_DEPT_SHOW").on("mouseleave","li",function(){
- $(this).removeClass("hoverli");
- });
-
- $("#WRITE_DEPT_SHOW").on("click","li",function(){
- $("#inverse").removeClass("backcolor");
- $("#addAll").removeClass("backcolor");
- var _this = $(this);
- var id = _this.attr("id");
- if(_this.hasClass("selectedli")){
- _this.removeClass("selectedli");
- $("#WRITE_DEPT li").each(function(){
- if($(this).data("id")==id){
- $(this).remove();
- }
- });
- }else{
- _this.addClass("selectedli");
- var $li = $("<li class='selectCondi'>"+_this.text()+"</li>");
- $li.data("id",_this.attr("id"));
- $("#WRITE_DEPT").append($li);
- }
- $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
- // $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- setBbContentHeight();
- });
-
- $("#WRITE_DEPT").on("click","li",function(){
- $("#inverse").removeClass("backcolor");
- $("#addAll").removeClass("backcolor");
- var _this = $(this);
- var id = _this.data("id");
- _this.remove();
- $("#WRITE_DEPT_SHOW li").each(function(){
- if(id==$(this).attr("id")){
- $(this).removeClass("selectedli");
- }
- });
- $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
- // $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- setBbContentHeight();
- });
- //全选
- $("#addAll").bind("click",function(){
- $("#inverse").removeClass("backcolor");
- $("#addAll").addClass("backcolor");
- $("#WRITE_DEPT").empty();
- $("#WRITE_DEPT_SHOW li").each(function(){
- var $li = $("<li class='selectCondi'>"+$(this).text()+"</li>");
- $li.data("id",$(this).attr("id"));
- $("#WRITE_DEPT").append($li);
- });
- $("#WRITE_DEPT_SHOW li").addClass("selectedli");
- $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
- // $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- setBbContentHeight();
- });
- //反选
- $("#inverse").bind("click",function(){
- if($("#WRITE_DEPT li").length<=0){
- return;
- }
- $("#inverse").addClass("backcolor");
- $("#addAll").removeClass("backcolor");
- $("#WRITE_DEPT").empty();
- $("#WRITE_DEPT_SHOW li").each(function(){
- var _this = $(this);
- if(_this.hasClass("selectedli")){
- _this.removeClass("selectedli");
- }else{
- _this.addClass("selectedli");
- var $li = $("<li class='selectCondi'>"+_this.text()+"</li>");
- $li.data("id",_this.attr("id"));
- $("#WRITE_DEPT").append($li);
- }
- });
- $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
- // $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- setBbContentHeight();
- });
- }
- function checkScreenWidth(){
- var W = window.screen.width;
- var H = window.screen.height;
- if(W=="1024"&&H=="768"){
- $("#buttonDiv").css("left","74.5%");
- }
- }
- function initTypeSel(){
- var urls = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getRequireTypeSel";
- $.ajax({
- url : urls,
- type : 'post',
- timeout : 15000,
- async : false,
- data : {
- "comp_id" : corpId
-
- },
- dataType : 'json',
- success : function(data) {
- for(var i=0;i<data.length;i++){
- var data1 = data[i].value;
- data1 = eval('('+data1+')');
- if(data[i].key=='R002105430210'){
- $("#SYSTEM_DEPT").data("data",data1);
- $("#SYSTEM_DEPT").render();
- }
- if(data[i].key=='R002105430211'){
- $("#EQUIPMENT_DEPT").data("data",data1);
- $("#EQUIPMENT_DEPT").render();
- }
- if(data[i].key=='R002105430212'){
- $("#MARKETING_DEPT").data("data",data1);
- $("#MARKETING_DEPT").render();
- }
- if(data[i].key=='R002105430213'){
- $("#SAFEY_DEPT").data("data",data1);
- $("#SAFEY_DEPT").render();
- }
-
- if(deptLevel=="2"){
- if(data[i].key=='R002105430222'){
- $("#QX_DEPT").data("data",data1);
- $("#QX_DEPT").render();
- }
- $("#qx").show();
- }
- }
- setBbContentHeight();
- },
- error : function(e) {
- $.messager.alert('查询报表类型失败', '访问服务失败!', 'error');
- }
- });
- }
- /**
- * 保存
- */
- function sure(nextReportTaskFlag){
- var pattern = new RegExp("[`~!@#$^&*=|{}':;',\\[\\].<>/?~!@#¥……&*|{}【】‘;:”“'。,、?]");
- //var obj = getTimeId();
- if(!checkTime()){
- return;
- }else if(!decideTime()){
- return ;
- } else if(!checkTimes()){
- return;
- }/*else if(!checkTimeAdd("addTime",obj,timeindex)){
- return;
- }*/else if(pattern.test($("#PROJECT_NAME_337").val())){
- top.Dialog.alert("计划名称不能包含特殊字符");
- return;
- }
-
- else{
- if($("#SYSTEM_DEPT").attr("relText")!="请选择"){
- sysval = splits($("#SYSTEM_DEPT").attr("relValue"));
- systext = $("#SYSTEM_DEPT").attr("relText");
- var nodes = $("#SYSTEM_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- tableName += nodes[i].report_type+","+nodes[i].name+"||";
- }
- message += sysval+";"+systext +"|";
- }
-
- if($("#EQUIPMENT_DEPT").attr("relText")!="请选择"){
- equipmentval = splits($("#EQUIPMENT_DEPT").attr("relValue"));
- equipmenttext = $("#EQUIPMENT_DEPT").attr("relText");
- var nodes = $("#EQUIPMENT_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- tableName += nodes[i].report_type+","+nodes[i].name+"||";
- }
- message += equipmentval+";"+equipmenttext+"|";
- }
-
- if($("#MARKETING_DEPT").attr("relText")!="请选择"){
- markval = splits($("#MARKETING_DEPT").attr("relValue"));
- marktext = $("#MARKETING_DEPT").attr("relText");
- var nodes = $("#MARKETING_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- tableName += nodes[i].report_type+","+nodes[i].name+"||";
- }
- message += markval+";"+marktext+"|";
- }
- if($("#SAFEY_DEPT").attr("relText")!="请选择"){
- safeyval = splits($("#SAFEY_DEPT").attr("relValue"));
- safetext = $("#SAFEY_DEPT").attr("relText");
- var nodes = $("#SAFEY_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- tableName += nodes[i].report_type+","+nodes[i].name+"||";
- }
- message += safeyval+";"+safetext+"|";
- }
-
- if(deptLevel=="2"){
- if($("#QX_DEPT").attr("relText")!="请选择"){
- qxval = splits($("#QX_DEPT").attr("relValue"));
- qxtext = $("#QX_DEPT").attr("relText");
- var nodes = $("#QX_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- tableName += nodes[i].report_type+","+nodes[i].name+"||";
- }
- message += qxval+";"+qxtext+"|";
- }
- }
-
- if(message=="应急办:" || tableName==""){
- top.Dialog.alert("最少选择一个部门填报报表");
- return;
- }
- $("#REPORT_DEPT_337").val(message);
- console.log(tableName);
- var json=[{
- "WARNING_NUMBER":$("#EARLY_WARNING_ID").val(),
- "START_TIME":$("#START_TIME_337").val(),
- "FILL_IN_SCHEDULE": getVal(),
- "REPORT_DEPT":tableName,
- "DEPT_ID":corpId,
- "ROUND_TIME":$("#ROUND_TIME_337").val(),
- "TEMPORARY_TIME":$("#TEMPORARY_TIME_337").val(),
- "USER_ID":userId,
- "ROLE_ID":$("#ROLE_ID_337").val(),
- "deptName":comp_name,
- "real_name":real_name,
- "alertName":$("#EARLY_WARNING_NAME").val(),
- "areaId":areaId,
- "areaName":areaName,
- "isAlert":$("#IS_ALERT").val(),
- "alertLevel":$("#CURRENT_EW_LEVEL").val()
- }];
- var jsonData = JSON.stringify(json);
- console.log(jsonData);
-
- //$form = $("#requireForm");
- //var url = $.pathname() + '/ws/crud/CRUDService/create';
- var url = $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/createPlanByAlert";
- $.ajax({
- url : url,
- type : 'post',
- //data : $form.serialize(),
- data : {json:jsonData,type:"sure",nextFlag:nextReportTaskFlag},
- dataType : 'text',
- timeout : 60000,
- success : function(data){
- top.Dialog.alert("保存成功",null,null,null,null);
- if(_thisUrl.indexOf("fd_id")>-1 && planType == '0'){
- window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+fd_id);
- }else if(_thisUrl.indexOf("fd_id")>-1 && planType == "1"){
- window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/response/emergencyResponse/WarningReleaseMatter.jsp?fd_id="+fd_id);
- }else{
- goback();
- }
- },
- error : function(){
- top.Dialog.alert('操作失败');
- }
- });
- }
- }
- /**
- * 保存并发布
- */
- function save1(nextReportTaskFlag){
- var pattern = new RegExp("[`~!@#$^&*=|{}':;',\\[\\].<>/?~!@#¥……&*|{}【】‘;:”“'。,、?]");
- //var obj = getTimeId();
- if(!checkTime()){
- return;
- }else if(!decideTime()){
- return ;
- } else if(!checkTimes()){
- return;
- }/*else if(!checkTimeAdd("addTime",obj,timeindex)){
- return ;
- }*/else if(pattern.test($("#PROJECT_NAME_337").val())){
- top.Dialog.alert("计划名称不能包含特殊字符");
- return;
- }
- else{
- if($("#SYSTEM_DEPT").attr("relText")!="请选择"){
- sysval = splits($("#SYSTEM_DEPT").attr("relValue"));
- systext = $("#SYSTEM_DEPT").attr("relText");
- var nodes = $("#SYSTEM_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- tableName += nodes[i].report_type+","+nodes[i].name+"||";
- }
- message += sysval+";"+systext +"|";
- }
-
- if($("#EQUIPMENT_DEPT").attr("relText")!="请选择"){
- equipmentval = splits($("#EQUIPMENT_DEPT").attr("relValue"));
- equipmenttext = $("#EQUIPMENT_DEPT").attr("relText");
- var nodes = $("#EQUIPMENT_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- tableName += nodes[i].report_type+","+nodes[i].name+"||";
- }
- message += equipmentval+";"+equipmenttext+"|";
- }
-
- if($("#MARKETING_DEPT").attr("relText")!="请选择"){
- markval = splits($("#MARKETING_DEPT").attr("relValue"));
- marktext = $("#MARKETING_DEPT").attr("relText");
- var nodes = $("#MARKETING_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- tableName += nodes[i].report_type+","+nodes[i].name+"||";
- }
- message += markval+";"+marktext+"|";
- }
- if($("#SAFEY_DEPT").attr("relText")!="请选择"){
- safeyval = splits($("#SAFEY_DEPT").attr("relValue"));
- safetext = $("#SAFEY_DEPT").attr("relText");
- var nodes = $("#SAFEY_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- tableName += nodes[i].report_type+","+nodes[i].name+"||";
- }
- message += safeyval+";"+safetext+"|";
- }
-
- if(deptLevel=="2"){
- if($("#QX_DEPT").attr("relText")!="请选择"){
- qxval = splits($("#QX_DEPT").attr("relValue"));
- qxtext = $("#QX_DEPT").attr("relText");
- var nodes = $("#QX_DEPT").data("selectedNodes");
- for(var i=0;i<nodes.length;i++){
- tableName += nodes[i].report_type+","+nodes[i].name+"||";
- }
- message += qxval+";"+qxtext+"|";
- }
- }
- if(message=="应急办:" || tableName==""){
- top.Dialog.alert("最少选择一个部门填报报表");
- return;
- }
- $("#REPORT_DEPT_337").val(message);
-
- /*var json=[{
- "ROLE_ID":$("#ROLE_ID_337").val(),
- "DEPT":$("#DEPT_337").val(),
- "REAL_NAME":$("#REAL_NAME_337").val(),
- "REPORT_DEPT":$("#REPORT_DEPT_337").val(),
- "ROUND_TIME":$("#ROUND_TIME_337").val(),
- "TEMPORARY_TIME":$("#TEMPORARY_TIME_337").val(),
- "PROJECT":$("#PROJECT_NAME_337").val(),
- "START_TIME":$("#START_TIME_337").val(),
- "END_TIME":$("#END_TIME_337").val(),
- "FILL_IN_SCHEDULE": getVal(),
- "WARNING_NUMBER":$("#WARNING_NUMBER_337").val()
-
- }];*/
- var json=[{
- "WARNING_NUMBER":$("#EARLY_WARNING_ID").val(),
- "START_TIME":$("#START_TIME_337").val(),
- "FILL_IN_SCHEDULE": getVal(),
- "REPORT_DEPT":tableName,
- "DEPT_ID":corpId,
- "ROUND_TIME":$("#ROUND_TIME_337").val(),
- "TEMPORARY_TIME":$("#TEMPORARY_TIME_337").val(),
- "USER_ID":userId,
- "ROLE_ID":$("#ROLE_ID_337").val(),
- "deptName":comp_name,
- "real_name":real_name,
- "alertName":$("#EARLY_WARNING_NAME").val(),
- "areaId":areaId,
- "areaName":areaName,
- "isAlert":$("#IS_ALERT").val(),
- "alertLevel":$("#CURRENT_EW_LEVEL").val()
- }];
- var jsonData = JSON.stringify(json);
-
- $("body").eq(0).showLoading();
- $.ajax({
- //url : $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/saveAndSend",
- url : $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/createPlanByAlert",
- type : 'post',
- data : {json:jsonData,type:"save","nextFlag":nextReportTaskFlag},
- /*{
- json:jsons,
- compId:corpId,
- userId:userId
- }*/
- dataType : 'json',
- timeout : 60000,
- success : function(data){
- if(data[0].succ=="true"){
- $("body").eq(0).hideLoading();
- var name=data[0].name;
- var tel=data[0].tel;
- top.Dialog.confirm("保存并发布成功,是否发送短信?|发送短信",function(){
- addMsg(name,tel,"","1");
- },function(){
- if(_thisUrl.indexOf("fd_id")>-1 && planType == '0'){
- window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/alert/warning/WarningReleaseMatter.jsp?fd_id="+fd_id);
- }else if(_thisUrl.indexOf("fd_id")>-1 && planType == "1"){
- window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/response/emergencyResponse/WarningReleaseMatter.jsp?fd_id="+fd_id);
- }else{
- goback();
- }
- });
- }else{
- top.Dialog.alert("保存并发布失败");
- }
-
-
- },
- error : function(){
- top.Dialog.alert('操作失败');
- }
- });
- }
- }
- //是否生成下级任务 有选择填报单位时生成下级任务
- var nextReportTaskFlag = true;
- function save(num) {
- var valid = $("#requireForm").validationEngine({
- returnIsValid : true
- });
- if($("#WRITE_DEPT").text()==""){
- nextReportTaskFlag = false;
- }
-
- var deptLength = $("#WRITE_DEPT li").length;
- for(var i=0;i<deptLength;i++){
- areaId += $("#WRITE_DEPT li").eq(i).data("id")+",";
- areaName += $("#WRITE_DEPT li").eq(i).text()+",";
- }
-
- if(valid==true&&num=="1"){
- //保存
- sure(nextReportTaskFlag);
- }else if(valid==true&&num=="0"){
- //保存并发布
- save1(nextReportTaskFlag);
- }else{
-
- var obj = getTimeId();
- if($("#WARNING_NUMBER_337").val().trim()==""){
- top.Dialog.alert("请输入预警/响应编号");
- }else if($("#PROJECT_NAME_337").val().trim()==""){
- top.Dialog.alert("请输入填报要求名称");
- }else if($("#START_TIME_337").val().trim()==""){
- top.Dialog.alert("请输入起始日期");
- }else if(obj=="round" || obj=="temporary"){
- var $inputs = $("#addTime").find("input");
- for(var i=0;i<$inputs.length;i++){
- if($inputs.eq(i).val()==""){
- if(obj=="temporary"){
- top.Dialog.alert("请输入第"+(i+1)+"个临时性时间");
- }else{
- top.Dialog.alert("请输入第"+(i+1)+"个周期性时间");
- }
- break;
- }
-
- }
- }
- }
- }
- function clear_msg(){
- top.Dialog.confirm("确定要重置?将会清空填写的数据,请慎重选择|重置", function() {
- $("#WARNING_NUMBER_337").render();
- $("#START_TIME_337").val("");
- $("#END_TIME_337").val("");
- $("#PROJECT_NAME_337").val("");
- $(".selectTree").render();
- $("#round").attr("checked","checked");
- change("round");
- });
- }
- //置换周期性、临时性
- function change(obj){
- timeindex = 0;
- if(obj=="round"){
- $("#addTime").html("");
- var $td=$('<td class="circle_type" colspan="3" fixedCellHeight="true"></td>');
- var $date = $('<input type="text" class="date validate[required] round" id="time0" style="width:32%;" dateFmt="HH:mm" readOnly="readOnly"/>');
- var $add = $('<input type="button" id="addBtn" onclick="addTime()" value="增加"/>');
- var $delete = $('<input type="button" id="addBtn" onclick="deleteTime()" value="删除"/>');
- $td.append($date);
- $td.append($add);
- $td.append($delete);
- $("#addTime").append('<td width="15%" align="right" class="circle_type"><span class="star">*</span>每日:</td>');
- $("#addTime").append($td);
- $add.render();
- $delete.render();
- $date.render();
- }
- if(obj=="temporary"){
-
- $("#addTime").html("");
- var $td=$('<td class="temporary_type" colspan="3" fixedCellHeight="true"></td>');
- var $date = $('<input type="text" class="date validate[required] temporary" id="time0" style="width:32%;" dateFmt="yyyy-MM-dd HH:mm" readOnly="readOnly"/>');
- var $add = $('<input type="button" id="addBtn" onclick="addTime()" value="增加"/>');
- var $delete = $('<input type="button" id="addBtn" onclick="deleteTime()" value="删除"/>');
- $td.append($date);
- $td.append($add);
- $td.append($delete);
- $("#addTime").append('<td width="15%" align="right" class="temporary_type"><span class="star">*</span>填报时间:</td>');
- $("#addTime").append($td);
- $add.render();
- $delete.render();
- $date.render();
-
- }
- }
- //判定时间
- function checkTime(){
-
- var star = $("#START_TIME_337").val();
- var end = $("#END_TIME_337").val();
- star = star.substring(0,10);
- if(star&&end&&(star>end)){
- top.Dialog.alert("截止日期不能小于起始日期");
- return false;
- }else{
- return true;
- }
-
-
-
- }
- //获取下填报要求报告的名字
- function getProjectName(){
-
- var value = $("#WARNING_NUMBER_337").val();
- var selData = $("#WARNING_NUMBER_337").data("data");
- if(value){
- for(var i=0;i<selData.length;i++){
- if(selData[i]["value"]==value){
- if(selData[i]["is_alert"]=='0'){
- $("#PROJECT_NAME_337").val($("#WARNING_NUMBER_337").attr("relText")+"预警计划");
- }else{
-
- $("#PROJECT_NAME_337").val($("#WARNING_NUMBER_337").attr("relText")+"响应计划");
- }
- planType = selData[i]["is_alert"];
- $("#EARLY_WARNING_ID").val(selData[i]["key"]);
- $("#EARLY_WARNING_NAME").val(selData[i]["value"]);
- $("#IS_ALERT").val(selData[i]["is_alert"]);
- $("#EARLY_WARNING_AREA_NAME").val(selData[i]["early_warning_area_name"]);
- $("#EARLY_WARNING_AREA_ID").val(selData[i]["early_warning_area_id"]);
- $("#CURRENT_EW_LEVEL").val(selData[i]["current_ew_level"]);
- childComp(selData[i]["early_warning_area_name"]);
- }
- }
- }else{
- $("#PROJECT_NAME_337").val("");
- $("#WRITE_DEPT_SHOW").empty();
- $("#WRITE_DEPT").empty();
- $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
- }
- setBbContentHeight();
- }
-
- function childComp(area){
- var url = $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/childComp";
- $.post(url,{comp_id:corpId},function(data){
- //alert(JSON.stringify(data));
- $("#WRITE_DEPT_SHOW").empty();
- $("#WRITE_DEPT").empty();
- $.each(data,function(n,value){
- var $li = null;
- if(area.indexOf(value.COMP_NAME)>-1){
- $li = ("<li id='"+value.COMP_ID+"' class='selectedli'>"+value.COMP_NAME+"</li>");
- var $lis = $("<li class='selectCondi'>"+value.COMP_NAME+"</li>");
- $lis.data("id",value.COMP_ID);
- $("#WRITE_DEPT").append($lis);
- $("#selectNum").text("已选择"+$("#WRITE_DEPT li").length+"个填报单位");
- $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- }else{
- $li = ("<li id='"+value.COMP_ID+"'>"+value.COMP_NAME+"</li>");
- }
- $("#WRITE_DEPT_SHOW").append($li);
- });
- },"json");
- }
-
- //获取当前时间
- function getTime(){
- var now=allGetServerTime();
- var year = now.getFullYear();
- var month=now.getMonth()+1;
- if(month>=1&&month<=9){
- month = "0"+month;
- }
- //获取日期
- var day=now.getDate();
- if(day>=1&&day<=9){
- day = "0"+day;
- }
- var currenttime = year+"-"+month+"-"+day;
-
- return currenttime;
- };
-
- //判断起始时间和截止时间不能小于当前时间
- function decideTime(){
- var star = $("#START_TIME_337").val();
- var end = $("#END_TIME_337").val();
-
-
-
- if(star&&end&&(getTime()>star||getTime()>end)){
- top.Dialog.alert("起始日期或截止日期不能小于当前日期");
- return false;
- }else if(star&&(getTime()>star)){
- top.Dialog.alert("起始日期不能小于当前日期");
- return false;
- }
- else{
- return true;
- }
-
- }
-
-
- //将角色Id劈开
- function splits(val){
- relval = val.split(",")[0];
- return relval;
- }
-
- var timeindex = 0;
- function addTime(){
- var obj = getTimeId();
- /*if(checkTimeAdd("addTime",obj,timeindex)){*/
- var addTime = $("#addTime");
- var lastVal = addTime.find("."+obj).last().val();
- if(lastVal==""){
- top.Dialog.alert("请输入时间再进行添加");
- return false;
- }
- timeindex++;
- var $date = "";
- if(obj=="round"){
- $date = $('<input type="text" id="time'+timeindex+'" class="date validate[required] round" style="width:32%;" dateFmt="HH:mm" readOnly="readOnly"/>');
- }else{
- $date = $('<input type="text" id="time'+timeindex+'" class="date validate[required] temporary" style="width:32%;" dateFmt="yyyy-MM-dd HH:mm" readOnly="readOnly"/>');
- }
-
- $("#addBtn").before($date);
- $date.render();
- $("#addBtn").render();
- addTime.render();
-
- setBbContentHeight();
- /*}*/
-
- }
- function deleteTime(){
- var $date = $("#addTime").find(".date");
- if($date.length==1){
- return;
- }else{
- $date.last().remove();
- timeindex--;
- }
- setBbContentHeight();
-
- }
-
-
-
- function checkTimes(){
- var obj = getTimeId();
- var timeStr = "";
- var startTime = $("#START_TIME_337").val().substring(0,10);
- var endTime = $("#END_TIME_337").val();
- var $date = $("#addTime").find(".date");
- for(var i=0;i<$date.length;i++){
- var time = $date.eq(i).val().trim();
- if(obj=="temporary"){
- var time1 = time.substring(0,10);
- if(startTime&&endTime&&(time1<startTime||time1>endTime)){
- top.Dialog.alert("填报时间要在起始日期和截止日期之间");
- return false;
- }else if(startTime&&(time1<startTime)){
- top.Dialog.alert("填报时间不能小于起始日期");
- return false;
- }
- }
-
- timeStr +=time+';';
-
-
- }
- timeStr = timeStr.substring(0, timeStr.lastIndexOf(";"));
-
- if(obj=="temporary"){
- $("#TEMPORARY_TIME_337").val(timeStr);
- }else{
- $("#ROUND_TIME_337").val(timeStr);
- }
- return true;
- }
-
- function getTimes(){
-
- var now=allGetServerTime();
- //获取年份
- var year=now.getFullYear();
- //获取月份
- var month=now.getMonth()+1;
- if(month>=1&&month<=9){
- month = "0"+month;
- }
- //获取日期
- var day=now.getDate();
- if(day>=1&&day<=9){
- day = "0"+day;
- }
- //获取小时
- var hours=now.getHours();
- if(hours>=1&&hours<=9){
- hours = "0"+hours;
- }
- //获取分钟
- var minutes=now.getMinutes();
- if(minutes>=1&&minutes<=9){
- minutes = "0"+minutes;
- }
- //获取秒
- var seconds=now.getSeconds();
- if(seconds>=1&&seconds<=9){
- seconds = "0"+seconds;
- }
- var currentTime =year+"-"+month+"-"+day+" "+hours+":"+minutes+":"+seconds;
- return currentTime;
- }
-
- function getVal(){
- $int=$("#int").find("input");
-
- for(var i=0;i<$int.length;i++){
- if($int.eq(i).attr("checked")=="checked"){
- return $int.eq(i).val();
- }
- }
- }
-
-
- function getTimeId(){
-
- var $radio = $("#int :radio");
- var obj = "";
- for(var i=0;i<$radio.length;i++){
- if($radio.eq(i).attr("checked")=="checked"){
- obj = $radio.eq(i).attr("id");
- }
- }
-
- return obj;
- }
-
-
- function getUrlParams(msg,url){
- if(msg!=""&&url.indexOf(msg)>-1){
- return url.split("?")[1].split("=")[1];
- }else{
- return "";
- }
- }
-
- function setBbContentHeight(){
- var content = $(".box1").height();
- $(window.document.body).height(content+30);
- $(parent.document.body).find("#frmright").height($(window.document.body).height());
- }
-
|