This commit is contained in:
BianLzhaoMin 2025-08-23 16:00:02 +08:00
parent 375aea5f5b
commit bb21cf051c
3 changed files with 75 additions and 48 deletions

View File

@ -12,8 +12,8 @@ export default {
mixins: [resize],
props: {
threeData: {
type: Object,
default: () => ({}),
type: Array,
default: () => [],
},
},
data() {
@ -62,9 +62,9 @@ export default {
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
// this.$nextTick(() => {
// this.initChart()
// })
},
beforeDestroy() {
if (!this.chart) {
@ -76,11 +76,12 @@ export default {
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
const pieData = this.pieData.map((item) => ({
...item,
value: this.threeData[item.dataKey],
}))
// const pieData = this.pieData.map((item) => ({
// ...item,
// value: this.threeData[item.dataKey],
// }))
const pieData = this.threeData
//
const defaultSelectedIndex = 0
const defaultSelectedData = pieData[defaultSelectedIndex]
@ -255,7 +256,7 @@ export default {
//
this.chart.on('click', (params) => {
this.$emit('handleOpenDialog', params.data.type)
this.$emit('handleOpenDialog', params.data.name)
})
},
},

View File

@ -42,8 +42,8 @@ export default {
// .map((item) => item.value)
// .reverse()
const xAxisData = this.twoData.map((item) => item.name).reverse()
const seriesData = this.twoData.map((item) => item.value).reverse()
const xAxisData = this.twoData.map((item) => item.name)
const seriesData = this.twoData.map((item) => item.value)
this.chart.setOption({
grid: {

View File

@ -60,7 +60,7 @@ import { getProjectInfoAPI } from '@/api/home-index/index'
export default {
name: 'ProjectInfo',
dicts: ['voltage_level'],
dicts: ['voltage_level', 'project_type'],
components: {
ItemOne,
ItemTwo,
@ -84,14 +84,15 @@ export default {
legacyProNum: 0, //
},
twoData: [],
threeData: {
infrastructureLine: 0, // 线
infrastructureSubstation: 0, //
productionLine: 0, // 线
productionSubstation: 0, //
network: 0, //
proNum: 0,
},
threeData: [],
// threeData: {
// infrastructureLine: 0, // 线
// infrastructureSubstation: 0, //
// productionLine: 0, // 线
// productionSubstation: 0, //
// network: 0, //
// proNum: 0,
// },
//
dialogConfig: {
@ -119,6 +120,9 @@ export default {
stopProNum,
completeProNum,
legacyProNum,
proByProStatus,
proByVolLevel,
} = res
this.oneInfo = {
@ -129,29 +133,45 @@ export default {
legacyProNum,
}
this.twoData = []
for (const key in res) {
// this.dict.type.voltage_level.forEach((item) => {
// if (
// key.includes('level') &&
// item.value.includes(key.split('level')[1])
// ) {
this.threeData = []
// for (const key in res) {
// // this.dict.type.voltage_level.forEach((item) => {
// // if (
// // key.includes('level') &&
// // item.value.includes(key.split('level')[1])
// // ) {
// // this.twoData.push({
// // name: item.label,
// // value: res[key],
// // })
// // }
// // })
// if (key.includes('level')) {
// this.twoData.push({
// name: item.label,
// name: key.split('level')[1] + 'kV',
// value: res[key],
// })
// }
// })
// }
if (key.includes('level')) {
if (proByVolLevel && proByVolLevel.length > 0) {
proByVolLevel.forEach((item) => {
this.twoData.push({
name: key.split('level')[1] + 'kV',
value: res[key],
name: item.key,
value: item.value,
})
})
}
if (proByProStatus && proByProStatus.length > 0) {
proByProStatus.forEach((item) => {
this.threeData.push({
name: item.key,
value: item.value,
})
})
}
console.log(this.twoData, 'twoData')
const {
infrastructureLine,
infrastructureSubstation,
@ -161,14 +181,14 @@ export default {
proNum,
} = res
this.threeData = {
infrastructureLine,
infrastructureSubstation,
productionLine,
productionSubstation,
network,
proNum,
}
// this.threeData = {
// infrastructureLine,
// infrastructureSubstation,
// productionLine,
// productionSubstation,
// network,
// proNum,
// }
},
handleCloseDialogOuter() {
@ -183,13 +203,19 @@ export default {
},
handleOpenDialogTwo(name) {
console.log(name, 'name')
this.volLevel = name
this.dialogConfig.outerVisible = true
this.dialogConfig.outerTitle = '工程信息'
},
handleOpenDialogThree(type) {
this.proType = type
// this.proType = type
const id = this.dict.type.project_type.find(
(item) => item.label === type,
).value
this.proType = id
this.dialogConfig.outerVisible = true
this.dialogConfig.outerTitle = '工程信息'
},