12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031 |
- var corpId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- //部门名称
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
-
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- //获取用户Id
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var _thisUrl = window.location.href;
- //获取role_id
- var role_id = getUrlParams("role_Id=",_thisUrl);//top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
- var real_name = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- var addmessage =""; var relval;
- var sysval; var equipmentval; var markval;var safeyval;
- var systext;var equipmenttext;var marktext;var safetext;
- var temp;var roundtime;
- var flag = true;
- var roleSel = "";
- var roleObj = {"R002105430210":"系统运行部",
- "R002105430211":"生产设备部",
- "R002105430213":"安全监管部",
- "R002105430212":"市场营销部"};
-
-
-
-
- function initComplete(){
-
- var pepRole = role_id;
- if(pepRole=="R002105430200"){
- $(".tipsDiv").text("超级管理员没有固定模版");
- $(".tipsDiv").show();
- }
- $("#COMP_ID_337").val(corpId);
- $("#USER_ID_337").val(userId);
- $("#ROLE_ID_337").val( pepRole);
- $("#DEPT_337").val(deptName);
- $("#REAL_NAME_337").val(real_name);
- var deptUrl = $.pathname() + '/ws/xianlutingyun/XianlutingyunService/getChildComp';
- $.post(deptUrl,{role_id: pepRole,comp_id:corpId},function(data){
- if(data.treeNodes.length>0){
- for(var i=0;i<data.treeNodes.length;i++){
- if(data.treeNodes[i].id!=corpId){
- var $li = ("<li id='"+data.treeNodes[i].id+"'>"+data.treeNodes[i].name+"</li>");
- $("#WRITE_DEPT_SHOW").append($li);
- }
- }
- /*$("#WRITE_DEPT").data("data",data);
- $("#WRITE_DEPT").render();*/
- }else{
- top.Dialog.alert("您所在的公司没有下级单位,不能填报");
- }
- setBbContentHeight();
- }, "json");
-
- $("#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);
- //var id = _this.attr("id");
- if(_this.hasClass("selectedli")){
- _this.removeClass("selectedli");
- /*$("WRITE_DEPT li").each(function(){
- if(id==$(this).data("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();
- });
-
-
- //显示下拉框
- showData(pepRole);
-
- if(_thisUrl.indexOf('fd_id=')>-1){//代办进入页面
- $("#multiple").show();
- $("#single").hide();
- $("#save").hide();
- var fd_id = _thisUrl.split("?")[1].split("&")[0].split("=")[1];//获取记录id
- var proUrl = $.pathname() + '/ws/xianlutingyun/XianlutingyunService/getReportSchedule/';
- $.ajax({
- url:proUrl,
- type:'post',
- data:{"fd_id":fd_id,"role_id":role_id},
- ascyn:false,
- dataType:'json',
- success:function(data){
- $("#PROJECT_NAME").data("data",data);
- $("#PROJECT_NAME").render();
- getProjectName();
- },
- error:function(){
- $.messager.alert('系统提示信息', '查询填报计划名称失败', 'error');
- }
- });
- }else{
- $("#multiple").hide();
- $("#single").show();
- change('round');
- }
- checkScreenWidth();
-
-
- $("#back").hover(function(){
- $(this).attr("src","/nwyj/images/temp/back_hover.png");
- },function(){
- $(this).attr("src","/nwyj/images/temp/back.png");
- });
- }
- function getProjectName(){
- //要拆分的任务
- var fd_id = $("#PROJECT_NAME").attr("relValue");
- var cfRole = $("#PROJECT_NAME").data("selectedNode").cfRole;
- //判断cfRole中是否有拆分给下级已发布的任务
- var chFlag = "true";
- if(cfRole!=null && cfRole!="" && cfRole.indexOf(corpId)>-1){
- var cfRoleArr = cfRole.split("&");
- for(var i=0;i<cfRoleArr.length;i++){
- if(cfRoleArr[i].indexOf(corpId)>-1){
- var ch_fd_id = cfRoleArr[i].split(";")[2];
- chFlag = getThing($.pathname() + '/ws/xianlutingyun/XianlutingyunService/queryNextReportSchedule/', {"fd_id" : ch_fd_id}, "text");
- break;
- }
- }
- if(chFlag=="false"){
- getDataById(fd_id);
- return;
- }
- top.Dialog.confirm("该计划已拆分,是否继续拆分?|继续拆分",function(){
- getDataById(fd_id);
- },function(){
- goback();
- /*return;*/
- });
- }else{
- getDataById(fd_id);
- }
- }
- /**
- * 根据任务id获取信息
- * @param fd_id
- */
- function getDataById(fd_id){
- var url = $.pathname() + "/ws/crud/CRUDService/getDataById/";
- var params = {
- classid : '337',
- objectID : fd_id
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- success : function(data){
- if(data.PROJECT_NAME_337.indexOf("应急办")>=-1){
- data.PROJECT_NAME_337 = data.PROJECT_NAME_337.replace("应急办",roleObj[role_id]);
- }
- $("#PROJECT_NAME_337").val(data.PROJECT_NAME_337);
- $("#START_TIME_337").val(data.START_TIME_337);
- $("#END_TIME_337").val(data.END_TIME_337);
- $("#CF_ROLE_337").val(data.CF_ROLE_337);
-
- if(data.FILL_IN_SCHEDULE_337=="临时性"){
- temp = data.TEMPORARY_TIME_337;
- $("input:radio[name=FILL_IN_SCHEDULE_337]").eq(1).attr("checked",true);
- change('temporary');
-
- }else{
- temp = data.ROUND_TIME_337;
- $("input:radio[name=FILL_IN_SCHEDULE_337]").eq(0).attr("checked",true);
- change('round');
- }
-
- var timeArr = temp.split(";");
- for(var i=0;i<timeArr.length;i++){
- if(i!=0){
- $("#addBtn").click();
- }
- $("#time"+i).val(timeArr[i]);
- }
-
- var cfType = data.REPORT_DEPT_337.split(":")[0];
- showCfRequire(cfType,data.REPORT_DEPT_337,role_id);
-
- setBbContentHeight();
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
-
- }
- function checkScreenWidth(){
- var W = window.screen.width;
- var H = window.screen.height;
- if(W=="1024"&&H=="768"){
- $("#buttonDiv").css("left","74.5%");
- }
- }
- function clear_msg(){
- top.Dialog.confirm("确定要重置?将会清空填写的数据,请慎重选择|重置", function() {
- $("#START_TIME_337").val("");
- $("#END_TIME_337").val("");
- //$(".selectTree").render();
- $("#PROJECT_NAME_337").val("");
- $("#round").attr("checked","checked");
- //$("#WRITE_DEPT").render();
- $("#WRITE_DEPT").empty();
- change("round");
-
- if((window.location.href).indexOf('?')>-1){
- document.location.reload();
- }
- });
- }
- //置换周期性、临时性
- function change(obj){
- timeindex = 0;
- if(obj=="round"){
- $("#tbsj").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:28%;" dateFmt="HH:mm" readOnly="readOnly"/>');
- var $add = $('<input type="button" id="addBtn" value="增加"/>');
- var $delete = $('<input type="button" id="addBtn" onclick="deleteTimeInput()" value="删除"/>');
- $add.bind("click",addTimeInput);
- $td.append($date);
- $td.append($add);
- $td.append($delete);
- $("#tbsj").append('<td width="15%" align="right" class="circle_type"><span class="star">*</span><span class="odd">每日:</span></td>');
- $("#tbsj").append($td);
- $add.render();
- $delete.render();
- $date.render();
-
- }
- if(obj=="temporary"){
-
- $("#tbsj").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:28%;" dateFmt="yyyy-MM-dd HH:mm" readOnly="readOnly"/>');
- var $add = $('<input type="button" id="addBtn" value="增加"/>');
- var $delete = $('<input type="button" id="addBtn" onclick="deleteTimeInput()" value="删除"/>');
- $add.bind("click",addTimeInput);
- $td.append($date);
- $td.append($add);
- $td.append($delete);
- $("#tbsj").append('<td width="15%" align="right" class="temporary_type"><span class="star">*</span><span class="odd">填报时间:</span></td>');
- $("#tbsj").append($td);
- $add.render();
- $delete.render();
- $date.render();
-
- }
-
- }
- var timeindex = 0;
- //点击新增,增加一个时间选择框
- function addTimeInput(){
- var obj = getTimeId();
- /*if(checkTimeAdd("tbsj",obj,timeindex)){*/
- var addTime = $("#tbsj");
- 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:28%;" dateFmt=" HH:mm" readOnly="readOnly"/>');
- }else{
- $date = $('<input type="text" id="time'+timeindex+'" class="date validate[required] temporary" style="width:28%;" dateFmt="yyyy-MM-dd HH:mm" readOnly="readOnly"/>');
- }
- $("#addBtn").before($date);
- $date.render();
- $("#addBtn").render();
- addTime.render();
- /*}*/
-
- }
- //点击删除,删除最后一个时间选择框
- function deleteTimeInput(){
- var $date = $("#tbsj").find(".date");
- if($date.length==1){
- return;
- }else{
- $date.last().remove();
- timeindex--;
- }
-
-
- }
- function sure(role,cfRole){
- var pattern = new RegExp("[`~!@#$^&*=|{}':;',\\[\\].<>/?~!@#¥……&*|{}【】‘;:”“'。,、?]");
- //var obj = getTimeId();
- if(!checkTime()){
- return;
- }else if(!decideTime()){
- return ;
- } else if(!checkTimes()){
- return;
- }/*else if(!checkTimeAdd("tbsj",obj,timeindex)){
- return;
- }*/else if(pattern.test($("#PROJECT_NAME_337").val())){
- top.Dialog.alert("计划名称不能包含特殊字符");
- return;
- }
-
- else{
- if($("#SYSTEM_DEPT").attr("relText")!="请选择"&&role=="R002105430210"){
- sysval = $("#SYSTEM_DEPT").attr("relValue");
- systext = $("#SYSTEM_DEPT").attr("relText");
- //addmessage = sysval+";"+$("#WRITE_DEPT").attr("relValue")+";"+systext;
- addmessage = sysval+";"+getCorpInfo('id')+";"+systext;
- }
-
- if($("#EQUIPMENT_DEPT").attr("relText")!="请选择"&&role=="R002105430211"){
- equipmentval = $("#EQUIPMENT_DEPT").attr("relValue");
- equipmenttext = $("#EQUIPMENT_DEPT").attr("relText");
- //addmessage = equipmentval+";"+$("#WRITE_DEPT").attr("relValue")+";"+equipmenttext;
- addmessage = equipmentval+";"+getCorpInfo('id')+";"+equipmenttext;
- }
-
- if($("#MARKETING_DEPT").attr("relText")!="请选择"&&role=="R002105430212"){
- //alert($("#MARKETING_DEPT").attr("relText"));
- markval = $("#MARKETING_DEPT").attr("relValue");
- marktext = $("#MARKETING_DEPT").attr("relText");
- //addmessage = markval+";"+$("#WRITE_DEPT").attr("relValue")+";"+marktext;
- addmessage = markval+";"+getCorpInfo('id')+";"+marktext;
- }
- if($("#SAFEY_DEPT").attr("relText")!="请选择"&&role=="R002105430213"){
- safeyval = $("#SAFEY_DEPT").attr("relValue");
- safetext = $("#SAFEY_DEPT").attr("relText");
- //addmessage = safeyval+";"+$("#WRITE_DEPT").attr("relValue")+";"+safetext;
- addmessage = safeyval+";"+getCorpInfo('id')+";"+safetext;
- }
- var messages = "专业管理部门:"+addmessage;
- $form = $("#requireForm");
- $("#REPORT_DEPT_337").val(messages.trim());
- //$("#DEPT_NAME_337").val($("#WRITE_DEPT").attr("relText"));
- $("#DEPT_NAME_337").val(getCorpInfo('name'));
-
-
- //判断本单位是否对上级任务已拆分,若已拆分则删除上次拆分给下级的任务(不区分是否已发布)
- var old_fdId = "";
- if(cfRole!=null && cfRole!="" && cfRole.indexOf(corpId)>-1){
- var fd_ids = cfRole.split("&");
- for(var i=0;i<fd_ids.length;i++){
- if(fd_ids[i].indexOf(corpId)>-1){
- old_fdId = fd_ids[i].split(";")[2];
- }
- }
- var is_del = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/deleteReportSchedule",{fd_id:old_fdId},'text');
- if(is_del=="false"){
- top.Dialog.alert("更新报表计划失败");
- }
- }
-
- //给下级生成任务
- var url = $.pathname() + '/ws/crud/CRUDService/create';
- $.ajax({
- url : url,
- type : 'post',
- data : $form.serialize(),
- dataType : 'json',
- timeout : 60000,
- success : function(data){
- //拆分给下级的任务id
- var new_fdId = data.Msg.objectID;
- if(_thisUrl.indexOf('fd_id=')>-1){//代办 进入
- var fd_id = $("#PROJECT_NAME").attr("relValue");//获取记录id
- //更新任务的拆分字段
- getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/updateCfRole",{roleId:role_id,fd_id:fd_id,cf_role:cfRole,old_fdId:old_fdId,new_fdId:new_fdId,comp_id:corpId},'text');
- }
- top.Dialog.alert("保存成功",null,null,null,null);
- goback();
- },
- error : function(){
- top.Dialog.alert('操作失败');
- }
- });
- }
- }
- function save1(role,cfRole){
- var pattern = new RegExp("[`~!@#$^&*=|{}':;',\\[\\].<>/?~!@#¥……&*|{}【】‘;:”“'。,、?]");
- //var obj = getTimeId();
- if(!checkTime()){
- return;
- }else if(!decideTime()){
- return ;
- } else if(!checkTimes()){
- return;
- }/*else if(!checkTimeAdd("tbsj",obj,timeindex)){
- return;
- } */
- else if(pattern.test($("#PROJECT_NAME_337").val())){
- top.Dialog.alert("计划名称不能包含特殊字符");
- return;
- }
- else{
- if($("#SYSTEM_DEPT").attr("relText")!="请选择"&&role=='R002105430210'){
- sysval = $("#SYSTEM_DEPT").attr("relValue");
- systext = $("#SYSTEM_DEPT").attr("relText");
- //message = sysval+";"+$("#WRITE_DEPT").attr("relValue")+";"+systext;
- message = sysval+";"+getCorpInfo('id')+";"+systext;
- }
-
- if($("#EQUIPMENT_DEPT").attr("relText")!="请选择"&&role=="R002105430211"){
- equipmentval = $("#EQUIPMENT_DEPT").attr("relValue");
- equipmenttext = $("#EQUIPMENT_DEPT").attr("relText");
- //message = equipmentval+";"+$("#WRITE_DEPT").attr("relValue")+";"+equipmenttext;
- message = equipmentval+";"+getCorpInfo('id')+";"+equipmenttext;
- }
-
- if($("#MARKETING_DEPT").attr("relText")!="请选择"&&role=="R002105430212"){
- markval = $("#MARKETING_DEPT").attr("relValue");
- marktext = $("#MARKETING_DEPT").attr("relText");
- //message = markval+";"+$("#WRITE_DEPT").attr("relValue")+";"+marktext;
- message = markval+";"+getCorpInfo('id')+";"+marktext;
- }
- if($("#SAFEY_DEPT").attr("relText")!="请选择"&&role=="R002105430213"){
- safeyval = $("#SAFEY_DEPT").attr("relValue");
- safetext = $("#SAFEY_DEPT").attr("relText");
- //message = safeyval+";"+$("#WRITE_DEPT").attr("relValue")+";"+safetext;
- message = safeyval+";"+getCorpInfo('id')+";"+safetext;
- }
- var messages = "专业管理部门:"+message;
- $("#REPORT_DEPT_337").val(messages.trim());
- //$("#DEPT_NAME_337").val($("#WRITE_DEPT").attr("relText"));
- $("#DEPT_NAME_337").val(getCorpInfo('name'));
-
- var json=[{
- "ROLE_ID":$("#ROLE_ID_337").val(),
- "DEPT":$("#DEPT_337").val(),
- "REAL_NAME":$("#REAL_NAME_337").val(),
- "REPORT_DEPT":$("#REPORT_DEPT_337").val(),
- "DEPT_NAME":$("#DEPT_NAME_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()
-
- }];
- var jsons = JSON.stringify(json);
- $("body").eq(0).showLoading();
- var old_fdId = "";
- //判断本单位是否对上级任务已拆分,若已拆分则删除上次拆分给下级的任务(不区分是否已发布)
- if(cfRole!=null && cfRole!="" && cfRole.indexOf(corpId)>-1){
- var fd_ids = cfRole.split("&");
- for(var i=0;i<fd_ids.length;i++){
- if(fd_ids[i].indexOf(corpId)>-1){
- old_fdId = fd_ids[i].split(";")[2];
- }
- }
- var is_del = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/deleteReportSchedule",{fd_id:old_fdId},'text');
- if(is_del=="false"){
- top.Dialog.alert("更新报表计划失败");
- }
- }
-
- $.ajax({
- url : $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/saveAndSend",
- type : 'post',
- data : {
- json:jsons,
- compId:corpId,
- userId:userId
- },
- dataType : 'json',
- timeout : 60000,
- success : function(data){
- $("body").eq(0).hideLoading();
- if(data[0].succ=="true"){
- var name=data[0].name;
- var tel=data[0].tel;
- //拆分给下级的任务id
- var new_fdId = data[0].fd_id;
- if(_thisUrl.indexOf('fd_id=')>-1){//代办 进入
- var fd_id = $("#PROJECT_NAME").attr("relValue");//获取记录id
- //更新任务的拆分字段
- getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/updateCfRole",{roleId:role_id,fd_id:fd_id,cf_role:cfRole,old_fdId:old_fdId,new_fdId:new_fdId,comp_id:corpId},'text');
- }
- top.Dialog.confirm("保存并发布成功,是否发送短信?|发送短信",function(){
- addMsg(name,tel,"","1");
- },function(){
- goback();
- });
-
- }else{
- top.Dialog.alert("保存并发布失败");
- }
- },
- error : function(){
- top.Dialog.alert('操作失败');
- }
- });
- }
- }
- //获取填报单位
- function getCorpInfo(type){
- var corpIds = "";
- var corpNames = "";
- var len = $("#WRITE_DEPT li").length;
- for(var i=0;i<len;i++){
- if(i==len-1){
- corpIds += $("#WRITE_DEPT li").eq(i).data("id");
- corpNames += $("#WRITE_DEPT li").eq(i).text();
- }else{
- corpIds += $("#WRITE_DEPT li").eq(i).data("id")+",";
- corpNames += $("#WRITE_DEPT li").eq(i).text()+",";
- }
- }
- if(type=='id'){
- return corpIds;
- }
- if(type=='name'){
- return corpNames;
- }
-
- }
- function save(num) {
-
- var valid = $("#requireForm").validationEngine({
-
- returnIsValid : true
- });
- var rr=role_id;
- var obj = getTimeId();
- var cfRole = $("#CF_ROLE_337").val();
- if(_thisUrl.indexOf('fd_id=')>-1){
- if($("#PROJECT_NAME").attr("relText").trim()==""){
- top.Dialog.alert("请输入计划名称");
- return;
- }
- }else{
- if($("#PROJECT_NAME_337").val().trim()==""){
- top.Dialog.alert("请输入计划名称");
- return;
- }
- }
- if($("input[name=WRITE_DEPT]").val()==""){
- top.Dialog.alert("请选择填报单位");
- return;
- }
- if($("#START_TIME_337").val().trim()==""){
- top.Dialog.alert("请输入起始日期");
- return;
- }
- if(obj=="round"){
- var $inputs = $("#tbsj").find("input");
- for(var i=0;i<$inputs.length;i++){
- if($inputs.eq(i).val()==""){
- top.Dialog.alert("请输入第"+(i+1)+"个周期性时间");
- return;
- }
- }
- }
- if(obj=="temporary"){
- var $inputs = $("#tbsj").find("input");
- for(var i=0;i<$inputs.length;i++){
- if($inputs.eq(i).val()==""){
- top.Dialog.alert("请输入第"+(i+1)+"个临时性时间");
- return;
- }
- }
- }
- if(!$(".system").is(":hidden")&&$("#SYSTEM_DEPT").attr("relvalue")==""){
- top.Dialog.alert("请选择要填报的报表模版");
- return;
- }
- if(!$(".equipment").is(":hidden")&&$("#EQUIPMENT_DEPT").attr("relvalue")==""){
- top.Dialog.alert("请选择要填报的报表模版");
- return;
- }
- if(!$(".marking").is(":hidden")&&$("#MARKETING_DEPT").attr("relvalue")==""){
- top.Dialog.alert("请选择要填报的报表模版");
- return;
- }
- if(!$(".safe").is(":hidden")&&$("#SAFEY_DEPT").attr("relvalue")==""){
- top.Dialog.alert("请选择要填报的报表模版");
- return;
- }
-
- if($("#WRITE_DEPT").text()==""){
- top.Dialog.alert("请选择填报单位!");
- return;
- }
-
- if(valid==true&&num=="0"){
-
- save1(rr,cfRole);
- }else if(valid==true&&num=="1"){
-
- sure(rr,cfRole);
- }
- }
- //判断起始时间和截止时间不能小于当前日期
- function decideTime(){
- var star = $("#START_TIME_337").val();
- var end = $("#END_TIME_337").val();
- /*if(star==""||star==null||star==undefined||end==""||end==null||end==undefined){
- return;
- }*/
- 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;
- }
- }
- //获取当前日期
- 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 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 goback(){
- var url = "";
- var len =_thisUrl.split("?")[1].split("&").length;
- if(len==1 || len==2){
- url = "/nwyj/page/business/em/report/Report_Require.jsp";
- }else{
- url ="/nwyj/page/business/em/waitdo/waitDo.html";
- }
- window.parent.document.getElementById("frmright").setAttribute("src",url);
- }
- //根据role_id 显示出不同的下拉框
- function showData(role,data){
- roleSel = getSelectedData(role);
- if(role=="R002105430210"){
- $("#mubang").text("系统运行部报表模版:");
- $(".system").show();
- $("#SYSTEM_DEPT").data("data",roleSel);
- $("#SYSTEM_DEPT").render();
- $("#SYSTEM_DEPT").addClass("validate[required]");
- }else
- if(role=="R002105430211"){
- $("#mubang").text("生产设备部报表模版:");
- $(".equipment").show();
- $("#EQUIPMENT_DEPT").data("data",roleSel);
- $("#EQUIPMENT_DEPT").render();
- $("#EQUIPMENT_DEPT").addClass("validate[required]");
- }else
- if(role=="R002105430213"){
- $("#mubang").text("安全监管部报表模版:");
- $(".safe").show();
- $("#SAFEY_DEPT").data("data",roleSel);
- $("#SAFEY_DEPT").render();
- $("#SAFEY_DEPT").addClass("validate[required]");
- }else
- if(role=="R002105430212"){
- $("#mubang").text("市场营销部报表模版:");
- $(".marking").show();
- $("#MARKETING_DEPT").data("data",roleSel);
- $("#MARKETING_DEPT").render();
- $("#MARKETING_DEPT").addClass("validate[required]");
- }
- else if(role=="R002105430200"){
- $("#mubang").text("超级管理员没有固定模板");
- $(".marking").show();
- //$("#MARKETING_DEPT").data("data",roleSel);
- //$("#MARKETING_DEPT").render();
- //$("#MARKETING_DEPT").addClass("validate[required]");
- }
- }
- function checkTimes(){
-
-
- var obj = getTimeId();
- var timeStr = "";
- var startTime = $("#START_TIME_337").val().substring(0,10);
- var endTime = $("#END_TIME_337").val();
- var $date = $("#tbsj").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 getSelectedData(r){
- var roleSelect="";
- var url = $.pathname() + '/ws/xianlutingyun/XianlutingyunService/getZYGLBMTypeSel';
- $.ajax({
- url : url,
- type : 'post',
- data : {role_id:r},
- dataType : 'json',
- timeout : 60000,
- async:false,
- success : function(data){
- roleSelect=data;
- },
- error : function(){
- top.Dialog.alert('操作失败');
- }
- });
- return roleSelect;
- }
- function checkName(arr,str){
- var val = "" ;
- for(var i=0;i<arr.length;i++){
- for(var j=0;j<str.length;j++){
- if(arr[i].name==str[j]){
- val += arr[i].id+",";
- }
-
- }
-
- }
- val = val.substring(0, val.lastIndexOf(","));
- return val;
- }
- function getUrlParams(msg,url){
- if(msg!=""&&url.indexOf(msg)>-1&&url.indexOf("&")==-1){
- return url.split("?")[1].split("=")[1];
- }else{
- return url.split("?")[1].split("&")[1].split("=")[1];
- }
- }
- function showCfRequire(dept,deptMessage,pepRole){
- if(dept=="应急办"){
-
- var message = deptMessage.split(":")[1].split("|");
- var depts = "";
- var tables = "";
-
- var tableArr = roleSel.treeNodes;
- var setVal="";
- if( pepRole=="R002105430210"){
-
- for(var i=0;i<message.length;i++){
- depts = message[i].split(";")[0];
- if(depts=="R002105430210"){
- tables = message[i].split(";")[1].split(",");
- setVal = checkName(tableArr,tables);
-
- }
- }
- $("#SYSTEM_DEPT").setValue(setVal);
-
- }
-
- if( pepRole=="R002105430211"){
-
- for(var i=0;i<message.length;i++){
- depts = message[i].split(";")[0];
- if(depts=="R002105430211"){
- tables = message[i].split(";")[1].split(",");
- setVal =checkName(tableArr,tables);
- }
- }
- $("#EQUIPMENT_DEPT").setValue(setVal);
- }
-
- if( pepRole=="R002105430212"){
-
- for(var i=0;i<message.length;i++){
- depts = message[i].split(";")[0];
- if(depts=="R002105430212"){
- tables = message[i].split(";")[1].split(",");
- setVal =checkName(tableArr,tables);
- }
- }
- $("#MARKETING_DEPT").setValue(setVal);
- }
-
- if( pepRole=="R002105430213"){
-
-
- for(var i=0;i<message.length;i++){
- depts = message[i].split(";")[0];
- if(depts=="R002105430213"){
- tables = message[i].split(";")[1].split(",");
- setVal =checkName(tableArr,tables);
- }
- }
- $("#SAFEY_DEPT").setValue(setVal);
- }
- }else{
- var message = deptMessage.split(":")[1].split(";")[0];
-
- if(pepRole=="R002105430210"){
-
- $("#SYSTEM_DEPT").setValue(message);
-
- }else if(pepRole=="R002105430211"){
-
- $("#EQUIPMENT_DEPT").setValue(message);
-
- }else if(pepRole=="R002105430212"){
-
- $("#MARKETING_DEPT").setValue(message);
-
- }else if(pepRole=="R002105430213"){
-
- $("#SAFEY_DEPT").setValue(message);
- }
-
- }
- }
- function setBbContentHeight(){
- var content = $(".box1").height();
- $(window.document.body).height(content+20);
- $(parent.document.body).find("#frmright").height($(window.document.body).height());
- }
|