Commit 25065fe5 by 胡悦

提交样式

1 parent 300e59d4
...@@ -163,8 +163,9 @@ export default { ...@@ -163,8 +163,9 @@ export default {
}) })
var seriesDate = this.dataList.map(item => +item.num) var seriesDate = this.dataList.map(item => +item.num)
this.lineOptions.series[0].data = seriesDate this.lineOptions.series[0].data = seriesDate
this.lineOptions.yAxis.min = Math.min(...seriesDate) this.lineOptions.yAxis.scale = true
this.lineOptions.yAxis.max = Math.max(...seriesDate) // this.lineOptions.yAxis.min = Math.min(...seriesDate)
// this.lineOptions.yAxis.max = Math.max(...seriesDate)
this[this.domId].setOption(this.lineOptions) this[this.domId].setOption(this.lineOptions)
// 默认展示tooltip // 默认展示tooltip
this.chartAction() this.chartAction()
......
...@@ -102,11 +102,11 @@ import * as echarts from 'echarts' ...@@ -102,11 +102,11 @@ import * as echarts from 'echarts'
export default { export default {
name: 'ViewTabs', name: 'ViewTabs',
mixins: [changeMixin], mixins: [changeMixin],
data () { data() {
return { return {
tabs, tabs,
tabHead: [], tabHead: [],
tabTitle:'客户总数', tabTitle: '客户总数',
tabType: 'total', tabType: 'total',
tabIndex: 0, tabIndex: 0,
delayTimer: 3000, delayTimer: 3000,
...@@ -126,10 +126,9 @@ export default { ...@@ -126,10 +126,9 @@ export default {
updata: Date.now() updata: Date.now()
} }
}, },
mounted () { mounted() {},
},
methods: { methods: {
init (params) { init(params) {
this.isGroup = true this.isGroup = true
let req = { let req = {
queryType: params.reportType || 0 queryType: params.reportType || 0
...@@ -144,20 +143,22 @@ export default { ...@@ -144,20 +143,22 @@ export default {
this.getOverallbase('publiccus') this.getOverallbase('publiccus')
this.getOveralltrend('total') this.getOveralltrend('total')
}, },
changeType (type) { changeType(type) {
let title = { let title = {
'total': '客户总数', total: '客户总数',
'wechat': '企微客户数', wechat: '企微客户数',
'wechatGroup': '企微群数', wechatGroup: '企微群数',
'applet': '小程序客户数', applet: '小程序客户数',
'publiccus': '公众号客户数' publiccus: '公众号客户数'
} }
this.tabTitle = title[type] this.tabTitle = title[type]
this.tabType = type this.tabType = type
this.getOveralltrend(type) this.getOveralltrend(type)
}, },
getOverallbase (queryItem) { getOverallbase(queryItem) {
let { req: { queryType } } = this let {
req: { queryType }
} = this
const params = { const params = {
queryItem, queryItem,
queryType, queryType,
...@@ -192,64 +193,66 @@ export default { ...@@ -192,64 +193,66 @@ export default {
} }
} }
this.pageData[queryItem] = dataList this.pageData[queryItem] = dataList
} }
}) })
}, },
ObjectToArray (obj) { ObjectToArray(obj) {
let arr = [] let arr = []
if (obj && obj !== 'null') { if (obj && obj !== 'null') {
obj = obj.replace('null', '"未知"') obj = obj.replace('null', '"未知"')
let item = JSON.parse(obj) let item = JSON.parse(obj)
if (Array.isArray(item)) item.map(e => { if (Array.isArray(item))
Object.keys(e).map(name => arr.push({ name, num: e[name] })) item.map(e => {
}) Object.keys(e).map(name => arr.push({ name, num: e[name] }))
})
else Object.keys(item).map(name => arr.push({ name, num: item[name] })) else Object.keys(item).map(name => arr.push({ name, num: item[name] }))
} }
return arr return arr
}, },
getOveralltrend (queryItem) { getOveralltrend(queryItem) {
let { req: { queryType } } = this let {
req: { queryType }
} = this
const params = { const params = {
queryItem, queryItem,
queryType, queryType,
querystartTime: queryType == 1 ? this.getNDate(-30) : this.getNMonth(-12), querystartTime: queryType == 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: queryType == 1 ? this.getNDate(-1) : this.getNMonth(-1), queryendTime: queryType == 1 ? this.getNDate(-1) : this.getNMonth(-1)
} }
this.api.overview[this.isGroup ? 'getBrandOveralltrend' : 'getMerchantOveralltrend'](params).then(({ data, code }) => { this.api.overview[this.isGroup ? 'getBrandOveralltrend' : 'getMerchantOveralltrend'](params)
this.flag = true .then(({ data, code }) => {
if (code == 0) { this.flag = true
if (!data.dataList.map(item => item.totalNum).every(item => item === 0)) { if (code == 0) {
this.isEmpty = false if (!data.dataList.map(item => item.totalNum).every(item => item === 0)) {
this.$nextTick(() => { this.isEmpty = false
this.canvas = echarts.init(this.$refs.canvas) this.$nextTick(() => {
this.draw(data.dataList, queryType) this.canvas = echarts.init(this.$refs.canvas)
}) this.draw(data.dataList, queryType)
})
}
} }
})
} .catch(() => {
}).catch(() => { this.flag = true
this.flag = true })
})
}, },
chartAction(dataList) { chartAction(dataList) {
this.canvas.dispatchAction({ this.canvas.dispatchAction({
type: 'showTip', type: 'showTip',
seriesIndex: 0, seriesIndex: 0,
dataIndex: dataList.length - 1 dataIndex: dataList.length - 1
}) })
}, },
draw (lineData, queryType) { draw(lineData, queryType) {
let data = [], let data = [],
Min=0, Min = 0,
xData = [], xData = [],
title = { title = {
'total': '客户总数', total: '客户总数',
'wechat': '企微客户数', wechat: '企微客户数',
'wechatGroup': '企微群数', wechatGroup: '企微群数',
'applet': '小程序客户数', applet: '小程序客户数',
'publiccus': '公众号客户数' publiccus: '公众号客户数'
}, },
{ tabType } = this { tabType } = this
lineData.map(e => { lineData.map(e => {
...@@ -296,10 +299,11 @@ export default { ...@@ -296,10 +299,11 @@ export default {
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
min: Min, // min: Min,
scale: true,
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: 'rgba(96,98,102,0.2)' color: 'rgba(96,98,102,0.2)'
} }
}, },
axisLabel: { axisLabel: {
...@@ -326,16 +330,16 @@ export default { ...@@ -326,16 +330,16 @@ export default {
y: 0, y: 0,
x2: 0, x2: 0,
y2: 1, y2: 1,
colorStops: [ colorStops: [
{ {
offset: 0, offset: 0,
color: 'rgba(254, 84, 0, 0.3)' color: 'rgba(254, 84, 0, 0.3)'
}, },
{ {
offset: 1, offset: 1,
color: 'rgba(254, 84, 0, 0.01)' color: 'rgba(254, 84, 0, 0.01)'
} }
] ]
} }
}, },
data data
...@@ -343,7 +347,7 @@ export default { ...@@ -343,7 +347,7 @@ export default {
] ]
} }
this.canvas.setOption(options) this.canvas.setOption(options)
this.chartAction(lineData) this.chartAction(lineData)
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.canvas.resize() this.canvas.resize()
}) })
......
...@@ -64,8 +64,10 @@ export default { ...@@ -64,8 +64,10 @@ export default {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
type: 'shadow' type: 'shadow',
// color: '#fff' shadowStyle: {
color: 'rgba(235,96,1,0.30'
}
}, },
borderWidth: 0, borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)', backgroundColor: 'rgba(68,68,68,0.80)',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!