a682067d3d4748815083e04ce61a0eea06e9247f.svn-base 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. // 路径配置
  2. ;$(function(){
  3. searchUnit();
  4. $(".triangle").on('click',function(){
  5. $("#searchByTime").fadeIn(500);
  6. $("#triangleOut").removeClass("triangle");
  7. $("#triangleOut").addClass("noneTri");
  8. });
  9. $(".triangleIn").on('click',function(){
  10. $("#searchByTime").fadeOut(500);
  11. setTimeout(function addClassTri(){
  12. $("#triangleOut").removeClass("noneTri");
  13. $("#triangleOut").addClass("triangle");
  14. },500);
  15. });
  16. $("#search").on("click",function(){
  17. var params = verify();
  18. if(params){
  19. search_btn(params);
  20. }
  21. });
  22. });
  23. function verify(){
  24. var beginTime = $("#beginTime").attr("value") ;
  25. var endTime = $("#endTime").attr("value") ;
  26. var unitID = $("#unitId").attr("relValue") ;
  27. if(beginTime != "" && endTime == "") endTime = getNowFormatDate(allGetServerTime()) ;
  28. if(beginTime == "" && endTime != "") beginTime = getThreeMonthsAgo(endTime);
  29. if(beginTime == "" && endTime == ""){
  30. var date = allGetServerTime() ;
  31. beginTime = getThreeMonthsAgo(getNowFormatDate(date)) ;
  32. endTime = getNowFormatDate(allGetServerTime()) ;
  33. } ;
  34. if(unitID == ""){
  35. alert("请选择单位!");
  36. return false;
  37. }else{
  38. return {beginTime:beginTime,endTime:endTime,ID:unitID};
  39. }
  40. };
  41. /* 初始化单位 */
  42. function searchUnit(){
  43. var userInfo=resolveUrl();
  44. var deptUrl= $.pathname() + "/ws/orgInDeptService/OrgInDeptService/getDeptRootById";
  45. $.post(deptUrl, {"deptId" : userInfo["dept_id"]}, function(data) {
  46. $("#unitId").data("data", data);
  47. $("#unitId").render();
  48. }, "json");
  49. };
  50. /**
  51. * 得到当前登录用户信息
  52. * @returns {___anonymous6112_6113}
  53. */
  54. function resolveUrl(){
  55. var encondeCondition=window.location.search;
  56. var condition= decodeURI(decodeURI(encondeCondition.substring(1,encondeCondition.length)));
  57. var conditionArr=condition.split("&");
  58. var condJson={};
  59. for(var item in conditionArr){
  60. var temArr=conditionArr[item].split("=");
  61. condJson[temArr[0]]=temArr[1];
  62. }
  63. userInfo = condJson;
  64. return condJson;
  65. };
  66. /**
  67. * 得到json格式请求
  68. */
  69. function getJsonData(url,params){
  70. var result={} ;
  71. $.ajax({
  72. async:false,
  73. url : url,
  74. type : 'post',
  75. timeout : 60000,
  76. data : params,
  77. dataType : 'json',
  78. success : function(data) {
  79. result = data ;
  80. return data ;
  81. },
  82. error : function(e) {
  83. $.messager.alert('系统提示信息error', '访问服务失败!', 'error');
  84. }
  85. });
  86. return result ;
  87. };
  88. // 路径配置
  89. ;$(function(){
  90. searchUnit();
  91. $(".triangle").on('click',function(){
  92. $("#searchByTime").fadeIn(500);
  93. $("#triangleOut").removeClass("triangle");
  94. $("#triangleOut").addClass("noneTri");
  95. });
  96. $(".triangleIn").on('click',function(){
  97. $("#searchByTime").fadeOut(500);
  98. setTimeout(function addClassTri(){
  99. $("#triangleOut").removeClass("noneTri");
  100. $("#triangleOut").addClass("triangle");
  101. },500);
  102. });
  103. $("#search").on("click",function(){
  104. var params = verify();
  105. if(params){
  106. search_btn(params);
  107. }
  108. });
  109. });
  110. function verify(){
  111. var beginTime = $("#beginTime").attr("value") ;
  112. var endTime = $("#endTime").attr("value") ;
  113. var unitID = $("#unitId").attr("relValue") ;
  114. if(beginTime != "" && endTime == "") endTime = getNowFormatDate(allGetServerTime()) ;
  115. if(beginTime == "" && endTime != "") beginTime = getThreeMonthsAgo(endTime);
  116. if(beginTime == "" && endTime == ""){
  117. var date = allGetServerTime() ;
  118. beginTime = getThreeMonthsAgo(getNowFormatDate(date)) ;
  119. endTime = getNowFormatDate(allGetServerTime()) ;
  120. } ;
  121. if(unitID == ""){
  122. alert("请选择单位!");
  123. return false;
  124. }else{
  125. return {beginTime:beginTime,endTime:endTime,ID:unitID};
  126. }
  127. };
  128. /* 初始化单位 */
  129. function searchUnit(){
  130. var userInfo=resolveUrl();
  131. var deptUrl= $.pathname() + "/ws/orgInDeptService/OrgInDeptService/getDeptRootById";
  132. $.post(deptUrl, {"deptId" : userInfo["dept_id"]}, function(data) {
  133. $("#unitId").data("data", data);
  134. $("#unitId").render();
  135. }, "json");
  136. };
  137. /**
  138. * 得到当前登录用户信息
  139. * @returns {___anonymous6112_6113}
  140. */
  141. function resolveUrl(){
  142. var encondeCondition=window.location.search;
  143. var condition= decodeURI(decodeURI(encondeCondition.substring(1,encondeCondition.length)));
  144. var conditionArr=condition.split("&");
  145. var condJson={};
  146. for(var item in conditionArr){
  147. var temArr=conditionArr[item].split("=");
  148. condJson[temArr[0]]=temArr[1];
  149. }
  150. userInfo = condJson;
  151. return condJson;
  152. };
  153. /**
  154. * 得到json格式请求
  155. */
  156. function getJsonData(url,params){
  157. var result={} ;
  158. $.ajax({
  159. async:false,
  160. url : url,
  161. type : 'post',
  162. timeout : 60000,
  163. data : params,
  164. dataType : 'json',
  165. success : function(data) {
  166. result = data ;
  167. return data ;
  168. },
  169. error : function(e) {
  170. $.messager.alert('系统提示信息error', '访问服务失败!', 'error');
  171. }
  172. });
  173. return result ;
  174. };