Compare commits

...

3 Commits

  1. 14
      src/views/dashboard/demo/components/ParameterInfo.vue
  2. 32
      src/views/dashboard/demo/components/ProjectCard.vue

14
src/views/dashboard/demo/components/ParameterInfo.vue

@ -1,6 +1,6 @@
<script lang="ts" setup>
import { Card } from 'ant-design-vue'
import { onBeforeUpdate, onMounted, onUpdated, toRefs, watch } from 'vue'
import { onBeforeUpdate, onMounted, onUpdated, ref, toRefs, watch } from 'vue'
import { BasicTable, useTable } from '@/components/Table'
import { getExaNow } from '@/api/alert/exa'
@ -10,6 +10,9 @@ const props = defineProps({
default: () => {},
},
})
const loading = ref(false)
watch(
() => props.data,
(newValue, oldValue) => {
@ -40,6 +43,8 @@ const [registerTable, { setTableData }] = useTable({
})
//
onBeforeUpdate(async () => {
loading.value = true
try {
const rr = [] as any[]
const rows = props.data.Content || []
for (const item of rows) {
@ -68,8 +73,11 @@ onBeforeUpdate(async () => {
catch (e) {
}
}
setTableData(rr)
}
finally {
loading.value = false
}
})
</script>
@ -80,7 +88,7 @@ onBeforeUpdate(async () => {
更多
</a-button>
</template> -->
<BasicTable style="min-height:30vh" @register="registerTable">
<BasicTable style="min-height:30vh" :loading="loading" @register="registerTable">
<template #threshold="{ record }">
<span>{{ getInterval(record) }}</span>
</template>

32
src/views/dashboard/demo/components/ProjectCard.vue

@ -10,17 +10,17 @@ const props = defineProps({
default: () => {},
},
})
const gridData = ref<any>([])
watch(
() => props.data,
(newValue, oldValue) => {
//
console.log('a has changed', newValue, oldValue)
getNewData()
},
)
const gridData = ref<any>([])
//
onMounted(async () => {
async function getNewData() {
const rows = props.data.Content || []
for (const item of rows) {
try {
@ -38,7 +38,29 @@ onMounted(async () => {
catch (e) {
}
}
})
}
//
// 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'
// gridData.value.push(Object.assign({}, item, { ifColor }))
// console.log(gridData.value)
// }
// catch (e) {
// }
// }
// })
</script>
<template>

Loading…
Cancel
Save