diff --git a/src/views/home-index/components/projectInfo/components/item-three.vue b/src/views/home-index/components/projectInfo/components/item-three.vue index f5b7ca1..9b7edee 100644 --- a/src/views/home-index/components/projectInfo/components/item-three.vue +++ b/src/views/home-index/components/projectInfo/components/item-three.vue @@ -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) }) }, }, diff --git a/src/views/home-index/components/projectInfo/components/item-two.vue b/src/views/home-index/components/projectInfo/components/item-two.vue index b064a00..812cf6c 100644 --- a/src/views/home-index/components/projectInfo/components/item-two.vue +++ b/src/views/home-index/components/projectInfo/components/item-two.vue @@ -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: { diff --git a/src/views/home-index/components/projectInfo/index.vue b/src/views/home-index/components/projectInfo/index.vue index 8c7e87c..6cf8c73 100644 --- a/src/views/home-index/components/projectInfo/index.vue +++ b/src/views/home-index/components/projectInfo/index.vue @@ -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,28 +133,44 @@ 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.twoData.push({ - // name: item.label, - // value: res[key], - // }) - // } - // }) + 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')) { + // 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({ - 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, @@ -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 = '工程信息' },