123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
- var userId =top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var dept_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var fd_id;
- var yqRole = getYqRole(role_id);
- var userZyRole = getZyRole(role_id);
- var defalutArr = ["R002105430210","R002105430211","R002105430212","R002105430213"];
- var tableObj = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getTableObj",{},'text');
- tableObj = eval('('+tableObj+')');
- var deptLevel = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getDeptLevel",{"comp_id":dept_id},"text");
- function initComplete(){
- var url = decodeURI(window.location.href);
- getToggle(userZyRole,yqRole);
- if($.inArray("R002105430205",yqRole)>-1){
- $("#send_report").toggle();
- }
-
- if(url.indexOf("?")>-1){
- var data = url.split("?");
- if(data.length==2&&data[1].indexOf("fd_id=")!=-1){
- fd_id = data[1].split("=")[1].split("_")[0];
- showScheduleMsg(fd_id);
- }
-
- }
-
-
- $("#img").changePic();
-
-
- }
- function newPage(){
- // 自动带出--填报要求名称、开始时间、截止时间、周期性、填报时间、填报模板
-
- var cfArr = [];
-
-
- if($("#SYSTEM_DEPT").html()==""){
- cfArr.push("R002105430210");
- }
-
- else if($("#EQUIPMENT_DEPT").html()==""){
- cfArr.push("R002105430211");
- }
-
- else if($("#MARKETING_DEPT").html()==""){
- cfArr.push("R002105430212");
-
- }else if($("#SAFEY_DEPT").html()==""){
- cfArr.push("R002105430213");
- }
-
-
- var hasArr = saveSameRole(cfArr,defalutArr);
- var hasCfArr = checkHasRole(hasArr,userZyRole);
-
- if(hasCfArr.length==0){
- top.Dialog.alert("你具备的专业管理部门角色没有要求拆分");
- }else if(hasCfArr.length==1){
- window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/report/reportDept/addReportRequire.html?fd_id="+fd_id+"&role_Id="+hasCfArr[0]);
- }else{
- /*top.Dialog.confirm("系统检测到您具有多重专业管理部门角色,可拆分多个计划,请选择一个专业管理部门角色再进行下一步操作", function() {*/
- var zyRoleId = getUserZyRole(hasCfArr);
- getRoleDeaitl(userId,hasCfArr,goAnotherPage,"/nwyj/page/business/em/report/reportDept/addReportRequire.html",zyRoleId,fd_id);
- /* });*/
- }
-
-
-
-
-
-
-
-
-
-
-
- }
- function goAnotherPage(url){
- window.parent.document.getElementById("frmright").setAttribute("src", url);
- }
- function goback(){
- window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/report/Report_Require.jsp");
- }
- var num=0;
- var user_id ="" ;
- var comp="";
- var send_stat ="";
- function send(){
-
- if(userId!=user_id){
- top.Dialog.alert("不可发布其他人填写的记录");
- return;
- }
- else if(comp!=dept_id){
- top.Dialog.alert("不可发布其他公司填写的记录");
- return;
- }
- else if(send_stat=="1"){
-
- top.Dialog.alert("该记录已发布,不可重复发布");
- return;
- }
-
- else if(num==1){
- top.Dialog.alert("该记录已发布,不可重复发布");
- return;
- }
-
- else {
- num=1;
- top.Dialog.confirm("确定要发布吗?|发布", function() {
- $("body").showLoading();
- $.post($.pathname() +"/ws/xianlutingyun/XianlutingyunService/SendPlan", {
- fd_id : fd_id
- }, function(result) {
- if (result[0].succ == "true") {
- $("body").hideLoading();
- var name=result[0].name;
- var tel=result[0].tel;
- top.Dialog.confirm("发布成功,是否发送短信?|是",function(){
- addMsg(name,tel,"","1");
- },function(){
-
- goback();
- });
- /* top.Dialog.alert("发布成功",null,null,null,null);*/
- // 刷新表格数据
- ///g.rend();
- } else {
- top.Dialog.alert("发布失败!");
- }
- }, "json");
- });
- }
- }
- function getToggle(arr1,arr2){
- if(checkUserRole(arr1,arr2)==1){
- $('#anniu').toggle();
- }
- }
- function showScheduleMsg(fd_id){
-
- $.ajax({
- url : $.pathname() +"/ws/xianlutingyun/XianlutingyunService/getReportScheduleMsg",
- type : 'post',
- timeout : 15000,
- data : {fd_id:fd_id},
- dataType : 'json',
- async:false,
- success : function(data) {
- data = removeNull(data);
- data = data.rows[0];
- user_id = data.USER_ID;
- comp = data.COMP_ID;
- send_stat = data.SEND_STAT;
- var schedule = data.FILL_IN_SCHEDULE;
- $("#WARNING_NUMBER_337").text(data.WARNING_NUMBER);
- $("#PROJECT_NAME_337").text(data.PROJECT_NAME);
- $("#START_TIME_337").text(data.START_TIME);
- $("#END_TIME_337").text(data.END_TIME);
- $("#FILL_IN_SCHEDULE_337").text(schedule);
- if(schedule=="周期性"){
-
- $(".temporary").hide();
- $(".round").show();
- $("#ROUND_TIME_337").text(data.ROUND_TIME);
- }
- if(schedule=="临时性"){
- $(".temporary").show();
- $(".round").hide();
- $("#TEMPORARY_TIME_337").text(data.TEMPORARY_TIME);
- }
- var message = data.REPORT_DEPT.split(":")[1].split("|");
- var depts ="";
- for(var i=0;i<message.length;i++){
- depts = message[i].split(";");
- if(depts[0]=="R002105430210"){
- //$("#SYSTEM_DEPT").text(depts[1]);
- $("#SYSTEM_DEPT").html(getTableName(depts[1],tableObj));
- }
- if(depts[0]=="R002105430211"){
- $("#EQUIPMENT_DEPT").html(getTableName(depts[1],tableObj));
- }
- if(depts[0]=="R002105430212"){
- $("#MARKETING_DEPT").html(getTableName(depts[1],tableObj));
- }
- if(depts[0]=="R002105430213"){
- $("#SAFEY_DEPT").html(getTableName(depts[1],tableObj));
- }
- }
- var stat = data.SEND_STAT;
- if(stat=="1"){
- $("#send_report").hide();
- }
-
-
- setHight();
- },
- error : function(e) {
- $.messager.alert('获取消息失败!', '访问服务失败!', 'error');
- }
- });
-
- }
- function getTableName(text,obj){
-
- var textArr = text.split(",");
-
- var ul = $("<ul class='tableUl'></ul>");
- var li ;
- for(var i=0;i<textArr.length;i++){
- if(textArr[i]=="变电站停运及恢复情况统计表"){
- if(deptLevel=="1" || deptLevel=="2"){
- textArr[i]="变电站停运及恢复统计表";
- }else{
- textArr[i]="变电站停运及恢复情况表";
- }
- }
- if(i==textArr.length-1){
- li = $("<li id=li_"+i+" class='tableLi fontTip' title='点击查看模板'>"+textArr[i]+"</li>");
-
- }else{
-
- li = $("<li id=li_"+i+" class='tableLi fontTip' title='点击查看模板'>"+textArr[i]+",</li>");
-
- }
- var type = obj[textArr[i]];
- if(deptLevel=="1" || deptLevel=="2"){
- if(type="2"){
- type="101";
- }
- }
- li.data("data_type",type);
- //li.data("data_type",obj[textArr[i]]);
-
- li.on("click",function(){
-
- var report_type = $(this).data("data_type");
- window.parent.document.getElementById("frmright").setAttribute("src",encodeURI("/nwyj/page/business/em/report/View.html?report_type="+report_type+"&fd_id="+fd_id+"_a&go=yj"));
- });
- ul.append(li);
- };
-
- return ul;
- };
|