Commit fc2fd526 by 姜雷

修改首页活跃有数据不重刷

parent bd9ed0cb
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
<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"
@input="val => updateFilters({reportYear: val})"
type="year" type="year"
value-format="yyyy" value-format="yyyy"
placeholder="请选择" placeholder="请选择"
...@@ -15,7 +16,8 @@ ...@@ -15,7 +16,8 @@
</search-item> </search-item>
<search-item label="校区"> <search-item label="校区">
<area-select <area-select
v-model.trim="campusFilters.areaId" :value="filters.reportAreaId"
@input="val => updateFilters({reportAreaId: val})"
:accessType="isAdmin?0:1" :accessType="isAdmin?0:1"
/> />
</search-item> </search-item>
...@@ -57,6 +59,7 @@ import { mapGetters, mapActions } from 'vuex'; ...@@ -57,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',
...@@ -84,10 +87,19 @@ export default { ...@@ -84,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;
...@@ -110,22 +122,20 @@ export default { ...@@ -110,22 +122,20 @@ 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() { searchList() {
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,
}); });
}, },
}, },
......
...@@ -50,6 +50,7 @@ export default { ...@@ -50,6 +50,7 @@ export default {
position: 'top', position: 'top',
title: null, title: null,
marker: 'square', marker: 'square',
clickable: false,
}) })
.interval() .interval()
.position('month*count') .position('month*count')
......
...@@ -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,
...@@ -277,6 +281,9 @@ const mutations = { ...@@ -277,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;
}, },
}; };
......
...@@ -34,15 +34,9 @@ export default { ...@@ -34,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>
......
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