Commit fb00b90d by 姜雷

选择不同区块查询新数据

parent 68b04e81
...@@ -7,6 +7,8 @@ import { ...@@ -7,6 +7,8 @@ import {
const GET_CONSUME_DATA = 'GET_CONSUME_DATA'; const GET_CONSUME_DATA = 'GET_CONSUME_DATA';
const GET_REPORT_DATA = 'GET_REPORT_DATA'; const GET_REPORT_DATA = 'GET_REPORT_DATA';
const GET_TITLE_DATA = 'GET_TITLE_DATA'; const GET_TITLE_DATA = 'GET_TITLE_DATA';
const GET_PERCENT_DATA = 'GET_PERCENT_DATA';
const GET_EUIPMENT_DATA = 'GET_EUIPMENT_DATA';
const state = () => ({ const state = () => ({
consume: { consume: {
...@@ -48,6 +50,14 @@ const actions = { ...@@ -48,6 +50,14 @@ const actions = {
}, },
}).then(res => { }).then(res => {
let list = res.data; let list = res.data;
if (entity && entity.updatePercentList) {
commit(GET_PERCENT_DATA, list);
return;
}
if (entity && entity.updateEuipmentList) {
commit(GET_EUIPMENT_DATA, list);
return;
}
commit(GET_CONSUME_DATA, list); commit(GET_CONSUME_DATA, list);
}); });
}, },
...@@ -75,6 +85,12 @@ const mutations = { ...@@ -75,6 +85,12 @@ const mutations = {
state.consume.list = data.list; state.consume.list = data.list;
state.consume.percentList = data.percentList; state.consume.percentList = data.percentList;
}, },
[GET_PERCENT_DATA]: (state, data) => {
state.consume.percentList = data.percentList;
},
[GET_EUIPMENT_DATA]: (state, data) => {
state.consume.consumeHardVos = data.consumeHardVos;
},
[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;
......
...@@ -67,7 +67,10 @@ ...@@ -67,7 +67,10 @@
/> />
</search-item> </search-item>
</div> </div>
<CampusRank :data="campusRankList" /> <CampusRank
:data="campusRankList"
:changeCampusHandle="changeCampusHandle"
/>
</div> </div>
<div class="Dashboard-DataCard"> <div class="Dashboard-DataCard">
<div class="Dashboard-title"> <div class="Dashboard-title">
...@@ -77,7 +80,10 @@ ...@@ -77,7 +80,10 @@
<div class="Dashboard-title-text">各服务消费占比</div> <div class="Dashboard-title-text">各服务消费占比</div>
<div class="Dashboard-title-top">TOP1</div> <div class="Dashboard-title-top">TOP1</div>
</div> </div>
<SeviceRatio :data="seviceRatioList" /> <SeviceRatio
:data="seviceRatioList"
:changeServiceHandle="changeServiceHandle"
/>
</div> </div>
<div class="Dashboard-DataCard"> <div class="Dashboard-DataCard">
<div class="Dashboard-title"> <div class="Dashboard-title">
...@@ -207,6 +213,30 @@ export default { ...@@ -207,6 +213,30 @@ export default {
}); });
} }
}, },
changeCampusHandle(data) {
let operateId = this.operatorFilters.operateId;
let year = this.operatorFilters.year;
let month = this.operatorFilters.month;
this.fetchConsumeList({
year: year ? year : null,
month: month ? month : null,
operateId: operateId ? operateId : null,
areaId: data.areaId,
updatePercentList: true,
});
},
changeServiceHandle(data) {
let operateId = this.operatorFilters.operateId;
let year = this.operatorFilters.year;
let month = this.operatorFilters.month;
this.fetchConsumeList({
year: year ? year : null,
month: month ? month : null,
operateId: operateId ? operateId : null,
serviceId: data.serviceId,
updateEuipmentList: true,
});
},
}, },
}; };
</script> </script>
......
...@@ -11,6 +11,11 @@ import chartMixin from '../chartMixin'; ...@@ -11,6 +11,11 @@ import chartMixin from '../chartMixin';
export default { export default {
name: 'CampusRank', name: 'CampusRank',
mixins: [chartMixin], mixins: [chartMixin],
props: {
changeCampusHandle: {
type: Function,
},
},
data() { data() {
let totle = this.data.reduce((count, item) => count + item.count, 0); let totle = this.data.reduce((count, item) => count + item.count, 0);
return { return {
...@@ -19,6 +24,7 @@ export default { ...@@ -19,6 +24,7 @@ export default {
totle: totle, totle: totle,
percentDom: null, percentDom: null,
areaNameDom: null, areaNameDom: null,
SelectedDataIndex: null,
}; };
}, },
mounted() { mounted() {
...@@ -116,19 +122,28 @@ export default { ...@@ -116,19 +122,28 @@ export default {
alignY: 'middle', alignY: 'middle',
}); });
this.chart.render(); this.chart.render();
this.chart.on('plotclick', this.clickHandle); this.chart.on('interval:click', this.clickHandle);
}, },
updateData() { updateData() {
if (this.data.length) { if (this.data.length) {
this.totle = this.data.reduce((count, item) => count + item.count, 0); this.totle = this.data.reduce((count, item) => count + item.count, 0);
this.chartGeom.setSelected(this.data[0]); let data = this.SelectedDataIndex;
this.changeSelected(this.data[0]); if (data) {
this.changeSelected(data);
this.chartGeom.setSelected(data);
} else {
this.chartGeom.setSelected(this.data[0]);
this.changeSelected(this.data[0]);
this.SelectedDataIndex = this.data[0];
}
} }
}, },
clickHandle(ev) { clickHandle(ev) {
if (ev.data) { let data = ev.data._origin;
let data = ev.data._origin; if (this.SelectedDataIndex.areaId !== data.areaId) {
this.SelectedDataIndex = data;
this.changeSelected(data); this.changeSelected(data);
this.changeCampusHandle(data);
} }
}, },
changeSelected(data) { changeSelected(data) {
......
...@@ -12,12 +12,18 @@ import chartMixin from '../chartMixin'; ...@@ -12,12 +12,18 @@ import chartMixin from '../chartMixin';
export default { export default {
name: 'SeviceRatio', name: 'SeviceRatio',
mixins: [chartMixin], mixins: [chartMixin],
props: {
changeServiceHandle: {
type: Function,
},
},
data() { data() {
let totle = this.data.reduce((count, item) => count + item.count, 0); let totle = this.data.reduce((count, item) => count + item.count, 0);
return { return {
totle: totle, totle: totle,
percentDom: null, percentDom: null,
serviceNameDom: null, serviceNameDom: null,
SelectedDataIndex: null,
}; };
}, },
mounted() { mounted() {
...@@ -102,14 +108,23 @@ export default { ...@@ -102,14 +108,23 @@ export default {
updateData() { updateData() {
if (this.data.length) { if (this.data.length) {
this.totle = this.data.reduce((count, item) => count + item.count, 0); this.totle = this.data.reduce((count, item) => count + item.count, 0);
this.chartGeom.setSelected(this.data[0]); let data = this.SelectedDataIndex;
this.changeSelected(this.data[0]); if (data) {
this.changeSelected(data);
this.chartGeom.setSelected(data);
} else {
this.chartGeom.setSelected(this.data[0]);
this.changeSelected(this.data[0]);
this.SelectedDataIndex = this.data[0];
}
} }
}, },
clickHandle(ev) { clickHandle(ev) {
if (ev.data) { let data = ev.data._origin;
if (this.SelectedDataIndex.serviceId !== data.serviceId) {
let data = ev.data._origin; let data = ev.data._origin;
this.changeSelected(data); this.changeSelected(data);
this.changeServiceHandle(data);
} }
}, },
changeSelected(data) { changeSelected(data) {
......
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