diff --git a/src/views/BrandComparison/brandEventComparison/index.vue b/src/views/BrandComparison/brandEventComparison/index.vue index 4b5423b..ff931d6 100644 --- a/src/views/BrandComparison/brandEventComparison/index.vue +++ b/src/views/BrandComparison/brandEventComparison/index.vue @@ -127,10 +127,17 @@ export default { .then((res) => { let data = res.data || []; let brandList = []; + let dx = []; data.forEach((e) => { + let ab = e.Data || {}; + for (let key in ab) { + if (!dx.includes(key)) { + dx.push(key); + } + } brandList.push(e.Name); }); - this.opt1 = createOpt(data, brandList); + this.opt1 = createOpt(data,dx, brandList); resolve(data); }) .catch(() => { diff --git a/src/views/BrandComparison/brandEventComparison/opt.js b/src/views/BrandComparison/brandEventComparison/opt.js index c64bbca..5a1525a 100644 --- a/src/views/BrandComparison/brandEventComparison/opt.js +++ b/src/views/BrandComparison/brandEventComparison/opt.js @@ -18,9 +18,14 @@ }, data: [320, 332, 301, 334, 390, 400] },*/ -function createData(dataList = []) { +function createData(dataList = [],dx = []) { let arr = []; dataList.forEach(ele => { + let a = []; + let Data = ele.Data || {}; + dx.forEach(e => { + a.push(Data[e]) + }) let o = { name: ele.Name, type: 'bar', @@ -29,15 +34,15 @@ function createData(dataList = []) { emphasis: { focus: 'series' }, - data: [ele.Data.新闻,ele.Data.APP,ele.Data.微信,ele.Data.微博,ele.Data.短视频,ele.Data.论坛,ele.Data.其他] + data: a }; arr.push(o) }) return arr; } -export default function createOpt(dataList = [], brandList = []) { - let info = createData(dataList); +export default function createOpt(dataList = [],dx = [], brandList = []) { + let info = createData(dataList,dx); return { grid: { top: "56px", @@ -76,7 +81,7 @@ export default function createOpt(dataList = [], brandList = []) { color: "#fff", }, }, - data: ['新闻', 'APP', '微信', '微博', '短视频','论坛', "其他"] + data: dx } ], yAxis: [ diff --git a/src/views/BrandComparison/channelDistribution/index.vue b/src/views/BrandComparison/channelDistribution/index.vue index 420281c..f07ac43 100644 --- a/src/views/BrandComparison/channelDistribution/index.vue +++ b/src/views/BrandComparison/channelDistribution/index.vue @@ -50,10 +50,17 @@ export default { .then((res) => { let data = res.data || []; let brandList = []; - data.forEach(e => { - brandList.push(e.Name) - }) - this.opt = createOpt(data,brandList); + let dx = []; + data.forEach((e) => { + let ab = e.Data || {}; + for (let key in ab) { + if (!dx.includes(key)) { + dx.push(key); + } + } + brandList.push(e.Name); + }); + this.opt = createOpt(data,dx, brandList); resolve(data); }) .catch(() => { diff --git a/src/views/BrandComparison/channelDistribution/opt.js b/src/views/BrandComparison/channelDistribution/opt.js index 901f07a..da96d22 100644 --- a/src/views/BrandComparison/channelDistribution/opt.js +++ b/src/views/BrandComparison/channelDistribution/opt.js @@ -8,9 +8,14 @@ */ import { bigNumberTransform } from "@/utils/gol/dataTool" let colors = ['#3373CC', '#63AECC', '#54BF93', '#CC9D12', '#CC7733', "#CC5B41", '#452b74', '#71686f'] -function createData(dataList = []) { +function createData(dataList = [],dx = []) { let arr = []; dataList.forEach(e => { + let a = []; + let Data = e.Data || {}; + dx.forEach(e => { + a.push(Data[e]) + }) let o = { name: e.Name, type: 'bar', @@ -19,14 +24,14 @@ function createData(dataList = []) { emphasis: { focus: 'series' }, - data: [e.Data.新闻, e.Data.微信, e.Data.短视频, e.Data.APP, e.Data.论坛,e.Data.微博, e.Data.其他] + data: a }; arr.push(o) }) return arr; } -export default function createOpt(dataList = [], brandList = []) { - let info = createData(dataList); +export default function createOpt(dataList = [],dx = [], brandList = []) { + let info = createData(dataList,dx); return { grid: { top: "56px", @@ -66,7 +71,7 @@ export default function createOpt(dataList = [], brandList = []) { color: "#fff", }, }, - data: ['新闻', '微信', '短视频', 'APP','论坛', '微博', "其他"] + data: dx } ], yAxis: [ diff --git a/src/views/BrandComparison/informationVolumeByChannel/index.vue b/src/views/BrandComparison/informationVolumeByChannel/index.vue index 0e3ff2d..b31221b 100644 --- a/src/views/BrandComparison/informationVolumeByChannel/index.vue +++ b/src/views/BrandComparison/informationVolumeByChannel/index.vue @@ -7,32 +7,36 @@ * @FilePath: /data-show/src/views/BrandComparison/informationVolumeByChannel/index.vue --> diff --git a/src/views/BrandComparison/informationVolumeByChannel/opt.js b/src/views/BrandComparison/informationVolumeByChannel/opt.js index 287c075..5fe1b9f 100644 --- a/src/views/BrandComparison/informationVolumeByChannel/opt.js +++ b/src/views/BrandComparison/informationVolumeByChannel/opt.js @@ -7,9 +7,14 @@ * @FilePath: /data-show/src/views/BrandComparison/channelDistribution/opt.js */ import { bigNumberTransform } from "@/utils/gol/dataTool" -function createData(dataList = []) { +function createData(dataList = [],dx = []) { let arr = []; dataList.forEach(e => { + let a = []; + let Data = e.Data || {}; + dx.forEach(e => { + a.push(Data[e]) + }) let o = { name: e.Name, type: 'bar', @@ -18,15 +23,15 @@ function createData(dataList = []) { emphasis: { focus: 'series' }, - data: [e.Data.新闻, e.Data.微信, e.Data.短视频, e.Data.论坛, e.Data.微博, e.Data.其他] + data: a }; arr.push(o) }) return arr; } -export default function createOpt(dataList = [], brandList = []) { - let info = createData(dataList); +export default function createOpt(dataList = [],dx = [], brandList = []) { + let info = createData(dataList,dx); return { grid: { top: "56px", @@ -65,7 +70,7 @@ export default function createOpt(dataList = [], brandList = []) { color: "#fff", }, }, - data: ['新闻', '微信', '短视频', 'APP','论坛' ,'微博', "其他"] + data: dx } ], yAxis: [