Commit 623264ef by 姜雷

调整数据首页样式

parent 87f391ed
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<search-item label="运营商"> <search-item label="运营商">
<operator-select <operator-select
:accessType="1" :accessType="1"
:value="filters.operatorId" :value="filters.operateId"
@input="val => fetchConsumeList({ operatorId: val })" @input="val => fetchConsumeList({ operateId: val })"
/> />
</search-item> </search-item>
<el-radio-group <el-radio-group
......
<template> <template>
<div class="CampusRank"> <div class="CampusRank">
<div id="CampusRank"></div> <div id="CampusRank">
<div class="CampusRank-legend">
<template v-if="this.data && this.data.length === 10">
其他校区:<span>{{other}}</span><br>
前十校区:<span>{{topTen}}</span>
</template>
<template v-else-if="this.data.length">
校区汇总:<span>{{topTen}}</span>
</template>
</div>
</div>
</div> </div>
</template> </template>
...@@ -9,7 +19,7 @@ import chartMixin from '../chartMixin'; ...@@ -9,7 +19,7 @@ import chartMixin from '../chartMixin';
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
export default { export default {
name: 'CampusRank', name: 'CampusRankChart',
mixins: [chartMixin], mixins: [chartMixin],
props: { props: {
changeCampusHandle: { changeCampusHandle: {
...@@ -17,11 +27,13 @@ export default { ...@@ -17,11 +27,13 @@ export default {
}, },
}, },
data() { data() {
let totle = this.data.reduce((count, item) => count + item.count, 0); let total = this.data.reduce((count, item) => count + item.count, 0);
return { return {
chart: null, chart: null,
today: this.$formatDate(new Date(), 'yyyy-MM-dd'), today: this.$formatDate(new Date(), 'yyyy-MM-dd'),
totle: totle, total: total,
topTen: 0,
other: 0,
percentDom: null, percentDom: null,
areaNameDom: null, areaNameDom: null,
SelectedDataIndex: null, SelectedDataIndex: null,
...@@ -36,7 +48,7 @@ export default { ...@@ -36,7 +48,7 @@ export default {
container: 'CampusRank', container: 'CampusRank',
forceFit: true, forceFit: true,
height: this.height, height: this.height,
padding: [0, 130, 0, 0], padding: [20, 160, 20, 0],
}); });
this.chart.source(this.data); this.chart.source(this.data);
this.chart.coord('theta', { this.chart.coord('theta', {
...@@ -45,54 +57,7 @@ export default { ...@@ -45,54 +57,7 @@ export default {
}); });
this.chart.tooltip(false); this.chart.tooltip(false);
// 图例 // 图例
this.chart.legend({ this.chart.legend(false);
position: 'right-center',
marker: 'square',
useHtml: true,
itemTpl: (value, color, checked, index) => {
const obj = this.data[index];
return obj.type === '8'
? `
<li
class="g2-legend-list-item item-${index} ${checked}"
data-value="${value}"
data-color=${color}
style="cursor: pointer;font-size:14px;"
>
<i
class="g2-legend-marker"
style="background-color:${color};"
></i>
<span>其他校区<br/>汇总数据</span>
</li>
`
: `<li
class="g2-legend-list-item item-noshow item-${index} ${checked}"
data-value="${value}"
data-color=${color}
>
<i
class="g2-legend-marker"
style="background-color:${color};"
></i>
${value}
</li>`;
},
'g2-legend-list-item': {
display: 'flex',
// color: '#333',
},
'g2-legend-marker': {
width: '10px',
height: '5px',
borderRadius: 'none',
marginTop: '8px',
marginRight: '10px',
},
'item-noshow': {
display: 'none',
},
});
// 坐标系及着色 // 坐标系及着色
this.chartGeom = this.chart this.chartGeom = this.chart
.intervalStack() .intervalStack()
...@@ -126,7 +91,14 @@ export default { ...@@ -126,7 +91,14 @@ export default {
}, },
updateData() { updateData() {
if (this.data.length) { if (this.data.length) {
this.totle = this.data.reduce((count, item) => count + item.count, 0); this.total = this.data.reduce((count, item) => count + item.count, 0);
if (this.data.length === 10) {
this.other = this.data[this.data.length - 1].count;
this.topTen = this.total - this.other;
} else {
this.other = 0;
this.topTen = this.total;
}
let data = this.SelectedDataIndex; let data = this.SelectedDataIndex;
this.chartGeom.setSelected(this.data[0]); this.chartGeom.setSelected(this.data[0]);
...@@ -148,7 +120,7 @@ export default { ...@@ -148,7 +120,7 @@ export default {
this.percentDom = document.querySelector('.CampusRank-percent'); this.percentDom = document.querySelector('.CampusRank-percent');
this.areaNameDom = document.querySelector('.CampusRank-areaName'); this.areaNameDom = document.querySelector('.CampusRank-areaName');
if (this.percentDom) { if (this.percentDom) {
this.percentDom.innerHTML = ((data.count / this.totle) * 100).toFixed( this.percentDom.innerHTML = ((data.count / this.total) * 100).toFixed(
2 2
); );
} }
...@@ -162,10 +134,19 @@ export default { ...@@ -162,10 +134,19 @@ export default {
<style lang="scss"> <style lang="scss">
.CampusRank { .CampusRank {
position: relative;
.CampusRank-title { .CampusRank-title {
font-size: 16px; font-size: 16px;
text-align: center; text-align: center;
padding-bottom: 12px; padding-bottom: 12px;
} }
.CampusRank-legend {
position: absolute;
width: 160px;
transform: translateY(-50%);
line-height: 30px;
top: 50%;
right: 0;
}
} }
</style> </style>
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<search-item label="运营商"> <search-item label="运营商">
<operator-select <operator-select
:accessType="1" :accessType="1"
:value="filters.operatorId" :value="filters.operateId"
@input="val => getConsumeOrderList({operatorId: val})" @input="val => getConsumeOrderList({operateId: val})"
/> />
</search-item> </search-item>
<search-item label="区域"> <search-item label="区域">
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
>本年</el-radio> >本年</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<div class="Dashboard-title">会员消费数据 <div class="Dashboard-title">消费视图
<div <div
class="CustomerConsumptionChart-tip" class="CustomerConsumptionChart-tip"
style="color:#333;font-size:14px;text-align: center;" style="color:#333;font-size:14px;text-align: center;"
...@@ -96,7 +96,6 @@ export default { ...@@ -96,7 +96,6 @@ export default {
.CustomerConsumptionChart-tip { .CustomerConsumptionChart-tip {
position: absolute; position: absolute;
right: 0; right: 0;
top: 50px;
margin-left: 10px; margin-left: 10px;
color: #333; color: #333;
font-size: 14px; font-size: 14px;
......
...@@ -4,7 +4,7 @@ import { getFilters, formatDate } from '@/utils/index'; ...@@ -4,7 +4,7 @@ import { getFilters, formatDate } from '@/utils/index';
const FETCH_CONSUME_LIST = 'FETCH_CONSUME_LIST'; const FETCH_CONSUME_LIST = 'FETCH_CONSUME_LIST';
const initFilters = () => ({ const initFilters = () => ({
operatorId: undefined, operateId: undefined,
areaId: undefined, areaId: undefined,
timeType: 0, // 0 本日,1 本月, 2 本年 timeType: 0, // 0 本日,1 本月, 2 本年
}); });
......
...@@ -56,18 +56,6 @@ export default { ...@@ -56,18 +56,6 @@ export default {
this.consumeCount && this.consumeCount.payMen this.consumeCount && this.consumeCount.payMen
? this.consumeCount.payMen ? this.consumeCount.payMen
: '0'; : '0';
// 辅助元素
// this.chart.guide().html({
// position: ['0%', '0%'],
// htmlContent: `<div style="color:#333;font-size:14px;text-align: center;">
// 合计消费总金额:<span class="CustomerConsumption-total" style="color:#f00;">0.00</span>
// 合计消费人数:<span class="CustomerConsumption-count" style="color:#f00;">0</span>
// </div>`,
// alignX: 'left',
// alignY: 'top',
// offsetX: -40,
// offsetY: -40,
// });
this.chart.render(); this.chart.render();
this.chart.guide().text({ this.chart.guide().text({
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<search-item label="运营商"> <search-item label="运营商">
<operator-select <operator-select
:accessType="1" :accessType="1"
:value="filters.operatorId" :value="filters.operateId"
@input="val => getRechargeOrderList({operatorId: val})" @input="val => getRechargeOrderList({operateId: val})"
/> />
</search-item> </search-item>
<el-radio-group <el-radio-group
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
>本年</el-radio> >本年</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<div class="Dashboard-title">会员充值数据 <div class="Dashboard-title">充值视图
<div class="CustomerRechargeChart-tip"> <div class="CustomerRechargeChart-tip">
<span <span
class="CustomerRecharge-tooltip" class="CustomerRecharge-tooltip"
style="background-color:#4e82fb;" style="background-color:#4e82fb;"
></span> 累计充值: ></span> 充值:
<span style="color:#f00;">{{ rechargeCount && rechargeCount.rechargeMoney ? (rechargeCount.rechargeMoney).toFixed(2) : '0.00' }}</span> <span style="color:#f00;">{{ rechargeCount && rechargeCount.rechargeMoney ? (rechargeCount.rechargeMoney).toFixed(2) : '0.00' }}</span>
<span <span
class="CustomerRecharge-tooltip" class="CustomerRecharge-tooltip"
...@@ -85,8 +85,6 @@ export default { ...@@ -85,8 +85,6 @@ export default {
.CustomerRechargeChart-tip { .CustomerRechargeChart-tip {
position: absolute; position: absolute;
right: 0; right: 0;
top: 50px;
margin-right: 10px;
color: #333; color: #333;
font-size: 14px; font-size: 14px;
font-weight: normal; font-weight: normal;
......
...@@ -4,7 +4,7 @@ import { getFilters, formatDate } from '@/utils'; ...@@ -4,7 +4,7 @@ import { getFilters, formatDate } from '@/utils';
const FETCH_RECHARGE_LIST = 'FETCH_RECHARGE_LIST'; const FETCH_RECHARGE_LIST = 'FETCH_RECHARGE_LIST';
const initFilters = () => ({ const initFilters = () => ({
operatorId: undefined, operateId: undefined,
timeType: 0, // 0 本日,1 本月, 2 本年 timeType: 0, // 0 本日,1 本月, 2 本年
}); });
const filtersStore = initFiltersStore(initFilters); const filtersStore = initFiltersStore(initFilters);
......
<template> <template>
<div class="CustomerRechargeChart"> <div class="CustomerRechargeChart">
<div id='CustomerRechargeChart'></div> <div
<div id='CustomerRechangeSlider'></div> id='CustomerRechargeChart'
:style="`height: ${height}px;width: ${width?width+'px':'auto'}`"
></div>
<!-- <div id='CustomerRechangeSlider'></div> -->
</div> </div>
</template> </template>
...@@ -41,8 +44,7 @@ Shape.registerShape('interval', 'left', { ...@@ -41,8 +44,7 @@ Shape.registerShape('interval', 'left', {
draw: function draw(cfg, container) { draw: function draw(cfg, container) {
var points = this.parsePoints(cfg.points); var points = this.parsePoints(cfg.points);
var style = Util.mix(Global.shape.interval, cfg.style, { fill: cfg.color }); var style = Util.mix(Global.shape.interval, cfg.style, { fill: cfg.color });
var rectCfg = getRectRange(points, cfg.size / 2); // cfg.size 对应 .size(25)
var rectCfg = getRectRange(points, cfg.size); // cfg.size 对应 .size(25)
return container.addShape('rect', { return container.addShape('rect', {
className: 'interval', className: 'interval',
...@@ -55,7 +57,7 @@ Shape.registerShape('interval', 'right', { ...@@ -55,7 +57,7 @@ Shape.registerShape('interval', 'right', {
draw: function draw(cfg, container) { draw: function draw(cfg, container) {
var points = this.parsePoints(cfg.points); var points = this.parsePoints(cfg.points);
var style = Util.mix(Global.shape.interval, cfg.style, { fill: cfg.color }); var style = Util.mix(Global.shape.interval, cfg.style, { fill: cfg.color });
var rectCfg = getRectRange(points, -cfg.size / 2); // cfg.size 对应 .size(25 var rectCfg = getRectRange(points, -cfg.size / 2); // cfg.size 对应 .size(25)
return container.addShape('rect', { return container.addShape('rect', {
className: 'interval', className: 'interval',
...@@ -125,7 +127,7 @@ export default { ...@@ -125,7 +127,7 @@ export default {
container: 'CustomerRechargeChart', container: 'CustomerRechargeChart',
forceFit: true, forceFit: true,
height: this.height, height: this.height,
padding: [50, 50, 50, 120], padding: [50, 50, 20, 120],
}); });
this.chart.source(dv, { this.chart.source(dv, {
...@@ -136,6 +138,11 @@ export default { ...@@ -136,6 +138,11 @@ export default {
alias: '充值人数', alias: '充值人数',
}, },
}); });
this.chart.axis('areaName', {
label: {
offsetX: 10,
},
});
this.chart.axis('rechargeMoney', { this.chart.axis('rechargeMoney', {
grid: null, grid: null,
}); });
...@@ -146,18 +153,18 @@ export default { ...@@ -146,18 +153,18 @@ export default {
.position('areaName*rechargeMoney') .position('areaName*rechargeMoney')
.color('#4e82fb') .color('#4e82fb')
.shape('left') .shape('left')
.size(10); .size(18);
this.chart this.chart
.interval() .interval()
.position('areaName*rechargeMen') .position('areaName*rechargeMen')
.shape('right') .shape('right')
.color('#26c9a8') .color('#26c9a8')
.size(10); .size(18);
this.chart.legend(false); this.chart.legend(false);
this.chart.render(); this.chart.render();
this.initSlider(); // this.initSlider();
}, },
initSlider() { initSlider() {
const wrapDom = document.getElementById('CustomerRechargeChart'); const wrapDom = document.getElementById('CustomerRechargeChart');
...@@ -235,11 +242,13 @@ export default { ...@@ -235,11 +242,13 @@ export default {
let spanNum = 4 / arrLength; let spanNum = 4 / arrLength;
this.ds.setState('endRadio', spanNum); this.ds.setState('endRadio', spanNum);
this.dv.source(this.data); this.dv.source(this.data);
this.updateSlider(); let height = this.data.length * 20;
this.chart.changeHeight(height);
// this.updateSlider();
this.updateData(); this.updateData();
} else { } else {
this.initData(); this.initData();
this.initSlider(); // this.initSlider();
} }
}, },
}, },
...@@ -249,6 +258,11 @@ export default { ...@@ -249,6 +258,11 @@ export default {
<style lang="scss"> <style lang="scss">
.CustomerRechargeChart { .CustomerRechargeChart {
position: relative; position: relative;
#CustomerRechargeChart {
width: 100%;
overflow-x: hidden;
overflow-y: auto;
}
#CustomerRechangeSlider { #CustomerRechangeSlider {
margin-left: -30px; margin-left: -30px;
width: 100%; width: 100%;
......
...@@ -17,7 +17,7 @@ const GET_EUIPMENT_DATA = 'GET_EUIPMENT_DATA'; ...@@ -17,7 +17,7 @@ const GET_EUIPMENT_DATA = 'GET_EUIPMENT_DATA';
const GET_CAMPUS_DATA = 'GET_CAMPUS_DATA'; const GET_CAMPUS_DATA = 'GET_CAMPUS_DATA';
const initFilters = () => ({ const initFilters = () => ({
operatorId: undefined, operateId: undefined,
timeType: 0, // 0 本日,1 本月, 2 本年 timeType: 0, // 0 本日,1 本月, 2 本年
}); });
const filtersStore = initFiltersStore(initFilters); const filtersStore = initFiltersStore(initFilters);
...@@ -62,15 +62,14 @@ const getters = { ...@@ -62,15 +62,14 @@ const getters = {
const actions = { const actions = {
fetchConsumeList({ commit, dispatch, getters }, data) { fetchConsumeList({ commit, dispatch, getters }, data) {
if (data) { if (data) {
const { timeType, operatorId } = data; const { timeType, operateId } = data;
(timeType || timeType == 0) && (timeType || timeType == 0) &&
dispatch('updateFilters', { dispatch('updateFilters', {
timeType: timeType, timeType: timeType,
}); });
operatorId && dispatch('updateFilters', {
dispatch('updateFilters', { operateId,
operatorId, });
});
} }
let entity = getFilters(getters.filters); let entity = getFilters(getters.filters);
switch (entity.timeType) { switch (entity.timeType) {
......
...@@ -9,6 +9,7 @@ export default { ...@@ -9,6 +9,7 @@ export default {
return { return {
chart: null, chart: null,
height: 270, height: 270,
width: 0,
chartGeom: null, chartGeom: null,
}; };
}, },
...@@ -23,6 +24,7 @@ export default { ...@@ -23,6 +24,7 @@ export default {
if (innerWidth < 1600) { if (innerWidth < 1600) {
this.height = (innerHeight - 270) / 2; this.height = (innerHeight - 270) / 2;
} }
this.width = this.$el.clientWidth;
this.initData(); this.initData();
}, },
methods: { methods: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment