feat:重新对接首页接口

This commit is contained in:
zjc
2025-01-14 19:01:09 +08:00
parent 880db48579
commit ebac43f818
28 changed files with 2250 additions and 2133 deletions

View File

@@ -98,7 +98,7 @@
<p class="value">{{ item.value }}%</p>
</li>
</ul>
<div class="alarm">
<div v-if="pointRankData.length > 0" class="alarm">
<Title2 title="异常点位告警排名" />
<ul class="alarm__wrapper">
<li class="alarm-item" v-for="(item, index) in pointRankData" :key="index">
@@ -154,7 +154,6 @@
const getNewsPointRank = async () => {
let res = await getNewsPointRankApi()
pointRankData.value = res.data
console.log(res, '1111')
}
const getTypeRate = async () => {
let res = await getTypeRateApi()

View File

@@ -5,49 +5,54 @@
<div class="statistics">
<div class="statistics-item">
<div class="flex align-center">
<img class="statistics-item__icon" src="@/assets/images/dot-primary.svg" alt="" />
<img class="statistics-item__icon" src="@/assets/images/dot-primary.svg" />
<span class="statistics-item__label">今日消息总条数</span>
</div>
<div class="statistics-item__value--primary">
<countup end-val="45678" />
<countup :end-val="countInfo.total" />
<span class="statistics-item__value-suffix"></span>
</div>
</div>
<div class="statistics-item">
<div class="flex align-center">
<img class="statistics-item__icon" src="@/assets/images/dot-error.svg" alt="" />
<img class="statistics-item__icon" src="@/assets/images/dot-error.svg" />
<span class="statistics-item__label">紧急消息</span>
</div>
<div class="statistics-item__value--error">
<countup end-val="45678" />
<countup :end-val="countInfo.warn" />
<span class="statistics-item__value-suffix"></span>
</div>
</div>
<div class="statistics-item">
<div class="flex align-center">
<img class="statistics-item__icon" src="@/assets/images/dot-warning.svg" alt="" />
<img class="statistics-item__icon" src="@/assets/images/dot-warning.svg" />
<span class="statistics-item__label">重要消息</span>
</div>
<div class="statistics-item__value--warning">
<countup end-val="45678" />
<countup :end-val="countInfo.important" />
<span class="statistics-item__value-suffix"></span>
</div>
</div>
<div class="statistics-item">
<div class="flex align-center">
<img class="statistics-item__icon" src="@/assets/images/dot-success.svg" alt="" />
<img class="statistics-item__icon" src="@/assets/images/dot-success.svg" />
<span class="statistics-item__label">普通消息</span>
</div>
<div class="statistics-item__value--success">
<countup end-val="45678" />
<countup :end-val="countInfo.normal" />
<span class="statistics-item__value-suffix"></span>
</div>
</div>
</div>
<div class="chart-box">
<pie :width="150" :height="150" />
<pie :width="150" :height="150" />
<pie :width="150" :height="150" />
<pie
v-for="(item, index) in newsStateList"
:key="index"
:value="item.value"
:label="item.name"
:width="150"
:height="150"
/>
</div>
</div>
<div class="work-box-1">
@@ -75,14 +80,22 @@
import pie from './pie.vue'
import { getNewsListApi, getNewsStateApi, getNewsTotalApi } from '@/api/news'
const list = ref([])
let list = ref([])
let countInfo = ref({
important: 0,
normal: 0,
total: 0,
warn: 0
})
let newsStateList = ref([])
const getNewsTotal = async () => {
let res = await getNewsTotalApi()
console.log(res, '============')
countInfo.value = res.data
}
const getNewsState = async () => {
let res = await getNewsStateApi()
newsStateList.value = res.data
console.log(newsStateList.value, '=================')
}
const getNewsList = async () => {
let res = await getNewsListApi()

View File

@@ -8,145 +8,169 @@
const { id, setOption } = useEchart()
let option = {
backgroundColor: 'transparent',
title: [
{
text: '45.5%',
x: 'center',
top: '42%',
textStyle: {
color: '#02F9FA',
fontSize: fitChartSize(24)
}
},
{
text: '完成率',
x: 'center',
top: '54%',
textStyle: {
color: '#fff',
fontSize: fitChartSize(12)
}
}
],
series: [
{
type: 'gauge',
radius: '100%',
center: ['50%', '50%'],
min: 0,
max: 100,
startAngle: 90,
endAngle: 450,
clockwise: false,
itemStyle: {
color: '#00D0FF'
},
axisLine: {
show: true,
roundCap: false,
lineStyle: {
color: [
[0, '#075199'],
[1, '#075199']
],
width: fitChartSize(6)
}
},
progress: {
show: true,
roundCap: false,
width: fitChartSize(6)
},
pointer: {
// 指针
show: false
},
axisTick: {
// 刻度
show: false
},
splitLine: {
// 分割线
show: false
},
axisLabel: {
// 刻度标签
show: false
},
detail: {
// 仪表盘详情
show: false
},
data: [
{
value: 50
}
]
},
{
type: 'gauge',
radius: '95%',
center: ['50%', '50%'],
min: 0,
max: 100,
startAngle: 90,
endAngle: 450,
clockwise: false,
itemStyle: {
color: '#057EB9'
},
axisLine: {
roundCap: false,
lineStyle: {
color: [
[0, '#075199'],
[1, '#075199']
],
width: fitChartSize(10)
}
},
progress: {
show: true,
roundCap: false,
width: fitChartSize(10)
},
pointer: {
// 指针
show: false
},
axisTick: {
// 刻度
show: false
},
splitLine: {
// 分割线
show: false
},
axisLabel: {
// 刻度标签
show: false
},
detail: {
// 仪表盘详情
show: false
},
data: [
{
value: 50
}
]
}
]
}
const init = () => {
setOption(option)
}
onMounted(() => {
init()
let props = defineProps({
value: {
type: Number,
default: () => 0
},
label: {
type: String,
default: () => ''
}
})
watch(
() => props.value,
(val) => {
if (val) {
nextTick(() => {
init()
})
}
},
{ immediate: true }
)
let params = null
const init = () => {
if (!params) {
params = {
backgroundColor: 'transparent',
title: [
{
text: `${(props.value * 100).toFixed(2)}%`,
x: 'center',
top: '40%',
textStyle: {
color: '#02F9FA',
fontSize: fitChartSize(24)
}
},
{
text: props.label,
x: 'center',
top: '56%',
textStyle: {
color: '#fff',
fontSize: fitChartSize(12)
}
}
],
series: [
{
type: 'gauge',
radius: '100%',
center: ['50%', '50%'],
min: 0,
max: 1,
startAngle: 90,
endAngle: 450,
clockwise: false,
itemStyle: {
color: '#00D0FF'
},
axisLine: {
show: true,
roundCap: false,
lineStyle: {
color: [
[0, '#075199'],
[1, '#075199']
],
width: fitChartSize(6)
}
},
progress: {
show: true,
roundCap: false,
width: fitChartSize(6)
},
pointer: {
// 指针
show: false
},
axisTick: {
// 刻度
show: false
},
splitLine: {
// 分割线
show: false
},
axisLabel: {
// 刻度标签
show: false
},
detail: {
// 仪表盘详情
show: false
},
data: [
{
value: props.value
}
]
},
{
type: 'gauge',
radius: '95%',
center: ['50%', '50%'],
min: 0,
max: 1,
startAngle: 90,
endAngle: 450,
clockwise: false,
itemStyle: {
color: '#057EB9'
},
axisLine: {
roundCap: false,
lineStyle: {
color: [
[0, '#075199'],
[1, '#075199']
],
width: fitChartSize(10)
}
},
progress: {
show: true,
roundCap: false,
width: fitChartSize(10)
},
pointer: {
// 指针
show: false
},
axisTick: {
// 刻度
show: false
},
splitLine: {
// 分割线
show: false
},
axisLabel: {
// 刻度标签
show: false
},
detail: {
// 仪表盘详情
show: false
},
data: [
{
value: props.value
}
]
}
]
}
} else {
params.series[0].data[0].value = props.value
}
setOption(params)
}
</script>
<style lang="scss" scoped>