Commit 694c93d5 by 姜雷

Merge branch 'test' into 'master'

Test See merge request !133
parents 68b037d7 d2b1fd3c
...@@ -220,6 +220,12 @@ export default { ...@@ -220,6 +220,12 @@ export default {
display: none; display: none;
} }
} }
.record-List {
.record-Item {
display: inline-block;
width: 30%;
}
}
@media screen and (max-width: $bigScreenWidth) { @media screen and (max-width: $bigScreenWidth) {
.topTitle { .topTitle {
.complate-logo { .complate-logo {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
filterable filterable
:value="value" :value="value"
@change="changeHandle" @change="changeHandle"
@visible-change="resetFilterText"
:multiple="multiple" :multiple="multiple"
ref="select" ref="select"
> >
...@@ -14,6 +15,7 @@ ...@@ -14,6 +15,7 @@
<el-input <el-input
v-if="multiple" v-if="multiple"
class="out-input" class="out-input"
:value="filterText"
clearable clearable
@click.stop @click.stop
@input="debouncedQueryChange" @input="debouncedQueryChange"
...@@ -111,6 +113,9 @@ export default { ...@@ -111,6 +113,9 @@ export default {
handleQueryChange(val) { handleQueryChange(val) {
this.filterText = val; this.filterText = val;
}, },
resetFilterText(visible) {
if (!visible) this.filterText = '';
},
}, },
}; };
</script> </script>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<dashboard-area-select <dashboard-area-select
:operateId="filters.operateId" :operateId="filters.operateId"
:value="filters.areaId" :value="filters.areaId"
multiple
@input="val => updateFilters({areaId: val})" @input="val => updateFilters({areaId: val})"
/> />
</search-item> </search-item>
...@@ -114,6 +115,21 @@ export default { ...@@ -114,6 +115,21 @@ export default {
flex: 1; flex: 1;
} }
} }
.el-select {
.el-select__tags {
height: 90%;
overflow: hidden;
input {
display: none;
}
}
.el-input {
overflow: hidden;
}
.el-input__inner {
height: 100% !important;
}
}
} }
</style> </style>
...@@ -4,7 +4,7 @@ import initFiltersStore from '@/store/modules/filters'; ...@@ -4,7 +4,7 @@ import initFiltersStore from '@/store/modules/filters';
const initFilters = () => ({ const initFilters = () => ({
operateId: undefined, operateId: undefined,
areaId: undefined, areaId: [],
timeType: 0, // 0 本日,1 本月, 2 本年 timeType: 0, // 0 本日,1 本月, 2 本年
}); });
const filtersStore = initFiltersStore(initFilters); const filtersStore = initFiltersStore(initFilters);
......
<template> <template>
<div <div
class="Dashboard-Row Dashboard-DataCard" class="Dashboard-Row Dashboard-DataCard Dashboard-Register"
v-loading="loading.regist" v-loading="loading.regist"
> >
<div class="Dashboard-SearchBar"> <div class="Dashboard-SearchBar">
<search-item label="年份"> <search-item label="年份">
<el-date-picker <el-date-picker
v-model.trim="campusFilters.year" :value="filters.reportYear"
@change="changeReportYearHandle" @input="val => updateFilters({reportYear: val})"
type="year" type="year"
value-format="yyyy" value-format="yyyy"
placeholder="请选择" placeholder="请选择"
...@@ -16,11 +16,17 @@ ...@@ -16,11 +16,17 @@
</search-item> </search-item>
<search-item label="校区"> <search-item label="校区">
<area-select <area-select
v-model.trim="campusFilters.areaId" :value="filters.reportAreaId"
@input="changeReportAreaHandle" @input="val => updateFilters({reportAreaId: val})"
:accessType="isAdmin?0:1" :accessType="isAdmin?0:1"
/> />
</search-item> </search-item>
<search-item label="">
<el-button
@click="searchList"
type="primary"
>搜索</el-button>
</search-item>
</div> </div>
<div class="Dashboard-CampusData"> <div class="Dashboard-CampusData">
<div class="Dashboard-CampusItem"> <div class="Dashboard-CampusItem">
...@@ -36,10 +42,14 @@ ...@@ -36,10 +42,14 @@
</div> </div>
<RegisterByDay :data="registePerDay" /> <RegisterByDay :data="registePerDay" />
</div> </div>
</div>
<div class="Dashboard-CampusData">
<div class="Dashboard-CampusItem"> <div class="Dashboard-CampusItem">
<div class="Dashboard-title">{{ reportYear }}年每月活跃数据</div> <div class="Dashboard-title">{{ reportYear }}年每月活跃数据</div>
<ActiveUserByMonth :data="activeUser" /> <ActiveUserByMonth :data="activeUser" />
</div> </div>
<div class="Dashboard-CampusItem">
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -49,6 +59,7 @@ import { mapGetters, mapActions } from 'vuex'; ...@@ -49,6 +59,7 @@ import { mapGetters, mapActions } from 'vuex';
import RegisterByMonth from './components/RegisterByMonth'; import RegisterByMonth from './components/RegisterByMonth';
import RegisterByDay from './components/RegisterByDay'; import RegisterByDay from './components/RegisterByDay';
import ActiveUserByMonth from './components/ActiveUserByMonth'; import ActiveUserByMonth from './components/ActiveUserByMonth';
import { getFilters } from '@/utils/index';
export default { export default {
name: 'CustomerRegister', name: 'CustomerRegister',
...@@ -76,10 +87,19 @@ export default { ...@@ -76,10 +87,19 @@ export default {
'registePerMonth', 'registePerMonth',
'activeUser', 'activeUser',
'loading', 'loading',
'reportMounted',
'filters',
]), ]),
}, },
mounted() {
if (!this.reportMounted) {
this.fetchReportList({
isAdmin: this.isAdmin ? 1 : 0,
});
}
},
methods: { methods: {
...mapActions('Dashboard', ['fetchReportList']), ...mapActions('Dashboard', ['fetchReportList', 'updateFilters']),
changeReportYearHandle(val) { changeReportYearHandle(val) {
if (val) { if (val) {
let areaId = this.campusFilters.areaId; let areaId = this.campusFilters.areaId;
...@@ -102,21 +122,31 @@ export default { ...@@ -102,21 +122,31 @@ export default {
}, },
changeReportMonthHandle(month) { changeReportMonthHandle(month) {
console.log(month); console.log(month);
let year = this.campusFilters.year; let filters = getFilters(this.filters);
let areaId = this.campusFilters.areaId;
this.fetchReportList({ this.fetchReportList({
isAdmin: this.isAdmin ? 1 : 0, isAdmin: this.isAdmin ? 1 : 0,
year: year ? year : null, year: filters.reportYear ? filters.reportYear : null,
areaId: areaId ? areaId : null, areaId: filters.reportAreaId ? filters.reportAreaId : null,
month: month, month: month,
}); });
}, },
searchList() {
let filters = getFilters(this.filters);
this.fetchReportList({
isAdmin: this.isAdmin ? 1 : 0,
year: filters.reportYear ? filters.reportYear : null,
areaId: filters.reportAreaId ? filters.reportAreaId : null,
});
},
}, },
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.Dashboard { .Dashboard {
.Dashboard-Row.Dashboard-Register {
height: auto;
}
.Dashboard-DataCard { .Dashboard-DataCard {
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 8px;
......
...@@ -15,7 +15,8 @@ export default { ...@@ -15,7 +15,8 @@ export default {
serviceList: [ serviceList: [
{ value: 'monthAppActive', name: 'APP活跃用户' }, { value: 'monthAppActive', name: 'APP活跃用户' },
{ value: 'monthHardActive', name: '硬件活跃用户' }, { value: 'monthHardActive', name: '硬件活跃用户' },
{ value: 'allActive', name: '两者兼具' }, { value: 'allActive', name: '全部活跃' },
{ value: 'total', name: '全部活跃' },
], ],
}; };
}, },
...@@ -25,14 +26,12 @@ export default { ...@@ -25,14 +26,12 @@ export default {
container: 'ActiveUserByMonth', container: 'ActiveUserByMonth',
forceFit: true, forceFit: true,
height: this.height, height: this.height,
padding: [50, 40], padding: [30, 20, 30, 50],
}); });
this.chart this.chart
.source(this.data, { .source(this.data, {
month: { month: {
min: 1, type: 'cat',
max: 12,
tickCount: 12,
}, },
mark: { mark: {
type: 'cat', type: 'cat',
...@@ -51,17 +50,17 @@ export default { ...@@ -51,17 +50,17 @@ export default {
position: 'top', position: 'top',
title: null, title: null,
marker: 'square', marker: 'square',
clickable: false,
}) })
.axis('count', false) .interval()
.axis('mark', {
formatter: value => {
let service = this.serviceList.find(item => item.value === value);
return service ? `${service.name}` : '';
},
})
.intervalStack()
.position('month*count') .position('month*count')
.color('mark', ['#4e82fb', '#ffc934', '#26c9a8']); .color('mark', ['#4e82fb', '#ffc934', '#26c9a8'])
.adjust([
{
type: 'dodge',
marginRatio: 1 / 32,
},
]);
this.chart.render(); this.chart.render();
}, },
......
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
container: 'RegisterByDay', container: 'RegisterByDay',
forceFit: true, forceFit: true,
height: this.height, height: this.height,
padding: [40, 20, 30, 45], padding: [40, 20, 30, 50],
}); });
this.chart this.chart
.source(this.data, { .source(this.data, {
......
...@@ -24,20 +24,14 @@ export default { ...@@ -24,20 +24,14 @@ export default {
container: 'RegisterByMonth', container: 'RegisterByMonth',
forceFit: true, forceFit: true,
height: this.height, height: this.height,
padding: [0, 20, 30, 20], padding: [30, 20, 30, 50],
}); });
this.chart this.chart
.source(this.data, { .source(this.data, {
month: {
min: 1,
max: 12,
tickCount: 12,
},
count: { count: {
alias: '人数', alias: '人数',
}, },
}) })
.axis('count', false)
.axis('month', { .axis('month', {
label: { label: {
textStyle: { textStyle: {
...@@ -52,11 +46,14 @@ export default { ...@@ -52,11 +46,14 @@ 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); this.chart.on('plotclick', this.clickHandle);
}, },
clickHandle(ev) { clickHandle(ev) {
let data = ev.data._origin; let records = this.chart.getSnapRecords({ x: ev.x, y: ev.y });
if (records && records.length) {
let data = records[0]._origin;
this.changeReportMonthHandle(data.month); this.changeReportMonthHandle(data.month);
}
}, },
}, },
}; };
......
...@@ -26,6 +26,8 @@ const initFilters = () => ({ ...@@ -26,6 +26,8 @@ const initFilters = () => ({
operateId: undefined, operateId: undefined,
choiceareaIds: [], choiceareaIds: [],
timeType: 0, // 0 本日,1 本月, 2 本年 timeType: 0, // 0 本日,1 本月, 2 本年
reportYear: '',
reportAreaId: undefined,
}); });
const filtersStore = initFiltersStore(initFilters); const filtersStore = initFiltersStore(initFilters);
const nowTime = new Date(); const nowTime = new Date();
...@@ -51,6 +53,7 @@ const state = () => ({ ...@@ -51,6 +53,7 @@ const state = () => ({
percentList: [], percentList: [],
}, },
report: { report: {
mounted: false,
year: new Date().getFullYear(), year: new Date().getFullYear(),
month: new Date().getMonth() + 1, month: new Date().getMonth() + 1,
registePerDay: [], registePerDay: [],
...@@ -65,6 +68,7 @@ const state = () => ({ ...@@ -65,6 +68,7 @@ const state = () => ({
}); });
const getters = { const getters = {
reportMounted: state => state.report.mounted,
reportYear: state => state.report.year, reportYear: state => state.report.year,
reportMonth: state => state.report.month, reportMonth: state => state.report.month,
registePerDay: state => state.report.registePerDay, registePerDay: state => state.report.registePerDay,
...@@ -210,6 +214,7 @@ const mutations = { ...@@ -210,6 +214,7 @@ const mutations = {
[GET_REPORT_DATA]: (state, data) => { [GET_REPORT_DATA]: (state, data) => {
state.report.year = data.year; state.report.year = data.year;
state.report.month = data.month; state.report.month = data.month;
let dayList = new Array(31).fill({ count: 0 }); let dayList = new Array(31).fill({ count: 0 });
dayList = dayList.map((v, idx) => ({ ...v, days: idx + 1 })); dayList = dayList.map((v, idx) => ({ ...v, days: idx + 1 }));
data.dayVos.map(val => { data.dayVos.map(val => {
...@@ -217,8 +222,40 @@ const mutations = { ...@@ -217,8 +222,40 @@ const mutations = {
dayList[idx].count = val.count; dayList[idx].count = val.count;
}); });
state.report.registePerDay = dayList; state.report.registePerDay = dayList;
state.report.registePerMonth = data.list;
state.report.activeUser = data.listCount; let registerList = new Array(12)
.fill({ count: 0, mark: null })
.map((v, idx) => ({ ...v, month: (idx + 1).toString() }));
data.list.map(val => {
let idx = val.month - 1;
registerList[idx].count += val.count;
});
state.report.registePerMonth = registerList;
let activeList = new Array(12)
.fill({ count: 0, mark: 'allActive' })
.map((v, idx) => ({ ...v, month: (idx + 1).toString() }));
let activeAppList = new Array(12)
.fill({ count: 0, mark: 'monthAppActive' })
.map((v, idx) => ({ ...v, month: (idx + 1).toString() }));
let activeDeviceList = new Array(12)
.fill({ count: 0, mark: 'monthHardActive' })
.map((v, idx) => ({ ...v, month: (idx + 1).toString() }));
data.listCount.map(val => {
let idx = val.month - 1;
if (val.mark === 'allActive') {
activeList[idx].count += val.count;
}
if (val.mark === 'monthAppActive') {
activeAppList[idx].count += val.count;
}
if (val.mark === 'monthHardActive') {
activeDeviceList[idx].count += val.count;
}
});
activeList.push.apply(activeList, activeAppList);
activeList.push.apply(activeList, activeDeviceList);
state.report.activeUser = activeList;
}, },
[GET_TITLE_DATA](state, data) { [GET_TITLE_DATA](state, data) {
state.title = data; state.title = data;
...@@ -244,6 +281,9 @@ const mutations = { ...@@ -244,6 +281,9 @@ const mutations = {
state.loading.equipment = fetching; state.loading.equipment = fetching;
}, },
[LOADING_REGIST](state, fetching) { [LOADING_REGIST](state, fetching) {
if (fetching) {
state.report.mounted = true;
}
state.loading.regist = fetching; state.loading.regist = fetching;
}, },
}; };
......
...@@ -168,6 +168,7 @@ export default { ...@@ -168,6 +168,7 @@ export default {
this.SelectedDataIndex = data; this.SelectedDataIndex = data;
this.chartGeom.setSelected(data); this.chartGeom.setSelected(data);
this.changeSelected(data); this.changeSelected(data);
this.changeServiceHandle(data);
} }
}, },
changeSelected(data) { changeSelected(data) {
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<div class="Dashboard Home-Dashboard"> <div class="Dashboard Home-Dashboard">
<CustomerRegister <CustomerRegister
v-if="show" v-if="show"
class="Dashboard-Row Dashboard-DataCard"
:isAdmin="isAdmin" :isAdmin="isAdmin"
/> />
</div> </div>
...@@ -35,15 +34,9 @@ export default { ...@@ -35,15 +34,9 @@ export default {
item => item.menuCode === process.env.VUE_APP_REGISTER_DASHBOARD_CODE item => item.menuCode === process.env.VUE_APP_REGISTER_DASHBOARD_CODE
); );
if (item) { if (item) {
this.fetchReportList({
isAdmin: this.isAdmin ? 1 : 0,
});
this.show = true; this.show = true;
} }
}, },
methods: {
...mapActions('Dashboard', ['fetchReportList']),
},
}; };
</script> </script>
......
...@@ -115,6 +115,11 @@ export default { ...@@ -115,6 +115,11 @@ export default {
this.style = 'left: 0;'; this.style = 'left: 0;';
} }
}, },
watch: {
$route() {
this.toggleSubmenus(false);
},
},
methods: { methods: {
toggleSubmenus(visiable) { toggleSubmenus(visiable) {
this.showSubMenus = visiable; this.showSubMenus = visiable;
......
...@@ -63,8 +63,10 @@ const configRoutePermission = ( ...@@ -63,8 +63,10 @@ const configRoutePermission = (
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
next(); next();
} else { } else {
next('/login'); store.dispatch('FedLogOut').then(() => {
next({ path: '/login' });
NProgress.done(); NProgress.done();
});
} }
} }
}); });
......
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