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 +// }