Commit dca6ad7b by 姜雷

修改首页活跃展示

parent 1581c9b5
<template> <template>
<div <div class="Dashboard-Row Dashboard-DataCard Dashboard-Register">
class="Dashboard-Row Dashboard-DataCard Dashboard-Register"
v-loading="loading.regist"
>
<div class="Dashboard-SearchBar"> <div class="Dashboard-SearchBar">
<search-item label="年份"> <search-item label="年份">
<el-date-picker <el-date-picker
...@@ -23,20 +20,29 @@ ...@@ -23,20 +20,29 @@
</search-item> </search-item>
<search-item label=""> <search-item label="">
<el-button <el-button
:loading="loading.regist"
@click="searchList" @click="searchList"
type="primary" type="primary"
>搜索</el-button> >搜索</el-button>
</search-item> </search-item>
</div> </div>
<div class="Dashboard-CampusData"> <div class="Dashboard-CampusData">
<div class="Dashboard-CampusItem"> <div
class="Dashboard-CampusItem"
v-loading="loading.regist"
>
<div class="Dashboard-title">{{ reportYear }}年每月注册数据</div> <div class="Dashboard-title">{{ reportYear }}年每月注册数据</div>
<RegisterByMonth <RegisterByMonth
:data="registePerMonth" :data="registePerMonth"
:changeReportMonthHandle="changeReportMonthHandle" :changeReportMonthHandle="changeReportMonthHandle"
/> />
</div> </div>
<div class="Dashboard-CampusItem"> </div>
<div class="Dashboard-CampusData">
<div
class="Dashboard-CampusItem"
v-loading="loading.regist || loading.registByDay"
>
<div class="Dashboard-title"> <div class="Dashboard-title">
{{ reportYear }}{{ reportMonth }}月注册数据 {{ reportYear }}{{ reportMonth }}月注册数据
</div> </div>
...@@ -44,12 +50,13 @@ ...@@ -44,12 +50,13 @@
</div> </div>
</div> </div>
<div class="Dashboard-CampusData"> <div class="Dashboard-CampusData">
<div class="Dashboard-CampusItem"> <div
class="Dashboard-CampusItem"
v-loading="loading.regist"
>
<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>
...@@ -122,20 +129,15 @@ export default { ...@@ -122,20 +129,15 @@ export default {
}, },
changeReportMonthHandle(month) { changeReportMonthHandle(month) {
console.log(month); console.log(month);
let filters = getFilters(this.filters);
this.fetchReportList({ this.fetchReportList({
isAdmin: this.isAdmin ? 1 : 0, isAdmin: this.isAdmin ? 1 : 0,
year: filters.reportYear ? filters.reportYear : null,
areaId: filters.reportAreaId ? filters.reportAreaId : null,
month: month, month: month,
updateRegisteByDay: true,
}); });
}, },
searchList() { searchList() {
let filters = getFilters(this.filters);
this.fetchReportList({ this.fetchReportList({
isAdmin: this.isAdmin ? 1 : 0, isAdmin: this.isAdmin ? 1 : 0,
year: filters.reportYear ? filters.reportYear : null,
areaId: filters.reportAreaId ? filters.reportAreaId : null,
}); });
}, },
}, },
......
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
}) })
.line() .line()
.position('days*count'); .position('days*count');
this.chart.area().position('days*count'); this.chart.line().position('days*count');
this.chart.render(); this.chart.render();
}, },
}, },
......
...@@ -44,7 +44,11 @@ export default { ...@@ -44,7 +44,11 @@ export default {
}) })
.interval() .interval()
.position('month*count') .position('month*count')
.color('#4e82fb'); .color('#4e82fb')
.label('count', {
// position: 'middle',
offset: 10,
});
this.chart.render(); this.chart.render();
this.chart.on('plotclick', this.clickHandle); this.chart.on('plotclick', this.clickHandle);
}, },
......
...@@ -21,12 +21,13 @@ const LOADING_AREA = 'LOADING_AREA'; ...@@ -21,12 +21,13 @@ const LOADING_AREA = 'LOADING_AREA';
const LOADING_SERVICE = 'LOADING_SERVICE'; const LOADING_SERVICE = 'LOADING_SERVICE';
const LOADING_EQUIPMENT = 'LOADING_EQUIPMENT'; const LOADING_EQUIPMENT = 'LOADING_EQUIPMENT';
const LOADING_REGIST = 'LOADING_REGIST'; const LOADING_REGIST = 'LOADING_REGIST';
const LOADING_REGIST_BY_DAY = 'LOADING_REGIST_BY_DAY';
const initFilters = () => ({ const initFilters = () => ({
operateId: undefined, operateId: undefined,
choiceareaIds: [], choiceareaIds: [],
timeType: 0, // 0 本日,1 本月, 2 本年 timeType: 0, // 0 本日,1 本月, 2 本年
reportYear: '', reportYear: new Date().getFullYear().toString(),
reportAreaId: undefined, reportAreaId: undefined,
}); });
const filtersStore = initFiltersStore(initFilters); const filtersStore = initFiltersStore(initFilters);
...@@ -38,6 +39,7 @@ const state = () => ({ ...@@ -38,6 +39,7 @@ const state = () => ({
service: false, service: false,
equipment: false, equipment: false,
regist: false, regist: false,
registByDay: false,
}, },
consume: { consume: {
areaInfo: { areaInfo: {
...@@ -154,8 +156,19 @@ const actions = { ...@@ -154,8 +156,19 @@ const actions = {
commit(LOADING_AREA, false); commit(LOADING_AREA, false);
}); });
}, },
fetchReportList({ commit }, entity) { fetchReportList({ commit, getters }, entity) {
let filters = getFilters(getters.filters);
if (filters.reportYear) {
entity.year = filters.reportYear;
}
if (filters.reportAreaId) {
entity.year = filters.reportAreaId;
}
if (entity && entity.updateRegisteByDay) {
commit(LOADING_REGIST_BY_DAY, true);
} else {
commit(LOADING_REGIST, true); commit(LOADING_REGIST, true);
}
return fetchReportList({ return fetchReportList({
params: { params: {
...entity, ...entity,
...@@ -164,11 +177,19 @@ const actions = { ...@@ -164,11 +177,19 @@ const actions = {
.then(res => { .then(res => {
let list = res.data; let list = res.data;
commit(GET_REPORT_DATA, list); commit(GET_REPORT_DATA, list);
if (entity && entity.updateRegisteByDay) {
commit(LOADING_REGIST_BY_DAY, false);
} else {
commit(LOADING_REGIST, false); commit(LOADING_REGIST, false);
}
}) })
.catch(err => { .catch(err => {
console.error(err); console.error(err);
if (entity && entity.updateRegisteByDay) {
commit(LOADING_REGIST_BY_DAY, false);
} else {
commit(LOADING_REGIST, false); commit(LOADING_REGIST, false);
}
}); });
}, },
fetchTitleList({ commit }) { fetchTitleList({ commit }) {
...@@ -286,6 +307,9 @@ const mutations = { ...@@ -286,6 +307,9 @@ const mutations = {
} }
state.loading.regist = fetching; state.loading.regist = fetching;
}, },
[LOADING_REGIST_BY_DAY](state, fetching) {
state.loading.registByDay = fetching;
},
}; };
export default { export default {
......
...@@ -42,7 +42,6 @@ export default { ...@@ -42,7 +42,6 @@ export default {
<style lang="scss"> <style lang="scss">
.Home-Dashboard.Dashboard { .Home-Dashboard.Dashboard {
padding: 22px 34px 0; padding: 22px 34px;
overflow-y: hidden;
} }
</style> </style>
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