Commit 9ab0c7c0 by 杨明

fixed

1 parent 473ed145
...@@ -395,110 +395,112 @@ export default { ...@@ -395,110 +395,112 @@ export default {
//折线图数据 //折线图数据
async getChart() { async getChart() {
this.$apis.home.getChart({ day: 30, date: this.summaryTime }).then(res => { this.$apis.home.getChart({ day: 30, date: this.summaryTime }).then(res => {
const { custAddList, custEntmicroAdds, custLoseList } = res if (res.custAddList && res.custAddList.length) {
let custAddListData = custAddList.map(item => { const { custAddList, custEntmicroAdds, custLoseList } = res
return item.customerCount let custAddListData = custAddList.map(item => {
}) return item.customerCount
let custAddListAverg = custAddList.map(item => { })
return item.monthAverg let custAddListAverg = custAddList.map(item => {
}) return item.monthAverg
let custAddListRatio = custAddList.map(item => { })
return item.ratio let custAddListRatio = custAddList.map(item => {
}) return item.ratio
let custEntmicroAddsData = custEntmicroAdds.map(item => { })
return item.customerCount let custEntmicroAddsData = custEntmicroAdds.map(item => {
}) return item.customerCount
let custEntmicroAddsAverg = custEntmicroAdds.map(item => { })
return item.monthAverg let custEntmicroAddsAverg = custEntmicroAdds.map(item => {
}) return item.monthAverg
let custEntmicroAddsRatio = custEntmicroAdds.map(item => { })
return item.ratio let custEntmicroAddsRatio = custEntmicroAdds.map(item => {
}) return item.ratio
let custLoseListData = custLoseList.map(item => { })
return item.customerCount let custLoseListData = custLoseList.map(item => {
}) return item.customerCount
let custLoseListAverg = custLoseList.map(item => { })
return item.monthAverg let custLoseListAverg = custLoseList.map(item => {
}) return item.monthAverg
let custLoseListRatio = custLoseList.map(item => { })
return item.ratio let custLoseListRatio = custLoseList.map(item => {
}) return item.ratio
const dateTime = custAddList.map(item => item.dateTime) })
this.optionCoustom = { const dateTime = custAddList.map(item => item.dateTime)
tooltip: { this.optionCoustom = {
trigger: 'item', tooltip: {
formatter(params) { trigger: 'item',
let circleColor formatter(params) {
let Averg let circleColor
let i_name let Averg
if (params.seriesName == '总客户数') { let i_name
circleColor = '#5850FF' if (params.seriesName == '总客户数') {
Averg = custAddListAverg[params.dataIndex] circleColor = '#5850FF'
i_name = custAddListRatio[params.dataIndex] ? 'el-icon-top' : 'el-icon-bottom' Averg = custAddListAverg[params.dataIndex]
} i_name = custAddListRatio[params.dataIndex] ? 'el-icon-top' : 'el-icon-bottom'
if (params.seriesName == '已加企微客户数') { }
circleColor = '#2CCA74' if (params.seriesName == '已加企微客户数') {
Averg = custEntmicroAddsAverg[params.dataIndex] circleColor = '#2CCA74'
i_name = custEntmicroAddsRatio[params.dataIndex] == 1 ? 'el-icon-top' : custEntmicroAddsRatio[params.dataIndex] == -1 ? 'el-icon-bottom' : '' Averg = custEntmicroAddsAverg[params.dataIndex]
} i_name = custEntmicroAddsRatio[params.dataIndex] == 1 ? 'el-icon-top' : custEntmicroAddsRatio[params.dataIndex] == -1 ? 'el-icon-bottom' : ''
if (params.seriesName == '企微流失客户') { }
circleColor = '#FF6D00' if (params.seriesName == '企微流失客户') {
Averg = custLoseListAverg[params.dataIndex] circleColor = '#FF6D00'
i_name = custLoseListRatio[params.dataIndex] ? 'el-icon-top' : 'el-icon-bottom' Averg = custLoseListAverg[params.dataIndex]
i_name = custLoseListRatio[params.dataIndex] ? 'el-icon-top' : 'el-icon-bottom'
}
return params.name + '<br>' + `<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${circleColor};"></span>` + params.seriesName + ':' + params.value + `<i class="${i_name}" style="color: ${circleColor}"></i>` + '<br>' + `<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${circleColor};"></span>` + (new Date(params.name).getMonth() + 1) + '月均值:' + Averg
} }
return params.name + '<br>' + `<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${circleColor};"></span>` + params.seriesName + ':' + params.value + `<i class="${i_name}" style="color: ${circleColor}"></i>` + '<br>' + `<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${circleColor};"></span>` + (new Date(params.name).getMonth() + 1) + '月均值:' + Averg
}
},
legend: {
data: ['总客户数', '已加企微客户数', '企微流失客户'],
x: 'center',
icon: 'stack',
itemHeight: 2,
itemWidth: 12
},
grid: {
left: '3%',
right: '4%',
bottom: 0,
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
color: '#A3A3A3',
data: dateTime
},
yAxis: {
type: 'value',
show: true,
name: '单位:人',
minInterval: 1
},
series: [
{
name: '总客户数',
type: 'line',
lineStyle: { color: '#5850FF ' },
data: custAddListData,
smooth: true
}, },
{ legend: {
name: '已加企微客户数', data: ['总客户数', '已加企微客户数', '企微流失客户'],
type: 'line', x: 'center',
lineStyle: { color: '#2CCA74 ' }, icon: 'stack',
data: custEntmicroAddsData, itemHeight: 2,
smooth: true itemWidth: 12
}, },
{ grid: {
name: '企微流失客户', left: '3%',
type: 'line', right: '4%',
lineStyle: { color: '#FF6D00 ' }, bottom: 0,
data: custLoseListData, containLabel: true
smooth: true },
} xAxis: {
] type: 'category',
boundaryGap: false,
color: '#A3A3A3',
data: dateTime
},
yAxis: {
type: 'value',
show: true,
name: '单位:人',
minInterval: 1
},
series: [
{
name: '总客户数',
type: 'line',
lineStyle: { color: '#5850FF ' },
data: custAddListData,
smooth: true
},
{
name: '已加企微客户数',
type: 'line',
lineStyle: { color: '#2CCA74 ' },
data: custEntmicroAddsData,
smooth: true
},
{
name: '企微流失客户',
type: 'line',
lineStyle: { color: '#FF6D00 ' },
data: custLoseListData,
smooth: true
}
]
}
this.getView()
} }
this.getView()
}) })
}, },
async getOpen() { async getOpen() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!