2024-10-24 13:56:14 +08:00
|
|
|
<template>
|
|
|
|
|
<view class="charts-container">
|
|
|
|
|
<qiun-data-charts type="arcbar" :opts="opts" :chartData="chartData" @getIndex="handleChartClick" />
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { getHomePageListApi } from '@/api/phaseTwo/homePage'
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
chartData: {},
|
|
|
|
|
opts: {
|
2024-10-24 14:10:40 +08:00
|
|
|
color: ['#fc8483'],
|
2024-10-24 13:56:14 +08:00
|
|
|
padding: undefined,
|
|
|
|
|
backgroundColor: '#fc8483',
|
|
|
|
|
title: {
|
|
|
|
|
name: '',
|
|
|
|
|
fontSize: 0,
|
|
|
|
|
color: ''
|
|
|
|
|
},
|
|
|
|
|
subtitle: {
|
|
|
|
|
name: '',
|
|
|
|
|
fontSize: 0,
|
|
|
|
|
color: ''
|
|
|
|
|
},
|
|
|
|
|
extra: {
|
|
|
|
|
arcbar: {
|
|
|
|
|
type: 'default',
|
|
|
|
|
width: 14,
|
|
|
|
|
backgroundColor: '#E9E9E9',
|
|
|
|
|
startAngle: 0.25,
|
|
|
|
|
endAngle: 0.75,
|
|
|
|
|
gap: 2,
|
|
|
|
|
direction: 'ccw',
|
2024-10-24 14:10:40 +08:00
|
|
|
linearType: 'none'
|
2024-10-24 13:56:14 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.getServerData()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getServerData() {
|
|
|
|
|
getHomePageListApi().then(res => {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
const { workerMsgBean } = res.data
|
|
|
|
|
|
|
|
|
|
const maleNum = workerMsgBean.maleNum
|
|
|
|
|
const femaleNum = workerMsgBean.femaleNum
|
|
|
|
|
const dataGirl = femaleNum / (maleNum + femaleNum)
|
|
|
|
|
let data = {
|
|
|
|
|
series: [
|
|
|
|
|
{
|
2024-10-24 14:10:40 +08:00
|
|
|
name: '',
|
2024-10-24 13:56:14 +08:00
|
|
|
color: '#fc8483',
|
2024-10-24 14:10:40 +08:00
|
|
|
data: 0.9
|
2024-10-24 13:56:14 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
this.chartData = JSON.parse(JSON.stringify(data))
|
|
|
|
|
}, 500)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleChartClick(index) {
|
|
|
|
|
// const { currentIndex } = index // 获取当前点击的图表索引
|
|
|
|
|
// const chartsData = this.chartData.series[0].data
|
|
|
|
|
// const currenRows = chartsData[currentIndex]
|
|
|
|
|
// console.log('currenRows选中的工程类型', currenRows.name)
|
|
|
|
|
// // 电压等级信息
|
|
|
|
|
// const voltageLevel = {
|
|
|
|
|
// currentIndex,
|
|
|
|
|
// name: currenRows.name
|
|
|
|
|
// }
|
|
|
|
|
// uni.navigateTo({ url: `/pages/realName/index/pages/project?voltageLevel=${JSON.stringify(voltageLevel)}` })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.charts-container {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
</style>
|