123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529 |
- var loginfojson = eval('(' + top.window.name + ')');//登录用户信息
- var user_id = loginfojson.LoginInfo.user_id;
- var role_id =loginfojson.LoginInfo.roleids;
- var comp_id = loginfojson.LoginInfo.corp_ids;
- var comp_name = loginfojson.LoginInfo.corp_names;
- var pcomp_name = loginfojson.LoginInfo.pcorp_names;
- //发电车
- var generatorCar;
- //发电机
- var electricGenerator;
- //应急队伍
- var emergencyResponseTeam;
- //应急专家
- var emergencResponse;
- //通信车
- var emergencyCommandCommunication;
- //应急资源类型
- var emergencResouseType;
- //行政区域名称
- var historgramName;
- //柱状图参数
- var historgramData;
- //定义一个行政区域的名称
- var provinces=["广东","广西","云南","贵州","海南"];
- var prefectureLevelCitys=["清远","韶关","湛江","梅州","河源","肇庆","惠州","茂名","江门","阳江","云浮","广州","汕尾","揭阳","珠海","佛山","潮州","汕头","深圳","东莞","中山"];
- var province="";//===行政区域
- /**
- * @param 循环查出所属单位,显示相应的地图
- */
- function useMap()
- {
- var key = xpref(prefectureLevelCitys) ;
- if(key != -1)
- {
- var pkey = Pxpref(provinces);
- if(pkey!=-1)
- {
- province=pkey+"|"+key+"市";
- }
-
- }
- else
- {
- key = xpref(provinces) ;
- if(key != -1){
- province=key;
- }
- }
- }
- /**
- * @author jyf
- * @param 循环本级单位
- */
- function xpref(citys){
- for(var key in citys){
- if(comp_name.indexOf(citys[key])!=-1){
- return citys[key];
- }
- }
- return -1 ;
- }
- /**
- * @author jyf
- * @param 循环上级单位
- */
- function Pxpref(prive){
- for(var key in prive){
- if(pcomp_name.indexOf(prive[key])!=-1){
- return prive[key];
- }
- }
- return -1 ;
- }
- /**
- * @author jyf
- * @param 获取地图中所有显示的json
- */
- function getChildInfo(){
- var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getAllSum/';
- var params = {
- deptId : comp_id
- };
- $.ajax({
- url : url,
- type : 'post',
- async: false,
- timeout : 60000,
- data : params,
- dataType : 'JSON',
- success : function(data){
- JSON.stringify(data);
- //发电车
- generatorCar= JSON.stringify(data.l3);
- //发电机
- electricGenerator=JSON.stringify(data.l4);
- //应急队伍
- emergencyResponseTeam=JSON.stringify(data.l1);
- //应急专家
- emergencResponse=JSON.stringify(data.l2);
- //应急通信指挥车
- emergencyCommandCommunication=JSON.stringify(data.l5);
- //应急资源类型
- emergencResouseType=JSON.stringify(data.typeList);
- //行政区域名称
- historgramName=JSON.stringify(data.compList);
- //柱状图参数
- historgramData=JSON.stringify(data.beanList);
- for(var i=0;i<5;i++)
- {
- historgramData=historgramData.replace("\"{normal: {label:{show: true, position: insideRight}}}\"", "{normal: {label:{show: true, position: \"insideRight\"}}}");
- }
- historgramData=eval('('+ historgramData+')');
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
- // Step:3 conifg ECharts's path, link to echarts.js from current page.
- // Step:3 为模块加载器配置echarts的路径,从当前页面链接到echarts.js,定义所需图表路径
- function inite_charts()
- {
- /*alert(typeof emergencResouseType);*/
- require.config({
- paths: {
- echarts: '/nwyj/page/cockpit/tableandmap/js'
- }
- });
- // Step:4 require echarts and use it in the callback.
- // Step:4 动态加载echarts然后在回调函数中开始使用,注意保持按需加载结构定义图表路径
- require(
- [
- 'echarts',
- 'echarts/chart/bar',
- 'echarts/chart/line',
- 'echarts/chart/map',
- 'echarts/chart/funnel'
- ],
- function (ec) {
- //监测当前数组的格式
- option = {
-
- title: {
- //text: "",
- //subtext: "",
- //x: "110"
- },
- tooltip: {
- trigger: "item",
- showContent:true,
- formatter:function(params)
- {
- //打印出当前所有的数据
- console.log(params);
- //var series=this.getSeries();
- //每个省份中定义的多少个系列
- var series=option.series;
- //拿到当前的省份是哪个
- var name=params.data.name;
- var seriesIndex = params.data.seriesIndex;
- //var res = name+"物资总数"+params.data.value;
- var res = name+":";
- for(var i=0,l=seriesIndex.length;i<l;i++)
- {
- var data = series[seriesIndex[i]].data;
- for(var j = 0,k=data.length;j<k;j++)
- {
- if(data[j].name==name)
- {
- res+='<br/>'+series[seriesIndex[i]].name+':'+data[j].value;
- }
- }
- }
- return res;
- }
- },
- legend: {
- show:true,
- orient: "vertical",
- x: "left",
- data:eval('('+emergencResouseType+')')/*fff*/,
- selectedMode: "single",
- textStyle: {
- color: "rgb(0, 0, 0)",
- fontFamily:"微软雅黑",
- fontSize: 14,
- fontStyle: "normal",
- fontWeight: "normal",
- align: "center"
- }
- },
- dataRange: {
- min: 0,
- max: 300,
- x: "left",
- y: "bottom",
- text: ["高", "低"],
- calculable: true,
- color: ["#006edd", "rgb(224, 255, 255)"],
- textStyle: {
- color: "rgb(0, 0, 0)",
- fontFamily:"微软雅黑"
- }
- },
- toolbox: {
- show: false,
- orient: "vertical",
- x: "right",
- y: "top",
- feature: {
- dataView: {
- readOnly: false,
- show: false
- },
- restore: {
- show: false
- },
- saveAsImage: {
- show: true
- },
- mark: {
- show: false
- },
- dataZoom: {
- show: false
- },
- magicType: {
- show: false
- }
- }
- },
- roamController: {
- show:true,
- x: "right",
- y:"top",
- mapTypeControl: {
- 广东: true
- },
- width: 61,
- height: 89,
- y: "top",
- handlerColor: "rgb(18, 145, 204)",
- step: 20
- },
- series: [
- {
- name: "发电车",
- type: "map",
- mapType: province,
- roam: true,
- scaleLimit:{min:0.5,max:3},
- mapValueCalculation: "sum",
- itemStyle: {
- normal: {
- label: {
- show: true,
- textStyle: {
- color: "rgb(127, 63, 0)",
- fontSize: 12,
- fontStyle: "normal",
- fontWeight: "bold"
- }
- }
- },
- emphasis: {
- label: {
- show: true
- }
- }
- },
- data:eval('('+generatorCar+')')/*aaa*/,
- showLegendSymbol: true,
- mapLocation: {
- x: "center",
- y: "center"
- }
- },
- {
- name: "发电机",
- type: "map",
- mapType: province,
- roam: true,
- scaleLimit:{min:0.5,max:3},
- mapValueCalculation: "sum",
- itemStyle: {
- normal: {
- label: {
- show: true,
- textStyle: {
- color: "rgb(127, 63, 0)",
- fontSize: 12,
- fontStyle: "normal",
- fontWeight: "bold"
- }
- }
- },
- emphasis: {
- label: {
- show: true
- }
- }
- },
- data:eval('('+electricGenerator+')')/*bbb*/,
- showLegendSymbol: true,
- mapLocation: {
- x: "center",
- y: "center"
- }
- },
- {
- name: "应急队伍",
- type: "map",
- mapType: province,
- roam: true,
- scaleLimit:{min:0.5,max:3},
- mapValueCalculation: "sum",
- itemStyle: {
- normal: {
- label: {
- show: true,
- textStyle: {
- color: "rgb(127, 63, 0)",
- fontSize: 12,
- fontStyle: "normal",
- fontWeight: "bold"
- }
- }
- },
- emphasis: {
- label: {
- show: true
- }
- }
- },
- data:eval('('+emergencyResponseTeam+')')/*ccc*/,
- showLegendSymbol: true,
- mapLocation: {
- x: "center",
- y: "center"
- }
- },
- {
- type: "map",
- name: "应急专家",
- mapType: province,
- roam: true,
- scaleLimit:{min:0.5,max:3},
- mapValueCalculation: "sum",
- itemStyle: {
- normal: {
- label: {
- show: true,
- textStyle: {
- color: "rgb(127, 63, 0)",
- fontSize: 12,
- fontStyle: "normal",
- fontWeight: "bold"
- }
- }
- },
- emphasis: {
- label: {
- show: true
- }
- }
- },
- data:eval('('+emergencResponse+')')/*ddd*/,
- showLegendSymbol: true,
- mapLocation: {
- x: "center",
- y: "center"
- }
- },
- {
- type: "map",
- name: "通信车",
- mapType: province,
- roam: true,
- scaleLimit:{min:0.5,max:3},
- mapValueCalculation: "sum",
- itemStyle: {
- normal: {
- label: {
- show: true,
- textStyle: {
- color: "rgb(127, 63, 0)",
- fontSize: 12,
- fontStyle: "normal",
- fontWeight: "bold"
- }
- }
- },
- emphasis: {
- label: {
- show: true
- }
- }
- },
- data:eval('('+emergencyCommandCommunication+')')/*eee*/,
- showLegendSymbol: true,
- mapLocation: {
- x: "center",
- y: "center"
- },
- markPoint: {
- data: []
- }
- }
- ],
- //backgroundColor: "white",
- color: ["#CCCC33","#CC6699","#CC9933","#CC6600","#CC6600","#CC6600","#339999",
- "#CC6699","#CC6699","#FF6666","#FF99CC","#CC3399","#FF99CC","#CC3399",
- "#CC3399","#FF9999"],
- animation: true
- };
- option2 = {
- title: {
- //text: "",
- //subtext: ""
- },
- tooltip: {
- trigger: "axis",
- axisPointer : { // 坐标轴指示器,坐标轴触发有效
- show:false,
- type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
- }
- },
- legend: {
- show:false,
- orient: "vertical",
- x:"left",
- data:eval('('+emergencResouseType+')')/*fff*/,
- selectedMode: "single",
- textStyle: {
- color: "rgb(0, 0, 0)",
- fontFamily:"微软雅黑",
- fontSize: 10,
- fontStyle: "normal",
- fontWeight: "normal",
- align: "center"
- }
- },
- toolbox: {
- show: true,
- feature: {
- mark: {
- show: false
- },
- dataView: {
- show: false,
- readOnly: false
- },
- magicType: {
- show: false,
- type: ["line", "bar"]
- },
- restore: {
- title:"刷新",
- show: true
- },
- saveAsImage: {
- show: true
- }
- }
- },
- calculable: true,
- xAxis: [
- {
- type: "value",
- boundaryGap: [0, 0.01],
- axisLabel:
- {
- textStyle:{color:"#000000",fontFamily:"微软雅黑"}
- },
- splitLine:{
- lineStyle:
- {
- color: '#f0fcff',
- width: 1,
- type: 'solid'
- }
- }
- }
- ],
- yAxis: [
- {
- type: "category",
- data:eval('('+historgramName+')')/*ggg*/,
- axisLabel:
- {
- textStyle:{color:"#000000",fontFamily:"微软雅黑"}
- },
-
- splitLine:{
- lineStyle:
- {
- color: '#f0fcff',
- width: 1,
- type: 'solid'
- }
- }
- }
- ],
- series:historgramData,
- //backgroundColor:"white",
- color: ["#CCCC33","#CC6699","#CC9933","#CC6600","#CC6600","#CC6600","#339999",
- "#CC6699","#CC6699","#FF6666","#FF99CC","#CC3399","#FF99CC","#CC3399",
- "#CC3399","#FF9999"]
- };
- var myChart = ec.init(document.getElementById("map"));
-
- myChart.setOption(option);
- myChart2 = ec.init(document.getElementById("histogram"));
- myChart2.setOption(option2);
- myChart.connect(myChart2);
- myChart2.connect(myChart);
- setTimeout(function ()
- {
- window.onresize = function ()
- {
- myChart.resize();
- myChart2.resize();
- };
- },200);
- });
- };
|