|
@@ -157,7 +157,8 @@ const materialData = ref({})
|
|
const orderSevenData = ref({})
|
|
const orderSevenData = ref({})
|
|
const safe = ref()
|
|
const safe = ref()
|
|
/** 获取统计数据 */
|
|
/** 获取统计数据 */
|
|
-const getStats = async () => {
|
|
|
|
|
|
+const getStats = () => {
|
|
|
|
+ initYwcbChart()
|
|
// 获取基础统计数据
|
|
// 获取基础统计数据
|
|
IotStatApi.getDeviceCount().then((res) => {
|
|
IotStatApi.getDeviceCount().then((res) => {
|
|
device.value = res
|
|
device.value = res
|
|
@@ -173,38 +174,43 @@ const getStats = async () => {
|
|
})
|
|
})
|
|
IotStatApi.getMaintenanceStatus().then((res) => {
|
|
IotStatApi.getMaintenanceStatus().then((res) => {
|
|
status.value = res
|
|
status.value = res
|
|
- initCharts()
|
|
|
|
|
|
+ // initCharts()
|
|
})
|
|
})
|
|
IotStatApi.getMaintenanceTodayStatus().then((res) => {
|
|
IotStatApi.getMaintenanceTodayStatus().then((res) => {
|
|
todayStatus.value = res
|
|
todayStatus.value = res
|
|
- initCharts()
|
|
|
|
|
|
+ initTopChart()
|
|
})
|
|
})
|
|
|
|
+
|
|
IotStatApi.getDeviceStatusCount().then((res) => {
|
|
IotStatApi.getDeviceStatusCount().then((res) => {
|
|
typeData.value = res
|
|
typeData.value = res
|
|
- initCharts()
|
|
|
|
|
|
+ initDeviceStatusCharts()
|
|
})
|
|
})
|
|
IotStatApi.getSafeCount().then((res) => {
|
|
IotStatApi.getSafeCount().then((res) => {
|
|
safe.value = res
|
|
safe.value = res
|
|
})
|
|
})
|
|
IotStatApi.getMaterial().then((res) => {
|
|
IotStatApi.getMaterial().then((res) => {
|
|
materialData.value = res
|
|
materialData.value = res
|
|
- initCharts();
|
|
|
|
|
|
+ initMaterials()
|
|
})
|
|
})
|
|
|
|
+
|
|
IotStatApi.getOrderSeven().then((res) => {
|
|
IotStatApi.getOrderSeven().then((res) => {
|
|
- debugger
|
|
|
|
orderSevenData.value = res
|
|
orderSevenData.value = res
|
|
initQxChart();
|
|
initQxChart();
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-/** 初始化图表 */
|
|
|
|
-const initCharts = () => {
|
|
|
|
- // 设备数量统计
|
|
|
|
- echarts.init(statusChartRef.value).setOption({
|
|
|
|
|
|
+const initMaterials = () => {
|
|
|
|
+
|
|
|
|
+ echarts.init(materialChartRef.value).setOption({
|
|
tooltip: {
|
|
tooltip: {
|
|
trigger: 'item'
|
|
trigger: 'item'
|
|
},
|
|
},
|
|
legend: {
|
|
legend: {
|
|
|
|
+ // top: '5%',
|
|
|
|
+ // right: '10%',
|
|
|
|
+ // align: 'left',
|
|
|
|
+ // orient: 'vertical',
|
|
|
|
+ // icon: 'circle'
|
|
orient: 'horizontal', // 水平排列图例项
|
|
orient: 'horizontal', // 水平排列图例项
|
|
bottom: '0%', // 放置在底部
|
|
bottom: '0%', // 放置在底部
|
|
icon: 'circle'
|
|
icon: 'circle'
|
|
@@ -230,21 +236,20 @@ const initCharts = () => {
|
|
labelLine: {
|
|
labelLine: {
|
|
show: false
|
|
show: false
|
|
},
|
|
},
|
|
- data: typeData.value
|
|
|
|
|
|
+ data: materialData.value
|
|
}
|
|
}
|
|
]
|
|
]
|
|
})
|
|
})
|
|
|
|
+}
|
|
|
|
|
|
- echarts.init(materialChartRef.value).setOption({
|
|
|
|
|
|
+/** 初始化图表 */
|
|
|
|
+const initDeviceStatusCharts = () => {
|
|
|
|
+ // 设备数量统计
|
|
|
|
+ echarts.init(statusChartRef.value).setOption({
|
|
tooltip: {
|
|
tooltip: {
|
|
trigger: 'item'
|
|
trigger: 'item'
|
|
},
|
|
},
|
|
legend: {
|
|
legend: {
|
|
- // top: '5%',
|
|
|
|
- // right: '10%',
|
|
|
|
- // align: 'left',
|
|
|
|
- // orient: 'vertical',
|
|
|
|
- // icon: 'circle'
|
|
|
|
orient: 'horizontal', // 水平排列图例项
|
|
orient: 'horizontal', // 水平排列图例项
|
|
bottom: '0%', // 放置在底部
|
|
bottom: '0%', // 放置在底部
|
|
icon: 'circle'
|
|
icon: 'circle'
|
|
@@ -270,10 +275,12 @@ const initCharts = () => {
|
|
labelLine: {
|
|
labelLine: {
|
|
show: false
|
|
show: false
|
|
},
|
|
},
|
|
- data: materialData.value
|
|
|
|
|
|
+ data: typeData.value
|
|
}
|
|
}
|
|
]
|
|
]
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/** 初始化消息统计图表 */
|
|
/** 初始化消息统计图表 */
|
|
@@ -307,7 +314,7 @@ const fetchChartData = async () => {
|
|
}
|
|
}
|
|
|
|
|
|
// 初始化图表配置
|
|
// 初始化图表配置
|
|
-const initChart = async () => {
|
|
|
|
|
|
+const initYwcbChart = async () => {
|
|
if (!chartContainer.value) return
|
|
if (!chartContainer.value) return
|
|
|
|
|
|
// 获取数据
|
|
// 获取数据
|
|
@@ -585,7 +592,6 @@ const generateMonths = () => {
|
|
|
|
|
|
const initQxChart = () => {
|
|
const initQxChart = () => {
|
|
if (!qxRef.value) return
|
|
if (!qxRef.value) return
|
|
-debugger
|
|
|
|
qxInstance = echarts.init(qxRef.value)
|
|
qxInstance = echarts.init(qxRef.value)
|
|
debugger
|
|
debugger
|
|
const option = {
|
|
const option = {
|
|
@@ -692,10 +698,10 @@ const resizeQxChart = () => qxInstance?.resize()
|
|
/** 初始化 */
|
|
/** 初始化 */
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
getStats()
|
|
getStats()
|
|
- initChart()
|
|
|
|
- initTopChart()
|
|
|
|
- initActiveChart()
|
|
|
|
- initQxChart()
|
|
|
|
|
|
+ // initChart()
|
|
|
|
+ // initTopChart()
|
|
|
|
+ // initActiveChart()
|
|
|
|
+ // initQxChart()
|
|
window.addEventListener('resize', resizeQxChart)
|
|
window.addEventListener('resize', resizeQxChart)
|
|
// fetchTop()
|
|
// fetchTop()
|
|
window.addEventListener('resize', () => topInstance?.resize())
|
|
window.addEventListener('resize', () => topInstance?.resize())
|