37dcd47dd56b91ad7efbab0956b2a3985bc8181c.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. var loginfojson = eval('(' + top.window.name + ')');//登录用户信息
  2. var user_id = loginfojson.LoginInfo.user_id;
  3. var role_id =loginfojson.LoginInfo.roleids;
  4. var comp_id = loginfojson.LoginInfo.corp_ids;
  5. var comp_name = loginfojson.LoginInfo.corp_names;
  6. var pcomp_name = loginfojson.LoginInfo.pcorp_names;
  7. //发电车
  8. var generatorCar;
  9. //发电机
  10. var electricGenerator;
  11. //应急队伍
  12. var emergencyResponseTeam;
  13. //应急专家
  14. var emergencResponse;
  15. //通信车
  16. var emergencyCommandCommunication;
  17. //应急资源类型
  18. var emergencResouseType;
  19. //行政区域名称
  20. var historgramName;
  21. //柱状图参数
  22. var historgramData;
  23. //定义一个行政区域的名称
  24. var provinces=["广东","广西","云南","贵州","海南"];
  25. var prefectureLevelCitys=["清远","韶关","湛江","梅州","河源","肇庆","惠州","茂名","江门","阳江","云浮","广州","汕尾","揭阳","珠海","佛山","潮州","汕头","深圳","东莞","中山"];
  26. var province="";//===行政区域
  27. /**
  28. * @param 循环查出所属单位,显示相应的地图
  29. */
  30. function useMap()
  31. {
  32. var key = xpref(prefectureLevelCitys) ;
  33. if(key != -1)
  34. {
  35. var pkey = Pxpref(provinces);
  36. if(pkey!=-1)
  37. {
  38. province=pkey+"|"+key+"市";
  39. }
  40. }
  41. else
  42. {
  43. key = xpref(provinces) ;
  44. if(key != -1){
  45. province=key;
  46. }
  47. }
  48. }
  49. /**
  50. * @author jyf
  51. * @param 循环本级单位
  52. */
  53. function xpref(citys){
  54. for(var key in citys){
  55. if(comp_name.indexOf(citys[key])!=-1){
  56. return citys[key];
  57. }
  58. }
  59. return -1 ;
  60. }
  61. /**
  62. * @author jyf
  63. * @param 循环上级单位
  64. */
  65. function Pxpref(prive){
  66. for(var key in prive){
  67. if(pcomp_name.indexOf(prive[key])!=-1){
  68. return prive[key];
  69. }
  70. }
  71. return -1 ;
  72. }
  73. /**
  74. * @author jyf
  75. * @param 获取地图中所有显示的json
  76. */
  77. function getChildInfo(){
  78. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getAllSum/';
  79. var params = {
  80. deptId : comp_id
  81. };
  82. $.ajax({
  83. url : url,
  84. type : 'post',
  85. async: false,
  86. timeout : 60000,
  87. data : params,
  88. dataType : 'JSON',
  89. success : function(data){
  90. JSON.stringify(data);
  91. //发电车
  92. generatorCar= JSON.stringify(data.l3);
  93. //发电机
  94. electricGenerator=JSON.stringify(data.l4);
  95. //应急队伍
  96. emergencyResponseTeam=JSON.stringify(data.l1);
  97. //应急专家
  98. emergencResponse=JSON.stringify(data.l2);
  99. //应急通信指挥车
  100. emergencyCommandCommunication=JSON.stringify(data.l5);
  101. //应急资源类型
  102. emergencResouseType=JSON.stringify(data.typeList);
  103. //行政区域名称
  104. historgramName=JSON.stringify(data.compList);
  105. //柱状图参数
  106. historgramData=JSON.stringify(data.beanList);
  107. for(var i=0;i<5;i++)
  108. {
  109. historgramData=historgramData.replace("\"{normal: {label:{show: true, position: insideRight}}}\"", "{normal: {label:{show: true, position: \"insideRight\"}}}");
  110. }
  111. historgramData=eval('('+ historgramData+')');
  112. },
  113. error : function(e){
  114. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  115. }
  116. });
  117. }
  118. // Step:3 conifg ECharts's path, link to echarts.js from current page.
  119. // Step:3 为模块加载器配置echarts的路径,从当前页面链接到echarts.js,定义所需图表路径
  120. function inite_charts()
  121. {
  122. /*alert(typeof emergencResouseType);*/
  123. require.config({
  124. paths: {
  125. echarts: '/nwyj/page/cockpit/tableandmap/js'
  126. }
  127. });
  128. // Step:4 require echarts and use it in the callback.
  129. // Step:4 动态加载echarts然后在回调函数中开始使用,注意保持按需加载结构定义图表路径
  130. require(
  131. [
  132. 'echarts',
  133. 'echarts/chart/bar',
  134. 'echarts/chart/line',
  135. 'echarts/chart/map',
  136. 'echarts/chart/funnel'
  137. ],
  138. function (ec) {
  139. //监测当前数组的格式
  140. option = {
  141. title: {
  142. //text: "",
  143. //subtext: "",
  144. //x: "110"
  145. },
  146. tooltip: {
  147. trigger: "item",
  148. showContent:true,
  149. formatter:function(params)
  150. {
  151. //打印出当前所有的数据
  152. console.log(params);
  153. //var series=this.getSeries();
  154. //每个省份中定义的多少个系列
  155. var series=option.series;
  156. //拿到当前的省份是哪个
  157. var name=params.data.name;
  158. var seriesIndex = params.data.seriesIndex;
  159. //var res = name+"物资总数"+params.data.value;
  160. var res = name+":";
  161. for(var i=0,l=seriesIndex.length;i<l;i++)
  162. {
  163. var data = series[seriesIndex[i]].data;
  164. for(var j = 0,k=data.length;j<k;j++)
  165. {
  166. if(data[j].name==name)
  167. {
  168. res+='<br/>'+series[seriesIndex[i]].name+':'+data[j].value;
  169. }
  170. }
  171. }
  172. return res;
  173. }
  174. },
  175. legend: {
  176. show:true,
  177. orient: "vertical",
  178. x: "left",
  179. data:eval('('+emergencResouseType+')')/*fff*/,
  180. selectedMode: "single",
  181. textStyle: {
  182. color: "rgb(0, 0, 0)",
  183. fontFamily:"微软雅黑",
  184. fontSize: 14,
  185. fontStyle: "normal",
  186. fontWeight: "normal",
  187. align: "center"
  188. }
  189. },
  190. dataRange: {
  191. min: 0,
  192. max: 300,
  193. x: "left",
  194. y: "bottom",
  195. text: ["高", "低"],
  196. calculable: true,
  197. color: ["#006edd", "rgb(224, 255, 255)"],
  198. textStyle: {
  199. color: "rgb(0, 0, 0)",
  200. fontFamily:"微软雅黑"
  201. }
  202. },
  203. toolbox: {
  204. show: false,
  205. orient: "vertical",
  206. x: "right",
  207. y: "top",
  208. feature: {
  209. dataView: {
  210. readOnly: false,
  211. show: false
  212. },
  213. restore: {
  214. show: false
  215. },
  216. saveAsImage: {
  217. show: true
  218. },
  219. mark: {
  220. show: false
  221. },
  222. dataZoom: {
  223. show: false
  224. },
  225. magicType: {
  226. show: false
  227. }
  228. }
  229. },
  230. roamController: {
  231. show:true,
  232. x: "right",
  233. y:"top",
  234. mapTypeControl: {
  235. 广东: true
  236. },
  237. width: 61,
  238. height: 89,
  239. y: "top",
  240. handlerColor: "rgb(18, 145, 204)",
  241. step: 20
  242. },
  243. series: [
  244. {
  245. name: "发电车",
  246. type: "map",
  247. mapType: province,
  248. roam: true,
  249. scaleLimit:{min:0.5,max:3},
  250. mapValueCalculation: "sum",
  251. itemStyle: {
  252. normal: {
  253. label: {
  254. show: true,
  255. textStyle: {
  256. color: "rgb(127, 63, 0)",
  257. fontSize: 12,
  258. fontStyle: "normal",
  259. fontWeight: "bold"
  260. }
  261. }
  262. },
  263. emphasis: {
  264. label: {
  265. show: true
  266. }
  267. }
  268. },
  269. data:eval('('+generatorCar+')')/*aaa*/,
  270. showLegendSymbol: true,
  271. mapLocation: {
  272. x: "center",
  273. y: "center"
  274. }
  275. },
  276. {
  277. name: "发电机",
  278. type: "map",
  279. mapType: province,
  280. roam: true,
  281. scaleLimit:{min:0.5,max:3},
  282. mapValueCalculation: "sum",
  283. itemStyle: {
  284. normal: {
  285. label: {
  286. show: true,
  287. textStyle: {
  288. color: "rgb(127, 63, 0)",
  289. fontSize: 12,
  290. fontStyle: "normal",
  291. fontWeight: "bold"
  292. }
  293. }
  294. },
  295. emphasis: {
  296. label: {
  297. show: true
  298. }
  299. }
  300. },
  301. data:eval('('+electricGenerator+')')/*bbb*/,
  302. showLegendSymbol: true,
  303. mapLocation: {
  304. x: "center",
  305. y: "center"
  306. }
  307. },
  308. {
  309. name: "应急队伍",
  310. type: "map",
  311. mapType: province,
  312. roam: true,
  313. scaleLimit:{min:0.5,max:3},
  314. mapValueCalculation: "sum",
  315. itemStyle: {
  316. normal: {
  317. label: {
  318. show: true,
  319. textStyle: {
  320. color: "rgb(127, 63, 0)",
  321. fontSize: 12,
  322. fontStyle: "normal",
  323. fontWeight: "bold"
  324. }
  325. }
  326. },
  327. emphasis: {
  328. label: {
  329. show: true
  330. }
  331. }
  332. },
  333. data:eval('('+emergencyResponseTeam+')')/*ccc*/,
  334. showLegendSymbol: true,
  335. mapLocation: {
  336. x: "center",
  337. y: "center"
  338. }
  339. },
  340. {
  341. type: "map",
  342. name: "应急专家",
  343. mapType: province,
  344. roam: true,
  345. scaleLimit:{min:0.5,max:3},
  346. mapValueCalculation: "sum",
  347. itemStyle: {
  348. normal: {
  349. label: {
  350. show: true,
  351. textStyle: {
  352. color: "rgb(127, 63, 0)",
  353. fontSize: 12,
  354. fontStyle: "normal",
  355. fontWeight: "bold"
  356. }
  357. }
  358. },
  359. emphasis: {
  360. label: {
  361. show: true
  362. }
  363. }
  364. },
  365. data:eval('('+emergencResponse+')')/*ddd*/,
  366. showLegendSymbol: true,
  367. mapLocation: {
  368. x: "center",
  369. y: "center"
  370. }
  371. },
  372. {
  373. type: "map",
  374. name: "通信车",
  375. mapType: province,
  376. roam: true,
  377. scaleLimit:{min:0.5,max:3},
  378. mapValueCalculation: "sum",
  379. itemStyle: {
  380. normal: {
  381. label: {
  382. show: true,
  383. textStyle: {
  384. color: "rgb(127, 63, 0)",
  385. fontSize: 12,
  386. fontStyle: "normal",
  387. fontWeight: "bold"
  388. }
  389. }
  390. },
  391. emphasis: {
  392. label: {
  393. show: true
  394. }
  395. }
  396. },
  397. data:eval('('+emergencyCommandCommunication+')')/*eee*/,
  398. showLegendSymbol: true,
  399. mapLocation: {
  400. x: "center",
  401. y: "center"
  402. },
  403. markPoint: {
  404. data: []
  405. }
  406. }
  407. ],
  408. //backgroundColor: "white",
  409. color: ["#CCCC33","#CC6699","#CC9933","#CC6600","#CC6600","#CC6600","#339999",
  410. "#CC6699","#CC6699","#FF6666","#FF99CC","#CC3399","#FF99CC","#CC3399",
  411. "#CC3399","#FF9999"],
  412. animation: true
  413. };
  414. option2 = {
  415. title: {
  416. //text: "",
  417. //subtext: ""
  418. },
  419. tooltip: {
  420. trigger: "axis",
  421. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  422. show:false,
  423. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  424. }
  425. },
  426. legend: {
  427. show:false,
  428. orient: "vertical",
  429. x:"left",
  430. data:eval('('+emergencResouseType+')')/*fff*/,
  431. selectedMode: "single",
  432. textStyle: {
  433. color: "rgb(0, 0, 0)",
  434. fontFamily:"微软雅黑",
  435. fontSize: 10,
  436. fontStyle: "normal",
  437. fontWeight: "normal",
  438. align: "center"
  439. }
  440. },
  441. toolbox: {
  442. show: true,
  443. feature: {
  444. mark: {
  445. show: false
  446. },
  447. dataView: {
  448. show: false,
  449. readOnly: false
  450. },
  451. magicType: {
  452. show: false,
  453. type: ["line", "bar"]
  454. },
  455. restore: {
  456. title:"刷新",
  457. show: true
  458. },
  459. saveAsImage: {
  460. show: true
  461. }
  462. }
  463. },
  464. calculable: true,
  465. xAxis: [
  466. {
  467. type: "value",
  468. boundaryGap: [0, 0.01],
  469. axisLabel:
  470. {
  471. textStyle:{color:"#000000",fontFamily:"微软雅黑"}
  472. },
  473. splitLine:{
  474. lineStyle:
  475. {
  476. color: '#f0fcff',
  477. width: 1,
  478. type: 'solid'
  479. }
  480. }
  481. }
  482. ],
  483. yAxis: [
  484. {
  485. type: "category",
  486. data:eval('('+historgramName+')')/*ggg*/,
  487. axisLabel:
  488. {
  489. textStyle:{color:"#000000",fontFamily:"微软雅黑"}
  490. },
  491. splitLine:{
  492. lineStyle:
  493. {
  494. color: '#f0fcff',
  495. width: 1,
  496. type: 'solid'
  497. }
  498. }
  499. }
  500. ],
  501. series:historgramData,
  502. //backgroundColor:"white",
  503. color: ["#CCCC33","#CC6699","#CC9933","#CC6600","#CC6600","#CC6600","#339999",
  504. "#CC6699","#CC6699","#FF6666","#FF99CC","#CC3399","#FF99CC","#CC3399",
  505. "#CC3399","#FF9999"]
  506. };
  507. var myChart = ec.init(document.getElementById("map"));
  508. myChart.setOption(option);
  509. myChart2 = ec.init(document.getElementById("histogram"));
  510. myChart2.setOption(option2);
  511. myChart.connect(myChart2);
  512. myChart2.connect(myChart);
  513. setTimeout(function ()
  514. {
  515. window.onresize = function ()
  516. {
  517. myChart.resize();
  518. myChart2.resize();
  519. };
  520. },200);
  521. });
  522. };