Commit e31509de by 李伟康

Merge branch 'dev_v1.0.0' of http://192.168.3.233:8090/gh/data-view into dev_v1.0.0

2 parents 9df07251 8cefb039
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-30 18:34:48
* @LastEditTime: 2022-06-30 19:40:27
-->
<template>
<div>
......@@ -57,27 +57,27 @@ export default {
{
name: '客流',
type: 'enter',
value: ''
value: 100
},
{
name: '留档',
type: 'stayfile',
value: ''
value: 80
},
{
name: '试驾',
type: 'test',
value: ''
value: 60
},
{
name: '订单',
type: 'placeorder',
value: ''
value: 40
},
{
name: '成交',
type: 'success',
value: ''
value: 20
}
],
option: {},
......@@ -111,28 +111,35 @@ export default {
}
}
var brandName = val.brand ? val.brand.name : ''
this.api.sales[brandName ? 'storeTotal' : 'saleTotal'](params).then(res => {
if (res.code === '0') {
if (res.data.dataList.length) {
res.data.dataList[0].num.forEach((item, index) => {
this.funnelData[index].value = item
})
this.hasData = res.data.dataList[0].num.every(i => i != 0)
if (this.hasData) this.draw()
} else {
this.hasData = false
this.api.sales[brandName ? 'storeTotal' : 'saleTotal'](params)
.then(res => {
if (res.code === '0') {
if (res.data.dataList.length) {
res.data.dataList[0].num.forEach((item, index) => {
this.funnelData[index].num = item
})
this.hasData = res.data.dataList[0].num.every(i => i != 0)
if (this.hasData) this.draw()
} else {
this.hasData = false
}
}
}
})
})
.catch(() => {
this.hasData = false
})
},
draw() {
this.option = {
tooltip: {
trigger: 'item',
backgroundColor: 'rgba(68,68,68,0.8)',
formatter: '{a} <br/>{b} : {c}',
formatter: e => {
return `${e.data.name}: ${e.data.num}`
},
textStyle: {
color: '#fff'
color: '#fff',
fontSize: 8
},
borderWidth: 0
},
......@@ -145,9 +152,7 @@ export default {
top: 8,
bottom: 8,
width: '100%',
min: 0,
// max: 10000,
minSize: '25%',
minSize: '30%',
maxSize: '100%',
sort: 'descending',
gap: 2,
......@@ -172,12 +177,6 @@ export default {
}
},
data: this.funnelData
// data: [
// { value: 20, name: 'Order' },
// { value: 40, name: 'Inquiry' },
// { value: 60, name: 'Visit' },
// { value: 80, name: 'Click' },
// { value: 100, name: 'Show' }
// ]
}
]
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-30 18:35:10
* @LastEditTime: 2022-06-30 19:38:58
-->
<template>
<div>
......@@ -60,23 +60,31 @@ export default {
this.list.forEach((i, idx) => {
p[idx] = new Promise((resolve, reject) => {
params.req.queryItem = i
this.api.sales[api](params).then(res => {
resolve(res.data.dataList)
})
this.api.sales[api](params)
.then(res => {
resolve(res.data.dataList)
})
.catch(() => {
reject()
})
})
})
Promise.all([p[0], p[1], p[2], p[3], p[4]]).then(results => {
this.dataList = results
const flag = results.map(item => {
if (item.length) {
return item.map(i => i.num).some(j => j != 0)
} else {
return false
}
Promise.all([p[0], p[1], p[2], p[3], p[4]])
.then(results => {
this.dataList = results
const flag = results.map(item => {
if (item.length) {
return item.map(i => i.num).some(j => j != 0)
} else {
return false
}
})
this.$set(this, 'hasData', !flag.every(i => !i))
this.draw()
})
.catch(() => {
this.hasData = false
})
this.$set(this, 'hasData', !flag.every(i => !i))
this.draw()
})
},
draw() {
this.option = {
......@@ -85,7 +93,39 @@ export default {
show: true,
borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)',
// position: [20, 20],
// position: (point, params, dom, rect, size) => {
// var x = 0 // x坐标位置
// var y = 0 // y坐标位置
// // 当前鼠标位置
// var pointX = point[0]
// var pointY = point[1]
// // 外层div大小
// // var viewWidth = size.viewSize[0];
// // var viewHeight = size.viewSize[1];
// // 提示框大小
// var boxWidth = size.contentSize[0]
// var boxHeight = size.contentSize[1]
// // boxWidth > pointX 说明鼠标左边放不下提示框
// if (boxWidth > pointX) {
// x = 5
// } else {
// // 左边放的下
// x = pointX - boxWidth
// }
// // boxHeight > pointY 说明鼠标上边放不下提示框
// if (boxHeight > pointY) {
// y = 5
// } else {
// // 上边放得下
// y = pointY - boxHeight
// }
// return [x, y]
// },
textStyle: {
color: '#FFFFFF',
fontSize: 8
......@@ -95,7 +135,7 @@ export default {
var txt = ''
e.forEach(item => {
if (txt) {
txt = txt + '<br>'
txt = txt + '<br />'
}
txt = txt + item.seriesName + ':' + item.value
})
......@@ -114,12 +154,17 @@ export default {
type: 'category',
axisLabel: {
color: '#606266',
fontSize: '0.8em'
fontSize: 10
},
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data: []
},
yAxis: {
type: 'value'
type: 'value',
splitLine: {
lineStyle: {
color: '#606266'
}
}
},
series: [
{
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!