fc3e040a3214edd320b676f1a6d31e88711d0ace.svn-base 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. function saveRecords(json,obj,backUrl){
  2. var saveUrl = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/create";
  3. var userId = json.user_id;
  4. var type = json.report_type;
  5. var comp = json.comp_id;
  6. //var report_id = json.report_id;
  7. var name = json.name;
  8. var operate = json.operate;
  9. var jsonData = json.json;
  10. var dept = json.report_comp;
  11. var sendStat = json.sendStat;
  12. var roleId = json.roleId;
  13. var relVal = "";
  14. var relText ="";
  15. ///var relVal = $("#warning").attr("relValue");
  16. /*if(relVal==""){
  17. top.Dialog.alert("请选择选择填报计划");
  18. return;
  19. }
  20. var relText = $("#warning").attr("relText");*/
  21. var treeObj = $.fn.zTree.getZTreeObj("reportTree");
  22. var checked = treeObj.getCheckedNodes(true);
  23. if(checked.length==0){
  24. top.Dialog.alert("请选择选择填报计划");
  25. return ;
  26. }else{
  27. for(var i=0;i<checked.length;i++){
  28. if(!checked[i].isParent){
  29. relVal += checked[i].id+",";
  30. relText +=checked[i].name+",";
  31. }
  32. }
  33. }
  34. var recordParams ="";
  35. if(json.flag){
  36. recordParams = {
  37. json:jsonData,
  38. user_id:userId,
  39. report_type:type,
  40. comp_id : comp,
  41. report_id:relVal,
  42. name:name,
  43. operate:operate,
  44. report_comp:dept,
  45. warnText:relText,
  46. sendStat:sendStat,
  47. roleId:roleId,
  48. flag:json.flag
  49. };
  50. }else{
  51. recordParams = {
  52. json:jsonData,
  53. user_id:userId,
  54. report_type:type,
  55. comp_id : comp,
  56. report_id:relVal,
  57. name:name,
  58. operate:operate,
  59. report_comp:dept,
  60. warnText:relText,
  61. sendStat:sendStat,
  62. roleId:roleId,
  63. };
  64. }
  65. if(backUrl){
  66. window.parent.document.getElementById("frmright").setAttribute("src", backUrl);
  67. }else{
  68. window.history.go(-1);
  69. }
  70. addNewReport(saveUrl,recordParams,obj);
  71. }
  72. function showWarningNumber(json){
  73. var type = json.report_type;
  74. var comp = json.comp_id;
  75. var report_id = json.report_id;
  76. var role = json.roleId;
  77. var moreReportrl = $.pathname() + "/ws/xianlutingyun/XianlutingyunService/getNeedWritePro";
  78. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  79. var deptFlag = getThing($.pathname() +"/ws/getRepotDept/ReportDeptService/checkReportDept",{"corpId":comp,"deptId":deptId},"text");
  80. var setting1 = {
  81. view : {
  82. selectedMulti : false
  83. },
  84. check: {
  85. enable: true
  86. },
  87. async : {
  88. dataType : 'JSON',
  89. contentType : "application/json"
  90. },
  91. callback : {
  92. onClick : nodeNick,
  93. }
  94. };
  95. var params = {
  96. comp_id :comp,
  97. report_type:type,
  98. role_id:role,
  99. deptId:deptId,
  100. flag:deptFlag,
  101. needType:"another",
  102. report_id:report_id
  103. };
  104. var nodes = getThing(moreReportrl, params);
  105. $.fn.zTree.init($("#reportTree"), setting1, nodes);
  106. //var treeObj = $.fn.zTree.getZTreeObj("reportTree");
  107. //var node =treeObj.getNodeByParam("id", report_id, null);
  108. //treeObj.selectNode(node);
  109. }
  110. function addNewReport(url,params,obj){
  111. $.ajax({
  112. url : url,
  113. type : 'post',
  114. timeout : 15000,
  115. async : false,
  116. data : params,
  117. dataType : 'json',
  118. success : function(data) {
  119. if(data.Msg.sucsess==true){
  120. top.Dialog.alert("新增报表成功");
  121. obj.close();
  122. }else{
  123. top.Dialog.alert("新增报表失败");
  124. }
  125. },
  126. error : function(e) {
  127. $.messager.alert('保存报表失败!', '访问服务失败!', 'error');
  128. }
  129. });
  130. }
  131. /*function getThing(url,params,text){
  132. var datas="" ;
  133. if(!text){
  134. text = "json";
  135. }
  136. $.ajax({
  137. url : url,
  138. type : 'post',
  139. timeout : 15000,
  140. async : false,
  141. data : params,
  142. dataType : text,
  143. success : function(data) {
  144. datas = data;
  145. },
  146. error : function(e) {
  147. $.messager.alert('获取消息失败!', '访问服务失败!', 'error');
  148. }
  149. });
  150. return datas;
  151. }*/
  152. function nodeNick(event, treeId, treeNode){
  153. if (!treeNode.isParent) {
  154. var treeObj = $.fn.zTree.getZTreeObj("reportTree");
  155. treeObj.checkNode(treeNode,true,true);
  156. }
  157. }