e26eea5263896ec3e6f5f13b9a97aef6e0c55dfa.svn-base 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. var deptName = resolveUrl().dept_id;
  2. function resolveUrl(){
  3. var encondeCondition=window.location.search;
  4. var condition= decodeURI(decodeURI(encondeCondition.substring(1,encondeCondition.length)));
  5. var conditionArr=condition.split("&");
  6. var condJson={};
  7. for(var item in conditionArr){
  8. var temArr=conditionArr[item].split("=");
  9. condJson[temArr[0]]=temArr[1];
  10. }
  11. userInfo = condJson;
  12. return condJson;
  13. };
  14. // 数据表格
  15. var g;
  16. var gridData;
  17. var myCols1 = [{
  18. display : '0-250kW',
  19. "name" : 'content_min',
  20. minWidth : 60,
  21. width : "8%",render:showMsg
  22. }, {
  23. display : '251-500kW',
  24. "name" : 'content_mid',
  25. minWidth : 60,
  26. width : "8%",render:showMsg
  27. }, {
  28. display : '501kW及以上',
  29. "name" : 'content_max',
  30. minWidth : 60,
  31. width : "8%",render:showMsg
  32. }];
  33. var myCols2 = [{
  34. display : '380V',
  35. "name" : 'level_max',
  36. minWidth : 60,
  37. width : "8%",render:showMsg
  38. }, {
  39. display : '10kV',
  40. "name" : 'level_min',
  41. minWidth : 60,
  42. width : "8%",render:showMsg
  43. }];
  44. var myCols3 = [{
  45. display : '发电机',
  46. "name" : 'generator',
  47. minWidth : 60,
  48. width : "8%",render:showMsg
  49. }, {
  50. display : 'UPS',
  51. "name" : 'ups',
  52. minWidth : 60,
  53. width : "8%",render:showMsg
  54. }, {
  55. display : '磁飞轮',
  56. "name" : 'fly_circle',
  57. minWidth : 60,
  58. width : "8%",render:showMsg
  59. }];
  60. var myCols4 = [{
  61. display : '可调拨',
  62. "name" : 'kused',
  63. minWidth : 60,
  64. width : "5%",render:showMsg
  65. }, {
  66. display : '不可调拨',
  67. "name" : 'bused',
  68. minWidth : 60,
  69. width : "5%",render:showMsg
  70. }];
  71. $(function(){
  72. $("body").eq(0).showLoading();
  73. $.post($.pathname()+ "/ws/generatorcar/GeneratorCarService/getCarInfo",{id : deptName},function (data){
  74. //初始化表格
  75. initCompletes(data);
  76. $("body").eq(0).hideLoading();
  77. gridData=data;
  78. });
  79. });
  80. var columns= [
  81. { display : '供电局',"name" : 'name',id : 'name',width : "10%",dept_id:'dept_id',align : 'center',render : addStatus, frozen: true },
  82. { display : '按容量分类(辆)',columns : myCols1,width : "8%",align : 'center' },
  83. { display : '按电压等级分类(辆)',columns : myCols2,width : "8%",align : 'center' },
  84. { display : '按储能方式分类(辆)',columns : myCols3,width : "8%",align : 'center' },
  85. { display : '按调拨分类(辆)',columns : myCols4,width : "8%",align : 'center' },
  86. { display : '总数量(辆)',"name" : 'num',width : "8%",align : 'center' },
  87. { display : '总容量(kW)',"name" : 'sum',width : "8%",align : 'center' }
  88. ];
  89. var json ="";
  90. var loadData;
  91. function initCompletes(json){
  92. g = $("#maingrid").quiGrid({
  93. columns: columns,
  94. data:json,
  95. rownumbers : true,
  96. usePager : false
  97. });
  98. // $(parent.document.body).find("iframe").height($(window.document.body).height()+30);
  99. // $(top.document.body).find("iframe").height($(window.document.body).height()+30);
  100. }
  101. //发送请求,从后台获取数据
  102. function getNewValue(){
  103. //容量
  104. var content = $('#CAR_CONTENT_265').attr("relValue");
  105. var tempContent = content.split(",");
  106. var content1 = "";
  107. var content2 = "";
  108. if(content.length>0){
  109. for(var i =0; i<content.length; i++){
  110. if(tempContent[i]=="content_min"){
  111. content1+= "'"+"250" + "'" + ",";
  112. }
  113. if(tempContent[i]=="content_mid"){
  114. content1= "251" + ",";
  115. content2="500" ;
  116. }
  117. if(tempContent[i]=="content_max"){
  118. content1="501";
  119. content2="99999999999999";
  120. }
  121. }
  122. }
  123. //电压等级
  124. var level = $('#CAR_LEVEL_265').attr("relValue");
  125. //储能方式
  126. var storedtype = $('#STORED_ENERGY_TYPE_265').attr("relValue");
  127. //可否调用
  128. var isUsed = $('#IS_USED_265').attr("relValue");
  129. //取所属单位
  130. var units = $('#COMP_ID_265').val();
  131. //电压等级
  132. var templevel = level+",";
  133. var temp = templevel.split(",");
  134. var valueType1 = "";
  135. for(var i=0; i<temp.length; i++){
  136. if(temp[i]=="level_max"){
  137. valueType1+= "'" + "139" +"'" +",";
  138. }
  139. if(temp[i]=="level_min"){
  140. valueType1+= "'" + "138" +"'" +",";
  141. }
  142. }
  143. var valueType = null;
  144. if(level.length>0){
  145. valueType = valueType1.substring(0,valueType1.length-1);
  146. }
  147. //储能
  148. var energytype = storedtype+",";
  149. var temp1 = energytype.split(",");
  150. var energytype1 = "";
  151. for(var i=0; i<temp1.length; i++){
  152. if(temp1[i]=="generator"){
  153. energytype1+= "'" + "1" +"'" +",";
  154. }
  155. if(temp1[i]=="ups"){
  156. energytype1+= "'" + "2" +"'" +",";
  157. }
  158. if(temp1[i]=="fly_circle"){
  159. energytype1+= "'" + "3" +"'" +",";
  160. }
  161. }
  162. var valueType2 = null;
  163. if(storedtype.length>0){
  164. valueType2 = energytype1.substring(0,energytype1.length-1);
  165. }
  166. //调用
  167. var isused1 = isUsed + ",";
  168. var temp2 = isused1.split(",");
  169. var isused3 = "";
  170. for(var i=0; i<temp2.length; i++){
  171. if(temp2[i]=="kused"){
  172. isused3+= "'" + "1" +"'" +",";
  173. }
  174. if(temp2[i]=="bused"){
  175. isused3+= "'" + "2" +"'" +",";
  176. }
  177. }
  178. var valueType3 = null;
  179. if(isUsed.length>0){
  180. valueType3 = isused3.substring(0,isused3.length-1);
  181. }
  182. //单位
  183. var leng = units.length;
  184. var deptId = null;
  185. if(leng>0){
  186. var deptIdsTemp = units.split(",");
  187. var arrFF = "";
  188. for(var i=0; i<deptIdsTemp.length; i++){
  189. arrFF+="'"+deptIdsTemp[i]+"'"+",";
  190. }
  191. deptId = arrFF.substring(0,arrFF.length-1);
  192. }
  193. $.post($.pathname()+ "/ws/generatorcar/GeneratorCarService/getCarInfo",{id : deptName,content1:content1,content2:content2,valueType:valueType,valueType2:valueType2,valueType3:valueType3,deptId:deptId},function (data){
  194. json = data;
  195. //给表格数据赋值
  196. gridData= data;
  197. //初始化表格
  198. initCompletes(json);
  199. });
  200. }
  201. function addStatus(rowdata, rowindex, value, column){
  202. var comp_id='"'+rowdata.dept_id+'"';
  203. var name = '"'+value+'"';
  204. return "<a href='javascript:newHtml("+comp_id+","+name+")'>" + value +" </a>";
  205. }
  206. function newHtml(comp_id,name){
  207. if(name=="总计"){
  208. return;
  209. }else if(deptName==comp_id){
  210. return;
  211. }else{
  212. window.open("/nwyj/page/business/am/resource/ledger/generator-car-poll1.jsp?"+comp_id);
  213. // window.location.href = "/nwyj/page/business/am/resource/expert/expert-poll.jsp?"+comp_id;
  214. // alert(comp_id);
  215. }
  216. }
  217. function showMsg(rowdata ,rowindex,value,column){
  218. return '<a href="javascript:void(0)" '
  219. + 'onclick=showDetail("'
  220. + rowdata.dept_id
  221. + '",'+'"'+column.name+ '",'+'"'+value+'")>'+value+'</a>';
  222. }
  223. function showDetail(index,name,val){
  224. if(index=="11111"){
  225. return;
  226. }
  227. return top.Dialog.open({URL:"/nwyj/page/business/am/resource/ledger/windowgenerator-car1.jsp?"+index+"?"+name,ID:"window1",Title:"发电车",ShowMaxButton:true,ShowMinButton:true,Width:1100,Height:500});
  228. }
  229. $.messager=top.Dialog;