|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="home-container layout-pd" v-if="state.v_if" v-loading="state.loading">
|
|
|
+ <div class="home-container layout-pd" v-loading="state.loading">
|
|
|
<el-row :gutter="15" class="home-card-one mb15">
|
|
|
<el-col
|
|
|
:xs="24"
|
|
@@ -71,7 +71,9 @@ import * as echarts from 'echarts'
|
|
|
import {storeToRefs} from 'pinia'
|
|
|
import {useThemeConfig} from '/@/stores/themeConfig'
|
|
|
import {useTagsViewRoutes} from '/@/stores/tagsViewRoutes'
|
|
|
-import {WorkBench} from "/@/api/admin/workbench/workBench";
|
|
|
+import {useChartDataStore} from "/@/stores/chartDataStore";
|
|
|
+import {workBenchDto} from "/@/api/admin/workbench/workBenchDto";
|
|
|
+const chartDataStore = useChartDataStore()
|
|
|
|
|
|
// 定义变量内容
|
|
|
const homeLineRef = ref()
|
|
@@ -84,7 +86,6 @@ const { isTagsViewCurrenFull } = storeToRefs(storesTagsViewRoutes)
|
|
|
|
|
|
const state = reactive({
|
|
|
loading:false,
|
|
|
- v_if:false,
|
|
|
global: {
|
|
|
homeChartOne: null,
|
|
|
homeChartTwo: null,
|
|
@@ -529,12 +530,12 @@ const initEchartsResize = () => {
|
|
|
|
|
|
const initData = async () => {
|
|
|
state.loading = true
|
|
|
- const { data } = await new WorkBench().getInitData()
|
|
|
+ const data : workBenchDto = chartDataStore.getChartStore()
|
|
|
const { mainboardChart } = data.chart
|
|
|
- state.homeOne[0].num1 = data.calculatorMainboardCount
|
|
|
- state.homeOne[1].num1 = data.vaporRecoveryCount
|
|
|
- state.homeOne[2].num1 = data.vaporRecoveryStateCount
|
|
|
- state.homeOne[3].num1 = data.calculatorMainboardStateCount
|
|
|
+ state.homeOne[0].num1 = data.calculatorMainboardCount ?? 0
|
|
|
+ state.homeOne[1].num1 = data.vaporRecoveryCount ?? 0
|
|
|
+ state.homeOne[2].num1 = data.vaporRecoveryStateCount ?? 0
|
|
|
+ state.homeOne[3].num1 = data.calculatorMainboardStateCount ?? 0
|
|
|
lineChart.value.option.series[0].data = getSeriesData(data.chart?.vaporRecovery)
|
|
|
lineChart.value.option.series[1].data = getSeriesData(data.chart?.calculatorMainboard)
|
|
|
lineChart.value.option.series[2].data = getSeriesData(data.chart?.recordCalculatorMainboard)
|
|
@@ -542,7 +543,6 @@ const initData = async () => {
|
|
|
pieChart.getName = pieChartGetName(mainboardChart)
|
|
|
pieChart.getValue = pieChartGetValue(mainboardChart)
|
|
|
state.loading = false
|
|
|
- state.v_if = true
|
|
|
}
|
|
|
|
|
|
/**获取当前月份*/
|
|
@@ -583,8 +583,8 @@ const pieChartGetValue = (val) => {
|
|
|
|
|
|
// 页面加载时
|
|
|
onMounted(() => {
|
|
|
- initData()
|
|
|
initEchartsResize()
|
|
|
+ initData()
|
|
|
})
|
|
|
// 由于页面缓存原因,keep-alive
|
|
|
onActivated(() => {
|
|
@@ -621,6 +621,7 @@ watch(
|
|
|
immediate: true,
|
|
|
}
|
|
|
)
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|