Commit 3b05ea21 authored by 李苏's avatar 李苏 💬

erp调整

parent cc5ed5e1
......@@ -5,7 +5,7 @@ VUE_APP_TITLE = 格物软件
ENV = 'production'
# gavelErp/生产环境
VUE_APP_BASE_API = 'wmsappServie'
VUE_APP_BASE_API = 'http://192.168.30.254:28080/erp'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
<template>
<section class="app-main">
<transition name="fade-transform" mode="out-in">
<template v-if="cachedViews.indexOf(key)!=-1 ">
<keep-alive >
<router-view :key="key" />
<template>
<section class="app-main">
<transition name="fade-transform" mode="out-in">
<keep-alive :include="cachedViews">
<router-view v-if="!$route.meta.link" :key="key" />
</keep-alive>
</template>
<template v-else >
<router-view :key="key" />
</template>
</transition>
</section>
</template>
<script>
</transition>
</section>
</template>
<script>
export default {
name: 'AppMain',
computed: {
cachedViews() {
return this.$store.state.tagsView.cachedViews
},
key() {
console.log(this.$route.name)
return this.$route.name
export default {
name: 'AppMain',
computed: {
cachedViews() {
return this.$store.state.tagsView.cachedViews
},
key() {
return this.$route.path
}
}
}
}
</script>
</script>
<style lang="scss" scoped>
.app-main {
/* 50= navbar 50 */
min-height: calc(100vh - 50px);
width: 100%;
position: relative;
overflow: hidden;
}
.fixed-header+.app-main {
padding-top: 50px;
}
.hasTagsView {
<style lang="scss" scoped>
.app-main {
/* 84 = navbar + tags-view = 50 + 34 */
min-height: calc(100vh - 84px);
/* 50= navbar 50 */
min-height: calc(100vh - 50px);
width: 100%;
position: relative;
overflow: hidden;
}
.fixed-header+.app-main {
padding-top: 84px;
padding-top: 50px;
}
.hasTagsView {
.app-main {
/* 84 = navbar + tags-view = 50 + 34 */
min-height: calc(100vh - 84px);
}
.fixed-header+.app-main {
padding-top: 84px;
}
}
}
</style>
<style lang="scss">
// fix css style bug in open el-dialog
.el-popup-parent--hidden {
.fixed-header {
padding-right: 17px;
// fix css style bug in open el-dialog
.el-popup-parent--hidden {
.fixed-header {
padding-right: 17px;
}
}
}
</style>
import auth from '@/plugins/auth'
import router, { constantRoutes, dynamicRoutes,powerRoutes } from '@/router'
import { getRouters } from '@/api/menu'
import router, {
constantRoutes,
dynamicRoutes,
powerRoutes
} from '@/router'
import {
getRouters
} from '@/api/menu'
import Layout from '@/layout/index'
import ParentView from '@/components/ParentView'
import InnerLink from '@/layout/components/InnerLink'
......@@ -8,7 +14,11 @@ import views from 'common'
import vue from 'vue'
import commonList from "common/src/commonList"
import erpList from "common/src/erpList"
/* 引入common */
import dynamicRouter from 'common/src/utils/router/dynamic.js'
import {
treeToList
} from 'common/src/utils/router/dynamic.js'
/* 过滤mkid相同的定制路由 */
const permission = {
......@@ -18,40 +28,40 @@ const permission = {
defaultRoutes: [],
topbarRouters: [],
sidebarRouters: [],
appName:'',
customName:'',
systemName:'',
systemInfo:[]
appName: '',
customName: '',
systemName: '',
systemInfo: []
},
mutations: {
INIT_SIDEBARRPUTERS:(state)=>{
state.sidebarRouters=[]
INIT_SIDEBARRPUTERS: (state) => {
state.sidebarRouters = []
},
SET_SYSTEMINFO:(state,systemInfo)=>{
state.systemInfo=systemInfo
SET_SYSTEMINFO: (state, systemInfo) => {
state.systemInfo = systemInfo
},
SET_CUSTOMNAME:(state,customName)=>{
state.customName=customName
SET_CUSTOMNAME: (state, customName) => {
state.customName = customName
},
SET_SYSTEMNAME:(state,systemName)=>{
state.systemName=systemName
SET_SYSTEMNAME: (state, systemName) => {
state.systemName = systemName
},
SET_APPNAME:(state,appName)=>{
state.appName=appName
SET_APPNAME: (state, appName) => {
state.appName = appName
},
SET_SIDEBAR_SHOW:(state, menusBizType)=>{
state.sidebarRouters.forEach((e,index)=>{
if(menusBizType!='root'&&e.menusBizType&&e.menusBizType==menusBizType){
SET_SIDEBAR_SHOW: (state, menusBizType) => {
state.sidebarRouters.forEach((e, index) => {
if (menusBizType != 'root' && e.menusBizType && e.menusBizType == menusBizType) {
state.sidebarRouters[index].hidden=false
}else{
state.sidebarRouters[index].hidden=true
state.sidebarRouters[index].hidden = false
} else {
state.sidebarRouters[index].hidden = true
}
if(menusBizType=='root'&&e.mkid){
state.sidebarRouters[index].hidden=false
if (menusBizType == 'root' && e.mkid) {
state.sidebarRouters[index].hidden = false
}
if(e.redirect=='index'){
e.hidden=false
if (e.redirect == 'index') {
e.hidden = false
}
})
......@@ -72,79 +82,96 @@ const permission = {
},
actions: {
// 生成路由
GenerateRoutes({ commit }) {
GenerateRoutes({
commit
}) {
return new Promise(resolve => {
// 向后端请求路由数据
getRouters({}).then(res => {
let appName=res.data.appName||''
let customName=res.data.customName||''
let systemName=res.data.systemName||''
commit('SET_APPNAME', appName)
commit('SET_CUSTOMNAME', customName)
commit('SET_SYSTEMNAME', systemName)
localStorage.setItem('homeMkid', res.data.homeMkid)
localStorage.setItem('homeName', res.data.homeName)
let appName = res.data.appName || ''
let customName = res.data.customName || ''
let systemName = res.data.systemName || ''
commit('SET_APPNAME', appName)
commit('SET_CUSTOMNAME', customName)
commit('SET_SYSTEMNAME', systemName)
/* 构建新list放进列表切换*/
localStorage.setItem('appName',appName)
localStorage.setItem('appName', appName)
/* 存储system id list*/
/* 将可切换系统存入store*/
let systemInfo=res.data.systemInfo||[]
if(systemInfo.length!=0){
let systemInfo = res.data.systemInfo || []
if (systemInfo.length != 0) {
systemInfo.unshift({
id:'',
name:customName
id: '',
name: customName
})
}
commit('SET_SYSTEMINFO', systemInfo)
let menus=res.data.menu
let asymenus=JSON.parse(JSON.stringify(res.data.menu))
/* 权限路由*/
/* */
function filter (data) {
var newData = data.filter(
(item)=>{
let hasMkid=false
asymenus.forEach(e=>{
if((e.mkid==item.meta.mkid)||(item.meta.mkid=='test')){
item.meta.icon=e.icon
if(item.meta.mkid!='test'){
item.meta.title=e.mkmc
}
/* 额外参数*/
e.mkid&&(item.mkid=e.mkid)
e.menusBizType&&(item.menusBizType=e.menusBizType)
e.mkid&&(item.menusBizTypeName=e.menusBizTypeName)
hasMkid=true
}
})
return hasMkid
}
)
newData.forEach(x => x.children && (x.children = filter(x.children)))
return newData
}
let newPowerRoutes=filter(powerRoutes)
console.log(newPowerRoutes,'newPowerRoutes')
let newCommonList=filter(commonList.list)
let newErpList=filter(erpList.list)
let menus = res.data.menu
let asymenus = JSON.parse(JSON.stringify(res.data.menu))
/* 权限路由*/
/* */
function filter(data) {
var newData = data.filter(
(item) => {
let hasMkid = false
asymenus.forEach(e => {
if ((e.mkid == item.meta.mkid) || (item.meta.mkid == 'test')) {
item.meta.icon = e.icon
if (item.meta.mkid != 'test') {
item.meta.title = e.mkmc
}
/* 额外参数*/
e.mkid && (item.mkid = e.mkid)
e.menusBizType && (item.menusBizType = e.menusBizType)
e.mkid && (item.menusBizTypeName = e.menusBizTypeName)
hasMkid = true
}
})
return hasMkid
}
)
newData.forEach(x => x.children && (x.children = filter(x.children)))
return newData
}
let newPowerRoutes = filter(powerRoutes)
let newCommonList = filter(commonList.list)
let newErpList = filter(erpList.list)
/* 转化菜单格式*/
let delArr=[]
let newmenus=[]
menus.forEach((mi,i)=>{
let length= Object.keys(mi)
if(length!=0){
newmenus.push(mi)
}
let delArr = []
let newmenus = []
menus.forEach((mi, i) => {
let length = Object.keys(mi)
if (length != 0) {
newmenus.push(mi)
}
})
// res.data=[...
// newCommonList, ...newErpList, ...newPowerRoutes]
res.data = dynamicRouter([...newCommonList, ...newErpList, ...newPowerRoutes], asymenus) || [...
newCommonList, ...newErpList, ...newPowerRoutes
]
/* 重置首页路由*/
/*
res.data=[...newCommonList,...newErpList,...newPowerRoutes]
*/
// res.data=[...newCommonList,...newErpList,...newPowerRoutes]
const sdata = JSON.parse(JSON.stringify(res.data))
const rdata = JSON.parse(JSON.stringify(res.data))
console.log(sdata,'加载的全部路由')
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
const asyncRoutes = filterDynamicRoutes(dynamicRoutes);
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
rewriteRoutes.push({
path: '*',
redirect: '/404',
hidden: true
})
router.addRoutes(asyncRoutes);
// router.addRoutes(powerRoutes1)
......@@ -175,15 +202,14 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
} else if (route.component === 'InnerLink') {
route.component = InnerLink
} else {
if(route.commonComponent){
if (route.commonComponent) {
route.component = loadCommonView(route.component)
route.component = loadCommonView(route.component)
}else if(route.erpComponent){
} else if (route.erpComponent) {
route.component = loadErpView(route.component)
}
else{
route.component = loadView(route.component)
} else {
route.component = loadView(route.component)
}
}
......@@ -197,19 +223,19 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
return true
})
}
/* 递归整理*/
function dgmk(arr,pid){
let oldarr = JSON.parse(JSON.stringify(arr))
let outarr = []
oldarr.forEach((e,index)=>{
if(e.fmkid==pid){
/* 递归整理*/
function dgmk(arr, pid) {
let oldarr = JSON.parse(JSON.stringify(arr))
let outarr = []
oldarr.forEach((e, index) => {
if (e.fmkid == pid) {
outarr.push(e)
e.children=dgmk(oldarr,e.mkid)
}
})
return outarr
}
outarr.push(e)
e.children = dgmk(oldarr, e.mkid)
}
})
return outarr
}
......@@ -261,7 +287,7 @@ export const loadView = (view) => {
} else {
// 使用 import 实现生产环境的路由懒加载
// return () => import(`@/views/${view}`)
return (resolve) => require([`@/views/${view}`], resolve)
return (resolve) => require([`@/views/${view}`], resolve)
}
}
......@@ -272,7 +298,7 @@ export const loadCommonView = (view) => {
} else {
// 使用 import 实现生产环境的路由懒加载
// return () => import(`@/views/${view}`)
return (resolve) => require([`common/src/views/${view}`], resolve)
return (resolve) => require([`common/src/views/${view}`], resolve)
}
}
export const loadErpView = (view) => {
......@@ -282,7 +308,7 @@ export const loadErpView = (view) => {
} else {
// 使用 import 实现生产环境的路由懒加载
// return () => import(`@/views/${view}`)
return (resolve) => require([`common/src/erpViews/${view}`], resolve)
return (resolve) => require([`common/src/erpViews/${view}`], resolve)
}
}
......
......@@ -49,7 +49,7 @@ const user = {
login(username, password, code, uuid,systemid).then(res => {
sessionStorage.setItem('allUserInfo',JSON.stringify(res.data))
localStorage.setItem('username',res.data.username)
localStorage.setItem('userid',res.data.userid)
localStorage.setItem('userid',res.data.userkey)
localStorage.setItem('systemid',systemid)
/* 存储本地一份 */
setToken(res.data.token)
......
......@@ -28,8 +28,8 @@
</div>
</div>
<div class="login_submit">
<el-tabs class="full" type="border-card" >
<el-tab-pane label="账户登录">
<el-tabs v-model="tabPaneName" class="full" type="border-card" >
<el-tab-pane name='zh' label="账户登录">
<div class="full" >
<el-form ref="loginForm1" :model="loginForm" :rules="loginRules" class="full login-form">
<el-form-item prop="username">
......@@ -76,7 +76,7 @@
</el-form>
</div>
</el-tab-pane>
<el-tab-pane label="企业号登录">
<el-tab-pane name='qyh' label="企业号登录">
<div class="full" >
<el-form ref="loginForm2" :model="loginForm" :rules="loginRules" class="full login-form login-form2 ">
<el-form-item prop="systemid" >
......@@ -150,11 +150,13 @@ import {systeminfo} from "@/api/common/common.js"
export default {
mounted() {
// alert(window.location.origin+'/'+(window.pathname||'')+process.env.VUE_APP_BASE_API)
},
name: "Login",
data() {
return {
tabPaneName:'zh',
/* 登录方式*/
isqyh:false,
appName:'',
......@@ -306,20 +308,20 @@ export default {
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.my-element {
animation: animatedBackground 11s linear infinite;
}
@keyframes animatedBackground {
0% {
filter: hue-rotate(0deg) saturate(100%) brightness(100%) ;
}
50% {
filter: hue-rotate(38deg) saturate(100%) brightness(100%) ;
}
100% {
filter: hue-rotate(0deg) saturate(100%) brightness(100%) ;
}
}
// .my-element {
// animation: animatedBackground 11s linear infinite;
// }
// @keyframes animatedBackground {
// 0% {
// filter: hue-rotate(0deg) saturate(100%) brightness(100%) ;
// }
// 50% {
// filter: hue-rotate(38deg) saturate(100%) brightness(100%) ;
// }
// 100% {
// filter: hue-rotate(0deg) saturate(100%) brightness(100%) ;
// }
// }
.btn {
--hue: 190;
padding: 0px!important;
......@@ -437,8 +439,8 @@ export default {
justify-content: right;
align-items: center;
height: 100%;
background-image: url("../assets/images/login-rj.png");
background-size: cover;
background-image: url("../assets/images/login_iot.png");
background-size: 100% 100%;
}
.title {
font-family: Georgia, 'Times New Roman', Times, serif;
......@@ -519,9 +521,11 @@ export default {
font-size: 24px;
width: 100%;
font-weight: 800;
color: #fff;
}
}
.login_submit{
transform: translate(0.7);
height: 70%;
width: 100%;
}
......
......@@ -37,10 +37,10 @@ module.exports = {
[process.env.VUE_APP_BASE_API]: {
// target: `http://192.168.30.254:18080/dmg`,
// target: `http://192.168.30.106:9081/erp`,
// target: `http://192.168.30.254:28084/erp`,
target: `http://localhost:9080/erp`,
// target:'http://clouderp.gavelinfo.com/erp',
// target: `http://localhost:9080/erp`,
target:'http://clouderp.gavelinfo.com/erp',
changeOrigin: true,
logLevel: 'debug',
pathRewrite: {
......
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