Commit 1e0edae5 by 王志慧

饼图交互修改

1 parent c57e7d15
...@@ -64,8 +64,8 @@ export default { ...@@ -64,8 +64,8 @@ export default {
}, },
mounted() { mounted() {
this.initData() // this.initData()
this.draw() // this.draw()
}, },
methods: { methods: {
......
...@@ -37,12 +37,11 @@ export default { ...@@ -37,12 +37,11 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.ranking-container { .ranking-container {
flex: 1; flex: 1;
margin-left: 8px; margin-left: 0.6vw;
box-sizing: border-box; box-sizing: border-box;
height: 12.7vh; height: 12.7vh;
background: #262525; background: #262525;
.ranking-title { .ranking-title {
width: 100%;
background: rgba(53, 53, 53, 0.6); background: rgba(53, 53, 53, 0.6);
font-size: 10px; font-size: 10px;
color: #eb6001; color: #eb6001;
...@@ -62,9 +61,10 @@ export default { ...@@ -62,9 +61,10 @@ export default {
.brand-num { .brand-num {
color: #606266; color: #606266;
margin-right: 0.6vw; margin-right: 0.6vw;
max-width:20px;
} }
.marquee { .marquee {
// width: calc(100% - 2.2vw); width: calc(100% - 1.5vw);
height: 1.9vh; height: 1.9vh;
} }
} }
......
...@@ -13,9 +13,8 @@ ...@@ -13,9 +13,8 @@
<div id="analyzeBar" style="height: 100%"></div> <div id="analyzeBar" style="height: 100%"></div>
</div> </div>
<div class="contetn-right bg"> <div class="contetn-right bg">
<!-- <pie-chart :id="chart.id" :list="analyzeData" :height="height - 4.9 + 'vh'" :radius="chart.radius" @pieAction="pieAction"> <pie-chart :id="chart.id" :list="analyzeData" :height="height - 4.9 + 'vh'" :radius="chart.radius"></pie-chart>
</pie-chart> --> </div>
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -35,7 +34,8 @@ export default { ...@@ -35,7 +34,8 @@ export default {
}, },
barChart: '', barChart: '',
option: {}, option: {},
barData: [] barData: [],
key: 1
} }
}, },
mounted() { mounted() {
...@@ -47,16 +47,6 @@ export default { ...@@ -47,16 +47,6 @@ export default {
this.init() this.init()
}, },
methods: { methods: {
pieAction(data) {
// let distributionRank = this.distributionRank[data.name]
// for (const key in distributionRank) {
// this.rankingData.push({
// brand: key,
// value: distributionRank[key]
// })
// }
// console.log(this.rankingData, '================')
},
init() { init() {
this.getValueType() this.getValueType()
}, },
...@@ -136,16 +126,24 @@ export default { ...@@ -136,16 +126,24 @@ export default {
} }
} }
this.api.afterSales.aftersaleother(params).then(res => { this.api.afterSales.aftersaleother(params).then(res => {
const reqData = JSON.parse(res.data.dataList[0].distribution) const reqData = JSON.parse(res.data.dataList[0].distribution)
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
this.barData = [] this.barData = []
for (let i in reqData) { for (let i in reqData) {
this.barData.push(reqData[i]) this.barData.push(reqData[i])
} }
this.getChart() this.getChart()
this.initPieData()
})
},
initPieData() {
const distributionRank = this.distributionRank[this.key]
Object.keys(distributionRank).forEach(item => {
this.analyzeData.push({
name: item,
value: distributionRank[item]
})
}) })
} }
} }
......
...@@ -10,7 +10,19 @@ ...@@ -10,7 +10,19 @@
<div class="title">售后车辆里程</div> <div class="title">售后车辆里程</div>
<div class="flex"> <div class="flex">
<pie-chart :id="chart.id" :list="mileageData" :height="height - 4.9 + 'vh'" :radius="chart.radius" @pieAction="pieAction"></pie-chart> <pie-chart :id="chart.id" :list="mileageData" :height="height - 4.9 + 'vh'" :radius="chart.radius" @pieAction="pieAction"></pie-chart>
<div class="ranking-container"></div> <div class="ranking-container">
<div class="ranking-title">
<div class="ranking-title-brand">品牌</div>
<div>客户数</div>
</div>
<div class="ranking">
<div class="brand flex" v-for="(item, index) in rankingData" :key="index">
<span class="brand-num">{{ index + 1 }}</span>
<marquee class="marquee" :direction="directionTimer" :delay="delayTimer" :text="item.brand" />
<span>{{ item.value }}</span>
</div>
</div>
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -27,7 +39,10 @@ export default { ...@@ -27,7 +39,10 @@ export default {
chart: { chart: {
id: 'mileagePie', id: 'mileagePie',
radius: ['60%', '78%'] radius: ['60%', '78%']
} },
delayTimer: 3000,
directionTimer: 3000,
brandList: this.list
} }
}, },
mounted() { mounted() {
...@@ -45,6 +60,7 @@ export default { ...@@ -45,6 +60,7 @@ export default {
} }
this.api.afterSales.aftersaleother(params).then(res => { this.api.afterSales.aftersaleother(params).then(res => {
let distribution = JSON.parse(res.data.dataList[0].distribution) let distribution = JSON.parse(res.data.dataList[0].distribution)
// console.log()
const keys = Object.keys(distribution) const keys = Object.keys(distribution)
keys.forEach((item, index) => { keys.forEach((item, index) => {
this.mileageData.push({ this.mileageData.push({
...@@ -53,10 +69,10 @@ export default { ...@@ -53,10 +69,10 @@ export default {
}) })
}) })
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank) this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
// console.log(this.distributionRank, 'mileage')
}) })
}, },
pieAction(data) { pieAction(data) {
this.rankingData = []
let distributionRank = this.distributionRank[data.name] let distributionRank = this.distributionRank[data.name]
for (const key in distributionRank) { for (const key in distributionRank) {
this.rankingData.push({ this.rankingData.push({
...@@ -64,17 +80,52 @@ export default { ...@@ -64,17 +80,52 @@ export default {
value: distributionRank[key] value: distributionRank[key]
}) })
} }
// console.log(this.rankingData, '================')
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.ranking-container { .ranking-container {
flex: 1;
margin-left: 0.6vw; margin-left: 0.6vw;
box-sizing: border-box; box-sizing: border-box;
height: 21.5vh; height: 21.5vh;
width:10.8vw; width: 10.8vw;
background: #262525; background: #262525;
.ranking-title {
padding: 0.5vh 1.5vw 0.4vh 1.5vw;
font-size: 12px;
color: #eb6001;
letter-spacing: 0;
font-weight: 400;
background: rgba(53, 53, 53, 0.6);
display: flex;
align-items: center;
.ranking-title-brand {
width: 4.9vw;
margin-right: 0.6vw;
}
}
.ranking {
font-size: 10px;
color: #ffffff;
letter-spacing: 0;
font-weight: 400;
padding: 0.1vh 0 0.4vh 8px;
height: 18.5vh;
box-sizing: border-box;
.brand {
line-height: 3.6vh;
.brand-num {
color: #606266;
margin-right: 8px;
}
.marquee {
width: 4.9vw;
height: 3.6vh;
margin-right: 0.6vw;
}
}
}
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!