feat:对接首页数据

This commit is contained in:
zjc
2025-03-11 16:02:49 +08:00
parent a63ace50c4
commit 999d99b68c
5 changed files with 79 additions and 16 deletions

View File

@@ -34,7 +34,7 @@
return props.list.map((item) => {
return {
...item,
value: item.occupiedPercentage,
value: item.occupiedSpaces,
itemStyle: {
color: {
type: 'linear',
@@ -61,7 +61,7 @@
return props.list.map((item) => {
return {
...item,
value: item.occupiedPercentage,
value: item.occupiedSpaces,
itemStyle: {
color: '#fff',
opacity: 1
@@ -70,7 +70,7 @@
})
}
const getYAxisData = () => {
return props.list.map((item) => item.occupied)
return props.list.map((item) => item.occupiedSpaces)
}
const init = () => {
if (!params) {
@@ -91,22 +91,23 @@
},
xAxis: [
{
type: 'value',
max: 100,
show: false,
splitLine: {
show: false
},
type: 'value',
show: false
}
}
],
yAxis: [
{
type: 'category',
splitLine: {
show: false
},
axisLine: {
show: false
},
type: 'category',
axisTick: {
show: false
},
@@ -146,6 +147,7 @@
{
name: '',
type: 'bar',
max: 100,
barWidth: fitChartSize(8),
showBackground: true,
borderRadius: [0, 0, 0, 0],

View File

@@ -38,6 +38,7 @@
() => dataRes.value,
(val) => {
if (val) {
console.log(val, '首页接受数据')
switch (val.type) {
case 'userPortrait':
homeStore.setUserPortraitData(val.data)

View File

@@ -98,10 +98,12 @@
}
watch(
() => [props.dataList, chart.value],
() => props.dataList,
() => {
if (props.dataList.length > 0 && chart.value) {
init()
if (props.dataList.length > 0) {
setTimeout(() => {
init()
}, 1000)
}
},
{ immediate: true }