From fa9d21e5519141ce6d55618b48dfca53c0ff1d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=96=E6=99=8B=E9=A3=9E?= <378266566@qq.com> Date: Thu, 18 Sep 2025 10:14:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=8D=A2=E4=B8=80=E7=A7=8D=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=AE=9E=E7=8E=B0=E5=8F=98=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/demo/components/ProjectCard.vue | 40 +++++++++---------- src/views/dashboard/demo/index.vue | 38 +++++++++--------- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/src/views/dashboard/demo/components/ProjectCard.vue b/src/views/dashboard/demo/components/ProjectCard.vue index 2af3a5b..b355498 100644 --- a/src/views/dashboard/demo/components/ProjectCard.vue +++ b/src/views/dashboard/demo/components/ProjectCard.vue @@ -3,7 +3,7 @@ import { Card, CardGrid } from 'ant-design-vue' import { computed, onBeforeMount, onMounted, ref } from 'vue' import { groupItems } from './data' import { Icon } from '@/components/Icon' - +import { getExaNow } from '@/api/alert/exa' const props = defineProps({ data: { @@ -12,30 +12,28 @@ const props = defineProps({ }, }) - - -// const gridData = ref([]) +const gridData = ref([]) // 页面挂载时批量请求并更新数据(避免在模板中调用异步) -// onMounted(async () => { -// const rows = props.data.Content || [] -// for (const item of rows) { -// try { -// const param = item.Point -// const res = await getExaNow(param) +onMounted(async () => { + const rows = props.data.Content || [] + 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' + let ifColor: boolean = false + if (res != null) + ifColor = res === '1' -// gridData.value.push(Object.assign({}, item, { ifColor })) + gridData.value.push(Object.assign({}, item, { ifColor })) -// console.log(gridData.value) -// } -// catch (e) { -// } -// } -// }) + console.log(gridData.value) + } + catch (e) { + } + } +}) - +
diff --git a/src/views/dashboard/demo/index.vue b/src/views/dashboard/demo/index.vue index 0cb4501..0818d14 100644 --- a/src/views/dashboard/demo/index.vue +++ b/src/views/dashboard/demo/index.vue @@ -29,30 +29,30 @@ onBeforeMount(async () => { console.log(res) if (res) data.value = JSON.parse(res.Page_Content) - getColor(data.value) + // getColor(data.value) }) -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) +// 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' +// let ifColor: boolean = false +// if (res != null) +// ifColor = res === '1' - gridData.push(Object.assign({}, item, { ifColor })) +// gridData.push(Object.assign({}, item, { ifColor })) - console.log(gridData) - } - catch (e) { - } - } - data.LeftMidUp.Content = gridData -} +// console.log(gridData) +// } +// catch (e) { +// } +// } +// data.LeftMidUp.Content = gridData +// }