|
|
|
@ -1,7 +1,6 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
import { onMounted, ref } from 'vue' |
|
|
|
import { useRoute } from 'vue-router' |
|
|
|
import { message } from 'ant-design-vue' |
|
|
|
import ProjectCard from './components/ProjectCard.vue' |
|
|
|
import DynamicInfo from './components/DynamicInfo.vue' |
|
|
|
import StaticImg from './components/staticImg.vue' |
|
|
|
@ -16,10 +15,8 @@ import { getExaNow } from '@/api/alert/exa' |
|
|
|
|
|
|
|
const loading = ref(true) |
|
|
|
const route = useRoute() |
|
|
|
const gridData = ref<any[]>([]) |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
loading.value = false |
|
|
|
}, 500) |
|
|
|
// 为了解决系统不支持传参的问题,改为从路由参数中获取id,不是最终解决办法,带系统commitbug |
|
|
|
const id = route.path.split('/').pop() || '' |
|
|
|
const data = ref<any>(data1) |
|
|
|
@ -28,30 +25,32 @@ onMounted(async () => { |
|
|
|
const res = await getDeviceInfo(id) |
|
|
|
if (res) |
|
|
|
data.value = JSON.parse(res.Page_Content) |
|
|
|
// getColor(data.value) |
|
|
|
// 加载数据后调用 getNewData 处理 LeftMidUp 数据 |
|
|
|
await getNewData() |
|
|
|
loading.value = false |
|
|
|
}) |
|
|
|
|
|
|
|
// async function getColor(data: any) { |
|
|
|
// const rows = data.LeftMidUp.Content || [] |
|
|
|
// const gridData = [] as any[] |
|
|
|
// for (const item of rows) { |
|
|
|
// try { |
|
|
|
// const param = item.Point |
|
|
|
// const res = await getExaNow(param) |
|
|
|
|
|
|
|
// let ifColor: boolean = false |
|
|
|
// if (res != null) |
|
|
|
// ifColor = res === '1' |
|
|
|
|
|
|
|
// gridData.push(Object.assign({}, item, { ifColor })) |
|
|
|
|
|
|
|
// console.log(gridData) |
|
|
|
// } |
|
|
|
// catch (e) { |
|
|
|
// } |
|
|
|
// } |
|
|
|
// data.LeftMidUp.Content = gridData |
|
|
|
// } |
|
|
|
// 处理故障诊断的数据,为每个对象增加ifColor属性 |
|
|
|
async function getNewData() { |
|
|
|
const rows = data.value.LeftMidUp.Content || [] |
|
|
|
for (const item of rows) { |
|
|
|
try { |
|
|
|
const param = item.Point |
|
|
|
const res = await getExaNow(param) |
|
|
|
console.log(res) |
|
|
|
let ifColor: boolean = false |
|
|
|
if (res != null) |
|
|
|
ifColor = res === '1' |
|
|
|
// 直接修改原始对象,添加ifColor属性 |
|
|
|
item.ifColor = ifColor |
|
|
|
} |
|
|
|
catch (e) { |
|
|
|
// 出错时默认添加ifColor为false |
|
|
|
item.ifColor = false |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(data.value) |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<template> |
|
|
|
@ -72,23 +71,6 @@ onMounted(async () => { |
|
|
|
<StaticSvg class="m-1 w-full md:w-1/2" :loading="loading" :data="data.LeftDown || {}" /> |
|
|
|
<ParameterInfo class="m-1 w-full md:w-1/2" :loading="loading" :data="data.RightDown || {}" /> |
|
|
|
</div> |
|
|
|
<!-- <div class="enter-y w-full !mr-4 lg:w-7/10"> |
|
|
|
<StaticImg :loading="loading" :data="data.LeftUp" class="enter-y" /> |
|
|
|
</div> --> |
|
|
|
|
|
|
|
<!-- <div class="enter-y w-full !mr-4 lg:w-7/10"> |
|
|
|
<ProjectCard :loading="loading" class="enter-y" /> |
|
|
|
<DynamicInfo :loading="loading" class="enter-y !my-4" /> |
|
|
|
</div> |
|
|
|
<div class="enter-y w-full lg:w-3/10"> |
|
|
|
<QuickNav :loading="loading" class="enter-y" /> |
|
|
|
|
|
|
|
<Card class="enter-y !my-4" :loading="loading"> |
|
|
|
<img class="mx-auto h-30 xl:h-50" src="@/assets/svg/illustration.svg"> |
|
|
|
</Card> |
|
|
|
|
|
|
|
<SaleRadar :loading="loading" class="enter-y" /> |
|
|
|
</div> --> |
|
|
|
</div> |
|
|
|
</pagewrapper> |
|
|
|
</template> |
|
|
|
|