Files
PropertyDeployment/resources/Web/MicroCommunityWeb/html/components/property/indexRepairComplaint/indexRepairComplaint.js
Anfioo be079067e6 version9
4
2026-01-14 11:39:11 +08:00

137 lines
5.4 KiB
JavaScript

(function(vc) {
vc.extends({
data: {
indexRepairComplaintInfo: {
allCount: 0,
waitCount: 0,
doingCount: 0,
finishCount: 0,
allComplaintCount: 0,
waitComplaintCount: 0,
finishComplaintCount: 0,
}
},
_initMethod: function() {
},
_initEvent: function() {
vc.on('indexRepairComplaint','initData',function(){
$that._loadIndexComplaintData();
$that._loadIndexRepairData();
})
},
methods: {
_loadIndexRepairData: function() {
let param = {
params: {
page: 1,
row: 10,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/propertyIndex.queryRepairIndex',
param,
function(json, res) {
let _res = JSON.parse(json);
if (_res.code != 0) {
return;
}
vc.copyObject(_res.data, $that.indexRepairComplaintInfo);
let _dom = document.getElementById('repairCount');
let repairDataList =[
{ value: $that.indexRepairComplaintInfo.waitCount, name: vc.i18n('待派单', 'indexRepairComplaint'), color: '#FF6B6B' },
{ value: $that.indexRepairComplaintInfo.doingCount, name: vc.i18n('处理中', 'indexRepairComplaint'), color: '#FFD93D' },
{ value: $that.indexRepairComplaintInfo.finishCount, name: vc.i18n('已处理', 'indexRepairComplaint'), color: '#4B7AF0' },
];
$that._initEcharts(repairDataList, _dom, vc.i18n('报修信息', 'indexRepairComplaint'));
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadIndexComplaintData: function() {
let param = {
params: {
page: 1,
row: 10,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/propertyIndex.queryComplaintIndex',
param,
function(json, res) {
let _res = JSON.parse(json);
if (_res.code != 0) {
return;
}
vc.copyObject(_res.data, $that.indexRepairComplaintInfo);
let _complaintCountDom = document.getElementById('complaintCount');
let complaintDataList = [
{ value: $that.indexRepairComplaintInfo.waitComplaintCount, name: vc.i18n('处理中', 'indexRepairComplaint'), color: '#FFD93D' },
{ value: $that.indexRepairComplaintInfo.finishComplaintCount, name: vc.i18n('已处理', 'indexRepairComplaint'), color: '#01C36D' }
];
$that._initEcharts(complaintDataList, _complaintCountDom, vc.i18n('投诉统计', 'indexRepairComplaint'));
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_initEcharts: 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);