123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- (function() {
- Vue.component('high-incidence-disease', {
- template: '<div style="height: 100%;">\
- <h4 class="c-b5e1fc c-f16 c-t-center div-common-title">本月高发疾病排行</h4>\
- <img src="../images/icon.png" class="icon-img" @click="detailClick">\
- <div data-toggle="buttons" class="btn-group">\
- <label class="btn btn-default" :class="{active: index1 == 0}" @click="btnClick1(0)">\
- <input type="radio">全部\
- </label>\
- <label class="btn btn-default" :class="{active: index1 == 1}" @click="btnClick1(1)">\
- <input type="radio">住院\
- </label>\
- <label class="btn btn-default" :class="{active: index1 == 2}" @click="btnClick1(2)">\
- <input type="radio">门诊\
- </label>\
- </div>\
- <div data-toggle="buttons" class="btn-group fr mr20" style="margin-left: 0;">\
- <label class="btn btn-default" :class="{active: index2 == 0}" @click="btnClick2(0)">\
- <input type="radio">本月\
- </label>\
- <img src="../images/icon.png" class="icon-img">\
- <label class="btn btn-default" :class="{active: index2 == 1}" @click="btnClick2(1)">\
- <input type="radio">本季\
- </label>\
- <label class="btn btn-default" :class="{active: index2 == 2}" @click="btnClick2(2)">\
- <input type="radio">本年\
- </label>\
- </div>\
- <div v-show="!hasData" class="no-result-panel">\
- <div class="no-result-img" style="padding-top:1.09375rem;">\
- <img src="../images/noData.png">\
- </div>\
- <div class="no-result-text">暂无数据!</div>\
- </div>\
- <div id="div-gaofa-disease-chart" v-show="hasData"></div>\
- </div>',
- props: ["data","city","cityVal"],
- data: function() {
- return {
- index1:0,
- index2:0,
- gaoBingFaData:null,
- isInit:true,
- fontSize: 0,
- linkageFilter:"",
- hasData:true,
- monthData:null,
- jiData:null,
- yearMonth:null,
- }
- },
- mounted: function() {
- var width = window.screen.width>=1920?window.screen.width:1920;
- this.fontSize = 0.007 * width;
- },
- watch:{
- data:function(data){
- if(data[0] || data[1] || data[2]){
- this.monthData = data[0];
- this.yearData = data[1];
- this.jiData = data[2];
- this.initData();
- }else{
- this.hasData = false;
- }
- }
- },
- methods: {
- detailClick:function(){
- var vm = this;
- var width = (0.7604 * window.screen.width) + 'px';
- var height = (0.41875 * window.screen.width) + 'px';
- vm.cityVal = vm.cityVal=="0"?"":vm.cityVal;
- top.layer.open({
- id: 'LAY_layuipro', //设定一个id,防止重复弹出
- type: 2,
- title: false,
- closeBtn: 0,
- shade: 0.5,
- shadeClose: true,
- area: [width, height],
- content: httpRequest.alertUrl+'/page/bigData/html/alert6.html?town='+vm.city+"&cityVal="+vm.cityVal
- });
- },
- btnClick1:function(idx){
- this.index1 = idx;
- this.initData();
- },
- btnClick2:function(idx){
- this.index2 = idx;
- this.initData();
- },
- initData:function(){//高发疾病
- if(this.index2==0){//本月
- this.gaoBingFaData = this.monthData.successFlg?this.monthData.obj.viewInfos&&JSON.parse(this.monthData.obj.viewInfos[0].options[0].option):{};
- }else if(this.index2==1){//本季
- this.gaoBingFaData = this.jiData.successFlg?this.jiData.obj.viewInfos&&JSON.parse(this.jiData.obj.viewInfos[0].options[0].option):{};
- }else if(this.index2==2){//本年
- this.gaoBingFaData = this.yearData.successFlg?this.yearData.obj.viewInfos&&JSON.parse(this.yearData.obj.viewInfos[0].options[0].option):{};
- }
- if(this.gaoBingFaData&&this.gaoBingFaData.xAxis[0].data){
- this.hasData = true;
- }else{
- this.hasData = false;
- return false;
- }
- var menZhenData = [],menZhenTitle = "";
- var xAxisData = (this.gaoBingFaData.xAxis[0].data)||[];
- var zhuYuanData = (this.gaoBingFaData.series[1].data)||[];
- var zhuYuanTitle = this.gaoBingFaData.series[1].name||"";
- if(this.index1==0){//全部(显示门诊/住院数据叠加)
- menZhenData = (this.gaoBingFaData.series[0].data);
- menZhenTitle = this.gaoBingFaData.series[0].name;
- }else if(this.index1==2){//门诊(显示单个柱状图)
- zhuYuanData = (this.gaoBingFaData.series[0].data);
- zhuYuanTitle = this.gaoBingFaData.series[0].name;
- menZhenData = [];
- menZhenTitle = "";
- }
- //数据排序(降序排列)
- if(this.index1==0){
- var formatData = _.map(zhuYuanData,function(item,idx){
- var total = parseInt(item)+parseInt(menZhenData[idx]);
- return {total:total,zhuyuanval:parseInt(item),menzhenval:parseInt(menZhenData[idx]),xAxis:xAxisData[idx]}
- })
- formatData = _.sortBy(formatData,"total").reverse();
- xAxisData = [],zhuYuanData=[],menZhenData=[];
- _.map(formatData,function(item,idx){
- xAxisData.push(item.xAxis);
- zhuYuanData.push(item.zhuyuanval);
- menZhenData.push(item.menzhenval);
- })
- }else if(this.index1==1 || this.index1==2){
- var formatData = _.map(zhuYuanData,function(item,idx){
- return {total:parseInt(item),zhuyuanval:parseInt(item),xAxis:xAxisData[idx]}
- })
- formatData = _.sortBy(formatData,"total").reverse();
- xAxisData = [],zhuYuanData=[];
- _.map(formatData,function(item,idx){
- xAxisData.push(item.xAxis);
- zhuYuanData.push(item.zhuyuanval);
- })
- }
- this.geoFaMainFun(xAxisData,menZhenData,zhuYuanData,menZhenTitle,zhuYuanTitle)
- },
- geoFaMainFun:function(xAxisData,menZhenData,zhuYuanData,menZhenTitle,zhuYuanTitle){
- var vm = this;
- var gaoFaChart = echarts.init(document.getElementById('div-gaofa-disease-chart'));
- debugger
- var gaofaOption = {
- "tooltip": {
- "trigger": "axis"
- },
- "grid": {top: 40, bottom: 30, left: 140,right:80},
- "yAxis": [{
- "type": "category",
- "name": "人次",
- "data": xAxisData.reverse(),
- axisPointer: {
- type: 'shadow'
- },
- axisTick: {
- show: false
- },
- axisLine: {
- lineStyle: {
- color: '#095f8e'
- }
- },
- axisLabel: {
- color: '#b5e1fc',
- fontSize:vm.fontSize,
- interval: 0,
- formatter: function(value) {
- if (value.length > 8) {
- return value.substring(0, 8) + "...";
- } else {
- return value;
- }
- }
- },
- nameTextStyle:{color: '#b5e1fc'},
- }],
- "xAxis": [{
- "type": "value",
- axisPointer: {
- type: 'shadow'
- },
- axisTick: {
- show: false
- },
- axisLine: {
- lineStyle: {
- color: '#095f8e'
- }
- },
- axisLabel: {
- color: '#fff',
- fontSize:vm.fontSize,
- interval:0
- },
- splitLine: {
- show: false // 不显示坐标轴刻度
- }
- }],
- "series": [{
- "smooth": true,
- "name": zhuYuanTitle,
- "type": "bar",
- stack: '高发疾病',
- barWidth: 20,
- "label": {
- show: true,
- position: "right",
- color: '#b5e1fc'
- },
- "itemStyle": {
- "normal": {
- "lineStyle": {
- "shadowColor": "rgba(0,0,0,0.4)"
- },
- color: '#00e6f3',
- barBorderRadius: [0, 8, 8, 0],
- }
- },
- "data": zhuYuanData.reverse()
- },
- ]
- }
- if(menZhenData.length>0){
- gaofaOption.series[0].label.show = false;
- gaofaOption.series[0].itemStyle.normal.color = "#6576e0";
- delete gaofaOption.series[0].itemStyle.normal.barBorderRadius;
- gaofaOption.series[1] = {
- "smooth": true,
- "name": menZhenTitle,
- "type": "bar",
- stack: '高发疾病',
- "label": {
- show: true,
- position: "right",
- color: '#b5e1fc',
- fontSize:vm.fontSize,
- formatter:function(param){
- var dataIndex = param.dataIndex,zhuYuanVal;
- _.map(zhuYuanData,function(item,idx){
- if(idx==dataIndex){
- zhuYuanVal = item
- }
- })
- return zhuYuanVal+"+"+param.value;
- },
- },
- "itemStyle": {
- "normal": {
- "lineStyle": {
- "shadowColor": "rgba(0,0,0,0.4)"
- },
- barBorderRadius: [0, 8, 8, 0],
- color: '#00e6f3'
- },
- },
- "data": menZhenData.reverse()
- }
- }else{
- gaofaOption.series = gaofaOption.series[0];
- }
- if(gaoFaChart){
- gaoFaChart.clear();
- }
- gaoFaChart.setOption(gaofaOption);
- }
- },
-
- })
- })()
|