100 lines
3.7 KiB
JavaScript
100 lines
3.7 KiB
JavaScript
(function(vc) {
|
|
vc.extends({
|
|
data: {
|
|
indexOwnerRoomInfo: {
|
|
unbindCount: 0,
|
|
bindCount: 0,
|
|
unbindRoomCount: 0,
|
|
bindRoomCount: 0,
|
|
}
|
|
},
|
|
_initMethod: function() {
|
|
},
|
|
_initEvent: function() {
|
|
vc.on('indexOwnerRoom','initData',function(){
|
|
$that._loadIndexOwnerRegisterData();
|
|
|
|
})
|
|
},
|
|
methods: {
|
|
_loadIndexOwnerRegisterData: function() {
|
|
let param = {
|
|
params: {
|
|
page: 1,
|
|
row: 10,
|
|
communityId: vc.getCurrentCommunity().communityId
|
|
}
|
|
};
|
|
|
|
//发送get请求
|
|
vc.http.apiGet('/propertyIndex.queryOwnerRegisterIndex',
|
|
param,
|
|
function(json, res) {
|
|
let _res = JSON.parse(json);
|
|
if (_res.code != 0) {
|
|
return;
|
|
}
|
|
vc.copyObject(_res.data, $that.indexOwnerRoomInfo);
|
|
let _dom = document.getElementById('ownerRoomCount');
|
|
let ownerDataList = [
|
|
{ value: $that.indexOwnerRoomInfo.bindCount, name: vc.i18n('已注册', 'indexOwnerRoom'), color: '#4B7AF0' },
|
|
{ value: $that.indexOwnerRoomInfo.unbindRoomCount, name: vc.i18n('未绑定房屋', 'indexOwnerRoom'), color: '#FFD93D' },
|
|
{ value: $that.indexOwnerRoomInfo.bindRoomCount, name: vc.i18n('已绑定房屋', 'indexOwnerRoom'), color: '#01C36D' }
|
|
];
|
|
$that._initOwnerEcharts(ownerDataList, _dom, vc.i18n('住户信息', 'indexOwnerRoom'));
|
|
},
|
|
function(errInfo, error) {
|
|
console.log('请求失败处理');
|
|
|
|
}
|
|
);
|
|
},
|
|
_initOwnerEcharts: function(dataList, dom, _title) {
|
|
let myChart = echarts.init(dom);
|
|
let option = null;
|
|
option = {
|
|
tooltip: {
|
|
trigger: 'item'
|
|
},
|
|
|
|
legend: {
|
|
top: '5%',
|
|
left: 'right',
|
|
orient: 'vertical',
|
|
textStyle: {
|
|
color: '#9D9D9F'
|
|
},
|
|
},
|
|
color: dataList.map(item => item.color),
|
|
series: [{
|
|
name: _title,
|
|
type: 'pie',
|
|
radius: ['40%', '65%'],
|
|
avoidLabelOverlap: false,
|
|
label: {
|
|
show: false,
|
|
position: 'top'
|
|
},
|
|
emphasis: {
|
|
label: {
|
|
show: true,
|
|
fontSize: '20',
|
|
fontWeight: 'bold'
|
|
}
|
|
},
|
|
labelLine: {
|
|
show: false
|
|
},
|
|
data: dataList.map(item => ({
|
|
value: item.value,
|
|
name: item.name
|
|
})),
|
|
}]
|
|
};
|
|
if (option && typeof option === "object") {
|
|
myChart.setOption(option, true);
|
|
}
|
|
},
|
|
}
|
|
})
|
|
})(window.vc); |