Commit 7664bc98 by 前端

fixed

1 parent 4c2ca37e
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-06-28 16:55:48 * @Date: 2022-06-28 16:55:48
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 13:55:36 * @LastEditTime: 2022-10-27 15:23:24
*/ */
// 私域用户池总览数据 // 私域用户池总览数据
const getoverview = params => { const getoverview = params => {
...@@ -18,6 +18,12 @@ const getDistribution = params => { ...@@ -18,6 +18,12 @@ const getDistribution = params => {
const getTrend = params => { const getTrend = params => {
return window.$HTTP.get('privateDomainUserPool/getTrend', params) return window.$HTTP.get('privateDomainUserPool/getTrend', params)
} }
const getCustomerValueAnalysis = params => {
return window.$HTTP.get('privateDomainUserPool/getCustomerValueAnalysis', params)
}
const getValueDistribution = params => {
return window.$HTTP.get('privateDomainUserPool/getValueDistribution', params)
}
// // 获取品牌售后其他信息 // // 获取品牌售后其他信息
// const aftersaleother = params => { // const aftersaleother = params => {
...@@ -29,4 +35,4 @@ const getTrend = params => { ...@@ -29,4 +35,4 @@ const getTrend = params => {
// return window.$HTTP.get('merchant/aftersaleother', params) // return window.$HTTP.get('merchant/aftersaleother', params)
// } // }
export default { getoverview, getDistribution, getTrend } export default { getoverview, getDistribution, getTrend, getCustomerValueAnalysis, getValueDistribution }
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* @Description: * @Description:
* @Author: huyue * @Author: huyue
* @Date: 2022-06-23 10:52:23 * @Date: 2022-06-23 10:52:23
* @LastEditors: huyue * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-06-24 14:44:50 * @LastEditTime: 2022-10-28 09:34:04
--> -->
<template> <template>
<div class="right"> <div class="right">
...@@ -18,14 +18,15 @@ ...@@ -18,14 +18,15 @@
<view-chart></view-chart> <view-chart></view-chart>
<view-line-group> <view-line-group>
<div slot="1"><Analyse :height="defaultHeight"></Analyse></div> <div slot="1"><Analyse :height="defaultHeight"></Analyse></div>
<div slot="2"><Brand :height="defaultHeight"></Brand></div> <div slot="2"><Brand :height="defaultHeight" :brandList="brandList"></Brand></div>
<div slot="3"><Area :height="defaultHeight"></Area></div> <div slot="3"><Area :height="defaultHeight" :areaList="areaList"></Area></div>
</view-line-group> </view-line-group>
</div> </div>
</div> </div>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
const queryItem = ['Importantvalue', 'Importantdevelopments', 'Importantrecall', 'Importantretention', 'Generalvalue', 'Generaldevelopments', 'Generalrecall','Generalretention']
import datas from '../utils/data' import datas from '../utils/data'
import Business from '../views/saas/business' import Business from '../views/saas/business'
import Project from '../views/saas/project' import Project from '../views/saas/project'
...@@ -45,11 +46,32 @@ export default { ...@@ -45,11 +46,32 @@ export default {
}, },
data() { data() {
return { return {
defaultHeight: datas.DefaultData.defaultLineHeight defaultHeight: datas.DefaultData.defaultLineHeight,
brandList: [],
areaList: []
} }
}, },
mounted() {}, mounted() {
methods: {} this.getValueDistribution(7);
this.$bus.$on('drawChart', data => {
this.getValueDistribution(data)
})
},
methods: {
getValueDistribution(itemKey) {
const params = {
req: {
queryItem: queryItem[7-itemKey]
}
}
this.api.user.getValueDistribution(params).then(res => {
if(res.code ==0) {
this.areaList = res.data.dataList[0].rankDistributions
this.brandList = res.data.dataList[1].rankDistributions
}
})
}
}
} }
</script> </script>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:43:46 * @Date: 2022-10-25 10:43:46
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-26 17:06:07 * @LastEditTime: 2022-10-28 10:08:29
* @FilePath: \dj-data-view\src\components\barChart.vue * @FilePath: \dj-data-view\src\components\barChart.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -39,8 +39,8 @@ export default { ...@@ -39,8 +39,8 @@ export default {
type: String, type: String,
default: '品牌' default: '品牌'
}, },
dataList: { analysisList: {
type: Array, type: [Array, Object],
default: () => [] default: () => []
}, },
// 0-月表;1-日表 // 0-月表;1-日表
...@@ -77,6 +77,7 @@ export default { ...@@ -77,6 +77,7 @@ export default {
rankFlag: 'top', rankFlag: 'top',
lineOptions: [], lineOptions: [],
rankList: [], rankList: [],
areaList2: this.areaList,
echartsLine: '', echartsLine: '',
moveAttr: { moveAttr: {
// speed: 900, // speed: 900,
...@@ -86,14 +87,31 @@ export default { ...@@ -86,14 +87,31 @@ export default {
timer: null timer: null
} }
}, },
created() { // created() {
const { rotate } = this // const { rotate, analysisList } = this
// const obj = {
// rotate,
// analysisList
// }
// this.lineOptions = this.revese ? getBarReverseOptions(obj) : getBarOptions(obj)
// },
watch: {
analysisList: {
handler() {
const { rotate, analysisList } = this
const obj = { const obj = {
rotate rotate,
analysisList
}
this.lineOptions = this.revese ? getBarReverseOptions(obj) : getBarOptions(obj)
this.chartBindEvent()
},
deep: true,
immediate: true
} }
this.lineOptions = this.revese ? getBarReverseOptions() : getBarOptions(obj)
}, },
mounted() { mounted() {
console.log(this.areaList, 999)
this.lineDom = document.getElementById(this.domId) this.lineDom = document.getElementById(this.domId)
this[this.domId] = echarts.init(this.lineDom) this[this.domId] = echarts.init(this.lineDom)
this.chartBindEvent() this.chartBindEvent()
...@@ -105,16 +123,11 @@ export default { ...@@ -105,16 +123,11 @@ export default {
this[this.domId].getZr().on( this[this.domId].getZr().on(
'mousemove', 'mousemove',
utils.debounce(params => { utils.debounce(params => {
console.log(params)
const pointInPixel = [params.offsetX, params.offsetY] const pointInPixel = [params.offsetX, params.offsetY]
const pointInGrid = this[this.domId].convertFromPixel({ seriesIndex: 0 }, pointInPixel) const pointInGrid = this[this.domId].convertFromPixel({ seriesIndex: 0 }, pointInPixel)
const yIndex = pointInGrid[1] const yIndex = pointInGrid[1]
const op = this[this.domId].getOption() this.$bus.$emit('drawChart', yIndex)
const name = op.yAxis[0].data[yIndex] }, 500)
console.log(name, yIndex)
this.$bus.$emit('drawChart', name)
}),
500
) )
} }
} }
......
...@@ -2,18 +2,23 @@ ...@@ -2,18 +2,23 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:46:24 * @Date: 2022-10-25 10:46:24
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-27 14:31:44 * @LastEditTime: 2022-10-28 12:32:22
* @FilePath: \dj-data-view\src\components\barOptions.js * @FilePath: \dj-data-view\src\components\barOptions.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
function getBarOptions(obj) { function getBarOptions(obj) {
console.log(obj)
const { analysisList, rotate } = obj
const num = analysisList.map(item => item.num)
console.log(num)
const name = analysisList.map(item => item.name)
var options = { var options = {
xAxis: { xAxis: {
type: 'category', type: 'category',
axisLabel: { axisLabel: {
color: '#fff', color: '#fff',
fontSize: '0.8em', fontSize: '0.75em',
rotate: obj.rotate rotate
}, },
splitLine: { splitLine: {
show: false show: false
...@@ -24,7 +29,7 @@ function getBarOptions(obj) { ...@@ -24,7 +29,7 @@ function getBarOptions(obj) {
axisLine: { axisLine: {
show: false show: false
}, },
data: ['广汽本田', '广汽丰田', '一汽奥迪', '宝马', '奔驰', '其他'] data: name
}, },
grid: { grid: {
left: '8%', left: '8%',
...@@ -57,13 +62,15 @@ function getBarOptions(obj) { ...@@ -57,13 +62,15 @@ function getBarOptions(obj) {
color: '#6578FF' color: '#6578FF'
}, },
barWidth: '35%', barWidth: '35%',
data: [120, 200, 150, 80, 70, 110, 130] data: num
} }
] ]
} }
return options return options
} }
function getBarReverseOptions(obj) { function getBarReverseOptions(obj) {
const { analysisList } = obj
const value = Object.values(analysisList)
var options = { var options = {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
...@@ -139,7 +146,7 @@ function getBarReverseOptions(obj) { ...@@ -139,7 +146,7 @@ function getBarReverseOptions(obj) {
} }
} }
}, },
data: [30, 120, 200, 150, 80, 70, 110, 130] data: value
} }
] ]
} }
...@@ -173,7 +180,8 @@ function getLineOptions(obj) { ...@@ -173,7 +180,8 @@ function getLineOptions(obj) {
type: 'category', type: 'category',
axisLabel: { axisLabel: {
color: '#fff', color: '#fff',
fontSize: '0.8em' fontSize: '0.7em',
rotate: 30
}, },
splitLine: { splitLine: {
show: false show: false
...@@ -190,7 +198,7 @@ function getLineOptions(obj) { ...@@ -190,7 +198,7 @@ function getLineOptions(obj) {
left: '6%', left: '6%',
right: '6%', right: '6%',
top: '14%', top: '14%',
bottom: '1%', bottom: '3%',
containLabel: true containLabel: true
}, },
yAxis: { yAxis: {
...@@ -202,8 +210,8 @@ function getLineOptions(obj) { ...@@ -202,8 +210,8 @@ function getLineOptions(obj) {
} }
}, },
axisLabel: { axisLabel: {
color: '#fff', color: '#ccc',
fontSize: '0.8em' fontSize: '0.7em'
}, },
splitNumber: 4 splitNumber: 4
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26 * @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-25 15:16:19 * @LastEditTime: 2022-10-27 15:17:26
* @FilePath: \dj-data-view\src\views\user\analyse.vue * @FilePath: \dj-data-view\src\views\user\analyse.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<div class="title-h3">客户价值分析</div> <div class="title-h3">客户价值分析</div>
</div> </div>
<div class="container"> <div class="container">
<bar-chart domId="analyseChart" :revese="true" boxHeight="14.54vh"></bar-chart> <bar-chart domId="analyseChart" :revese="true" boxHeight="14.54vh" :analysisList="analysisList"></bar-chart>
</div> </div>
</div> </div>
</template> </template>
...@@ -22,7 +22,21 @@ ...@@ -22,7 +22,21 @@
export default { export default {
name: 'Analyse', name: 'Analyse',
data() { data() {
return {} return {
analysisList: ''
}
},
mounted() {
this.getCustomerValueAnalysis()
},
methods: {
getCustomerValueAnalysis() {
this.api.user.getCustomerValueAnalysis().then(res => {
if (res.code == 0) {
this.analysisList = res.data.dataList[0]
}
})
}
} }
} }
</script> </script>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26 * @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-26 16:58:27 * @LastEditTime: 2022-10-27 17:28:40
* @FilePath: \dj-data-view\src\views\user\area.vue * @FilePath: \dj-data-view\src\views\user\area.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<span>区域分布</span> <span>区域分布</span>
</div> </div>
<div class="container"> <div class="container">
<bar-chart domId="areaChart"></bar-chart> <bar-chart domId="areaChart" :analysisList="areaList"></bar-chart>
</div> </div>
</div> </div>
</template> </template>
...@@ -24,10 +24,11 @@ export default { ...@@ -24,10 +24,11 @@ export default {
data() { data() {
return {} return {}
}, },
mounted() { props: {
this.$bus.$on('drawChart', data => { areaList: {
console.log(data) type: Array,
}) default: () => []
}
} }
} }
</script> </script>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26 * @Date: 2022-10-25 10:12:26
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-26 16:58:18 * @LastEditTime: 2022-10-27 17:28:13
* @FilePath: \dj-data-view\src\views\user\brand.vue * @FilePath: \dj-data-view\src\views\user\brand.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<span>品牌分布</span> <span>品牌分布</span>
</div> </div>
<div class="container"> <div class="container">
<bar-chart domId="brandChart" :rotate="30"></bar-chart> <bar-chart domId="brandChart" :rotate="30" :analysisList="brandList"></bar-chart>
</div> </div>
</div> </div>
</template> </template>
...@@ -23,10 +23,11 @@ export default { ...@@ -23,10 +23,11 @@ export default {
data() { data() {
return {} return {}
}, },
mounted() { props: {
this.$bus.$on('drawChart', data => { brandList: {
console.log(data) type: Array,
}) default: () => []
}
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!