b7f0c3e22f3b1a37bab022badffda7c644027fbc.svn-base 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  2. var userId =top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  3. var dept_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  4. var fd_id;
  5. var yqRole = getYqRole(role_id);
  6. var userZyRole = getZyRole(role_id);
  7. var defalutArr = ["R002105430210","R002105430211","R002105430212","R002105430213"];
  8. var tableObj = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getTableObj",{},'text');
  9. tableObj = eval('('+tableObj+')');
  10. var deptLevel = getThing($.pathname() +"/ws/xianlutingyun/XianlutingyunService/getDeptLevel",{"comp_id":dept_id},"text");
  11. function initComplete(){
  12. var url = decodeURI(window.location.href);
  13. getToggle(userZyRole,yqRole);
  14. if($.inArray("R002105430205",yqRole)>-1){
  15. $("#send_report").toggle();
  16. }
  17. if(url.indexOf("?")>-1){
  18. var data = url.split("?");
  19. if(data.length==2&&data[1].indexOf("fd_id=")!=-1){
  20. fd_id = data[1].split("=")[1].split("_")[0];
  21. showScheduleMsg(fd_id);
  22. }
  23. }
  24. $("#img").changePic();
  25. }
  26. function newPage(){
  27. // 自动带出--填报要求名称、开始时间、截止时间、周期性、填报时间、填报模板
  28. var cfArr = [];
  29. if($("#SYSTEM_DEPT").html()==""){
  30. cfArr.push("R002105430210");
  31. }
  32. else if($("#EQUIPMENT_DEPT").html()==""){
  33. cfArr.push("R002105430211");
  34. }
  35. else if($("#MARKETING_DEPT").html()==""){
  36. cfArr.push("R002105430212");
  37. }else if($("#SAFEY_DEPT").html()==""){
  38. cfArr.push("R002105430213");
  39. }
  40. var hasArr = saveSameRole(cfArr,defalutArr);
  41. var hasCfArr = checkHasRole(hasArr,userZyRole);
  42. if(hasCfArr.length==0){
  43. top.Dialog.alert("你具备的专业管理部门角色没有要求拆分");
  44. }else if(hasCfArr.length==1){
  45. window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/report/reportDept/addReportRequire.html?fd_id="+fd_id+"&role_Id="+hasCfArr[0]);
  46. }else{
  47. /*top.Dialog.confirm("系统检测到您具有多重专业管理部门角色,可拆分多个计划,请选择一个专业管理部门角色再进行下一步操作", function() {*/
  48. var zyRoleId = getUserZyRole(hasCfArr);
  49. getRoleDeaitl(userId,hasCfArr,goAnotherPage,"/nwyj/page/business/em/report/reportDept/addReportRequire.html",zyRoleId,fd_id);
  50. /* });*/
  51. }
  52. }
  53. function goAnotherPage(url){
  54. window.parent.document.getElementById("frmright").setAttribute("src", url);
  55. }
  56. function goback(){
  57. window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/business/em/report/Report_Require.jsp");
  58. }
  59. var num=0;
  60. var user_id ="" ;
  61. var comp="";
  62. var send_stat ="";
  63. function send(){
  64. if(userId!=user_id){
  65. top.Dialog.alert("不可发布其他人填写的记录");
  66. return;
  67. }
  68. else if(comp!=dept_id){
  69. top.Dialog.alert("不可发布其他公司填写的记录");
  70. return;
  71. }
  72. else if(send_stat=="1"){
  73. top.Dialog.alert("该记录已发布,不可重复发布");
  74. return;
  75. }
  76. else if(num==1){
  77. top.Dialog.alert("该记录已发布,不可重复发布");
  78. return;
  79. }
  80. else {
  81. num=1;
  82. top.Dialog.confirm("确定要发布吗?|发布", function() {
  83. $("body").showLoading();
  84. $.post($.pathname() +"/ws/xianlutingyun/XianlutingyunService/SendPlan", {
  85. fd_id : fd_id
  86. }, function(result) {
  87. if (result[0].succ == "true") {
  88. $("body").hideLoading();
  89. var name=result[0].name;
  90. var tel=result[0].tel;
  91. top.Dialog.confirm("发布成功,是否发送短信?|是",function(){
  92. addMsg(name,tel,"","1");
  93. },function(){
  94. goback();
  95. });
  96. /* top.Dialog.alert("发布成功",null,null,null,null);*/
  97. // 刷新表格数据
  98. ///g.rend();
  99. } else {
  100. top.Dialog.alert("发布失败!");
  101. }
  102. }, "json");
  103. });
  104. }
  105. }
  106. function getToggle(arr1,arr2){
  107. if(checkUserRole(arr1,arr2)==1){
  108. $('#anniu').toggle();
  109. }
  110. }
  111. function showScheduleMsg(fd_id){
  112. $.ajax({
  113. url : $.pathname() +"/ws/xianlutingyun/XianlutingyunService/getReportScheduleMsg",
  114. type : 'post',
  115. timeout : 15000,
  116. data : {fd_id:fd_id},
  117. dataType : 'json',
  118. async:false,
  119. success : function(data) {
  120. data = removeNull(data);
  121. data = data.rows[0];
  122. user_id = data.USER_ID;
  123. comp = data.COMP_ID;
  124. send_stat = data.SEND_STAT;
  125. var schedule = data.FILL_IN_SCHEDULE;
  126. $("#WARNING_NUMBER_337").text(data.WARNING_NUMBER);
  127. $("#PROJECT_NAME_337").text(data.PROJECT_NAME);
  128. $("#START_TIME_337").text(data.START_TIME);
  129. $("#END_TIME_337").text(data.END_TIME);
  130. $("#FILL_IN_SCHEDULE_337").text(schedule);
  131. if(schedule=="周期性"){
  132. $(".temporary").hide();
  133. $(".round").show();
  134. $("#ROUND_TIME_337").text(data.ROUND_TIME);
  135. }
  136. if(schedule=="临时性"){
  137. $(".temporary").show();
  138. $(".round").hide();
  139. $("#TEMPORARY_TIME_337").text(data.TEMPORARY_TIME);
  140. }
  141. var message = data.REPORT_DEPT.split(":")[1].split("|");
  142. var depts ="";
  143. for(var i=0;i<message.length;i++){
  144. depts = message[i].split(";");
  145. if(depts[0]=="R002105430210"){
  146. //$("#SYSTEM_DEPT").text(depts[1]);
  147. $("#SYSTEM_DEPT").html(getTableName(depts[1],tableObj));
  148. }
  149. if(depts[0]=="R002105430211"){
  150. $("#EQUIPMENT_DEPT").html(getTableName(depts[1],tableObj));
  151. }
  152. if(depts[0]=="R002105430212"){
  153. $("#MARKETING_DEPT").html(getTableName(depts[1],tableObj));
  154. }
  155. if(depts[0]=="R002105430213"){
  156. $("#SAFEY_DEPT").html(getTableName(depts[1],tableObj));
  157. }
  158. }
  159. var stat = data.SEND_STAT;
  160. if(stat=="1"){
  161. $("#send_report").hide();
  162. }
  163. setHight();
  164. },
  165. error : function(e) {
  166. $.messager.alert('获取消息失败!', '访问服务失败!', 'error');
  167. }
  168. });
  169. }
  170. function getTableName(text,obj){
  171. var textArr = text.split(",");
  172. var ul = $("<ul class='tableUl'></ul>");
  173. var li ;
  174. for(var i=0;i<textArr.length;i++){
  175. if(textArr[i]=="变电站停运及恢复情况统计表"){
  176. if(deptLevel=="1" || deptLevel=="2"){
  177. textArr[i]="变电站停运及恢复统计表";
  178. }else{
  179. textArr[i]="变电站停运及恢复情况表";
  180. }
  181. }
  182. if(i==textArr.length-1){
  183. li = $("<li id=li_"+i+" class='tableLi fontTip' title='点击查看模板'>"+textArr[i]+"</li>");
  184. }else{
  185. li = $("<li id=li_"+i+" class='tableLi fontTip' title='点击查看模板'>"+textArr[i]+",</li>");
  186. }
  187. var type = obj[textArr[i]];
  188. if(deptLevel=="1" || deptLevel=="2"){
  189. if(type="2"){
  190. type="101";
  191. }
  192. }
  193. li.data("data_type",type);
  194. //li.data("data_type",obj[textArr[i]]);
  195. li.on("click",function(){
  196. var report_type = $(this).data("data_type");
  197. 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"));
  198. });
  199. ul.append(li);
  200. };
  201. return ul;
  202. };