Commit a852090e by 姜雷

Merge branch 'develop' into 'test'

添加首页告警数据展示 See merge request !161
parents ecba0777 86d1923a
...@@ -4,6 +4,7 @@ VUE_APP_CUSTOMER_MENU_CODE=0001 ...@@ -4,6 +4,7 @@ VUE_APP_CUSTOMER_MENU_CODE=0001
VUE_APP_BASE_MENU_CODE=0002 VUE_APP_BASE_MENU_CODE=0002
VUE_APP_SYSTEM_MENU_CODE=0003 VUE_APP_SYSTEM_MENU_CODE=0003
VUE_APP_FEEDBACK_MENU_CODE=0018 VUE_APP_FEEDBACK_MENU_CODE=0018
VUE_APP_WARNNING_MENU_CODE=0098
VUE_APP_STATISTICS_MENU_CODE=0044 VUE_APP_STATISTICS_MENU_CODE=0044
VUE_APP_DEVICE_MENU_CODE=0048 VUE_APP_DEVICE_MENU_CODE=0048
VUE_APP_CUSTOMER_OPERATE_CODE=0077 VUE_APP_CUSTOMER_OPERATE_CODE=0077
...@@ -17,3 +18,4 @@ VUE_APP_CUSTOMER_SERVER_URL=http://ex-dev-customer-manage.168cad.top ...@@ -17,3 +18,4 @@ VUE_APP_CUSTOMER_SERVER_URL=http://ex-dev-customer-manage.168cad.top
VUE_APP_BASE_SERVER_URL=http://ex-dev-dcxy-base-manage.168cad.top VUE_APP_BASE_SERVER_URL=http://ex-dev-dcxy-base-manage.168cad.top
VUE_APP_BASE_SERVER_URL_APP=http://ex-dev-dcxy-base-app.168cad.top VUE_APP_BASE_SERVER_URL_APP=http://ex-dev-dcxy-base-app.168cad.top
VUE_APP_STATISTICS_SERVER_URL=http://ex-dev-dcxy-statistics-manage.168cad.top VUE_APP_STATISTICS_SERVER_URL=http://ex-dev-dcxy-statistics-manage.168cad.top
VUE_APP_DEVICE_SERVER_URL=http://in-dev-device-management-api.168cad.top
...@@ -5,3 +5,4 @@ VUE_APP_CUSTOMER_SERVER_URL=http://ex-dev-customer-manage.168cad.top ...@@ -5,3 +5,4 @@ VUE_APP_CUSTOMER_SERVER_URL=http://ex-dev-customer-manage.168cad.top
VUE_APP_BASE_SERVER_URL=http://ex-dev-dcxy-base-manage.168cad.top VUE_APP_BASE_SERVER_URL=http://ex-dev-dcxy-base-manage.168cad.top
VUE_APP_BASE_SERVER_URL_APP=http://ex-dev-dcxy-base-app.168cad.top VUE_APP_BASE_SERVER_URL_APP=http://ex-dev-dcxy-base-app.168cad.top
VUE_APP_STATISTICS_SERVER_URL=http://ex-dev-dcxy-statistics-manage.168cad.top VUE_APP_STATISTICS_SERVER_URL=http://ex-dev-dcxy-statistics-manage.168cad.top
VUE_APP_DEVICE_SERVER_URL=http://in-dev-device-management-api.168cad.top
...@@ -4,3 +4,4 @@ VUE_APP_CUSTOMER_SERVER_URL=http://ex-test-customer-manage.168cad.top ...@@ -4,3 +4,4 @@ VUE_APP_CUSTOMER_SERVER_URL=http://ex-test-customer-manage.168cad.top
VUE_APP_BASE_SERVER_URL=http://ex-test-dcxy-base-manage.168cad.top VUE_APP_BASE_SERVER_URL=http://ex-test-dcxy-base-manage.168cad.top
VUE_APP_BASE_SERVER_URL_APP=http://ex-test-dcxy-base-app.168cad.top VUE_APP_BASE_SERVER_URL_APP=http://ex-test-dcxy-base-app.168cad.top
VUE_APP_STATISTICS_SERVER_URL=http://ex-test-dcxy-statistics-manage.168cad.top VUE_APP_STATISTICS_SERVER_URL=http://ex-test-dcxy-statistics-manage.168cad.top
VUE_APP_DEVICE_SERVER_URL=http://in-test-device-management-api.168cad.top
...@@ -132,7 +132,7 @@ export default { ...@@ -132,7 +132,7 @@ export default {
}, },
}, },
methods: { methods: {
...mapActions(['updateFeedbackPage']), ...mapActions(['updateFeedbackPage', 'updateWarnningPage']),
showComponents(store) { showComponents(store) {
this.isInnerPage = this.isInnerPage =
this.whiteList.indexOf(this.$route.path) !== -1 ? false : true; this.whiteList.indexOf(this.$route.path) !== -1 ? false : true;
...@@ -189,9 +189,14 @@ export default { ...@@ -189,9 +189,14 @@ export default {
}, },
getFeedbackPage() { getFeedbackPage() {
let feedbackCode = process.env.VUE_APP_FEEDBACK_MENU_CODE; let feedbackCode = process.env.VUE_APP_FEEDBACK_MENU_CODE;
let menu = getMenuDataByCode(this.route, feedbackCode); let feedbackMenu = getMenuDataByCode(this.route, feedbackCode);
if (menu) { let warnningCode = process.env.VUE_APP_WARNNING_MENU_CODE;
this.updateFeedbackPage(menu.name); let warnningMenu = getMenuDataByCode(this.route, warnningCode);
if (feedbackMenu) {
this.updateFeedbackPage(feedbackMenu.name);
}
if (warnningMenu) {
this.updateWarnningPage(warnningMenu.name);
} }
}, },
}, },
......
import fetch from '../fetch'; import fetch from '../fetch';
const path = process.env.VUE_APP_STATISTICS_SERVER_URL; const path = process.env.VUE_APP_STATISTICS_SERVER_URL;
const devicePath = process.env.VUE_APP_DEVICE_SERVER_URL;
export const fetchConsumeList = req => export const fetchConsumeList = req =>
fetch({ fetch({
...@@ -36,3 +37,8 @@ export const getFeedbackList = req => ...@@ -36,3 +37,8 @@ export const getFeedbackList = req =>
url: path + '/dcxy/reportInfo/queryFeedbackList', url: path + '/dcxy/reportInfo/queryFeedbackList',
...req, ...req,
}); });
export const getWarnningCount = req =>
fetch({
url: devicePath + '/device/warning/count',
...req,
});
...@@ -2,6 +2,7 @@ import { ...@@ -2,6 +2,7 @@ import {
fetchConsumeList, fetchConsumeList,
fetchReportList, fetchReportList,
fetchTitleList, fetchTitleList,
getWarnningCount,
} from '@/api/dashboard/dashboard'; } from '@/api/dashboard/dashboard';
import customerData from './CustomerData/CustomerDataStore'; import customerData from './CustomerData/CustomerDataStore';
import customerRecharge from './CustomerRecharge/CustomerRechargeStore'; import customerRecharge from './CustomerRecharge/CustomerRechargeStore';
...@@ -22,6 +23,7 @@ const LOADING_SERVICE = 'LOADING_SERVICE'; ...@@ -22,6 +23,7 @@ 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 LOADING_REGIST_BY_DAY = 'LOADING_REGIST_BY_DAY';
const GET_WARNNING_COUNT = 'GET_WARNNING_COUNT';
const initFilters = () => ({ const initFilters = () => ({
operateId: undefined, operateId: undefined,
...@@ -68,6 +70,7 @@ const state = () => ({ ...@@ -68,6 +70,7 @@ const state = () => ({
activeCount: 0, activeCount: 0,
countArea: 0, countArea: 0,
countCustomer: 0, countCustomer: 0,
warnningCount: 0,
}, },
}); });
...@@ -202,6 +205,15 @@ const actions = { ...@@ -202,6 +205,15 @@ const actions = {
commit(GET_TITLE_DATA, data); commit(GET_TITLE_DATA, data);
}); });
}, },
getWarnningCount({ commit, rootGetters }) {
getWarnningCount({
params: {
operatorId: rootGetters.userInfo.operateId,
},
}).then(res => {
commit(GET_WARNNING_COUNT, res.data);
});
},
updateCampusName({ commit }, data) { updateCampusName({ commit }, data) {
if (data) { if (data) {
commit(GET_CAMPUS_DATA, data); commit(GET_CAMPUS_DATA, data);
...@@ -286,7 +298,12 @@ const mutations = { ...@@ -286,7 +298,12 @@ const mutations = {
state.report.activeUser = activeList; state.report.activeUser = activeList;
}, },
[GET_TITLE_DATA](state, data) { [GET_TITLE_DATA](state, data) {
state.title = data; state.title.activeCount = data.activeCount;
state.title.countArea = data.countArea;
state.title.countCustomer = data.countCustomer;
},
[GET_WARNNING_COUNT](state, count) {
state.title.warnningCount = count;
}, },
[GET_CAMPUS_DATA](state, name) { [GET_CAMPUS_DATA](state, name) {
state.consume.areaInfo = name; state.consume.areaInfo = name;
......
...@@ -36,12 +36,31 @@ export default { ...@@ -36,12 +36,31 @@ export default {
created() { created() {
this.initData(); this.initData();
}, },
data() {
return {
timer: null,
};
},
beforeDestroy() {
console.log('in beforeDestroy');
if (this.timer) {
clearInterval(this.timer);
}
},
methods: { methods: {
...mapActions('Dashboard', ['fetchConsumeList', 'fetchTitleList']), ...mapActions('Dashboard', [
'fetchConsumeList',
'fetchTitleList',
'getWarnningCount',
]),
...mapActions(['updateBackPage']), ...mapActions(['updateBackPage']),
initData() { initData() {
this.fetchConsumeList(); this.fetchConsumeList();
this.fetchTitleList(); this.fetchTitleList();
this.getWarnningCount();
this.timer = setInterval(() => {
this.getWarnningCount();
}, 5000);
}, },
}, },
}; };
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
> >
<div class="dataItem">所运营的校区<span class="dataNumber">{{titleData.countArea}}</span></div> <div class="dataItem">所运营的校区<span class="dataNumber">{{titleData.countArea}}</span></div>
<div class="dataItem">累计用户数<span class="dataNumber">{{titleData.countCustomer}}</span></div> <div class="dataItem">累计用户数<span class="dataNumber">{{titleData.countCustomer}}</span></div>
<div class="dataItem">活跃用户数<span class="dataNumber">{{titleData.activeCount}}</span></div> <div
class="dataItem clickable"
@click="goWarnningPage"
>今日系统告警数<span class="dataNumber">{{titleData.warnningCount}}</span></div>
</div> </div>
<div <div
class="IconMenus-list" class="IconMenus-list"
...@@ -99,7 +102,7 @@ export default { ...@@ -99,7 +102,7 @@ export default {
}, },
computed: { computed: {
...mapGetters('Dashboard', ['titleData']), ...mapGetters('Dashboard', ['titleData']),
...mapGetters(['collectList', 'dashboardBackPage']), ...mapGetters(['collectList', 'dashboardBackPage', 'warnningPage']),
formatRoute() { formatRoute() {
let routeList = this.routers.filter( let routeList = this.routers.filter(
menu => menu =>
...@@ -162,6 +165,18 @@ export default { ...@@ -162,6 +165,18 @@ export default {
}); });
} }
}, },
goWarnningPage() {
if (this.warnningPage) {
this.$router.push({
name: this.warnningPage,
query: {
isToday: true,
},
});
} else {
this.$message.error('无告警页面权限');
}
},
}, },
}; };
</script> </script>
...@@ -186,6 +201,9 @@ export default { ...@@ -186,6 +201,9 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.clickable {
cursor: pointer;
}
.dataNumber { .dataNumber {
margin-left: 10px; margin-left: 10px;
font-size: 16px; font-size: 16px;
......
...@@ -4,6 +4,7 @@ import { FETCH_START, FETCH_DONE } from './mutation-types'; ...@@ -4,6 +4,7 @@ import { FETCH_START, FETCH_DONE } from './mutation-types';
const GET_WHITE_LIST = 'GET_WHITE_LIST'; const GET_WHITE_LIST = 'GET_WHITE_LIST';
const UPDATE_BACK_PAGE = 'UPDATE_BACK_PAGE'; const UPDATE_BACK_PAGE = 'UPDATE_BACK_PAGE';
const UPDATE_FEEDBACK_PAGE = 'UPDATE_FEEDBACK_PAGE'; const UPDATE_FEEDBACK_PAGE = 'UPDATE_FEEDBACK_PAGE';
const UPDATE_WARNNING_PAGE = 'UPDATE_WARNNING_PAGE';
let fetchCount = 0; let fetchCount = 0;
const state = () => ({ const state = () => ({
...@@ -11,6 +12,7 @@ const state = () => ({ ...@@ -11,6 +12,7 @@ const state = () => ({
whiteList: [], whiteList: [],
dashboardBackPage: undefined, dashboardBackPage: undefined,
feedbackPage: undefined, feedbackPage: undefined,
warnningPage: undefined,
}); });
const getters = { const getters = {
...@@ -18,6 +20,7 @@ const getters = { ...@@ -18,6 +20,7 @@ const getters = {
whiteList: state => state.whiteList, whiteList: state => state.whiteList,
dashboardBackPage: state => state.dashboardBackPage, dashboardBackPage: state => state.dashboardBackPage,
feedbackPage: state => state.feedbackPage, feedbackPage: state => state.feedbackPage,
warnningPage: state => state.warnningPage,
}; };
const actions = { const actions = {
...@@ -36,6 +39,9 @@ const actions = { ...@@ -36,6 +39,9 @@ const actions = {
updateFeedbackPage({ commit }, name) { updateFeedbackPage({ commit }, name) {
commit(UPDATE_FEEDBACK_PAGE, name); commit(UPDATE_FEEDBACK_PAGE, name);
}, },
updateWarnningPage({ commit }, name) {
commit(UPDATE_WARNNING_PAGE, name);
},
}; };
const mutations = { const mutations = {
[FETCH_START](state, notLoading) { [FETCH_START](state, notLoading) {
...@@ -61,6 +67,9 @@ const mutations = { ...@@ -61,6 +67,9 @@ const mutations = {
[UPDATE_FEEDBACK_PAGE](state, name) { [UPDATE_FEEDBACK_PAGE](state, name) {
state.feedbackPage = name; state.feedbackPage = name;
}, },
[UPDATE_WARNNING_PAGE](state, name) {
state.warnningPage = name;
},
}; };
export default { export default {
modules: { modules: {
......
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