Commit 525b3cd9 by 姜雷

Merge branch 'test' into 'master'

Test See merge request !4
parents 84a8a7a2 c7b510ff
VUE_APP_BASE_URL=/systemManageShell/ VUE_APP_BASE_URL=/systemManageShell/
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
......
...@@ -13,11 +13,14 @@ npm run build:master # 生成环境 ...@@ -13,11 +13,14 @@ npm run build:master # 生成环境
根目录下`.env.dev`,`.env.test`,`.env.master`,分别替换服务地址 根目录下`.env.dev`,`.env.test`,`.env.master`,分别替换服务地址
```bash ```bash
# 如果多项目配置在同一域名下需要配置项目的文件路径
VUE_APP_BASE_URL=/systemManageShell/ # 项目文件路径 配合nginx设置
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 # 系统管理接口
VUE_APP_CUSTOMER_SERVER_URL=http://ex-dev-customer-manage.168cad.top #会员系统接口 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 #基础服务APP接口 VUE_APP_BASE_SERVER_URL_APP=http://ex-dev-dcxy-base-app.168cad.top # 基础服务APP接口
``` ```
## Build Setup ## Build Setup
......
module.exports = { module.exports = {
presets: ['@vue/app'], presets: ['@vue/app'],
plugins: [
[
'component',
{
libraryName: 'element-ui',
styleLibraryName: 'theme-chalk',
},
],
],
}; };
...@@ -6,34 +6,35 @@ ...@@ -6,34 +6,35 @@
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vue-cli-service serve --port 8891", "dev": "vue-cli-service serve --port 8891",
"dev:local": "vue-cli-service serve ./src/dev-local/develop.js --port 8891",
"start": "npm run dev", "start": "npm run dev",
"lint": "eslint --ext .js,.vue src", "lint": "eslint --ext .js,.vue src",
"build": "vue-cli-service build --modern", "build": "vue-cli-service build --modern",
"build:dev": "cross-env npm run buildapp:dev && npm run buildlib:dev", "build:dev": "cross-env npm run buildapp:dev && npm run buildlib:dev",
"build:test": "vue-cli-service build --modern --mode test",
"build:master": "vue-cli-service build --modern --mode master",
"build:prod": "vue-cli-service build --modern",
"buildapp:dev": "vue-cli-service build --modern --mode dev", "buildapp:dev": "vue-cli-service build --modern --mode dev",
"buildlib:dev": "vue-cli-service build --target lib --name manageShell ./src/lib/main.js --modern --mode dev", "buildlib:dev": "vue-cli-service build --target lib --name manageShell ./src/lib/main.js --modern --mode dev",
"build:test": "cross-env npm run buildapp:test && npm run buildlib:test",
"buildapp:test": "vue-cli-service build --modern --mode test",
"buildlib:test": "vue-cli-service build --target lib --name manageShell ./src/lib/main.js --modern --mode test",
"build:master": "cross-env npm run buildapp:master && npm run buildlib:master",
"buildapp:master": "vue-cli-service build --modern --mode master",
"buildlib:master": "vue-cli-service build --target lib --name manageShell ./src/lib/main.js --modern --mode master",
"build:prod": "vue-cli-service build --modern",
"analyz": "cross-env NODE_ENV=production npm_config_report=true npm run build" "analyz": "cross-env NODE_ENV=production npm_config_report=true npm run build"
}, },
"dependencies": { "dependencies": {
"@antv/g2": "^3.5.1", "@antv/g2": "^3.5.1",
"axios": "^0.18.0", "axios": "^0.18.0",
"blueimp-md5": "^2.10.0", "blueimp-md5": "^2.10.0",
"element-ui": "^2.4.5",
"js-cookie": "^2.2.0", "js-cookie": "^2.2.0",
"lodash": "^4.17.5", "lodash": "^4.17.5",
"normalize.css": "^8.0.0", "normalize.css": "^8.0.0",
"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.46", "rym-element-ui": "^0.1.54",
"vue": "^2.5.2",
"vue-qr": "^1.2.8", "vue-qr": "^1.2.8",
"vue-router": "^3.0.1",
"vuedraggable": "^2.16.0", "vuedraggable": "^2.16.0",
"vuex": "^3.0.1",
"wangeditor": "^3.1.1" "wangeditor": "^3.1.1"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -8,20 +8,13 @@ ...@@ -8,20 +8,13 @@
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script> <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuex@3.1.0/dist/vuex.js"></script> <script src="https://cdn.jsdelivr.net/npm/vuex@3.1.0/dist/vuex.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.0.1/dist/vue-router.js"></script> <script src="https://cdn.jsdelivr.net/npm/vue-router@3.0.1/dist/vue-router.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %><%= VUE_APP_LIB_BASE_URL %>lib/manageShell.umd.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %>/customerManage/lib/customerManage.umd.js"></script> <script src="<%= VUE_APP_LIB_MANAGER %>/customerManage/lib/customerManage.umd.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %>/baseManage/lib/baseManage.umd.js"></script> <script src="<%= VUE_APP_LIB_MANAGER %>/baseManage/lib/baseManage.umd.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %>/systemManage/lib/systemManage.umd.js"></script> <script src="<%= VUE_APP_LIB_MANAGER %>/systemManage/lib/systemManage.umd.js"></script>
<link <link
rel="stylesheet" rel="stylesheet"
href="<%= VUE_APP_LIB_MANAGER %>/customerManage/lib/customerManage.css" href="<%= VUE_APP_LIB_MANAGER %><%= VUE_APP_LIB_BASE_URL %>lib/manageShell.css"
/>
<link
rel="stylesheet"
href="<%= VUE_APP_LIB_MANAGER %>/baseManage/lib/baseManage.css"
/>
<link
rel="stylesheet"
href="<%= VUE_APP_LIB_MANAGER %>/systemManage/lib/systemManage.css"
/> />
<title>系统管理</title> <title>系统管理</title>
</head> </head>
......
import fetch from '../fetch'; import fetch from '../fetch';
const path = process.env.VUE_APP_BASE_SERVER_URL; const path = process.env.VUE_APP_BASE_SERVER_URL;
// const path = 'http://192.168.1.33:8889';
export const fetchAreaList = req => export const fetchAreaList = req =>
fetch({ fetch({
...@@ -21,7 +20,7 @@ export const fetchSelectList = req => ...@@ -21,7 +20,7 @@ export const fetchSelectList = req =>
//获取服务类型 //获取服务类型
export const fetchServiceList = req => export const fetchServiceList = req =>
fetch({ fetch({
url: path + '/baseData/get/service', url: path + '/dcxy/api/base/service/all/about/service',
method: 'get', method: 'get',
...req, ...req,
}); });
...@@ -35,7 +34,7 @@ export const fetchOperatorList = req => ...@@ -35,7 +34,7 @@ export const fetchOperatorList = req =>
// 获取豆类型 // 获取豆类型
export const fetchBeansList = req => export const fetchBeansList = req =>
fetch({ fetch({
url: '/baseData/beans', url: path + '/baseData/beans',
method: 'get', method: 'get',
...req, ...req,
}); });
......
...@@ -12,7 +12,8 @@ const createBaseFetch = config => { ...@@ -12,7 +12,8 @@ const createBaseFetch = config => {
// request拦截器 // request拦截器
service.interceptors.request.use( service.interceptors.request.use(
conf => { conf => {
store.dispatch('fetchStart'); const { notLoading } = conf;
store.dispatch('fetchStart', notLoading);
conf.headers = { conf.headers = {
...conf.headers, ...conf.headers,
reqSource: 'pc', reqSource: 'pc',
...@@ -34,7 +35,8 @@ const createBaseFetch = config => { ...@@ -34,7 +35,8 @@ const createBaseFetch = config => {
* code为非 1000 是抛错 * code为非 1000 是抛错
*/ */
setTimeout(() => { setTimeout(() => {
store.dispatch('fetchDone'); const { notLoading } = response.config;
store.dispatch('fetchDone', notLoading);
}, 500); }, 500);
if (res.code !== 1000) { if (res.code !== 1000) {
if ( if (
......
import axios from 'axios'; import axios from 'axios';
import { Message, MessageBox } from 'element-ui'; import { Message, MessageBox } from 'element-ui';
import store from '../store'; import store from '../store';
import { SUCCESS_CODE } from '@/config'; import { SUCCESS_CODE, LOGOUT_CODE } from '@/config';
import { errorHandle } from './validate'; import { errorHandle } from './validate';
import { getYourIP } from '@/utils/getIp.js'; import { getYourIP } from '@/utils/getIp.js';
...@@ -67,7 +67,7 @@ service.interceptors.response.use(response => { ...@@ -67,7 +67,7 @@ service.interceptors.response.use(response => {
}); });
// -2:其他客户端登录了;Token 过期了; // -2:其他客户端登录了;Token 过期了;
if (res.code === '-2') { if (res.code === LOGOUT_CODE) {
if (logout) return; if (logout) return;
logout = true; logout = true;
MessageBox.confirm( MessageBox.confirm(
......
...@@ -65,6 +65,7 @@ $--font-path: '~element-ui/lib/theme-chalk/fonts'; ...@@ -65,6 +65,7 @@ $--font-path: '~element-ui/lib/theme-chalk/fonts';
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
} }
.el-cascader,
.el-input__inner, .el-input__inner,
.el-button { .el-button {
height: 22px; height: 22px;
...@@ -88,6 +89,7 @@ $--font-path: '~element-ui/lib/theme-chalk/fonts'; ...@@ -88,6 +89,7 @@ $--font-path: '~element-ui/lib/theme-chalk/fonts';
height: 56px; height: 56px;
line-height: 56px; line-height: 56px;
} }
.el-cascader,
.el-input__inner, .el-input__inner,
.el-button { .el-button {
height: 40px; height: 40px;
......
...@@ -3,16 +3,24 @@ import store from './store'; ...@@ -3,16 +3,24 @@ import store from './store';
export default { export default {
props: { props: {
// null所有/1自助/2三方 // 服务类型:null所有/1自助/2三方
ServiceType: { ServiceType: {
type: Number, type: Number,
default: null, default: null,
}, },
// 服务状态:null所有/1开启/0关闭
ServiceState: {
type: Number,
default: null,
},
}, },
created() { created() {
store.install(this.$store); store.install(this.$store);
if (!this.serviceTypeLists[this.ServiceType].length) { if (!this.serviceTypeLists[this.ServiceType].length) {
this.fetchServiceTypeList(this.ServiceType); this.fetchServiceTypeList({
serviceType: this.ServiceType,
serviceState: this.ServiceState,
});
} }
}, },
computed: { computed: {
...@@ -24,7 +32,6 @@ export default { ...@@ -24,7 +32,6 @@ export default {
let item = this.serviceTypeLists[this.ServiceType].find( let item = this.serviceTypeLists[this.ServiceType].find(
ServiceType => ServiceType.id === id ServiceType => ServiceType.id === id
); );
return item ? item.serviceName : ''; return item ? item.serviceName : '';
}, },
}, },
......
...@@ -21,15 +21,15 @@ const getters = { ...@@ -21,15 +21,15 @@ const getters = {
}; };
const actions = { const actions = {
fetchServiceTypeList({ state, commit }, serviceType) { fetchServiceTypeList({ state, commit }, { serviceType, serviceState }) {
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 }, params: { serviceType, state: serviceState },
}).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 });
commit(FETCH_STATE, false); commit(FETCH_STATE, { value: false, index: serviceType });
}); });
}, },
}; };
......
export const TOKEN_KEY = 'dcrym'; export const TOKEN_KEY = 'dcrym';
export const SUCCESS_CODE = 1000; export const SUCCESS_CODE = 1000;
export const LOGOUT_CODE = -2;
export const selectTypeMapping = [ export const selectTypeMapping = [
{ label: '赠送类型', value: '2' }, { label: '赠送类型', value: '2' },
......
...@@ -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,11 +213,36 @@ export default { ...@@ -207,11 +213,36 @@ 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>
<style lang="scss"> <style lang="scss">
@import '@/assets/styles/variables.scss';
.Dashboard { .Dashboard {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -246,7 +277,6 @@ export default { ...@@ -246,7 +277,6 @@ export default {
} }
.Dashboard-CampusData { .Dashboard-CampusData {
display: flex; display: flex;
height: 300px;
padding: 0 15px; padding: 0 15px;
.Dashboard-title { .Dashboard-title {
...@@ -321,4 +351,20 @@ export default { ...@@ -321,4 +351,20 @@ export default {
} }
} }
} }
@media screen and (max-width: $bigScreenWidth) {
.Dashboard {
.Dashboard-SearchBar {
padding: 10px 0 10px;
}
.Dashboard-OperatorData {
.Dashboard-SearchBar {
height: 50px;
}
.Dashboard-title {
margin: 10px 10px 0;
padding-bottom: 10px;
}
}
}
}
</style> </style>
...@@ -8,6 +8,7 @@ export default { ...@@ -8,6 +8,7 @@ export default {
data() { data() {
return { return {
chart: null, chart: null,
height: 270,
chartGeom: null, chartGeom: null,
}; };
}, },
...@@ -17,6 +18,11 @@ export default { ...@@ -17,6 +18,11 @@ export default {
}, },
}, },
mounted() { mounted() {
const innerWidth = window.innerWidth;
const innerHeight = window.innerHeight;
if (innerWidth < 1600) {
this.height = (innerHeight - 250) / 2;
}
this.initData(); this.initData();
}, },
methods: { methods: {
......
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
this.chart = new G2.Chart({ this.chart = new G2.Chart({
container: 'ActiveUserByMonth', container: 'ActiveUserByMonth',
forceFit: true, forceFit: true,
height: 270, height: this.height,
padding: [50, 40], padding: [50, 40],
}); });
this.chart this.chart
......
...@@ -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() {
...@@ -29,7 +35,7 @@ export default { ...@@ -29,7 +35,7 @@ export default {
this.chart = new G2.Chart({ this.chart = new G2.Chart({
container: 'CampusRank', container: 'CampusRank',
forceFit: true, forceFit: true,
height: 270, height: this.height,
padding: [0, 130, 0, 0], padding: [0, 130, 0, 0],
}); });
this.chart.source(this.data); this.chart.source(this.data);
...@@ -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) {
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
this.chart = new G2.Chart({ this.chart = new G2.Chart({
container: 'RegisterByDay', container: 'RegisterByDay',
forceFit: true, forceFit: true,
height: 270, height: this.height,
padding: [40, 20, 30, 45], padding: [40, 20, 30, 45],
}); });
this.chart this.chart
......
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
this.chart = new G2.Chart({ this.chart = new G2.Chart({
container: 'RegisterByMonth', container: 'RegisterByMonth',
forceFit: true, forceFit: true,
height: 270, height: this.height,
padding: [0, 20, 30, 20], padding: [0, 20, 30, 20],
}); });
this.chart this.chart
......
...@@ -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() {
...@@ -29,7 +35,7 @@ export default { ...@@ -29,7 +35,7 @@ export default {
this.chart = new G2.Chart({ this.chart = new G2.Chart({
container: 'SeviceRatio', container: 'SeviceRatio',
forceFit: true, forceFit: true,
height: 270, height: this.height,
padding: [0, 130, 0, 0], padding: [0, 130, 0, 0],
}); });
this.chart.source(this.data); this.chart.source(this.data);
...@@ -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) {
......
...@@ -485,7 +485,8 @@ export default { ...@@ -485,7 +485,8 @@ export default {
this.updateUserCellphone(entity) this.updateUserCellphone(entity)
.then(res => { .then(res => {
this.resetCellphoneForm(); this.resetCellphoneForm();
console.log(res); this.$message.success(res.msg || '修改成功');
this.cancelCellphoneUpdate();
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuex@3.1.0/dist/vuex.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.0.1/dist/vue-router.js"></script>
<title>系统管理</title>
</head>
<body>
<noscript>
<strong
>We're sorry but hello-world doesn't work properly without JavaScript
enabled. Please enable it to continue.</strong
>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
<script src="<%= VUE_APP_LIB_MANAGER %>/customerManage/lib/customerManage.umd.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %>/baseManage/lib/baseManage.umd.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %>/systemManage/lib/systemManage.umd.js"></script>
<script src="https://webapi.amap.com/maps?v=1.4.12&key=dd6103c90f2f17310a8711f2d330a0a6"></script>
<script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
<script src="https://unpkg.com/@antv/data-set"></script>
</html>
import System from '../lib/main';
window.manageShell = { default: System };
setTimeout(() => {
let allAasyncRouterMap = [
...customerManage.default,
...baseManage.default,
...systemManage.default,
];
System.createSystem({
basePath: process.env.VUE_APP_BASE_URL,
routers: allAasyncRouterMap,
routeFilter: (routes, allRoute) => {
if (allRoute && allRoute.length) {
let addRoute = System.utils.route.formatRouteLink(allRoute);
for (let index = 0; index < addRoute.length; index++) {
const element = addRoute[index];
if (element.children) {
routes = routes.concat(element.children);
}
}
}
return {
allRoute,
routes,
};
},
});
}, 1000);
import axios from 'axios'; import axios from 'axios';
import { Message, MessageBox } from 'element-ui'; import { Message, MessageBox } from 'element-ui';
// import store from '../store'; import store from '../store';
import { SUCCESS_CODE } from '@/config'; import { SUCCESS_CODE } from '@/config';
import { errorHandle } from '@/api/validate'; import { errorHandle } from '@/api/validate';
import { getYourIP } from '@/utils/getIp.js'; import { getYourIP } from '@/utils/getIp.js';
...@@ -10,7 +10,7 @@ getYourIP(ipVal => { ...@@ -10,7 +10,7 @@ getYourIP(ipVal => {
ip = ipVal; ip = ipVal;
}); });
const createBaseFetch = (config, store) => { const createBaseFetch = config => {
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
timeout: 10000, timeout: 10000,
......
import 'normalize.css/normalize.css'; import 'normalize.css/normalize.css';
import App from '../App'; import App from '../App';
import router, { constantRouterMap, routeStore } from '../router'; import { constantRouterMap, routeStore } from '../router';
import store from '../store'; import store from '../store';
import createBaseFetch from './Api'; import createBaseFetch from './Api';
import configRoutePermission from './permission'; import configRoutePermission from './permission';
import extendCom from '@/utils/extends';
import '@/assets/styles/index.scss'; // global css import '@/assets/styles/index.scss'; // global css
import extendCom from '@/utils/extends';
import { formatRouteLink } from '@/utils/route';
import storeModule from './storeModule'; import storeModule from './storeModule';
import mixinModule from './mixins'; import mixinModule from './mixins';
import utilsModule from './utils';
const createSystem = ({ routers, routeFilter }) => {
class SystemShell { const fetch = createBaseFetch({
constructor() { timeout: 10000,
this.createBaseFetch = createBaseFetch; });
this.fetch = createBaseFetch(
{ class SystemShell {
timeout: 10000, constructor() {
}, this.Api = fetch;
store this.storeModule = storeModule;
); this.mixinModule = mixinModule;
this.initSystem(); this.utils = utilsModule;
}
mixins = mixinModule;
storeModule = storeModule;
initSystem() {
routeStore.install(store);
extendCom(Vue);
configRoutePermission(router, store, routers);
Vue.config.productionTip = false;
}
mount() {
/* eslint-disable no-new */
let app = new Vue({
el: '#app',
router,
store,
render: h => {
let routes = [...constantRouterMap];
let allRoute = store.getters.asyncRoutes;
if (typeof routeFilter === 'function') {
allRoute = routeFilter(allRoute);
}
if (allRoute && allRoute.length) {
let addRoute = formatRouteLink(allRoute);
for (let index = 0; index < addRoute.length; index++) {
const element = addRoute[index];
if (element.children) {
routes = routes.concat(element.children);
}
}
}
return <App route={routes} allRoutes={allRoute} />;
},
});
return app;
}
} }
const systemShell = new SystemShell(); createSystem = ({ basePath = '/', routers, routeFilter }) => {
window.$$SystemShell = systemShell; const router = new VueRouter({
return systemShell; mode: 'history',
}; base: basePath,
scrollBehavior: () => ({ y: 0 }),
export default createSystem; routes: constantRouterMap,
});
routeStore.install(store);
extendCom(Vue);
configRoutePermission(router, store, routers);
Vue.config.productionTip = false;
let app = new Vue({
el: '#app',
router,
store,
render: h => {
let routes = [...constantRouterMap];
let allRoute = store.getters.asyncRoutes;
if (typeof routeFilter === 'function') {
const data = routeFilter(routes, allRoute);
routes = data.routes;
allRoute = data.allRoute;
}
return <App route={routes} allRoutes={allRoute} />;
},
});
return app;
};
createBaseFetch = createBaseFetch;
}
export default new SystemShell();
...@@ -5,7 +5,13 @@ import Operator from '../mixins/operator'; ...@@ -5,7 +5,13 @@ import Operator from '../mixins/operator';
import Admin from '../mixins/admins/admins'; import Admin from '../mixins/admins/admins';
import Menu from '../mixins/menu/menus'; import Menu from '../mixins/menu/menus';
import UserInfoLabel from '../mixins/user/getUserInfoLabel'; import UserInfoLabel from '../mixins/user/getUserInfoLabel';
import UserBaseInfo from '../mixins/user/userBaseInfo'; import BaseInfo from '../mixins/user/userBaseInfo';
import Validate from '../mixins/user/validate';
import Area from '../components/input/AreaSelect/mixin';
import BaseData from '../components/input/BaseDataSelect/mixin';
import BeanType from '../components/input/BeanTypeSelect/mixin';
import OperatorOptions from '../components/input/OperatorSelect/mixin';
import ServiceType from '../components/input/ServiceTypeSelect/mixin';
export default { export default {
Dialog, Dialog,
...@@ -14,6 +20,16 @@ export default { ...@@ -14,6 +20,16 @@ export default {
Operator, Operator,
Admin, Admin,
Menu, Menu,
UserInfoLabel, User: {
UserBaseInfo, BaseInfo,
UserInfoLabel,
Validate,
},
Input: {
Area,
BaseData,
BeanType,
OperatorOptions,
ServiceType,
},
}; };
import * as main from '../utils/index';
import * as auth from '../utils/auth';
import * as route from '../utils/route';
import downloadUrl from '../utils/download';
import { getYourIP } from '../utils/getIp';
import * as validate from '../utils/validate';
export default {
...main,
auth,
route,
downloadFiles: downloadUrl,
getIp: getYourIP,
validate,
};
import createSystem from './lib/main';
let allAasyncRouterMap = [ let allAasyncRouterMap = [
...customerManage.default, ...customerManage.default,
...baseManage.default, ...baseManage.default,
...systemManage.default, ...systemManage.default,
]; ];
let app = createSystem({ const System = manageShell.default;
System.createSystem({
basePath: process.env.VUE_APP_BASE_URL,
routers: allAasyncRouterMap, routers: allAasyncRouterMap,
// routeFilter: allRoute => { routeFilter: (routes, allRoute) => {
// let filterRoute = allRoute.find(menu => menu.menuCode == '0001'); if (allRoute && allRoute.length) {
// return filterRoute ? [filterRoute] : []; let addRoute = System.utils.route.formatRouteLink(allRoute);
// }, for (let index = 0; index < addRoute.length; index++) {
const element = addRoute[index];
if (element.children) {
routes = routes.concat(element.children);
}
}
}
return {
allRoute,
routes,
};
},
}); });
app.mount();
import router, { asyncRouterMap } from './router';
import store from './store';
import NProgress from 'nprogress'; // Progress 进度条
import 'nprogress/nprogress.css'; // Progress 进度条样式
import { getToken } from '@/utils/auth'; // 验权
import { getAuthRoute } from './utils/route';
let allAasyncRouterMap = [
...customerManage.default,
...baseManage.default,
...systemManage.default,
];
NProgress.configure({ showSpinner: false }); // NProgress Configuration
const whiteList = process.env.VUE_APP_WHITE_LIST.split(','); // 不重定向白名单
const getRouteAdd = () => {
let allRoute = store.getters.asyncRoutes;
let asyncRouters = getAuthRoute(allAasyncRouterMap, allRoute);
router.addRoutes(asyncRouters); // 动态添加可访问路由表
router.addRoutes(asyncRouterMap);
};
router.beforeEach((to, from, next) => {
NProgress.start(); // 进度条Progress
if (getToken()) {
if (to.path === '/login') {
next({ path: '/' });
NProgress.done();
} else {
if (store.getters.isRouteDone) {
next(); //
} else {
let addRoute = store.getters.asyncRoutes;
if (addRoute && addRoute.length) {
getRouteAdd();
store.dispatch('GenerateRoutes');
next({ ...to, replace: true });
} else {
store
.dispatch('TokenLogin', {
data: { token: getToken() },
})
.then(() => {
getRouteAdd();
store.dispatch('GenerateRoutes');
next({ ...to, replace: true });
})
.catch(err => {
console.log(err);
store.dispatch('FedLogOut').then(() => {
next({ path: '/login' });
});
});
}
}
}
} else {
if (whiteList.indexOf(to.path) !== -1) {
next();
} else {
next('/login');
NProgress.done();
}
}
});
router.afterEach(() => {
NProgress.done(); // 结束Progress
});
...@@ -33,9 +33,8 @@ const asyncRouterMap = [{ path: '*', redirect: '/404', hidden: true }]; ...@@ -33,9 +33,8 @@ const asyncRouterMap = [{ path: '*', redirect: '/404', hidden: true }];
export { constantRouterMap, asyncRouterMap, routeStore }; export { constantRouterMap, asyncRouterMap, routeStore };
export default new VueRouter({ export default {
mode: 'history', constantRouterMap,
base: process.env.VUE_APP_BASE_URL, asyncRouterMap,
scrollBehavior: () => ({ y: 0 }), routeStore,
routes: constantRouterMap, };
});
...@@ -12,20 +12,24 @@ const getters = { ...@@ -12,20 +12,24 @@ const getters = {
}; };
const actions = { const actions = {
fetchStart({ commit }) { fetchStart({ commit }, notLoading) {
commit(FETCH_START); commit(FETCH_START, notLoading);
}, },
fetchDone({ commit }) { fetchDone({ commit }, notLoading) {
commit(FETCH_DONE); commit(FETCH_DONE, notLoading);
}, },
}; };
const mutations = { const mutations = {
[FETCH_START](state) { [FETCH_START](state, notLoading) {
fetchCount++; if (!notLoading) {
state.loading = true; fetchCount++;
state.loading = true;
}
}, },
[FETCH_DONE](state) { [FETCH_DONE](state, notLoading) {
fetchCount--; if (!notLoading) {
fetchCount--;
}
if (fetchCount === 0) { if (fetchCount === 0) {
state.loading = false; state.loading = false;
} }
......
import { login, logout, changePwd } from '@/api/user/login'; import { login, logout, changePwd } from '@/api/user/login';
import { getToken, setToken, removeToken } from '@/utils/auth'; import { getToken, setToken, removeToken } from '@/utils/auth';
import { SET_TOKEN, UPDATE_USERINFO } from './mutation-types'; import { SET_TOKEN, UPDATE_USERINFO } from './mutation-types';
import { updateUserinfo, updateUserCellphone } from '@/api/user/update';
import md5 from 'blueimp-md5'; import md5 from 'blueimp-md5';
const state = { const state = {
...@@ -85,6 +86,37 @@ const actions = { ...@@ -85,6 +86,37 @@ const actions = {
dispatch('getAsyncRoute', userRoles); dispatch('getAsyncRoute', userRoles);
}); });
}, },
// 修改资料
updateUserinfo({ commit, dispatch }, { name, newPwd, oldPwd }) {
return updateUserinfo({
data: newPwd
? {
name,
newPwd: md5(newPwd),
oldPwd: md5(oldPwd),
}
: {
name,
},
}).then(res => {
const {
data: { userRoles, userInfo },
} = res;
commit(UPDATE_USERINFO, userInfo);
dispatch('getAsyncRoute', userRoles);
return res;
});
},
// 修改电话
updateUserCellphone({ commit }, entity) {
return updateUserCellphone({
params: entity,
}).then(res => {
console.log(res);
commit(UPDATE_USERINFO, entity);
return res;
});
},
}; };
const mutations = { const mutations = {
......
...@@ -21,6 +21,7 @@ import GiveTypeSelect from '../components/input/GiveTypeSelect.vue'; ...@@ -21,6 +21,7 @@ import GiveTypeSelect from '../components/input/GiveTypeSelect.vue';
import BaseDataSelect from '../components/input/BaseDataSelect/index'; 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';
const extendVue = Vue => { const extendVue = Vue => {
Vue.use(rymUi); Vue.use(rymUi);
...@@ -44,6 +45,7 @@ const extendVue = Vue => { ...@@ -44,6 +45,7 @@ const extendVue = Vue => {
Vue.component(GiveTypeSelect.name, GiveTypeSelect); Vue.component(GiveTypeSelect.name, GiveTypeSelect);
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);
}; };
export default extendVue; export default extendVue;
...@@ -9,6 +9,10 @@ let isLib = (() => { ...@@ -9,6 +9,10 @@ let isLib = (() => {
} }
})(); })();
let isLocal = (() => {
return /develop/.test(process.argv[3]);
})();
module.exports = { module.exports = {
publicPath: process.env.VUE_APP_BASE_URL, publicPath: process.env.VUE_APP_BASE_URL,
outputDir: isLib ? Path.join('dist', 'lib') : 'dist', outputDir: isLib ? Path.join('dist', 'lib') : 'dist',
...@@ -21,4 +25,14 @@ module.exports = { ...@@ -21,4 +25,14 @@ module.exports = {
}, },
], ],
}, },
chainWebpack: config => {
if (!isLib && isLocal) {
config.plugin('html').tap(args => {
if (process.env.NODE_ENV == 'development') {
args[0].template = Path.join('src', 'dev-local', 'develop.html');
}
return args;
});
}
},
}; };
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