(function() {
//
//
Vue.component('high-incidence-disease', {
template: '
\
本月高发疾病排行
\
\
\

\
\
暂无数据!
\
\
\
\
\
\
\
\
\
\
\
\
',
props: ["data"],
data: function() {
return {
index1:0,
index2:0,
gaoBingFaData:null,
isInit:true,
fontSize: 0.007 * window.screen.width,
linkageFilter:"",
hasData:true,
monthData:null,
yearMonth:null,
}
},
mounted: function() {
},
watch:{
data:function(data){
if(data){
this.monthData = data[0];
this.yearData = data[1];
this.initData();
}
}
},
methods: {
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==2){//本年
this.gaoBingFaData = this.yearData.successFlg?this.yearData.obj.viewInfos&&JSON.parse(this.yearData.obj.viewInfos[0].options[0].option):{};
}
if(this.gaoBingFaData.xAxis[0].data){
this.hasData = true;
}else{
this.hasData = false;
return false;
}
var zhuYuanData = [],zhuYuanTitle = "";
var xAxisData = (this.gaoBingFaData.xAxis[0].data).reverse()||[];
var menZhenData = (this.gaoBingFaData.series[0].data).reverse()||[];
var menZhenTitle = this.gaoBingFaData.series[0].name||"";
if(this.index1==0){//全部(显示门诊/住院数据叠加)
zhuYuanData = (this.gaoBingFaData.series[1].data).reverse();
zhuYuanTitle = this.gaoBingFaData.series[1].name;
}else if(this.index1==1){//住院(显示单个柱状图)
menZhenData = (this.gaoBingFaData.series[1].data).reverse();
menZhenTitle = this.gaoBingFaData.series[1].name;
zhuYuanData = [];
zhuYuanTitle = "";
}
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'));
var gaofaOption = {
"tooltip": {
"trigger": "axis"
},
grid: {top: 40, bottom: 30, left: 140,right:80},
"yAxis": [{
"type": "category",
"name": "人次",
"data": xAxisData,
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": menZhenTitle,
"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": menZhenData
},
]
}
if(zhuYuanData.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": zhuYuanTitle,
"type": "bar",
stack: '高发疾病',
"label": {
show: true,
position: "right",
color: '#b5e1fc',
formatter:function(param){
var dataIndex = param.dataIndex,menZhenVal;
_.map(menZhenData,function(item,idx){
if(idx==dataIndex){
menZhenVal = item
}
})
return menZhenVal+"+"+param.value;
},
},
"itemStyle": {
"normal": {
"lineStyle": {
"shadowColor": "rgba(0,0,0,0.4)"
},
barBorderRadius: [0, 8, 8, 0],
color: '#00e6f3'
},
},
"data": zhuYuanData
}
}else{
gaofaOption.series = gaofaOption.series[0];
}
if(gaoFaChart){
gaoFaChart.clear();
}
gaoFaChart.setOption(gaofaOption);
}
},
})
})()