Commit 12237578 authored by 李苏's avatar 李苏 💬

ERP 特别修改

parent 26029be5
# 页面标题
VUE_APP_TITLE = Gavel
VUE_APP_TITLE = 格物软件
# 开发环境配置
ENV = 'http://demo.ruoyi.vip/'
......
# 页面标题
VUE_APP_TITLE = Gavel
VUE_APP_TITLE = 格物软件
# 生产环境配置
ENV = 'production'
# gavelErp/生产环境
VUE_APP_BASE_API = '/wmsapp/wmsappServie'
VUE_APP_BASE_API = 'test'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
\ No newline at end of file
VUE_CLI_BABEL_TRANSPILE_MODULES = true
import request from 'common/src/utils/request'
/* 事务类型接口 */
export function initSwlx(query) {
return request({
url: '/jcsj/common/wfstate',
method: 'post',
data: query||{}
})
}
/* 部门接口 */
export function initBm(query) {
return request({
url: '/kzzx/bm/query',
method: 'post',
data: query||{}
})
}
/* 系统初始接口 */
export function systeminfo(query) {
return request({
url: '/systeminfo',
method: 'post',
data: query||{}
})
}
// 公司接口
export function queryGs(query) {
return request({
url: '/jcsj/common/bm/queryGs',
method: 'post',
data: query||{}
})
}
import request from '@/utils/request'
import request from 'common/src/utils/request'
import md5 from '@/utils/md5.js'
// 登录方法
export function login(username, password, code, uuid) {
export function login(username, password, code, uuid,systemid) {
const data = {
"userid":username.toLowerCase(),
"password":md5(username.toLowerCase() + "USER" + password + "PASSWORD"),
"newPassword":md5(password)
}
if(systemid){
data.systemid=systemid
}
return request({
url: '/login',
headers: {
......@@ -55,4 +58,4 @@ export function getCodeImg() {
method: 'get',
timeout: 20000
})
}
\ No newline at end of file
}
......@@ -29,6 +29,7 @@ export default {
return {
search: '',
options: [],
allPool:[],
searchPool: [],
show: false,
fuse: undefined
......@@ -56,12 +57,23 @@ export default {
},
mounted() {
this.searchPool = this.generateRoutes(this.routes)
this.allPool= this.searchPool.map((item,index)=>{
let obj={
refIndex:index,
item:item
}
return obj
})
},
methods: {
click() {
this.show = !this.show
if (this.show) {
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus()
setTimeout(()=>{
this.options = this.allPool
},200)
}
},
close() {
......@@ -119,14 +131,14 @@ export default {
data.title = [...data.title, router.meta.title]
// if (router.redirect !== 'noRedirect') {
// res.push(data)
// }
if (!router.redirect) {
res.push(data)
}
//
//
}
// recursive child routes
......@@ -143,7 +155,7 @@ export default {
if (query !== '') {
this.options = this.fuse.search(query)
} else {
this.options = []
this.options = this.allPool
}
},
ishttp(url) {
......
<template>
<section class="app-main">
<transition name="fade-transform" mode="out-in">
<!-- <keep-alive :include="cachedViews">
<router-view :key="key" />
</keep-alive> -->
<keep-alive >
<template v-if="cachedViews.indexOf(key)!=-1 ">
<keep-alive >
<router-view :key="key" />
</keep-alive>
</template>
<template v-else >
<router-view :key="key" />
</keep-alive>
</template>
</transition>
</section>
</template>
......@@ -19,7 +22,8 @@ export default {
return this.$store.state.tagsView.cachedViews
},
key() {
return this.$route.path
console.log(this.$route.name)
return this.$route.name
}
}
}
......
<template>
<div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
<!-- 修改密码-->
<el-dialog :append-to-body='true' title="修改密码" :visible.sync="settingVisible" width="40%">
<div>
<el-form ref="form" :model="users" :rules="rules" label-width="80px">
<el-form-item label="旧密码" prop="oldPassword">
<el-input v-model="users.oldPassword" placeholder="请输入旧密码" type="password" show-password/>
</el-form-item>
<el-form-item label="新密码" prop="newPassword">
<el-input v-model="users.newPassword" placeholder="请输入新密码" type="password" show-password/>
</el-form-item>
<el-form-item label="确认密码" prop="confirmPassword">
<el-input v-model="users.confirmPassword" placeholder="请确认新密码" type="password" show-password/>
</el-form-item>
<!-- <el-form-item>
<el-button type="primary" size="mini" @click="submit">保存</el-button>
<el-button type="danger" size="mini" @click="close">关闭</el-button>
</el-form-item> -->
</el-form>
</div>
<div class="refooter">
<span slot="footer" class="dialog-footer">
<el-button @click="settingVisible = false">取 消</el-button>
<el-button type="primary" @click="submit">确 定</el-button>
</span>
</div>
</el-dialog>
<!-- -->
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
<div class="right-menu">
<div style="height: 100%;width: 200px;float: left;background-color: #eee;">
<navbarMenu/>
<div style="height: 100%;float: left;">
<search id="header-search" class="right-menu-item" />
</div>
<div v-if="systemInfo.length!=0" style="height: 100%;width: 200px;float: left;">
<ChangeProject/>
</div>
<template v-if="device!=='mobile'">
<search id="header-search" class="right-menu-item" />
<screenfull id="screenfull" class="right-menu-item hover-effect" />
</template>
......@@ -25,9 +56,12 @@
<router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
<!-- <el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item> -->
<span @click="showItem">
<el-dropdown-item>修改密码</el-dropdown-item>
</span>
<el-dropdown-item @click.native="setting = true">
<span>主题设置</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
......@@ -47,6 +81,8 @@ import SizeSelect from '@/components/SizeSelect'
import Search from '@/components/HeaderSearch'
import RuoYiGit from '@/components/RuoYi/Git'
import RuoYiDoc from '@/components/RuoYi/Doc'
import { updatePassword } from "common/src/api/development/development.js";
import ChangeProject from './changeProject.vue';
export default {
components: {
......@@ -57,17 +93,50 @@ export default {
SizeSelect,
Search,
RuoYiGit,
RuoYiDoc
RuoYiDoc,
ChangeProject
},
mounted(){
this.user=localStorage.getItem('username')||'用户'
},
data(){
const equalToPassword = (rule, value, callback) => {
if (this.users.newPassword !== value) {
callback(new Error("两次输入的密码不一致"));
} else {
callback();
}
};
return{
user:'用户'
users: {
oldPassword: undefined,
newPassword: undefined,
confirmPassword: undefined
},
user:'用户',
settingVisible:false,
// 表单校验
rules: {
oldPassword: [
{ required: true, message: "旧密码不能为空", trigger: "blur" }
],
newPassword: [
{ required: true, message: "新密码不能为空", trigger: "blur" },
{ min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" }
],
confirmPassword: [
{ required: true, message: "确认密码不能为空", trigger: "blur" },
{ required: true, validator: equalToPassword, trigger: "blur" }
]
}
}
},
computed: {
systemInfo(){
let data=this.$store.getters.systemInfo||[]
return data
},
...mapGetters([
'sidebar',
'avatar',
......@@ -91,6 +160,30 @@ export default {
}
},
methods: {
submit() {
this.$refs["form"].validate(valid => {
if (valid) {
let params={
oldPassword: Base64.encode(this.user.oldPassword),
newPassword: Base64.encode(this.user.newPassword),
newPasswordConfirm: Base64.encode(this.user.confirmPassword)
}
updatePassword(params).then(res=>{
if(res.success){
this.$success('密码修改成功!')
this.settingVisible=false
}
})
// updateUserPwd(this.user.oldPassword, this.user.newPassword).then(response => {
// this.$modal.msgSuccess("修改成功");
// });
}
});
},
showItem(){
this.settingVisible=true
},
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
......
......@@ -35,36 +35,36 @@
</div>
</div>
<el-divider/>
<!--<el-divider/>-->
<h3 class="drawer-title">系统布局配置</h3>
<div class="drawer-item">
<span>开启 TopNav</span>
<el-switch v-model="topNav" class="drawer-switch" />
</div>
<!--<h3 class="drawer-title">系统布局配置</h3>-->
<!---->
<!--<div class="drawer-item">-->
<!--<span>开启 TopNav</span>-->
<!--<el-switch v-model="topNav" class="drawer-switch" />-->
<!--</div>-->
<div class="drawer-item">
<span>开启 Tags-Views</span>
<el-switch v-model="tagsView" class="drawer-switch" />
</div>
<!--<div class="drawer-item">-->
<!--<span>开启 Tags-Views</span>-->
<!--<el-switch v-model="tagsView" class="drawer-switch" />-->
<!--</div>-->
<div class="drawer-item">
<span>固定 Header</span>
<el-switch v-model="fixedHeader" class="drawer-switch" />
</div>
<!--<div class="drawer-item">-->
<!--<span>固定 Header</span>-->
<!--<el-switch v-model="fixedHeader" class="drawer-switch" />-->
<!--</div>-->
<div class="drawer-item">
<span>显示 Logo</span>
<el-switch v-model="sidebarLogo" class="drawer-switch" />
</div>
<!--<div class="drawer-item">-->
<!--<span>显示 Logo</span>-->
<!--<el-switch v-model="sidebarLogo" class="drawer-switch" />-->
<!--</div>-->
<div class="drawer-item">
<span>动态标题</span>
<el-switch v-model="dynamicTitle" class="drawer-switch" />
</div>
<!--<div class="drawer-item">-->
<!--<span>动态标题</span>-->
<!--<el-switch v-model="dynamicTitle" class="drawer-switch" />-->
<!--</div>-->
<el-divider/>
<!--<el-divider/>-->
<el-button size="small" type="primary" plain icon="el-icon-document-add" @click="saveSetting">保存配置</el-button>
<el-button size="small" plain icon="el-icon-refresh" @click="resetSetting">重置配置</el-button>
......
<template>
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
<el-submenu index="1" @mouseover.native.once="titClick">
<template slot="title">{{systemName||customName}}</template>
<el-menu-item :key="item.id" :index="index" v-for="(item,index) in systemInfo" >{{item.name}}</el-menu-item>
</el-submenu>
</el-menu>
</template>
<script>
import store from '@/store'
import router from '@/router'
import {
queryMenusBizType
} from "common/src/api/system/dmgSystem.js";
export default{
name:'changeProject',
mounted() {
},
updated() {
},
computed: {
systemInfo(){
let data=this.$store.getters.systemInfo||[]
return data
},
systemName(){
let data=this.$store.getters.systemName||''
return data
},
customName(){
let data=this.$store.getters.customName||''
return data
},
theme() {
return this.$store.state.settings.theme;
},
// 顶部显示菜单
topMenus() {
let topMenus = [];
this.routers.map((menu) => {
if (menu.hidden !== true) {
// 兼容顶部栏一级菜单内部跳转
if (menu.path === "/") {
topMenus.push(menu.children[0]);
} else {
topMenus.push(menu);
}
}
});
return topMenus;
},
// 所有的路由信息
routers() {
return this.$store.state.permission.topbarRouters;
},
// 设置子路由
childrenMenus() {
var childrenMenus = [];
this.routers.map((router) => {
for (var item in router.children) {
if (router.children[item].parentPath === undefined) {
if(router.path === "/") {
router.children[item].path = "/" + router.children[item].path;
} else {
if(!this.ishttp(router.children[item].path)) {
router.children[item].path = router.path + "/" + router.children[item].path;
}
}
router.children[item].parentPath = router.path;
}
childrenMenus.push(router.children[item]);
}
});
return constantRoutes.concat(childrenMenus);
},
// 默认激活的菜单
activeMenu() {
},
},
data(){
return{
activeIndex:'1',
showList:[]
}
},
methods:{
clearPageCache() {
// 获取 router 的 matcher 对象
Object.keys(router.options.routes).forEach((route) => {
// 移除该路由的缓存
});
},
titClick(){
},
activeRoutes(key) {
var routes = [];
if (this.childrenMenus && this.childrenMenus.length > 0) {
this.childrenMenus.map((item) => {
if (key == item.parentPath || (key == "index" && "" == item.path)) {
routes.push(item);
}
});
}
if(routes.length > 0) {
this.$store.commit("SET_SIDEBAR_ROUTERS", routes);
}
},
handleSelect(index){
let id=this.systemInfo[index].id
this.$post('/frame/system/switch',{id:id}).then(res=>{
if(res.success){
/* 关闭所有标签页*/
store.commit('INIT_SIDEBARRPUTERS')
store.dispatch('GenerateRoutes').then(accessRoutes => {
router.addRoutes(accessRoutes)
this.$tab.closeAllPage()
this.clearPageCache()
this.$router.push({
path:'/index'
})
})
}
})
}
}
}
</script>
<style lang="scss" >
.el-submenu__title{
height: 50px!important;
line-height: 50px!important;
}
</style>
......@@ -30,7 +30,7 @@ import Layout from '@/layout'
export const powerRoutes=[
/* erp 基础数据*/
]
// 公共路由
......@@ -70,12 +70,12 @@ export const constantRoutes = [
path: '',
component: Layout,
redirect: 'index',
hidden: true,
children: [
{
path: 'index',
component: () => import('@/views/index'),
name: 'Index',
// redirect: '/user/profile',
meta: { title: '首页', icon: 'dashboard', affix: true }
}
]
......
......@@ -16,5 +16,9 @@ const getters = {
topbarRouters:state => state.permission.topbarRouters,
defaultRoutes:state => state.permission.defaultRoutes,
sidebarRouters:state => state.permission.sidebarRouters,
systemInfo:state => state.permission.systemInfo,
appName:state => state.permission.appName,
customName:state => state.permission.customName,
systemName:state => state.permission.systemName,
}
export default getters
......@@ -19,8 +19,23 @@ const permission = {
topbarRouters: [],
sidebarRouters: [],
appName:'',
customName:'',
systemName:'',
systemInfo:[]
},
mutations: {
INIT_SIDEBARRPUTERS:(state)=>{
state.sidebarRouters=[]
},
SET_SYSTEMINFO:(state,systemInfo)=>{
state.systemInfo=systemInfo
},
SET_CUSTOMNAME:(state,customName)=>{
state.customName=customName
},
SET_SYSTEMNAME:(state,systemName)=>{
state.systemName=systemName
},
SET_APPNAME:(state,appName)=>{
state.appName=appName
},
......@@ -63,9 +78,24 @@ const permission = {
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)
/* 构建新list放进列表切换*/
localStorage.setItem('appName',appName)
/* 存储system id list*/
/* 将可切换系统存入store*/
let systemInfo=res.data.systemInfo||[]
if(systemInfo.length!=0){
systemInfo.unshift({
id:'',
name:customName
})
}
commit('SET_SYSTEMINFO', systemInfo)
let menus=res.data.menu
let asymenus=JSON.parse(JSON.stringify(res.data.menu))
/* 权限路由*/
......
......@@ -43,11 +43,13 @@ const user = {
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
const systemid=userInfo.systemid
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
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('systemid',systemid)
/* 存储本地一份 */
setToken(res.data.token)
commit('SET_TOKEN', res.data.token)
......@@ -93,7 +95,8 @@ const user = {
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
removeToken()
location.href="login"
location.href="/#login"
location.reload();
})
},
......
......@@ -27,6 +27,16 @@
<!-- -->
<h3 class="title">{{appName}}</h3>
<el-form-item v-if="isqyh" prop="systemid">
<el-input
v-model="loginForm.systemid"
type="text"
auto-complete="off"
placeholder="企业号"
>
<!-- <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /> -->
</el-input>
</el-form-item>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
......@@ -75,8 +85,8 @@
<span v-if="!loading">登 录</span>
<span v-else>登 录 中...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
<div style="float: right;" >
<span @click="isqyh=!isqyh" class="link-type">{{isqyh?'账号登录':'企业号登录'}}</span>
</div>
</el-form-item>
</el-form>
......@@ -98,9 +108,12 @@ export default {
name: "Login",
data() {
return {
/* 登录方式*/
isqyh:false,
appName:'',
codeUrl: "",
loginForm: {
systemid:"",
username: "",
password: "",
rememberMe: false,
......@@ -108,6 +121,9 @@ export default {
uuid: ""
},
loginRules: {
systemid: [
{ required: true, trigger: "blur", message: "请输入企业号" }
],
username: [
{ required: true, trigger: "blur", message: "请输入您的账号" }
],
......@@ -153,10 +169,12 @@ export default {
});
},
getCookie() {
const systemid = Cookies.get("systemid");
const username = Cookies.get("username");
const password = Cookies.get("password");
const rememberMe = Cookies.get('rememberMe')
this.loginForm = {
systemid: systemid === undefined ? this.loginForm.systemid : systemid,
username: username === undefined ? this.loginForm.username : username,
password: password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
......@@ -167,17 +185,28 @@ export default {
if (valid) {
this.loading = true;
if (this.loginForm.rememberMe) {
Cookies.set("systemid", this.loginForm.systemid, { expires: 30 });
Cookies.set("username", this.loginForm.username, { expires: 30 });
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
} else {
Cookies.remove("systemid");
Cookies.remove("username");
Cookies.remove("password");
Cookies.remove('rememberMe');
}
this.$store.dispatch("Login", this.loginForm).then(() => {
/* 判定是否是企业号登录*/
const loginForm=_.cloneDeep(this.loginForm)
if(!this.isqyh){
/*
企业号登录模式为企业号必填
如何不是删除该字段
是否存在该字段将是判定是否企业号登录的标志
*/
delete loginForm.systemid
}
this.$store.dispatch("Login", loginForm).then(() => {
this.$router.push({path:'index'})
// this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
......
......@@ -38,7 +38,9 @@ module.exports = {
[process.env.VUE_APP_BASE_API]: {
// target: `http://192.168.30.254:18080/dmg`,
target: `http://localhost:9080/erp`,
// target: `http://192.168.30.254:28084/erp`,
target: `http://localhost:9080/erp`,
// target:'http://192.168.30.105:9081/erp',
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
......
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