Commit 7df5e7db by 姜雷

Merge branch 'test' into 'master'

Test See merge request !153
parents 694c93d5 0e6a29f2
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"popmotion": "^8.1.22", "popmotion": "^8.1.22",
"qiniu-js": "^2.2.0", "qiniu-js": "^2.2.0",
"rym-element-ui": "^0.1.56", "rym-element-ui": "^0.1.61",
"vue-qr": "^1.2.8", "vue-qr": "^1.2.8",
"vuedraggable": "^2.16.0", "vuedraggable": "^2.16.0",
"wangeditor": "^3.1.1" "wangeditor": "^3.1.1"
......
...@@ -223,7 +223,7 @@ export default { ...@@ -223,7 +223,7 @@ export default {
.record-List { .record-List {
.record-Item { .record-Item {
display: inline-block; display: inline-block;
width: 30%; min-width: 100px;
} }
} }
@media screen and (max-width: $bigScreenWidth) { @media screen and (max-width: $bigScreenWidth) {
......
...@@ -35,6 +35,13 @@ export const fetchServiceList = req => ...@@ -35,6 +35,13 @@ export const fetchServiceList = req =>
method: 'get', method: 'get',
...req, ...req,
}); });
// 根据区域获取服务
export const fetchAreaService = req =>
fetch({
url: path + '/dcxy/api/base/service/together/relation',
method: 'get',
...req,
});
// 获取运营商 // 获取运营商
export const fetchOperatorList = req => export const fetchOperatorList = req =>
fetch({ fetch({
......
...@@ -30,9 +30,13 @@ export default { ...@@ -30,9 +30,13 @@ export default {
}, },
computed: { computed: {
dashboardArea() { dashboardArea() {
if (this.$store.state.base['dashboardArea' + this.storeIndex]) {
return this.$store.getters[ return this.$store.getters[
`dashboardArea${this.storeIndex}/dashboardArea` `dashboardArea${this.storeIndex}/dashboardArea`
]; ];
} else {
return [];
}
}, },
}, },
methods: { methods: {
......
<template>
<el-select
:clearable="clearable"
:disabled="disabled"
filterable
:value="value"
@change="changeHandle"
>
<el-option
v-for="(item, index) in areaServiceList"
:disabled="disabledValue(item.serviceId)"
:key="index"
:value="item.serviceId"
:label="item.serviceName"
></el-option>
</el-select>
</template>
<script>
import areaServiceMixin from './mixin.js';
export default {
name: 'area-service-select',
props: {
value: {
type: Number,
default: null,
},
disabled: Boolean,
clearable: {
type: Boolean,
default: true,
},
filterList: {
type: Array,
},
},
mixins: [areaServiceMixin],
methods: {
changeHandle(val) {
if (val || val === 0) {
this.$emit('input', val);
} else {
this.$emit('input', null);
}
},
disabledValue(val) {
if (this.filterList && this.filterList.length) {
return this.filterList.indexOf(val) > -1;
}
return false;
},
},
};
</script>
import { fetchAreaService } from '@/api/base/index';
const AREA_SERVICE_LIST = 'AREA_SERVICE_LIST';
const FETCH_STATE = 'FETCH_STATE';
const UPDATE_FILTER_ID = 'UPDATE_FILTER_ID';
const state = () => ({
list: [],
filterId: undefined,
fetching: false,
});
const getters = {
areaServiceList: state =>
state.list.filter(item =>
state.filterId
? item.areaId === state.filterId &&
item.serviceId !== 0 &&
item.serviceId !== 1
: true
),
};
const actions = {
fetchAreaServiceList({ state, commit }, entity) {
if (state.fetching) return;
commit(FETCH_STATE, true);
return fetchAreaService({
params: entity,
})
.then(res => {
const { data } = res;
commit(AREA_SERVICE_LIST, data);
commit(FETCH_STATE, false);
})
.catch(err => {
commit(FETCH_STATE, false);
});
},
updateFilterId({ commit }, id) {
commit(UPDATE_FILTER_ID, id);
},
};
const mutations = {
[AREA_SERVICE_LIST](state, list) {
state.list = list;
},
[FETCH_STATE](state, value) {
state.fetching = value;
},
[UPDATE_FILTER_ID](state, id) {
state.filterId = id;
},
};
export default {
namespaced: true,
state,
getters,
actions,
mutations,
};
import AreaServiceSelect from './AreaServiceSelect.vue';
import areaServiceMixin from './mixin';
export { areaServiceMixin };
export default AreaServiceSelect;
import { mapGetters, mapActions } from 'vuex';
import store from './store';
export default {
props: {
// 所属区域
areaId: {
type: Number,
default: null,
},
},
created() {
store.install(this.$store);
if (!this.areaServiceList.length) {
this.fetchAreaServiceList({
areaId: this.areaId,
});
}
if (this.areaId) {
this.updateFilterId(this.areaId);
}
},
computed: {
...mapGetters('areaServiceOption', ['areaServiceList']),
},
watch: {
areaId(val) {
this.updateFilterId(val);
},
},
methods: {
...mapActions('areaServiceOption', [
'fetchAreaServiceList',
'updateFilterId',
]),
getServiceName(id) {
let item = this.areaServiceList.find(service => service.serviceId === id);
return item ? item.serviceName : '';
},
getServiceInfo() {
let item = this.areaServiceList.find(service => service.serviceId === id);
return item
? { serviceId: item.serviceId, serviceName: item.serviceName }
: null;
},
getOperatorInfo(id) {
let item = this.areaServiceList.find(service => service.serviceId === id);
return item
? { operateId: item.operateId, operateName: item.operateName }
: null;
},
getAreaInfo() {
let item = this.areaServiceList.find(service => service.serviceId === id);
return item ? { areaId: item.areaId, areaName: item.areaName } : null;
},
getAllItemInfo(id) {
let item = this.areaServiceList.find(service => service.serviceId === id);
return item ? item : null;
},
},
};
import areaServiceStore from './areaServiceStore';
export default {
install(store) {
if (!store.state.base) {
store.registerModule(['base'], {
state: {},
});
}
if (!store.state.base.areaServiceOption) {
store.registerModule(['base', 'areaServiceOption'], areaServiceStore);
}
},
uninstall(store) {
store.unregisterModule(['base', 'areaServiceOption']);
},
};
...@@ -53,6 +53,7 @@ export const operClassifyList = [ ...@@ -53,6 +53,7 @@ export const operClassifyList = [
{ label: '删除', value: '03' }, { label: '删除', value: '03' },
{ label: '开启', value: '04' }, { label: '开启', value: '04' },
{ label: '关闭', value: '05' }, { label: '关闭', value: '05' },
{ label: '模式修改', value: '06' },
]; ];
//角色操作记录 //角色操作记录
export const operClassifyName4role = [ export const operClassifyName4role = [
...@@ -71,6 +72,7 @@ export const operClassifyName4User = [ ...@@ -71,6 +72,7 @@ export const operClassifyName4User = [
{ label: '锁定', value: '03' }, { label: '锁定', value: '03' },
{ label: '解锁', value: '04' }, { label: '解锁', value: '04' },
{ label: '新增', value: '05' }, { label: '新增', value: '05' },
]; ];
export const serviceMap = [ export const serviceMap = [
......
<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,34 @@ ...@@ -23,20 +20,34 @@
</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="more-info">
{{ reportYear }}年注册人数为:{{ registeYearTotal }}人;平台注册会员总数: {{ registeTotal }}人;平台活跃会员总数:{{ activeTotal }}
</div>
<div class="Dashboard-CampusData"> <div class="Dashboard-CampusData">
<div class="Dashboard-CampusItem"> <div
<div class="Dashboard-title">{{ reportYear }}年每月注册数据</div> class="Dashboard-CampusItem"
v-loading="loading.regist"
>
<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,11 +55,14 @@ ...@@ -44,11 +55,14 @@
</div> </div>
</div> </div>
<div class="Dashboard-CampusData"> <div class="Dashboard-CampusData">
<div class="Dashboard-CampusItem"> <div
<div class="Dashboard-title">{{ reportYear }}年每月活跃数据</div> class="Dashboard-CampusItem"
<ActiveUserByMonth :data="activeUser" /> v-loading="loading.regist"
>
<div class="Dashboard-title">
{{ reportYear }}年每月活跃数据
</div> </div>
<div class="Dashboard-CampusItem"> <ActiveUserByMonth :data="activeUser" />
</div> </div>
</div> </div>
</div> </div>
...@@ -72,11 +86,9 @@ export default { ...@@ -72,11 +86,9 @@ export default {
isAdmin: Boolean, isAdmin: Boolean,
}, },
data() { data() {
let today = this.$formatDate(new Date(), 'yyyy-MM-dd');
return { return {
campusFilters: { today: today,
year: '',
areaId: undefined,
},
}; };
}, },
computed: { computed: {
...@@ -89,7 +101,14 @@ export default { ...@@ -89,7 +101,14 @@ export default {
'loading', 'loading',
'reportMounted', 'reportMounted',
'filters', 'filters',
'registeTotal',
'activeTotal',
]), ]),
registeYearTotal() {
return this.registePerMonth.reduce((pre, curItem) => {
return pre + curItem.count;
}, 0);
},
}, },
mounted() { mounted() {
if (!this.reportMounted) { if (!this.reportMounted) {
...@@ -122,20 +141,15 @@ export default { ...@@ -122,20 +141,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,
}); });
}, },
}, },
...@@ -143,9 +157,26 @@ export default { ...@@ -143,9 +157,26 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
@import '@/assets/styles/variables.scss';
.Dashboard { .Dashboard {
.Dashboard-Row.Dashboard-Register { .Dashboard-Row.Dashboard-Register {
height: auto; height: auto;
.Dashboard-SearchBar {
.filter-item-label {
min-width: auto;
width: auto;
}
}
}
.Dashboard-title {
font-size: 20px;
color: #333;
font-weight: 700;
}
@media screen and (max-width: $bigScreenWidth) {
.Dashboard-title {
font-size: 14px;
}
} }
.Dashboard-DataCard { .Dashboard-DataCard {
background-color: #fff; background-color: #fff;
...@@ -155,9 +186,17 @@ export default { ...@@ -155,9 +186,17 @@ export default {
margin-right: 0; margin-right: 0;
} }
} }
.more-info {
margin: 15px;
font-weight: normal;
color: #f70707;
}
.Dashboard-SearchBar { .Dashboard-SearchBar {
display: flex; display: flex;
padding: 10px 0 20px; padding: 10px 0 20px;
.filter-item {
margin: 0 0 0 34px;
}
.filter-item-input { .filter-item-input {
width: 200px; width: 200px;
.el-input { .el-input {
...@@ -168,6 +207,7 @@ export default { ...@@ -168,6 +207,7 @@ export default {
.Dashboard-CampusData { .Dashboard-CampusData {
display: flex; display: flex;
padding: 0 15px; padding: 0 15px;
margin-bottom: 16px;
.Dashboard-title { .Dashboard-title {
position: relative; position: relative;
} }
......
...@@ -32,6 +32,12 @@ export default { ...@@ -32,6 +32,12 @@ export default {
}, },
count: { count: {
alias: '人数', alias: '人数',
formatter: val => {
if (/\./.test(val)) {
return '';
}
return val;
},
}, },
}) })
.tooltip({ .tooltip({
...@@ -39,7 +45,7 @@ export default { ...@@ -39,7 +45,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();
}, },
}, },
......
...@@ -30,6 +30,12 @@ export default { ...@@ -30,6 +30,12 @@ export default {
.source(this.data, { .source(this.data, {
count: { count: {
alias: '人数', alias: '人数',
formatter: val => {
if (/\./.test(val)) {
return '';
}
return val;
},
}, },
}) })
.axis('month', { .axis('month', {
...@@ -44,7 +50,11 @@ export default { ...@@ -44,7 +50,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: {
...@@ -59,6 +61,8 @@ const state = () => ({ ...@@ -59,6 +61,8 @@ const state = () => ({
registePerDay: [], registePerDay: [],
registePerMonth: [], registePerMonth: [],
activeUser: [], activeUser: [],
customerCount: 0,
activeCount: 0,
}, },
title: { title: {
activeCount: 0, activeCount: 0,
...@@ -73,6 +77,8 @@ const getters = { ...@@ -73,6 +77,8 @@ const getters = {
reportMonth: state => state.report.month, reportMonth: state => state.report.month,
registePerDay: state => state.report.registePerDay, registePerDay: state => state.report.registePerDay,
registePerMonth: state => state.report.registePerMonth, registePerMonth: state => state.report.registePerMonth,
registeTotal: state => state.report.customerCount,
activeTotal: state => state.report.activeCount,
activeUser: state => state.report.activeUser, activeUser: state => state.report.activeUser,
titleData: state => state.title, titleData: state => state.title,
areaInfo: state => state.consume.areaInfo, areaInfo: state => state.consume.areaInfo,
...@@ -154,8 +160,19 @@ const actions = { ...@@ -154,8 +160,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.areaId = 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 +181,19 @@ const actions = { ...@@ -164,11 +181,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 }) {
...@@ -212,6 +237,9 @@ const mutations = { ...@@ -212,6 +237,9 @@ const mutations = {
: []; : [];
}, },
[GET_REPORT_DATA]: (state, data) => { [GET_REPORT_DATA]: (state, data) => {
state.report.customerCount = data.customerCount ? data.customerCount : 0;
state.report.activeCount = data.activeCount ? data.activeCount : 0;
state.report.year = data.year; state.report.year = data.year;
state.report.month = data.month; state.report.month = data.month;
...@@ -286,6 +314,9 @@ const mutations = { ...@@ -286,6 +314,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 {
......
...@@ -76,6 +76,7 @@ export default { ...@@ -76,6 +76,7 @@ export default {
'g2-legend': { 'g2-legend': {
width: '215px', width: '215px',
'max-width': '215px', 'max-width': '215px',
'max-height': this.height - 30 + 'px',
// left: '-20px', // left: '-20px',
}, },
'g2-legend-list-item': { 'g2-legend-list-item': {
......
...@@ -5,17 +5,32 @@ ...@@ -5,17 +5,32 @@
<operator-select <operator-select
:accessType="1" :accessType="1"
:value="filters.operateId" :value="filters.operateId"
@input="val => updateFilters({operateId: val,areaId:[]})" @input="val => updateFilters({operateId: val,areaIdArr:[]})"
/> />
</search-item> </search-item>
<search-item label="区域"> <!-- <search-item label="区域">
<dashboard-area-select <dashboard-area-select
:operateId="filters.operateId" :operateId="filters.operateId"
:value="filters.areaId" :value="filters.areaIdArr"
multiple multiple
@input="val => updateFilters({areaIdArr: val})"
/>
</search-item> -->
<search-item label="区域">
<area-select
:value="filters.areaId"
@input="val => updateFilters({areaId: val})" @input="val => updateFilters({areaId: val})"
/> />
</search-item> </search-item>
<search-item label="服务">
<area-service-select
:areaId="filters.areaId"
:filterList="[3]"
:value="filters.service"
@input="val => updateFilters({service: val})"
/>
</search-item>
</template> </template>
</list-layout> </list-layout>
</template> </template>
...@@ -26,7 +41,9 @@ export default { ...@@ -26,7 +41,9 @@ export default {
return { return {
filters: { filters: {
operateId: undefined, operateId: undefined,
areaId: [], areaIdArr: [],
areaId: undefined,
service: undefined,
}, },
}; };
}, },
......
...@@ -42,7 +42,8 @@ export default { ...@@ -42,7 +42,8 @@ export default {
<style lang="scss"> <style lang="scss">
.Home-Dashboard.Dashboard { .Home-Dashboard.Dashboard {
padding: 22px 34px 0; padding: 22px 34px;
overflow-y: hidden; height: 100%;
overflow-y: scroll;
} }
</style> </style>
...@@ -12,6 +12,8 @@ import BaseData from '../components/input/BaseDataSelect/mixin'; ...@@ -12,6 +12,8 @@ import BaseData from '../components/input/BaseDataSelect/mixin';
import BeanType from '../components/input/BeanTypeSelect/mixin'; import BeanType from '../components/input/BeanTypeSelect/mixin';
import OperatorOptions from '../components/input/OperatorSelect/mixin'; import OperatorOptions from '../components/input/OperatorSelect/mixin';
import ServiceType from '../components/input/ServiceTypeSelect/mixin'; import ServiceType from '../components/input/ServiceTypeSelect/mixin';
import AreaService from '../components/input/AreaServiceSelect/mixin';
import OperatorArea from '../components/input/AreaDashboard/mixin';
import SearchBar from '../mixins/searchBar'; import SearchBar from '../mixins/searchBar';
export default { export default {
...@@ -29,9 +31,11 @@ export default { ...@@ -29,9 +31,11 @@ export default {
}, },
Input: { Input: {
Area, Area,
OperatorArea,
BaseData, BaseData,
BeanType, BeanType,
OperatorOptions, OperatorOptions,
ServiceType, ServiceType,
AreaService,
}, },
}; };
...@@ -23,6 +23,7 @@ import BaseDataSelect from '../components/input/BaseDataSelect/index'; ...@@ -23,6 +23,7 @@ import BaseDataSelect from '../components/input/BaseDataSelect/index';
import OperatorSelect from '../components/input/OperatorSelect/index'; import OperatorSelect from '../components/input/OperatorSelect/index';
import BeansSelect from '../components/input/BeanTypeSelect/index'; import BeansSelect from '../components/input/BeanTypeSelect/index';
import ImageUploader from '../components/input/ImageUploader/index'; import ImageUploader from '../components/input/ImageUploader/index';
import AreaServiceSelect from '../components/input/AreaServiceSelect/index';
const extendVue = Vue => { const extendVue = Vue => {
Vue.use(rymUi); Vue.use(rymUi);
...@@ -48,6 +49,7 @@ const extendVue = Vue => { ...@@ -48,6 +49,7 @@ const extendVue = Vue => {
Vue.component(OperatorSelect.name, OperatorSelect); Vue.component(OperatorSelect.name, OperatorSelect);
Vue.component(BeansSelect.name, BeansSelect); Vue.component(BeansSelect.name, BeansSelect);
Vue.component(ImageUploader.name, ImageUploader); Vue.component(ImageUploader.name, ImageUploader);
Vue.component(AreaServiceSelect.name, AreaServiceSelect);
}; };
export default extendVue; export default extendVue;
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