Commit dd4de0d9 by 姜雷

Merge branch 'develop' into 'test'

添加数据首页载入效果 See merge request !17
parents ea40a82c c47641bb
<template> <template>
<div class="Dashboard-DataCard"> <div
class="Dashboard-DataCard"
v-loading="loading.area"
>
<div class="Dashboard-SearchBar"> <div class="Dashboard-SearchBar">
<search-item label="运营商"> <search-item label="运营商">
<operator-select <operator-select
...@@ -44,7 +47,12 @@ export default { ...@@ -44,7 +47,12 @@ export default {
name: 'CampusRank', name: 'CampusRank',
components: { CampusRankChart }, components: { CampusRankChart },
computed: { computed: {
...mapGetters('Dashboard', ['campusRankList', 'filters', 'areaName']), ...mapGetters('Dashboard', [
'campusRankList',
'filters',
'areaName',
'loading',
]),
}, },
methods: { methods: {
...mapActions('Dashboard', [ ...mapActions('Dashboard', [
......
<template> <template>
<div class="Dashboard-DataCard CustomerConsumption"> <div
class="Dashboard-DataCard CustomerConsumption"
v-loading="loading"
>
<div class="Dashboard-SearchBar"> <div class="Dashboard-SearchBar">
<search-item label="运营商"> <search-item label="运营商">
<operator-select <operator-select
...@@ -70,6 +73,7 @@ export default { ...@@ -70,6 +73,7 @@ export default {
'consumeList', 'consumeList',
'consumeCount', 'consumeCount',
'filters', 'filters',
'loading',
]), ]),
}, },
created() { created() {
......
...@@ -2,6 +2,7 @@ import { getConsumeOrderList } from '@/api/dashboard/dashboard'; ...@@ -2,6 +2,7 @@ import { getConsumeOrderList } from '@/api/dashboard/dashboard';
import initFiltersStore from '@/store/modules/filters'; import initFiltersStore from '@/store/modules/filters';
import { getFilters, formatDate } from '@/utils/index'; import { getFilters, formatDate } from '@/utils/index';
const FETCH_CONSUME_LIST = 'FETCH_CONSUME_LIST'; const FETCH_CONSUME_LIST = 'FETCH_CONSUME_LIST';
const FETCH_DATA = 'FETCH_DATA';
const initFilters = () => ({ const initFilters = () => ({
operateId: undefined, operateId: undefined,
...@@ -12,6 +13,7 @@ const filtersStore = initFiltersStore(initFilters); ...@@ -12,6 +13,7 @@ const filtersStore = initFiltersStore(initFilters);
const nowTime = new Date(); const nowTime = new Date();
const state = () => ({ const state = () => ({
loading: false,
list: [], list: [],
consumeCountVo: { consumeCountVo: {
payMen: 0, payMen: 0,
...@@ -22,10 +24,12 @@ const state = () => ({ ...@@ -22,10 +24,12 @@ const state = () => ({
const getters = { const getters = {
consumeList: state => state.list, consumeList: state => state.list,
consumeCount: state => state.consumeCountVo, consumeCount: state => state.consumeCountVo,
loading: state => state.loading,
}; };
const actions = { const actions = {
getConsumeOrderList({ commit, getters, dispatch }, data) { getConsumeOrderList({ commit, getters, dispatch }, data) {
commit(FETCH_DATA, true);
if (data) { if (data) {
dispatch('updateFilters', data); dispatch('updateFilters', data);
} }
...@@ -48,6 +52,7 @@ const actions = { ...@@ -48,6 +52,7 @@ const actions = {
.then(res => { .then(res => {
const { data, consumeCountVo } = res; const { data, consumeCountVo } = res;
commit(FETCH_CONSUME_LIST, { list: data, consumeCountVo }); commit(FETCH_CONSUME_LIST, { list: data, consumeCountVo });
commit(FETCH_DATA, false);
}) })
.catch(err => { .catch(err => {
console.error(err); console.error(err);
...@@ -60,6 +65,9 @@ const mutations = { ...@@ -60,6 +65,9 @@ const mutations = {
state.list = data.list; state.list = data.list;
state.consumeCountVo = data.consumeCountVo; state.consumeCountVo = data.consumeCountVo;
}, },
[FETCH_DATA](state, fetching) {
state.loading = fetching;
},
}; };
export default { export default {
......
<template> <template>
<div class="Dashboard-DataCard CustomerRecharge"> <div
class="Dashboard-DataCard CustomerRecharge"
v-loading="loading"
>
<div class="Dashboard-SearchBar"> <div class="Dashboard-SearchBar">
<search-item label="运营商"> <search-item label="运营商">
<operator-select <operator-select
...@@ -59,6 +62,7 @@ export default { ...@@ -59,6 +62,7 @@ export default {
'rechargeList', 'rechargeList',
'rechargeCount', 'rechargeCount',
'filters', 'filters',
'loading',
]), ]),
}, },
created() { created() {
......
...@@ -2,6 +2,7 @@ import { getRechargeOrderList } from '@/api/dashboard/dashboard'; ...@@ -2,6 +2,7 @@ import { getRechargeOrderList } from '@/api/dashboard/dashboard';
import initFiltersStore from '@/store/modules/filters'; import initFiltersStore from '@/store/modules/filters';
import { getFilters, formatDate } from '@/utils'; import { getFilters, formatDate } from '@/utils';
const FETCH_RECHARGE_LIST = 'FETCH_RECHARGE_LIST'; const FETCH_RECHARGE_LIST = 'FETCH_RECHARGE_LIST';
const FETCH_DATA = 'FETCH_DATA';
const initFilters = () => ({ const initFilters = () => ({
operateId: undefined, operateId: undefined,
...@@ -11,6 +12,7 @@ const filtersStore = initFiltersStore(initFilters); ...@@ -11,6 +12,7 @@ const filtersStore = initFiltersStore(initFilters);
const nowTime = new Date(); const nowTime = new Date();
const state = () => ({ const state = () => ({
loading: false,
list: [], list: [],
rechargeOrderCountVo: { rechargeOrderCountVo: {
rechargeMen: 0, rechargeMen: 0,
...@@ -21,10 +23,12 @@ const state = () => ({ ...@@ -21,10 +23,12 @@ const state = () => ({
const getters = { const getters = {
rechargeList: state => state.list, rechargeList: state => state.list,
rechargeCount: state => state.rechargeOrderCountVo, rechargeCount: state => state.rechargeOrderCountVo,
loading: state => state.loading,
}; };
const actions = { const actions = {
getRechargeOrderList({ commit, getters, dispatch }, data) { getRechargeOrderList({ commit, getters, dispatch }, data) {
commit(FETCH_DATA, true);
if (data) { if (data) {
dispatch('updateFilters', data); dispatch('updateFilters', data);
} }
...@@ -46,6 +50,7 @@ const actions = { ...@@ -46,6 +50,7 @@ const actions = {
}) })
.then(res => { .then(res => {
const { data, rechargeOrderCountVo } = res; const { data, rechargeOrderCountVo } = res;
commit(FETCH_DATA, false);
commit(FETCH_RECHARGE_LIST, { list: data, rechargeOrderCountVo }); commit(FETCH_RECHARGE_LIST, { list: data, rechargeOrderCountVo });
}) })
.catch(err => { .catch(err => {
...@@ -59,6 +64,9 @@ const mutations = { ...@@ -59,6 +64,9 @@ const mutations = {
state.list = data.list; state.list = data.list;
state.rechargeOrderCountVo = data.rechargeOrderCountVo; state.rechargeOrderCountVo = data.rechargeOrderCountVo;
}, },
[FETCH_DATA](state, fetching) {
state.loading = fetching;
},
}; };
export default { export default {
......
<template> <template>
<div class="Dashboard-Row Dashboard-DataCard"> <div
class="Dashboard-Row Dashboard-DataCard"
v-loading="loading.regist"
>
<div class="Dashboard-SearchBar"> <div class="Dashboard-SearchBar">
<search-item label="年份"> <search-item label="年份">
<el-date-picker <el-date-picker
...@@ -69,6 +72,7 @@ export default { ...@@ -69,6 +72,7 @@ export default {
'registePerDay', 'registePerDay',
'registePerMonth', 'registePerMonth',
'activeUser', 'activeUser',
'loading',
]), ]),
}, },
methods: { methods: {
......
...@@ -35,6 +35,7 @@ export default { ...@@ -35,6 +35,7 @@ export default {
tickCount: 12, tickCount: 12,
}, },
mark: { mark: {
type: 'cat',
formatter: value => { formatter: value => {
let service = this.serviceList.find(item => item.value === value); let service = this.serviceList.find(item => item.value === value);
return service ? service.name : ''; return service ? service.name : '';
......
...@@ -15,6 +15,10 @@ const GET_TITLE_DATA = 'GET_TITLE_DATA'; ...@@ -15,6 +15,10 @@ const GET_TITLE_DATA = 'GET_TITLE_DATA';
const GET_PERCENT_DATA = 'GET_PERCENT_DATA'; const GET_PERCENT_DATA = 'GET_PERCENT_DATA';
const GET_EUIPMENT_DATA = 'GET_EUIPMENT_DATA'; const GET_EUIPMENT_DATA = 'GET_EUIPMENT_DATA';
const GET_CAMPUS_DATA = 'GET_CAMPUS_DATA'; const GET_CAMPUS_DATA = 'GET_CAMPUS_DATA';
const LOADING_AREA = 'LOADING_AREA';
const LOADING_SERVICE = 'LOADING_SERVICE';
const LOADING_EQUIPMENT = 'LOADING_EQUIPMENT';
const LOADING_REGIST = 'LOADING_REGIST';
const initFilters = () => ({ const initFilters = () => ({
operateId: undefined, operateId: undefined,
...@@ -24,6 +28,12 @@ const filtersStore = initFiltersStore(initFilters); ...@@ -24,6 +28,12 @@ const filtersStore = initFiltersStore(initFilters);
const nowTime = new Date(); const nowTime = new Date();
const state = () => ({ const state = () => ({
loading: {
area: false,
service: false,
equipment: false,
regist: false,
},
consume: { consume: {
areaName: '', areaName: '',
consumeAfterVos: [], consumeAfterVos: [],
...@@ -57,6 +67,7 @@ const getters = { ...@@ -57,6 +67,7 @@ const getters = {
consumeHardVos: state => state.consume.consumeHardVos, consumeHardVos: state => state.consume.consumeHardVos,
campusRankList: state => state.consume.list, campusRankList: state => state.consume.list,
seviceRatioList: state => state.consume.percentList, seviceRatioList: state => state.consume.percentList,
loading: state => state.loading,
}; };
const actions = { const actions = {
...@@ -76,10 +87,14 @@ const actions = { ...@@ -76,10 +87,14 @@ const actions = {
} }
if (data && data.updatePercentList) { if (data && data.updatePercentList) {
entity.areaId = data.areaId; entity.areaId = data.areaId;
} commit(LOADING_SERVICE, true);
if (data && data.updateEuipmentList) { } else if (data && data.updateEuipmentList) {
entity.serviceId = data.serviceId; entity.serviceId = data.serviceId;
commit(LOADING_EQUIPMENT, true);
} else {
commit(LOADING_AREA, true);
} }
return fetchConsumeList({ return fetchConsumeList({
data: { data: {
...entity, ...entity,
...@@ -89,23 +104,31 @@ const actions = { ...@@ -89,23 +104,31 @@ const actions = {
if (data && data.updatePercentList) { if (data && data.updatePercentList) {
commit(GET_PERCENT_DATA, list); commit(GET_PERCENT_DATA, list);
commit(GET_EUIPMENT_DATA, list); commit(GET_EUIPMENT_DATA, list);
return; commit(LOADING_SERVICE, false);
} } else if (data && data.updateEuipmentList) {
if (data && data.updateEuipmentList) {
commit(GET_EUIPMENT_DATA, list); commit(GET_EUIPMENT_DATA, list);
return; commit(LOADING_EQUIPMENT, false);
} } else {
commit(GET_CONSUME_DATA, list); commit(GET_CONSUME_DATA, list);
commit(LOADING_AREA, false);
}
}); });
}, },
fetchReportList({ commit }, entity) { fetchReportList({ commit }, entity) {
commit(LOADING_REGIST, true);
return fetchReportList({ return fetchReportList({
params: { params: {
...entity, ...entity,
}, },
}).then(res => { })
.then(res => {
let list = res.data; let list = res.data;
commit(GET_REPORT_DATA, list); commit(GET_REPORT_DATA, list);
commit(LOADING_REGIST, false);
})
.catch(err => {
console.error(err);
commit(LOADING_REGIST, false);
}); });
}, },
fetchTitleList({ commit }) { fetchTitleList({ commit }) {
...@@ -175,6 +198,21 @@ const mutations = { ...@@ -175,6 +198,21 @@ const mutations = {
[GET_CAMPUS_DATA](state, name) { [GET_CAMPUS_DATA](state, name) {
state.consume.areaName = name; state.consume.areaName = name;
}, },
[LOADING_AREA](state, fetching) {
state.loading.area = fetching;
state.loading.service = fetching;
state.loading.equipment = fetching;
},
[LOADING_SERVICE](state, fetching) {
state.loading.service = fetching;
state.loading.equipment = fetching;
},
[LOADING_EQUIPMENT](state, fetching) {
state.loading.equipment = fetching;
},
[LOADING_REGIST](state, fetching) {
state.loading.regist = fetching;
},
}; };
export default { export default {
......
<template> <template>
<div class="Dashboard-DataCard EquipmentList"> <div
class="Dashboard-DataCard EquipmentList"
v-loading="loading.equipment"
>
<div class="Dashboard-title"> <div class="Dashboard-title">
<div class="Dashboard-title-icon equipment"> <div class="Dashboard-title-icon equipment">
<img src="@/assets/images/dashboard/icon_paiming@2x.png" /> <img src="@/assets/images/dashboard/icon_paiming@2x.png" />
...@@ -29,7 +32,11 @@ export default { ...@@ -29,7 +32,11 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters('Dashboard', ['consumeHardVos', 'consumeAfterVos']), ...mapGetters('Dashboard', [
'consumeHardVos',
'consumeAfterVos',
'loading',
]),
}, },
methods: { methods: {
...mapActions('Dashboard', ['fetchConsumeList']), ...mapActions('Dashboard', ['fetchConsumeList']),
......
<template> <template>
<div class="Dashboard-DataCard"> <div
class="Dashboard-DataCard"
v-loading="loading.service"
>
<div class="Dashboard-title"> <div class="Dashboard-title">
<div class="Dashboard-title-icon service"> <div class="Dashboard-title-icon service">
<img src="@/assets/images/dashboard/icon_zhanbi@2x.png" /> <img src="@/assets/images/dashboard/icon_zhanbi@2x.png" />
...@@ -22,7 +25,7 @@ export default { ...@@ -22,7 +25,7 @@ export default {
name: 'SeviceRatio', name: 'SeviceRatio',
components: { SeviceRatioChart }, components: { SeviceRatioChart },
computed: { computed: {
...mapGetters('Dashboard', ['seviceRatioList', 'areaName']), ...mapGetters('Dashboard', ['seviceRatioList', 'areaName', 'loading']),
}, },
methods: { methods: {
...mapActions('Dashboard', ['fetchConsumeList']), ...mapActions('Dashboard', ['fetchConsumeList']),
......
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