Commit ff96b955 by 姜雷

Merge branch 'develop' into 'test'

Develop See merge request !26
parents e6b5f086 c9611609
...@@ -3,6 +3,7 @@ VUE_APP_LIB_BASE_URL=/systemManageShell/ ...@@ -3,6 +3,7 @@ VUE_APP_LIB_BASE_URL=/systemManageShell/
VUE_APP_CUSTOMER_MENU_CODE=0001 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_DASHBOARD_CODE=0079
VUE_APP_WHITE_LIST=/login,/404,/401 VUE_APP_WHITE_LIST=/login,/404,/401
VUE_APP_LIB_MANAGER=http://ex-dev-dcxy-static.168cad.top VUE_APP_LIB_MANAGER=http://ex-dev-dcxy-static.168cad.top
VUE_APP_SYSTEM_SERVER_URL=http://ex-dev-dcxy-system-manage.168cad.top VUE_APP_SYSTEM_SERVER_URL=http://ex-dev-dcxy-system-manage.168cad.top
......
...@@ -13,6 +13,10 @@ export default { ...@@ -13,6 +13,10 @@ export default {
type: Number, type: Number,
default: null, default: null,
}, },
isAll: {
type: Number,
default: null,
},
}, },
created() { created() {
store.install(this.$store); store.install(this.$store);
...@@ -20,6 +24,7 @@ export default { ...@@ -20,6 +24,7 @@ export default {
this.fetchServiceTypeList({ this.fetchServiceTypeList({
serviceType: this.ServiceType, serviceType: this.ServiceType,
serviceState: this.ServiceState, serviceState: this.ServiceState,
isAll: this.isAll,
}); });
} }
}, },
......
...@@ -21,11 +21,14 @@ const getters = { ...@@ -21,11 +21,14 @@ const getters = {
}; };
const actions = { const actions = {
fetchServiceTypeList({ state, commit }, { serviceType, serviceState }) { fetchServiceTypeList(
{ state, commit },
{ serviceType, serviceState, isAll }
) {
if (state.fetching[serviceType]) return; if (state.fetching[serviceType]) return;
commit(FETCH_STATE, { value: true, index: serviceType }); commit(FETCH_STATE, { value: true, index: serviceType });
return fetchServiceList({ return fetchServiceList({
params: { serviceType, state: serviceState }, params: { serviceType, state: serviceState, isAll: isAll },
}).then(res => { }).then(res => {
const { selfService } = res; const { selfService } = res;
commit(SERVICE_TYPE_LIST, { list: selfService, index: serviceType }); commit(SERVICE_TYPE_LIST, { list: selfService, index: serviceType });
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<div id="CampusRank"> <div id="CampusRank">
<div class="CampusRank-legend"> <div class="CampusRank-legend">
<template v-if="this.data && this.data.length === 10"> <template v-if="this.data && this.data.length === 10">
其他校区:<span>{{other}}</span><br> 其他校区:<span>{{other.toFixed(2)}}</span><br>
前十校区:<span>{{topTen}}</span> 前十校区:<span>{{topTen.toFixed(2)}}</span>
</template> </template>
<template v-else-if="this.data.length"> <template v-else-if="this.data.length">
校区汇总:<span>{{topTen.toFixed(2)}}</span> 校区汇总:<span>{{topTen.toFixed(2)}}</span>
......
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
container: 'CustomerConsumptionChart', container: 'CustomerConsumptionChart',
forceFit: true, forceFit: true,
height: this.height, height: this.height,
padding: [50, 60, 50, 100], padding: [50, 80, 50, 100],
}); });
this.chart.source(this.data); this.chart.source(this.data);
this.chart this.chart
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
>本年</el-radio> >本年</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<div class="Dashboard-title">值视图 <div class="Dashboard-title">值视图
<div class="CustomerRechargeChart-tip"> <div class="CustomerRechargeChart-tip">
<span <span
class="CustomerRecharge-tooltip" class="CustomerRecharge-tooltip"
......
...@@ -5,6 +5,12 @@ ...@@ -5,6 +5,12 @@
:style="`height: ${height}px;width: ${width?width+'px':'auto'}`" :style="`height: ${height}px;width: ${width?width+'px':'auto'}`"
></div> ></div>
<!-- <div id='CustomerRechangeSlider'></div> --> <!-- <div id='CustomerRechangeSlider'></div> -->
<CustomerRechangeSlider
class="CustomerRechangeSlider"
:data="data"
:span="4"
:onChange="wheelHandle"
/>
</div> </div>
</template> </template>
...@@ -14,6 +20,7 @@ import Slider from '@antv/g2-plugin-slider'; ...@@ -14,6 +20,7 @@ import Slider from '@antv/g2-plugin-slider';
import chartMixin from '../chartMixin'; import chartMixin from '../chartMixin';
import DataSet from '@antv/data-set'; import DataSet from '@antv/data-set';
import _ from 'lodash'; import _ from 'lodash';
import CustomerRechangeSlider from './slider';
const Shape = G2.Shape; const Shape = G2.Shape;
const Util = G2.Util; const Util = G2.Util;
...@@ -68,6 +75,7 @@ Shape.registerShape('interval', 'right', { ...@@ -68,6 +75,7 @@ Shape.registerShape('interval', 'right', {
export default { export default {
name: 'CustomerRechargeChart', name: 'CustomerRechargeChart',
components: { CustomerRechangeSlider },
mixins: [chartMixin], mixins: [chartMixin],
props: { props: {
rechargeCount: { rechargeCount: {
...@@ -103,31 +111,31 @@ export default { ...@@ -103,31 +111,31 @@ export default {
}); });
const dv = this.ds.createView().source(this.data); const dv = this.ds.createView().source(this.data);
this.dv = dv; this.dv = dv;
// dv.transform({ dv.transform({
// type: 'filter', type: 'filter',
// callback: obj => { callback: obj => {
// if ( if (
// _.isNil(this.ds.state.startRadio) || _.isNil(this.ds.state.startRadio) ||
// _.isNil(this.ds.state.endRadio) _.isNil(this.ds.state.endRadio)
// ) { ) {
// return true; return true;
// } }
// const dataIndex = _.findIndex(this.data, { const dataIndex = _.findIndex(this.data, {
// areaName: obj.areaName, areaName: obj.areaName,
// }); });
// const currentRadio = dataIndex / this.data.length; const currentRadio = dataIndex / this.data.length;
// return ( return (
// currentRadio >= this.ds.state.startRadio && currentRadio >= this.ds.state.startRadio &&
// currentRadio <= this.ds.state.endRadio currentRadio <= this.ds.state.endRadio
// ); );
// }, },
// }); });
this.chart = new G2.Chart({ this.chart = new G2.Chart({
container: 'CustomerRechargeChart', container: 'CustomerRechargeChart',
forceFit: true, forceFit: true,
height: this.height, height: this.height,
padding: [30, 50, 20, 120], padding: [30, 70, 20, 120],
}); });
this.chart.source(dv, { this.chart.source(dv, {
...@@ -169,6 +177,23 @@ export default { ...@@ -169,6 +177,23 @@ export default {
.size(18); .size(18);
this.chart.legend(false); this.chart.legend(false);
this.chart.guide().text({
top: true,
position: ['100%', '0%'],
content: '(人)',
offsetX: 10,
offsetY: -8,
});
this.chart.guide().text({
top: true,
position: ['100%', '100%'],
content: '(元)',
offsetX: 10,
offsetY: 8,
});
this.chart.render(); this.chart.render();
// this.initSlider(); // this.initSlider();
...@@ -215,6 +240,7 @@ export default { ...@@ -215,6 +240,7 @@ export default {
let dom = this.sliderDom; let dom = this.sliderDom;
dom.innerHTML = ''; dom.innerHTML = '';
const arrLength = this.data.length; const arrLength = this.data.length;
if (arrLength) { if (arrLength) {
// let spanNum = 4 / arrLength; // let spanNum = 4 / arrLength;
this.slider = new Slider({ this.slider = new Slider({
...@@ -247,10 +273,12 @@ export default { ...@@ -247,10 +273,12 @@ export default {
if (this.chart) { if (this.chart) {
const arrLength = this.data.length; const arrLength = this.data.length;
let spanNum = 4 / arrLength; let spanNum = 4 / arrLength;
this.ds.setState('endRadio', spanNum);
this.ds.setState('startRadio', Math.abs(1 - spanNum));
this.ds.setState('endRadio', 1);
this.dv.source(this.data); this.dv.source(this.data);
let height = this.data.length * 50; // let height = this.data.length * 50;
this.chart.changeHeight(height); // this.chart.changeHeight(height);
// this.updateSlider(); // this.updateSlider();
this.updateData(); this.updateData();
} else { } else {
...@@ -258,6 +286,14 @@ export default { ...@@ -258,6 +286,14 @@ export default {
// this.initSlider(); // this.initSlider();
} }
}, },
wheelHandle({ startRadio, endRadio }) {
const tStartRadio = Math.abs(1 - endRadio);
const sEndRadio = Math.abs(1 - startRadio);
console.log(tStartRadio, sEndRadio);
this.ds.setState('startRadio', tStartRadio);
this.ds.setState('endRadio', sEndRadio);
},
}, },
}; };
</script> </script>
...@@ -267,8 +303,16 @@ export default { ...@@ -267,8 +303,16 @@ export default {
position: relative; position: relative;
#CustomerRechargeChart { #CustomerRechargeChart {
width: 100%; width: 100%;
overflow-x: hidden; // overflow-x: hidden;
overflow-y: auto; // overflow-y: auto;
}
.CustomerRechangeSlider {
position: absolute;
top: 0;
right: 0;
width: 28px;
height: 100%;
background-color: #eee;
} }
#CustomerRechangeSlider { #CustomerRechangeSlider {
margin-left: -30px; margin-left: -30px;
......
<template>
<div class="ks-Slider">
<div
class="ks-Slider-prev"
@click="clickPrev"
>
<img
v-if="pageNum === 1 || total === 0"
src="@/assets/images/dashboard/up_down_grey.png"
/>
<img
v-else
src="@/assets/images/dashboard/up_down_light.png"
>
</div>
<div class="ks-Slider-inner"></div>
<div
class="ks-Slider-next"
@click="clickNext"
>
<img
v-if="pageNum === pages || total === 0"
src="@/assets/images/dashboard/up_down_grey.png"
/>
<img
v-else
src="@/assets/images/dashboard/up_down_light.png"
>
</div>
</div>
</template>
<script>
export default {
name: 'CustomerRechangeSlider',
props: {
data: {
type: Array,
},
span: {
type: Number,
default: 4,
},
onChange: {
type: Function,
},
},
data() {
return {
pageNum: 1,
pageSize: this.span,
pages: 0,
total: 0,
startRadio: 0,
endRadio: 1,
};
},
watch: {
data() {
this.refreshSlider();
},
},
mounted() {},
methods: {
refreshSlider() {
let total = this.data.length;
this.total = total;
if (total) {
this.pages = Math.ceil(total / this.pageSize);
this.pageNum = 1;
this.startRadio = 0;
this.endRadio = this.pageSize / total;
} else {
this.pageNum = 1;
this.pages = 0;
this.startRadio = 0;
this.endRadio = 1;
}
},
clickPrev() {
if (this.pageNum === 1) return;
let nextNum = this.pageNum - 1;
const pStartRadio = this.startRadio;
let endRadio = pStartRadio;
console.log(nextNum);
let startRadio =
nextNum === 1 ? 0 : ((nextNum - 1) * this.pageSize) / this.total;
this.onChange &&
this.onChange({
startRadio,
endRadio,
});
this.pageNum = nextNum;
this.startRadio = startRadio;
this.endRadio = endRadio;
},
clickNext() {
if (this.pageNum === this.pages) return;
let nextNum = this.pageNum + 1;
const pEndRadio = this.endRadio;
let startRadio = pEndRadio;
let endRadio =
nextNum === this.pages ? 1 : (nextNum * this.pageSize) / this.total;
this.onChange &&
this.onChange({
startRadio,
endRadio,
});
this.pageNum = nextNum;
this.startRadio = startRadio;
this.endRadio = endRadio;
},
},
};
</script>
<style lang="scss">
.ks-Slider {
position: relative;
.ks-Slider-prev,
.ks-Slider-next {
position: absolute;
width: 28px;
height: 18px;
background-color: #666;
&.disabled {
background-color: #999;
}
}
.ks-Slider-prev {
top: 0;
}
.ks-Slider-next {
transform: rotate(180deg);
bottom: 0;
}
.ks-Slider-inner {
width: 100%;
background-color: #666;
}
}
</style>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<SeviceRatio class="Dashboard-DataCard" /> <SeviceRatio class="Dashboard-DataCard" />
<EquipmentList class="Dashboard-DataCard" /> <EquipmentList class="Dashboard-DataCard" />
</div> </div>
<CustomerRegister class="Dashboard-Row Dashboard-DataCard" /> <!-- <CustomerRegister class="Dashboard-Row Dashboard-DataCard" /> -->
</div> </div>
</div> </div>
</template> </template>
......
...@@ -45,6 +45,7 @@ export default { ...@@ -45,6 +45,7 @@ export default {
this.chart.legend({ this.chart.legend({
position: 'right-center', position: 'right-center',
marker: 'square', marker: 'square',
clickable: false,
useHtml: true, useHtml: true,
containerTpl: ` containerTpl: `
<div class="g2-legend"> <div class="g2-legend">
......
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
</MenuItem> </MenuItem>
</div> </div>
<div <div
v-if="dashboardButtonVisiable"
class="DashboardButton" class="DashboardButton"
@click="clickHandle" @click="clickHandle"
> >
...@@ -165,6 +166,12 @@ export default { ...@@ -165,6 +166,12 @@ export default {
); );
return item ? formatRouteLink([item]) : null; return item ? formatRouteLink([item]) : null;
}, },
dashboardButtonVisiable() {
let item = this.routers.find(
menu => menu.menuCode === process.env.VUE_APP_DASHBOARD_CODE
);
return item ? true : false;
},
}, },
methods: { methods: {
clickHandle() { clickHandle() {
......
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