(function() {
Vue.component('device-banding', {
template: '
',
props: [],
data: function() {
return {
isProduction: 0,
allYJCount: null,
allBDCount: null,
xtyYJCount: null,
xtyBDCount: null,
xyjYJCount: null,
xyjBDCount: null,
isRequestEnd: false
}
},
methods: {
changeProduction: function(num) {
this.isProduction = num;
}
},
mounted: function() {
var _self = this;
EventBus.$on('get-banding-info', function(arg) {
var type = arg.type;
if(type == "") { //全部
_self.changeProduction(0);
} else if(type == "1") { //血压计
_self.changeProduction(1);
} else if(type == "2") { //血糖仪
_self.changeProduction(2);
}
});
var url = "/svr-iot/wlyy/deviceBinding";
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 tangniaobingData = datas[1]; //糖尿病tab数据
var gaoxueyaData = datas[2]; //高血压tab数据
if(allData.status == 200) {
var data = allData.data;
_self.allYJCount = data[1].num;
_self.allBDCount = data[0].num;
}
if(gaoxueyaData.status == 200) {
var data = gaoxueyaData.data;
_self.xyjYJCount = data[1].num;
_self.xyjBDCount = data[0].num;
}
if(tangniaobingData.status == 200) {
var data = tangniaobingData.data;
_self.xtyYJCount = data[1].num;
_self.xtyBDCount = data[0].num;
}
_self.isRequestEnd = true;
})
}
})
})()