(function() {
Vue.component('manbing-tab', {
template: '
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
绿标居民 \
{{data.num}}\
\
\
\
\
\
黄标居民 \
{{data.num}}\
\
\
\
\
\
红标居民 \
{{data.num}}\
\
\
\
\
\
无标签居民\
{{data.num}}\
\
\
\
\
\
\
\
',
props: ["activeidx"],
data: function() {
return {
diseaseData: [],
isRequestEnd:false
}
},
methods: {
activeContent: function(data, activeIndex) {
//diseaseType为tab标签的值(0:全部;1:高血压;2:糖尿病)
//activeIndex为子项的值(-1:无标签;0:绿标;1黄标;2红标)
var diseaseType = $(".btn-group .btn.active").index();
if(this.activeidx != data.diseaseIndex) {
$(".div-juming-info").removeClass("active");
this.activeidx = data.diseaseIndex;
}
//[叶泽华 ]代码添加处
EventBus.$emit('device-map-filter', {
diseaseType: diseaseType,
diseaseCondition: data.diseaseCondition
});
},
activeTab: function(type) {
EventBus.$emit('device-map-filter', {
diseaseType: type,
diseaseCondition: ""
});
}
},
mounted: function() {
var _self = this;
getRequestData(_self);
}
})
function getRequestData(_self) {
var url = "/svr-iot/wlyy/chronicDiseaseCount";
var reqUrl = [{
url: url,
reqType: 'get',
data: {
type: ""
}
},
{
url: url,
reqType: 'get',
data: {
type: "1"
}
},
{
url: url,
reqType: 'get',
data: {
type: "2"
}
}
];
httpRequest.getReqPromises(reqUrl).then(function(datas) {
var allData = datas[0]; //全部tab数据
var gaoxueyaData = datas[1]; //高血压tab数据
var tangniaobingData = datas[2]; //糖尿病tab数据
//获取全部的疾病数据
if(allData.status == 200) {
var allDiseaseData = allData.data.reverse();
allDiseaseData = _.map(allDiseaseData, function(data, index) {
data.diseaseIndex = index;
return data;
});
_self.diseaseData.push(allDiseaseData);
} else {
toastr.error(allData.msg)
}
//获取高血压的疾病数据
if(gaoxueyaData.status == 200) {
var gaoXYDiseaseData = gaoxueyaData.data.reverse();
gaoXYDiseaseData = _.map(gaoXYDiseaseData, function(data, index) {
data.diseaseIndex = index + 4;
return data;
});
_self.diseaseData.push(gaoXYDiseaseData);
} else {
toastr.error(gaoxueyaData.msg)
}
//获取糖尿病的疾病数据
if(tangniaobingData.status == 200) {
var tangLBDiseaseData = tangniaobingData.data.reverse();
tangLBDiseaseData = _.map(tangLBDiseaseData, function(data, index) {
data.diseaseIndex = index + 8;
return data;
});
_self.diseaseData.push(tangLBDiseaseData);
} else {
toastr.error(tangniaobingData.msg)
}
_self.isRequestEnd = true;
EventBus.$emit('data-load-complete', {});
//【慢病患者情况】轮播
setTimeout(function() {
var slider1 = Slider.init({
target: $('.slider'),
time: 6000
});
}, 500)
});
}
})()