Commit 2be7ea0d by guoxuejian

完善大屏中工单完成率饼图数据获取逻辑及代码实现

parent 70fc978b
...@@ -1079,12 +1079,12 @@ ...@@ -1079,12 +1079,12 @@
<!-- 工单完成数 --> <!-- 工单完成数 -->
<script> <script>
var ulbox = document.getElementById("review_box"); var ulbox = document.getElementById("review_box");
var myChart = echarts.init(ulbox); var orderFinishRatePie = echarts.init(ulbox);
var weekOrderQuantity = 100 //总数 var allOrdersCount = 100 //总数
var weekOrderCompleted = 30 //已完成 var allOrdersCompletedCount = 30 //已完成
var weekOrderUnfinished = 70 //未完成 var allOrdersUnfinishedCount = 70 //未完成
var option = { var orderFinishRatePieOption = {
color: ['#22c2f0', '#28f19b', '#fcfa3c', '#f44061'], color: ['#22c2f0', '#28f19b', '#fcfa3c', '#f44061'],
title: { title: {
text: '', text: '',
...@@ -1115,127 +1115,128 @@ ...@@ -1115,127 +1115,128 @@
// }, // },
// data: ['工单完成率'] // data: ['工单完成率']
// }, // },
series: [{ series: [
name: '工单完成数', {
type: 'pie', name: '工单完成数',
clockWise: false, type: 'pie',
radius: ["70%", "80%"], clockWise: false,
itemStyle: { radius: ["70%", "80%"],
normal: { itemStyle: {
normal: {
label: {
show: false
},
labelLine: {
show: false
},
shadowBlur: 0,
shadowColor: '#203665'
}
},
hoverAnimation: false,
center: ['50%', '50%'],
data: [{
value: allOrdersCompletedCount,
label: { label: {
show: false normal: {
}, formatter: "{d}%",
labelLine: { position: 'center',
show: false show: true,
textStyle: {
fontSize: '24',
fontWeight: 'normal',
color: '#fff'
}
}
}, },
shadowBlur: 0, itemStyle: {
shadowColor: '#203665' normal: {
} color: '#2c6cc4',
}, shadowColor: '#2c6cc4',
hoverAnimation: false, shadowBlur: 0
center: ['50%', '50%'],
data: [{
value: weekOrderCompleted,
label: {
normal: {
formatter: "{d}%",
position: 'center',
show: true,
textStyle: {
fontSize: '24',
fontWeight: 'normal',
color: '#fff'
} }
} }
}, {
value: allOrdersUnfinishedCount,
name: 'invisible',
itemStyle: {
normal: {
color: '#f2c96b'
},
emphasis: {
color: '#24375c'
}
}
}]
},
{
type: "gauge",
radius: "75%",
startAngle: 0,
endAngle: 360,
splitNumber: 30,
axisTick: {
show: false
}, },
itemStyle: { splitLine: {
normal: { length: 10,
color: '#2c6cc4', lineStyle: {
shadowColor: '#2c6cc4', width: 1,
shadowBlur: 0 color: "#031845"
} }
} },
}, { axisLabel: {
value: weekOrderUnfinished, show: false
name: 'invisible', },
itemStyle: { pointer: {
normal: { show: false
color: '#f2c96b' },
}, axisLine: {
emphasis: { lineStyle: {
color: '#24375c' opacity: 0
} }
} },
}] detail: {
},
{
type: "gauge",
radius: "75%",
startAngle: 0,
endAngle: 360,
splitNumber: 30,
axisTick: {
show: false
},
splitLine: {
length: 10,
lineStyle: {
width: 1,
color: "#031845"
}
},
axisLabel: {
show: false
},
pointer: {
show: false
},
axisLine: {
lineStyle: {
opacity: 0
}
},
detail: {
show: false
},
data: [{
value: 0,
name: ""
}]
}, {
// name: '访问来源',
type: 'pie',
radius: ['50%', '60%'],
silent: true,
z: 0,
// zlevel: 0,
label: {
normal: {
show: false show: false
} },
data: [{
value: 0,
name: ""
}]
}, },
labelLine: { {
normal: { type: 'pie',
show: true, radius: ['50%', '60%'],
length: 0, silent: true,
length2: 100, z: 0,
lineStyle: { // zlevel: 0,
type: 'solid', label: {
width: 1 normal: {
show: false
}
},
labelLine: {
normal: {
show: true,
length: 0,
length2: 100,
lineStyle: {
type: 'solid',
width: 1
}
} }
},
data: [{
value: allOrdersCount,
name: ''
} }
},
data: [{
value: weekOrderQuantity,
name: ''
}
] ]
} }
] ]
}; };
if (option && typeof option === 'object') { if (orderFinishRatePieOption && typeof orderFinishRatePieOption === 'object') {
myChart.setOption(option); orderFinishRatePie.setOption(orderFinishRatePieOption);
} }
</script> </script>
<script> <script>
...@@ -1655,6 +1656,41 @@ ...@@ -1655,6 +1656,41 @@
}); });
} }
// 更新全部工单完成率
// api/blade-deviceAccount/deviceAccount/list?current=1&size=10
function updateAllOrdersFinishedRateData() {
$.ajax({
type: "GET",
url: "/api/blade-inspectionWorkOrder/inspectionWorkOrder/list?current=1&size=10",
success: function (result) {
console.log('AllOrdersData', result);
let allOrdersTotal = result.data.total;
let finished = 0;
$.ajax({
type: "GET",
url: "api/blade-inspectionWorkOrder/inspectionWorkOrder/list?taskStatus=1&current=1&size=10",
success: function (res) {
console.log('FinishedOrdersData', res);
let finishedTotal = res.data.total;
orderFinishRatePieOption.series[0].data[0].value = finishedTotal;
orderFinishRatePieOption.series[0].data[1].value = allOrdersTotal - finishedTotal;
orderFinishRatePieOption.series[2].data[0].value = allOrdersTotal;
orderFinishRatePie.setOption(orderFinishRatePieOption);
},
// 失败或者超时的回调函数
error: function (xhr, status, error) {
// loadDataStatus.updateEmergencyData = false
}
});
},
// 失败或者超时的回调函数
error: function (xhr, status, error) {
// loadDataStatus.updateEmergencyData = false
}
});
}
const loadDataStatus = { const loadDataStatus = {
uploadCompleteStatus: false, uploadCompleteStatus: false,
updateWarningData: false, updateWarningData: false,
...@@ -1666,6 +1702,7 @@ ...@@ -1666,6 +1702,7 @@
updateInspectionWeekOrderData: false, updateInspectionWeekOrderData: false,
updateRepairWeekOrderData: false, updateRepairWeekOrderData: false,
updateEmergencyData: false, updateEmergencyData: false,
updateAllOrdersFinishedRateData: false
} }
uploadDeviceAccountData() uploadDeviceAccountData()
...@@ -1736,6 +1773,10 @@ ...@@ -1736,6 +1773,10 @@
if (!loadDataStatus.updateEmergencyData) { if (!loadDataStatus.updateEmergencyData) {
updateEmergencyData() updateEmergencyData()
} }
// updateAllOrdersFinishedRateData();
if (!loadDataStatus.updateAllOrdersFinishedRateData) {
updateAllOrdersFinishedRateData()
}
}, 600000); }, 600000);
// 更新 monthOrderNum // 更新 monthOrderNum
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment