Commit 77daaa03 by 王志慧

commit

1 parent c2532d2a
......@@ -42,7 +42,7 @@ export default {
barChart: '',
option: {},
barData: [],
key: 1,
key: '重要价值',
isBrand: false,
brandName: ''
}
......@@ -154,18 +154,23 @@ export default {
}
this.$nextTick(() => {
this.getChart()
this.initPieData()
this.initPieData(this.key)
})
}
})
},
initPieData(name) {
const distributionRank = this.distributionRank[this.key]
Object.keys(distributionRank).forEach(item => {
this.analyzeData.push({
name: item,
value: distributionRank[item]
})
this.analyzeData = []
datas.Customer.valueType.value.map(item => {
if (item.name == name) {
const distributionRank = this.distributionRank[item.value]
Object.keys(distributionRank).forEach(item => {
this.analyzeData.push({
name: item,
value: distributionRank[item]
})
})
}
})
},
init(newVal) {
......
......@@ -11,12 +11,12 @@
<span class="icon"></span>
<span>客户性别</span>
</div>
<div class="container flex">
<div class="container flex">
<template v-if="clientData.length > 0">
<pie-chart :id="chart.id" :list="clientData" :colors="chart.colors" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height:12.7vh" v-else>
<div class="empty" style="height: 12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
......@@ -26,20 +26,23 @@
import { clientMixin } from '../../mixins/index'
export default {
name: 'Sex',
mixins: [clientMixin],
mixins: [clientMixin],
data() {
return {
type: 'gender',
chart: {
id: 'sex-pie',
colors:["#EB6001","#BF98FF","#FF6E76"]
colors: ['#EB6001', '#BF98FF', '#FF6E76']
}
}
},
methods:{
pieAction(data){
console.log(this.distributionRank,'客户性别')
this.brandList = this.distributionRank&&this.distributionRank[data.name]&&Object.keys(this.distributionRank[data.name])
methods: {
pieAction(data) {
this.brandList = []
let array = this.distributionRank && this.distributionRank[data.name]
for (let i of array) {
this.brandList.push(Object.keys(i)[0])
}
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!