Commit 268a7b9a by 李伟康

commit

1 parent 2f938b11
...@@ -18,6 +18,11 @@ class Request { ...@@ -18,6 +18,11 @@ class Request {
method method
} }
params.req.corporateGroupName = '广汇' params.req.corporateGroupName = '广汇'
const { reportParams } = window.vm.$store.state.app
if (reportParams) {
params.req.queryType = reportParams.reportType || 0
if (reportParams.brand) params.req.brandName = reportParams.brand.name
}
if (method === 'GET') { if (method === 'GET') {
var paramsArray = [] var paramsArray = []
Object.keys(params.req).forEach(key => paramsArray.push('req.' + key + '=' + params.req[key])) Object.keys(params.req).forEach(key => paramsArray.push('req.' + key + '=' + params.req[key]))
......
...@@ -55,10 +55,17 @@ ...@@ -55,10 +55,17 @@
<div class="tabs-content box"> <div class="tabs-content box">
<div class="tabs-title">客户增长趋势</div> <div class="tabs-title">客户增长趋势</div>
<div class="tabs-content-chart flex"> <div class="tabs-content-chart flex">
<div <template v-if="isEmpty">
class="line" <div class="empty">
ref="canvas" <img src="@/assets/images/empty.png" />
></div> </div>
</template>
<template v-else>
<div
class="line"
ref="canvas"
></div>
</template>
<div class="table user-select pointer"> <div class="table user-select pointer">
<div class="table-head"> <div class="table-head">
<template v-for="(i,index) in tabHead"> <template v-for="(i,index) in tabHead">
...@@ -136,23 +143,27 @@ export default { ...@@ -136,23 +143,27 @@ export default {
publiccus: {} publiccus: {}
}, },
canvas: null, canvas: null,
req: {} req: {},
isGroup: true,
isEmpty: true
} }
}, },
mounted () { mounted () {
}, },
methods: { methods: {
init (params) { init (params) {
console.log(params) let req = {
// params.queryType = params.reportType || 0 queryType: params.reportType || 0
// delete params.reportType }
// this.req = params if (params.brand) this.isGroup = false
// this.getOverallbase('total') this.req = req
// this.getOverallbase('wechat') this.isEmpty = true
// this.getOverallbase('wechatGroup') this.getOverallbase('total')
// this.getOverallbase('applet') this.getOverallbase('wechat')
// this.getOverallbase('publiccus') this.getOverallbase('wechatGroup')
// this.getOveralltrend('total') this.getOverallbase('applet')
this.getOverallbase('publiccus')
this.getOveralltrend('total')
}, },
changeType (type) { changeType (type) {
this.tabType = type this.tabType = type
...@@ -162,15 +173,11 @@ export default { ...@@ -162,15 +173,11 @@ export default {
this.tabIndex = index this.tabIndex = index
}, },
getOverallbase (queryItem) { getOverallbase (queryItem) {
let { req: { queryType }, req } = this
const params = { const params = {
queryItem, queryItem,
queryTime: '2022-06-23', queryTime: this.getCurrentDate(),
// queryTime: this.getCurrentDate(),
corporateGroupName: '集团1',
...req
} }
this.api.overview[queryType == 0 ? 'getBrandOverallbase' : 'getMerchantOverallbase'](params).then(({ code, data }) => { this.api.overview[this.isGroup ? 'getBrandOverallbase' : 'getMerchantOverallbase'](params).then(({ code, data }) => {
if (code == 0) { if (code == 0) {
let [dataList] = data.dataList let [dataList] = data.dataList
if (dataList) { if (dataList) {
...@@ -191,23 +198,28 @@ export default { ...@@ -191,23 +198,28 @@ export default {
}, },
ObjectToArray (obj) { ObjectToArray (obj) {
let arr = [] let arr = []
obj = JSON.parse(obj) JSON.parse(obj).map(e => {
Object.keys(obj).map(name => arr.push({ name, num: obj[name] })) Object.keys(e).map(name => arr.push({ name, num: e[name] }))
})
return arr return arr
}, },
getOveralltrend (queryItem) { getOveralltrend (queryItem) {
let { req: { queryType }, req } = this let { req: { queryType } } = this
const params = { const params = {
queryItem, queryItem,
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),
corporateGroupName: '集团1',
...req
} }
this.api.overview[queryType == 0 ? 'getBrandOveralltrend' : 'getMerchantOveralltrend'](params).then(({ data, code }) => { this.api.overview[this.isGroup ? 'getBrandOveralltrend' : 'getMerchantOveralltrend'](params).then(({ data, code }) => {
if (code == 0) { if (code == 0) {
this.canvas = echarts.init(this.$refs.canvas) if (!data.dataList.map(item => item.totalNum).every(item => item === 0)) {
this.draw(data.dataList, queryType) this.isEmpty = false
this.$nextTick(() => {
this.canvas = echarts.init(this.$refs.canvas)
this.draw(data.dataList, queryType)
})
}
} }
}) })
}, },
...@@ -393,7 +405,8 @@ export default { ...@@ -393,7 +405,8 @@ export default {
margin-top: auto; margin-top: auto;
justify-content: space-between; justify-content: space-between;
gap: 0 8px; gap: 0 8px;
.line { .line,
.empty {
flex: 7; flex: 7;
} }
.table { .table {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!