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

View File

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