Commit 9cb0ec13 by 王志慧

饼图接口对接

1 parent 96aa2179
import Request from './request'
var request = new Request()
const client = {
// 获取品牌年龄/性别/购车年限
overalldistribution: params => {
return request.get('brand/overalldistribution', params)
}
}
export default client
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
import Request from '../request' import Request from '../request'
const request = new Request() const request = new Request()
const getSales = params => { const getSales = params => {
return request.get('brand/sale', params) return request.get('brand/sale', params)
} }
......
...@@ -26,17 +26,13 @@ export default { ...@@ -26,17 +26,13 @@ export default {
type: String, type: String,
default: '12.7vh' default: '12.7vh'
}, },
width: {
type: String,
default: '7.2vw'
},
list: { list: {
type: Array, type: Array,
default: () => [] default: () => []
}, },
radius: { radius: {
type: Array, type: Array,
default: () => ['55%', '72%'] default: () => ['55%', '75%']
}, },
colors: { colors: {
type: Array, type: Array,
...@@ -63,13 +59,13 @@ export default { ...@@ -63,13 +59,13 @@ export default {
this.initData() this.initData()
this.draw() this.draw()
}, },
immediate:true immediate:false
} }
}, },
mounted() { mounted() {
// this.initData() this.initData()
// this.draw() this.draw()
}, },
methods: { methods: {
...@@ -216,13 +212,18 @@ export default { ...@@ -216,13 +212,18 @@ export default {
.pie-box { .pie-box {
background: #262525; background: #262525;
position: relative; position: relative;
flex:1;
.center-content { .center-content {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
text-align: center; text-align: center;
max-width: 40%;
&-num { &-num {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 0.8vw; font-size: 0.8vw;
color: #fff; color: #fff;
--step: 0; --step: 0;
...@@ -234,8 +235,10 @@ export default { ...@@ -234,8 +235,10 @@ export default {
} }
} }
&-desc { &-desc {
font-size: 0.4vw; font-size: 0.5vw;
color: #606266; color: #606266;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
animation: rotateIn 2s infinite; animation: rotateIn 2s infinite;
} }
......
...@@ -3,6 +3,7 @@ export default { ...@@ -3,6 +3,7 @@ export default {
return { return {
now: new Date().format('yyyy-MM-dd'), now: new Date().format('yyyy-MM-dd'),
clientData: [], clientData: [],
brandList: [],
distributionRank: '' distributionRank: ''
} }
}, },
...@@ -29,9 +30,7 @@ export default { ...@@ -29,9 +30,7 @@ export default {
value: distribution[item] value: distribution[item]
}) })
}) })
console.log(res.data.dataList[0].distributionRank)
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank) this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
// console.log(this.distributionRank,'this.distributionRank')
}) })
} }
} }
......
import changeMixin from './changeMixin' import changeMixin from './changeMixin'
import clientMixin from './clientMixin' import clientMixin from './clientMixin'
import salesMixin from './salesMixin'
export { export {
changeMixin, changeMixin,
clientMixin clientMixin,
salesMixin
} }
\ No newline at end of file \ No newline at end of file
export default {
data() {
return {
now: new Date().format('yyyy-MM-dd'),
salesData: []
}
},
created() {
this.getSalesData()
},
methods: {
getSalesData() {
const params = {
req: {
corporateGroupName: '集团1',
queryItem: this.type,
// queryTime: this.now,
queryTime: '2022-06-23',
queryType: 0
}
}
this.api.sales.getSales(params).then(res => {
console.log(res,'salesData')
// let distribution = JSON.parse(res.data.dataList[0].distribution)
// const keys = Object.keys(distribution)
// keys.forEach((item, index) => {
// this.clientData.push({
// name: item,
// value: distribution[item]
// })
// })
// console.log(res.data.dataList[0].distributionRank)
// this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
// console.log(this.distributionRank,'this.distributionRank')
})
}
}
}
...@@ -12,7 +12,9 @@ ...@@ -12,7 +12,9 @@
<div class="content-left bg"> <div class="content-left bg">
<div id="analyzeBar" style="height: 100%"></div> <div id="analyzeBar" style="height: 100%"></div>
</div> </div>
<div class="contetn-right bg">右边</div> <div class="contetn-right bg">
<pie-chart :id="chart.id" :list="analyzeData" :height="height - 4.9 + 'vh'" :radius="chart.radius" @pieAction="pieAction"></pie-chart>
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -26,6 +28,11 @@ export default { ...@@ -26,6 +28,11 @@ export default {
data() { data() {
return { return {
barChart: '', barChart: '',
chart: {
id: 'analyzePie',
radius:['60%', '78%']
},
analyzeData:[],
option: {}, option: {},
barData: [] barData: []
} }
...@@ -129,6 +136,9 @@ export default { ...@@ -129,6 +136,9 @@ export default {
this.getChart() this.getChart()
}) })
},
pieAction(data){
} }
} }
} }
......
...@@ -8,11 +8,73 @@ ...@@ -8,11 +8,73 @@
<template> <template>
<div> <div>
<div class="title">售后车辆里程</div> <div class="title">售后车辆里程</div>
<div class="flex">
<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>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'Mileage' name: 'Mileage',
props: ['height'],
data() {
return {
mileageData: [],
distributionRank: '',
rankingData: [],
chart: {
id: 'mileagePie',
radius: ['60%', '78%']
}
}
},
mounted() {
this.getValueType()
},
methods: {
getValueType() {
const params = {
req: {
corporateGroupName: '集团1',
queryItem: 'mileage',
queryTime: '2022-06-23',
queryType: 0
}
}
this.api.afterSales.aftersaleother(params).then(res => {
let distribution = JSON.parse(res.data.dataList[0].distribution)
const keys = Object.keys(distribution)
keys.forEach((item, index) => {
this.mileageData.push({
name: item,
value: distribution[item]
})
})
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
console.log(this.distributionRank, 'mileage')
})
},
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, '================')
}
}
} }
</script> </script>
<style lang="scss" scoped>
.ranking-container {
margin-left: 0.6vw;
box-sizing: border-box;
height: 21.5vh;
width:10.8vw;
background: #262525;
}
</style>
...@@ -26,7 +26,6 @@ export default { ...@@ -26,7 +26,6 @@ export default {
data() { data() {
return { return {
type:'age', type:'age',
brandList:[],
chart: { chart: {
id: 'age-pie' id: 'age-pie'
} }
......
...@@ -26,7 +26,6 @@ export default { ...@@ -26,7 +26,6 @@ export default {
data() { data() {
return { return {
type: 'buycarRange', type: 'buycarRange',
brandList: [],
chart: { chart: {
id: 'car-pie' id: 'car-pie'
} }
......
...@@ -12,21 +12,28 @@ ...@@ -12,21 +12,28 @@
<span>进店类型</span> <span>进店类型</span>
</div> </div>
<div class="container flex"> <div class="container flex">
<pie-chart :id="chart.id"></pie-chart> <pie-chart :id="chart.id" :list="salesData" @pieAction="pieAction"></pie-chart>
<ran-king></ran-king> <ran-king :list="brandList"></ran-king>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { salesMixin } from '../../mixins/index'
export default { export default {
name: 'EnterCategory', name: 'EnterCategory',
mixins: [salesMixin],
data() { data() {
return { return {
type: 'entertype',
brandList: [],
chart: { chart: {
id: 'enterCategory-pie' id: 'enterCategory-pie'
} }
} }
},
methods: {
pieAction(data) {}
} }
} }
</script> </script>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!