diff --git a/src/views/data/device/detail.vue b/src/views/data/device/detail.vue index ff65e93..6fd05d1 100644 --- a/src/views/data/device/detail.vue +++ b/src/views/data/device/detail.vue @@ -8,6 +8,12 @@ const $router = useRouter() const $route = useRoute() const width = (document.body.clientWidth - 180 - 20 - 40 - 24) / 24 +// 监测类型 用来判断碳排趋势chart显不显示 +const monitorType = ref('') +monitorType.value = $route.query.monitor as string +// 设备类型 +const deviceType = ref('') +deviceType.value = $route.query.deviceType as string // 监测趋势时间段 const range = ref('day') const goBak = () => { @@ -19,7 +25,6 @@ // 获取设备基本信息 const fetchDeviceInfo = () => { getDeviceDetail($route.query.id).then((res) => { - console.log(res.data, '设备基本信息') deviceInfo.value = res.data }) } @@ -37,10 +42,9 @@ deviceId: $route.query.id, type: range.value, }).then((res) => { - console.log(res.data, '设备监测分析') const data = res.data - // 整理节点监测趋势数据 - if (data.monitorTrends?.rp.length) { + // 整理节点监测趋势数据-用电 + if (data.monitorTrends?.rp.length && deviceType.value === '1') { xAxisData1.value = data.monitorTrends?.rp?.map((item: any) => item.time) data1.value = [ { @@ -53,6 +57,16 @@ }, ] } + // 整理节点监测趋势数据-用热/用气 + if (data.monitorTrends?.val.length && deviceType.value !== '1') { + xAxisData1.value = data.monitorTrends?.val?.map((item: any) => item.time) + data1.value = [ + { + name: '监测值', + data: data.monitorTrends?.val?.map((item: any) => item.value), + }, + ] + } // 整理节点碳排趋势数据 if (data.emissionsTrends?.data?.length) { const emissionsTrends = data.emissionsTrends.data @@ -67,7 +81,7 @@ loadingChart1.value = false }).catch(() => { data1.value = [] - data1.value = [] + data2.value = [] loadingChart1.value = false }) } @@ -78,10 +92,7 @@ { deep: true, }) -// 监测类型 用来判断碳排趋势chart显不显示 -const monitorType = ref('') -monitorType.value = $route.query.monitor as string -console.log(monitorType.value, 'monitorType') + onMounted(() => { fetchDeviceInfo() fetchDeviceAnalysis() diff --git a/src/views/data/device/detail.vue b/src/views/data/device/detail.vue index ff65e93..6fd05d1 100644 --- a/src/views/data/device/detail.vue +++ b/src/views/data/device/detail.vue @@ -8,6 +8,12 @@ const $router = useRouter() const $route = useRoute() const width = (document.body.clientWidth - 180 - 20 - 40 - 24) / 24 +// 监测类型 用来判断碳排趋势chart显不显示 +const monitorType = ref('') +monitorType.value = $route.query.monitor as string +// 设备类型 +const deviceType = ref('') +deviceType.value = $route.query.deviceType as string // 监测趋势时间段 const range = ref('day') const goBak = () => { @@ -19,7 +25,6 @@ // 获取设备基本信息 const fetchDeviceInfo = () => { getDeviceDetail($route.query.id).then((res) => { - console.log(res.data, '设备基本信息') deviceInfo.value = res.data }) } @@ -37,10 +42,9 @@ deviceId: $route.query.id, type: range.value, }).then((res) => { - console.log(res.data, '设备监测分析') const data = res.data - // 整理节点监测趋势数据 - if (data.monitorTrends?.rp.length) { + // 整理节点监测趋势数据-用电 + if (data.monitorTrends?.rp.length && deviceType.value === '1') { xAxisData1.value = data.monitorTrends?.rp?.map((item: any) => item.time) data1.value = [ { @@ -53,6 +57,16 @@ }, ] } + // 整理节点监测趋势数据-用热/用气 + if (data.monitorTrends?.val.length && deviceType.value !== '1') { + xAxisData1.value = data.monitorTrends?.val?.map((item: any) => item.time) + data1.value = [ + { + name: '监测值', + data: data.monitorTrends?.val?.map((item: any) => item.value), + }, + ] + } // 整理节点碳排趋势数据 if (data.emissionsTrends?.data?.length) { const emissionsTrends = data.emissionsTrends.data @@ -67,7 +81,7 @@ loadingChart1.value = false }).catch(() => { data1.value = [] - data1.value = [] + data2.value = [] loadingChart1.value = false }) } @@ -78,10 +92,7 @@ { deep: true, }) -// 监测类型 用来判断碳排趋势chart显不显示 -const monitorType = ref('') -monitorType.value = $route.query.monitor as string -console.log(monitorType.value, 'monitorType') + onMounted(() => { fetchDeviceInfo() fetchDeviceAnalysis() diff --git a/src/views/data/device/index.vue b/src/views/data/device/index.vue index 284b131..3e76d27 100644 --- a/src/views/data/device/index.vue +++ b/src/views/data/device/index.vue @@ -100,6 +100,7 @@ query: { id: row.id, monitor: row.monitorObj, + deviceType: row.deviceType, }, }) } diff --git a/src/views/data/device/detail.vue b/src/views/data/device/detail.vue index ff65e93..6fd05d1 100644 --- a/src/views/data/device/detail.vue +++ b/src/views/data/device/detail.vue @@ -8,6 +8,12 @@ const $router = useRouter() const $route = useRoute() const width = (document.body.clientWidth - 180 - 20 - 40 - 24) / 24 +// 监测类型 用来判断碳排趋势chart显不显示 +const monitorType = ref('') +monitorType.value = $route.query.monitor as string +// 设备类型 +const deviceType = ref('') +deviceType.value = $route.query.deviceType as string // 监测趋势时间段 const range = ref('day') const goBak = () => { @@ -19,7 +25,6 @@ // 获取设备基本信息 const fetchDeviceInfo = () => { getDeviceDetail($route.query.id).then((res) => { - console.log(res.data, '设备基本信息') deviceInfo.value = res.data }) } @@ -37,10 +42,9 @@ deviceId: $route.query.id, type: range.value, }).then((res) => { - console.log(res.data, '设备监测分析') const data = res.data - // 整理节点监测趋势数据 - if (data.monitorTrends?.rp.length) { + // 整理节点监测趋势数据-用电 + if (data.monitorTrends?.rp.length && deviceType.value === '1') { xAxisData1.value = data.monitorTrends?.rp?.map((item: any) => item.time) data1.value = [ { @@ -53,6 +57,16 @@ }, ] } + // 整理节点监测趋势数据-用热/用气 + if (data.monitorTrends?.val.length && deviceType.value !== '1') { + xAxisData1.value = data.monitorTrends?.val?.map((item: any) => item.time) + data1.value = [ + { + name: '监测值', + data: data.monitorTrends?.val?.map((item: any) => item.value), + }, + ] + } // 整理节点碳排趋势数据 if (data.emissionsTrends?.data?.length) { const emissionsTrends = data.emissionsTrends.data @@ -67,7 +81,7 @@ loadingChart1.value = false }).catch(() => { data1.value = [] - data1.value = [] + data2.value = [] loadingChart1.value = false }) } @@ -78,10 +92,7 @@ { deep: true, }) -// 监测类型 用来判断碳排趋势chart显不显示 -const monitorType = ref('') -monitorType.value = $route.query.monitor as string -console.log(monitorType.value, 'monitorType') + onMounted(() => { fetchDeviceInfo() fetchDeviceAnalysis() diff --git a/src/views/data/device/index.vue b/src/views/data/device/index.vue index 284b131..3e76d27 100644 --- a/src/views/data/device/index.vue +++ b/src/views/data/device/index.vue @@ -100,6 +100,7 @@ query: { id: row.id, monitor: row.monitorObj, + deviceType: row.deviceType, }, }) } diff --git a/vite.config.ts b/vite.config.ts index 288448a..bfcd8dd 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -26,7 +26,7 @@ server: { host: '0.0.0.0', // 设置ip分享 open: true, - port: 9000, + port: 9001, proxy: { '/proxy': { target: env.VITE_APP_API_BASEURL,