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 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-06-23 15:05:21 * @Date: 2022-06-23 15:05:21
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-06-30 18:34:48 * @LastEditTime: 2022-06-30 19:40:27
--> -->
<template> <template>
<div> <div>
...@@ -57,27 +57,27 @@ export default { ...@@ -57,27 +57,27 @@ export default {
{ {
name: '客流', name: '客流',
type: 'enter', type: 'enter',
value: '' value: 100
}, },
{ {
name: '留档', name: '留档',
type: 'stayfile', type: 'stayfile',
value: '' value: 80
}, },
{ {
name: '试驾', name: '试驾',
type: 'test', type: 'test',
value: '' value: 60
}, },
{ {
name: '订单', name: '订单',
type: 'placeorder', type: 'placeorder',
value: '' value: 40
}, },
{ {
name: '成交', name: '成交',
type: 'success', type: 'success',
value: '' value: 20
} }
], ],
option: {}, option: {},
...@@ -111,28 +111,35 @@ export default { ...@@ -111,28 +111,35 @@ export default {
} }
} }
var brandName = val.brand ? val.brand.name : '' var brandName = val.brand ? val.brand.name : ''
this.api.sales[brandName ? 'storeTotal' : 'saleTotal'](params).then(res => { this.api.sales[brandName ? 'storeTotal' : 'saleTotal'](params)
if (res.code === '0') { .then(res => {
if (res.data.dataList.length) { if (res.code === '0') {
res.data.dataList[0].num.forEach((item, index) => { if (res.data.dataList.length) {
this.funnelData[index].value = item 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() this.hasData = res.data.dataList[0].num.every(i => i != 0)
} else { if (this.hasData) this.draw()
this.hasData = false } else {
this.hasData = false
}
} }
} })
}) .catch(() => {
this.hasData = false
})
}, },
draw() { draw() {
this.option = { this.option = {
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
backgroundColor: 'rgba(68,68,68,0.8)', backgroundColor: 'rgba(68,68,68,0.8)',
formatter: '{a} <br/>{b} : {c}', formatter: e => {
return `${e.data.name}: ${e.data.num}`
},
textStyle: { textStyle: {
color: '#fff' color: '#fff',
fontSize: 8
}, },
borderWidth: 0 borderWidth: 0
}, },
...@@ -145,9 +152,7 @@ export default { ...@@ -145,9 +152,7 @@ export default {
top: 8, top: 8,
bottom: 8, bottom: 8,
width: '100%', width: '100%',
min: 0, minSize: '30%',
// max: 10000,
minSize: '25%',
maxSize: '100%', maxSize: '100%',
sort: 'descending', sort: 'descending',
gap: 2, gap: 2,
...@@ -172,12 +177,6 @@ export default { ...@@ -172,12 +177,6 @@ export default {
} }
}, },
data: this.funnelData 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 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-06-23 15:05:21 * @Date: 2022-06-23 15:05:21
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-06-30 18:35:10 * @LastEditTime: 2022-06-30 19:38:58
--> -->
<template> <template>
<div> <div>
...@@ -60,23 +60,31 @@ export default { ...@@ -60,23 +60,31 @@ export default {
this.list.forEach((i, idx) => { this.list.forEach((i, idx) => {
p[idx] = new Promise((resolve, reject) => { p[idx] = new Promise((resolve, reject) => {
params.req.queryItem = i params.req.queryItem = i
this.api.sales[api](params).then(res => { this.api.sales[api](params)
resolve(res.data.dataList) .then(res => {
}) resolve(res.data.dataList)
})
.catch(() => {
reject()
})
}) })
}) })
Promise.all([p[0], p[1], p[2], p[3], p[4]]).then(results => { Promise.all([p[0], p[1], p[2], p[3], p[4]])
this.dataList = results .then(results => {
const flag = results.map(item => { this.dataList = results
if (item.length) { const flag = results.map(item => {
return item.map(i => i.num).some(j => j != 0) if (item.length) {
} else { return item.map(i => i.num).some(j => j != 0)
return false } 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() { draw() {
this.option = { this.option = {
...@@ -85,7 +93,39 @@ export default { ...@@ -85,7 +93,39 @@ export default {
show: true, show: true,
borderWidth: 0, borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)', 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: { textStyle: {
color: '#FFFFFF', color: '#FFFFFF',
fontSize: 8 fontSize: 8
...@@ -95,7 +135,7 @@ export default { ...@@ -95,7 +135,7 @@ export default {
var txt = '' var txt = ''
e.forEach(item => { e.forEach(item => {
if (txt) { if (txt) {
txt = txt + '<br>' txt = txt + '<br />'
} }
txt = txt + item.seriesName + ':' + item.value txt = txt + item.seriesName + ':' + item.value
}) })
...@@ -114,12 +154,17 @@ export default { ...@@ -114,12 +154,17 @@ export default {
type: 'category', type: 'category',
axisLabel: { axisLabel: {
color: '#606266', color: '#606266',
fontSize: '0.8em' fontSize: 10
}, },
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: []
}, },
yAxis: { yAxis: {
type: 'value' type: 'value',
splitLine: {
lineStyle: {
color: '#606266'
}
}
}, },
series: [ series: [
{ {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!