Commit 26b6ab05 by 姜雷

修改数据首页

parent 982d08cb
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
:routers="allRoutes" :routers="allRoutes"
:dashboardVisiable="dashboardVisiable" :dashboardVisiable="dashboardVisiable"
:toggleFastLink="toggleFastLink" :toggleFastLink="toggleFastLink"
:selectRouteMenu="selectRouteMenu"
/> />
</div> </div>
<template v-if="dashboardVisiable"> <template v-if="dashboardVisiable">
...@@ -25,6 +26,10 @@ ...@@ -25,6 +26,10 @@
:routers="route" :routers="route"
/> />
<sidebar-nav <sidebar-nav
v-else-if="showSelected"
:routers="selectedRoute"
/>
<sidebar-nav
v-else v-else
:routers="route" :routers="route"
/> />
...@@ -63,9 +68,11 @@ export default { ...@@ -63,9 +68,11 @@ export default {
}, },
data() { data() {
return { return {
selectedRoute: [],
routerDone: false, routerDone: false,
isInnerPage: true, isInnerPage: true,
showFastLink: false, showFastLink: false,
showSelected: false,
}; };
}, },
computed: { computed: {
...@@ -104,7 +111,20 @@ export default { ...@@ -104,7 +111,20 @@ export default {
} }
}, },
toggleFastLink(entity) { toggleFastLink(entity) {
this.showFastLink = entity; if (entity) {
this.$router.push({
path: '/',
});
this.showFastLink = entity;
} else {
this.showFastLink = entity;
this.showSelected = false;
}
},
selectRouteMenu(routes) {
this.selectedRoute = routes;
this.showSelected = true;
this.showFastLink = false;
}, },
}, },
}; };
......
...@@ -45,8 +45,9 @@ export default { ...@@ -45,8 +45,9 @@ export default {
...mapGetters('Dashboard', ['campusRankList', 'filters']), ...mapGetters('Dashboard', ['campusRankList', 'filters']),
}, },
methods: { methods: {
...mapActions('Dashboard', ['fetchConsumeList']), ...mapActions('Dashboard', ['fetchConsumeList', 'updateCampusName']),
changeCampusHandle(data) { changeCampusHandle(data) {
this.updateCampusName(data.areaName);
this.fetchConsumeList({ this.fetchConsumeList({
areaId: data.areaId, areaId: data.areaId,
updatePercentList: true, updatePercentList: true,
......
...@@ -31,7 +31,6 @@ export default { ...@@ -31,7 +31,6 @@ export default {
this.initChart(); this.initChart();
}, },
methods: { methods: {
...mapActions('Dashboard', ['updateCampusName']),
initChart() { initChart() {
this.chart = new G2.Chart({ this.chart = new G2.Chart({
container: 'CampusRank', container: 'CampusRank',
...@@ -129,14 +128,10 @@ export default { ...@@ -129,14 +128,10 @@ export default {
if (this.data.length) { if (this.data.length) {
this.totle = this.data.reduce((count, item) => count + item.count, 0); this.totle = this.data.reduce((count, item) => count + item.count, 0);
let data = this.SelectedDataIndex; let data = this.SelectedDataIndex;
if (data) {
this.changeSelected(data); this.chartGeom.setSelected(this.data[0]);
this.chartGeom.setSelected(data); this.changeSelected(this.data[0]);
} else { this.SelectedDataIndex = this.data[0];
this.chartGeom.setSelected(this.data[0]);
this.changeSelected(this.data[0]);
this.SelectedDataIndex = this.data[0];
}
} }
}, },
clickHandle(ev) { clickHandle(ev) {
...@@ -144,11 +139,12 @@ export default { ...@@ -144,11 +139,12 @@ export default {
if (this.SelectedDataIndex.areaId !== data.areaId) { if (this.SelectedDataIndex.areaId !== data.areaId) {
this.SelectedDataIndex = data; this.SelectedDataIndex = data;
this.changeSelected(data); this.changeSelected(data);
this.changeCampusHandle(data); if (data.areaId) {
this.changeCampusHandle(data);
}
} }
}, },
changeSelected(data) { changeSelected(data) {
this.updateCampusName(data.areaName);
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) {
......
...@@ -121,7 +121,6 @@ export default { ...@@ -121,7 +121,6 @@ export default {
}, },
initSlider() { initSlider() {
const wrapDom = document.getElementById('CustomerRechangeChart'); const wrapDom = document.getElementById('CustomerRechangeChart');
console.log(wrapDom.clientHeight);
let height = wrapDom.clientHeight; let height = wrapDom.clientHeight;
// const arrLength = this.data.length; // const arrLength = this.data.length;
...@@ -154,6 +153,9 @@ export default { ...@@ -154,6 +153,9 @@ export default {
this.slider.render(); // 渲染 this.slider.render(); // 渲染
}, },
updateSlider() { updateSlider() {
const wrapDom = document.getElementById('CustomerRechangeChart');
let height = wrapDom.clientHeight;
let dom = this.sliderDom; let dom = this.sliderDom;
dom.innerHTML = ''; dom.innerHTML = '';
const arrLength = this.data.length; const arrLength = this.data.length;
...@@ -162,7 +164,7 @@ export default { ...@@ -162,7 +164,7 @@ export default {
this.slider = new Slider({ this.slider = new Slider({
container: this.sliderDom, container: this.sliderDom,
width: 26, width: 26,
height: 300, height: height,
xAxis: 'value', xAxis: 'value',
yAxis: 'areaName', yAxis: 'areaName',
startRadio: this.ds.state.startRadio, startRadio: this.ds.state.startRadio,
......
...@@ -22,7 +22,10 @@ ...@@ -22,7 +22,10 @@
<div class="Dashboard-CampusData"> <div class="Dashboard-CampusData">
<div class="Dashboard-CampusItem"> <div class="Dashboard-CampusItem">
<div class="Dashboard-title">{{ reportYear }}年每月注册数据</div> <div class="Dashboard-title">{{ reportYear }}年每月注册数据</div>
<RegisterByMonth :data="registePerMonth"></RegisterByMonth> <RegisterByMonth
:data="registePerMonth"
:changeReportMonthHandle="changeReportMonthHandle"
/>
</div> </div>
<div class="Dashboard-CampusItem"> <div class="Dashboard-CampusItem">
<div class="Dashboard-title"> <div class="Dashboard-title">
...@@ -88,6 +91,16 @@ export default { ...@@ -88,6 +91,16 @@ export default {
}); });
} }
}, },
changeReportMonthHandle(month) {
console.log(month);
let year = this.campusFilters.year;
let areaId = this.campusFilters.areaId;
this.fetchReportList({
year: year ? year : null,
areaId: areaId ? areaId : null,
month: month,
});
},
}, },
}; };
</script> </script>
...@@ -7,6 +7,11 @@ import chartMixin from '../../chartMixin'; ...@@ -7,6 +7,11 @@ import chartMixin from '../../chartMixin';
export default { export default {
name: 'RegisterByMonth', name: 'RegisterByMonth',
props: {
changeReportMonthHandle: {
type: Function,
},
},
mixins: [chartMixin], mixins: [chartMixin],
data() { data() {
return { return {
...@@ -47,6 +52,11 @@ export default { ...@@ -47,6 +52,11 @@ export default {
.position('month*count') .position('month*count')
.color('#4e82fb'); .color('#4e82fb');
this.chart.render(); this.chart.render();
this.chart.on('interval:click', this.clickHandle);
},
clickHandle(ev) {
let data = ev.data._origin;
this.changeReportMonthHandle(data.month);
}, },
}, },
}; };
......
...@@ -85,6 +85,9 @@ const actions = { ...@@ -85,6 +85,9 @@ const actions = {
entity.date = formatDate(nowTime, 'yyyy-MM-dd'); entity.date = formatDate(nowTime, 'yyyy-MM-dd');
break; break;
} }
if (data && data.areaId) {
entity.areaId = data.areaId;
}
return fetchConsumeList({ return fetchConsumeList({
data: { data: {
...entity, ...entity,
...@@ -131,7 +134,22 @@ const mutations = { ...@@ -131,7 +134,22 @@ const mutations = {
state.consume.consumeAfterVos = data.consumeAfterVos state.consume.consumeAfterVos = data.consumeAfterVos
? data.consumeAfterVos ? data.consumeAfterVos
: []; : [];
state.consume.list = data.list ? data.list : []; let campusList = data.list ? data.list : [];
if (campusList.length > 2) {
let arrStart = campusList.slice(0, 2);
let arrEnd = campusList.slice(2).reduce(
(item, curentVal) => ({
...item,
count: item.count + curentVal.count,
}),
{
areaName: '其他校区',
count: 0,
}
);
campusList = [...arrStart, arrEnd];
}
state.consume.list = campusList;
state.consume.percentList = data.percentList ? data.percentList : []; state.consume.percentList = data.percentList ? data.percentList : [];
}, },
[GET_PERCENT_DATA]: (state, data) => { [GET_PERCENT_DATA]: (state, data) => {
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
v-if="customerManage && customerManage.length" v-if="customerManage && customerManage.length"
menuName="会员管理" menuName="会员管理"
:menuList="customerManage[0].children" :menuList="customerManage[0].children"
:selectRouteMenu="selectRouteMenu"
> >
<img <img
slot="icon" slot="icon"
...@@ -32,6 +33,7 @@ ...@@ -32,6 +33,7 @@
v-if="baseManage && baseManage.length" v-if="baseManage && baseManage.length"
menuName="基础数据" menuName="基础数据"
:menuList="baseManage[0].children" :menuList="baseManage[0].children"
:selectRouteMenu="selectRouteMenu"
> >
<img <img
slot="icon" slot="icon"
...@@ -48,6 +50,7 @@ ...@@ -48,6 +50,7 @@
v-if="systemManage && systemManage.length" v-if="systemManage && systemManage.length"
menuName="系统管理" menuName="系统管理"
:menuList="systemManage[0].children" :menuList="systemManage[0].children"
:selectRouteMenu="selectRouteMenu"
> >
<img <img
slot="icon" slot="icon"
...@@ -110,6 +113,9 @@ export default { ...@@ -110,6 +113,9 @@ export default {
toggleFastLink: { toggleFastLink: {
type: Function, type: Function,
}, },
selectRouteMenu: {
type: Function,
},
}, },
data() { data() {
return { return {
......
...@@ -5,13 +5,16 @@ ...@@ -5,13 +5,16 @@
@mouseenter="toggleSubmenus" @mouseenter="toggleSubmenus"
@mouseleave="toggleSubmenus" @mouseleave="toggleSubmenus"
> >
<div class="IconMenus"> <div
<div class="IconMenus-icon"> class="IconMenu"
@click="selectHandle"
>
<div class="IconMenu-icon">
<slot name="icon"> <slot name="icon">
<img src="@/assets/images/layout/icon_huiyuanguanli@2x.png" /> <img src="@/assets/images/layout/icon_huiyuanguanli@2x.png" />
</slot> </slot>
</div> </div>
<div class="IconMenus-name">{{ menuName }}</div> <div class="IconMenu-name">{{ menuName }}</div>
</div> </div>
<div <div
:class="`SubmenuBox ${showSubMenus?'show':''}`" :class="`SubmenuBox ${showSubMenus?'show':''}`"
...@@ -67,6 +70,9 @@ export default { ...@@ -67,6 +70,9 @@ export default {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
selectRouteMenu: {
type: Function,
},
}, },
data() { data() {
return { return {
...@@ -89,6 +95,11 @@ export default { ...@@ -89,6 +95,11 @@ export default {
toggleSubmenus() { toggleSubmenus() {
this.showSubMenus = !this.showSubMenus; this.showSubMenus = !this.showSubMenus;
}, },
selectHandle() {
if (typeof this.selectRouteMenu === 'function') {
this.selectRouteMenu(this.menuList);
}
},
}, },
}; };
</script> </script>
...@@ -104,7 +115,7 @@ export default { ...@@ -104,7 +115,7 @@ export default {
&:hover { &:hover {
background-color: #68aaff; background-color: #68aaff;
} }
.IconMenus { .IconMenu {
display: flex; display: flex;
width: 100%; width: 100%;
height: 100%; height: 100%;
...@@ -112,12 +123,12 @@ export default { ...@@ -112,12 +123,12 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
.IconMenus-icon { .IconMenu-icon {
width: 17px; width: 17px;
height: 17px; height: 17px;
margin-bottom: 5px; margin-bottom: 5px;
} }
.IconMenus-name { .IconMenu-name {
font-size: 14px; font-size: 14px;
} }
} }
...@@ -176,13 +187,13 @@ export default { ...@@ -176,13 +187,13 @@ export default {
.MenuItem { .MenuItem {
width: 112px; width: 112px;
height: 80px; height: 80px;
.IconMenus { .IconMenu {
.IconMenus-icon { .IconMenu-icon {
width: 34px; width: 34px;
height: 34px; height: 34px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.IconMenus-name { .IconMenu-name {
font-size: 18px; font-size: 18px;
} }
} }
......
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