Commit 8539ac6e by chenwq

折线图

1 parent 3cdb955e
<template>
<div class="line-box">
<div id="line-chart" class="line-chart"></div>
<div :id="domId" class="line-chart"></div>
<div class="rank-box">
<div class="rank-title-block">
<p :class="[ 'rank-title', rankFlag == 'top' ? 'rank-title-active' : '' ]" @click="handleRankChange('top')">前5{{ storeOrBrandTxt }}</p>
......@@ -23,6 +23,10 @@ import getLineOptions from './lineOptions'
export default {
name: 'LineChart',
props: {
domId: {
type: String,
default: 'line-chart'
},
storeOrBrandTxt: {
type: String,
default: '品牌'
......@@ -42,7 +46,7 @@ export default {
rankList: [],
echartsLine: '',
moveAttr: {
speed: 2000,
speed: 900,
seriesIndex: 0,
dataIndex: -1
},
......@@ -55,7 +59,7 @@ export default {
},
mounted() {
this.lineDom = document.getElementById('line-chart')
this.lineDom = document.getElementById(this.domId)
this.echartsLine = echarts.init(this.lineDom)
},
......@@ -134,7 +138,7 @@ export default {
this.getRankList(0)
// this.autoMove()
this.autoMove()
},
handleRankChange(value) {
......
......@@ -8,6 +8,15 @@
<template>
<div>
<div class="title">有效客户</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="efficientChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt"></LineChart>
</div>
</div>
</template>
......@@ -24,48 +33,77 @@ export default {
},
data() {
return {
rankList: [
{
name: '奥迪',
num: 599604
},
{
name: '宝马',
num: 599604
},
{
name: '现代起亚',
num: 599604
},
{
name: '奔驰',
num: 599604
},
{
name: '沃尔沃',
num: 599604
}
]
isEmpty: true,
storeOrBrandTxt: '品牌',
dataList: []
}
},
mounted() {
// this.dealList()
},
mounted() { },
methods: {
init(val) {
},
// 折线图数据
getList() { },
// 排名数据
getRankList() { },
dealList() {
this.rankList.forEach(item => {
item.num = this.numAddSymbol(item.num)
this.isEmpty = true
var params = {
req: {
// corporateGroupName: '广汇',
corporateGroupName: '集团1',
queryItem: 'valid',
querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: val.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
handleRankChange(value) {
console.log(value)
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: this.numAddSymbol(topTempList[item])
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item])
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate || 0,
trate: item.trate || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
......@@ -15,7 +15,7 @@
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt"></LineChart>
<LineChart v-else ref="lineChartRef" domId="fileChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt"></LineChart>
</div>
</div>
</template>
......@@ -80,8 +80,8 @@ export default {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList == 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList == 'null' ? [] : JSON.parse(item.lastList)
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
......
......@@ -8,11 +8,101 @@
<template>
<div>
<div class="title">首保回店</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="firstChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'First'
name: 'First',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
dataList: []
}
},
mounted() { },
methods: {
init(val) {
this.isEmpty = true
var params = {
req: {
// corporateGroupName: '广汇',
corporateGroupName: '集团1',
queryItem: 'first',
querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: val.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: this.numAddSymbol(topTempList[item].num)
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item].num)
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate || 0,
trate: item.trate || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
......@@ -8,11 +8,101 @@
<template>
<div>
<div class="title">客户保持</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="keepChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'Keep'
name: 'Keep',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
dataList: []
}
},
mounted() { },
methods: {
init(val) {
this.isEmpty = true
var params = {
req: {
// corporateGroupName: '广汇',
corporateGroupName: '集团1',
queryItem: 'retain',
querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: val.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: this.numAddSymbol(topTempList[item])
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item])
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate || 0,
trate: item.trate || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
......@@ -8,11 +8,101 @@
<template>
<div>
<div class="title">客户流失</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="lostChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'Lost'
name: 'Lost',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
dataList: []
}
},
mounted() { },
methods: {
init(val) {
this.isEmpty = true
var params = {
req: {
// corporateGroupName: '广汇',
corporateGroupName: '集团1',
queryItem: 'loss',
querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: val.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: this.numAddSymbol(topTempList[item])
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item])
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate || 0,
trate: item.trate || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
......@@ -8,11 +8,101 @@
<template>
<div>
<div class="title">定保回店</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="sadayasuChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'Sadayasu'
name: 'Sadayasu',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
dataList: []
}
},
mounted() { },
methods: {
init(val) {
this.isEmpty = true
var params = {
req: {
// corporateGroupName: '广汇',
corporateGroupName: '集团1',
queryItem: 'regular',
querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: val.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: this.numAddSymbol(topTempList[item].num)
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item].num)
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate || 0,
trate: item.trate || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!