右边标题仓库,分库修改

fencang
anthonywj 3 years ago
parent a9ab66c0aa
commit fc5dac5fc1

@ -1,6 +1,6 @@
import { userInfo, loginName, logout } from "../../api/auth/login"; import {userInfo, loginName, logout} from "../../api/auth/login";
import * as types from "../mutation-types"; import * as types from "../mutation-types";
import { constantRouterMap } from "../../router"; import {constantRouterMap} from "../../router";
import { import {
getToken, getToken,
setToken, setToken,
@ -16,8 +16,8 @@ import {
removeCompanyName, removeCompanyName,
} from "../../utils/auth"; } from "../../utils/auth";
// import { $NOT_NETWORK } from '../../utils/errorCode' // import { $NOT_NETWORK } from '../../utils/errorCode'
import { Message } from "element-ui"; import {Message} from "element-ui";
import {RECEIVE_LOCINVCODE, RECEIVE_LOCSUBINVCODE} from "../mutation-types"; import {RECEIVE_LOCINVCODE, RECEIVE_LOCINVNAME, RECEIVE_LOCSUBINVCODE, RECEIVE_LOCSUBINVNAME} from "../mutation-types";
// initial state // initial state
const state = { const state = {
@ -28,10 +28,12 @@ const state = {
token: getToken(), // 登录token token: getToken(), // 登录token
authRules: [], // 权限列表 authRules: [], // 权限列表
routers: constantRouterMap, // 路由列表 routers: constantRouterMap, // 路由列表
customerId:getCustomerId(), customerId: getCustomerId(),
companyName:getCompanyName(), companyName: getCompanyName(),
locInvCode:"", locInvCode: "",
locSubInvCode:"" locSubInvCode: "",
locInvName: "",
locSubInvName: ""
}; };
// getters // getters
@ -43,23 +45,25 @@ const getters = {
token: state => state.token, token: state => state.token,
authRules: state => state.authRules, authRules: state => state.authRules,
routers: state => state.routers, routers: state => state.routers,
customerId:state => state.customerId, customerId: state => state.customerId,
companyName:state => state.companyName, companyName: state => state.companyName,
locInvCode:state => state.locInvCode, locInvCode: state => state.locInvCode,
locSubInvCode:state => state.locSubInvCode, locSubInvCode: state => state.locSubInvCode,
locInvName: state => state.locInvName,
locSubInvName: state => state.locSubInvName,
}; };
// actions // actions
const actions = { const actions = {
// 用户名登录 // 用户名登录
loginName({ commit }, userInfo) { loginName({commit}, userInfo) {
const userName = userInfo.userName ? userInfo.userName.trim() : ""; const userName = userInfo.userName ? userInfo.userName.trim() : "";
const pwd = userInfo.pwd ? userInfo.pwd : ""; const pwd = userInfo.pwd ? userInfo.pwd : "";
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
loginName(userName, pwd) loginName(userName, pwd)
.then(response => { .then(response => {
console.log(response); console.log(response);
if (response.code!=20000) { if (response.code != 20000) {
Message({ Message({
message: response.message, message: response.message,
type: "error", type: "error",
@ -80,7 +84,7 @@ const actions = {
}); });
}); });
}, },
userInfo({ commit }) { userInfo({commit}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
userInfo() userInfo()
.then(response => { .then(response => {
@ -102,7 +106,7 @@ const actions = {
}); });
}, },
// 登出 // 登出
loginOut({ commit }) { loginOut({commit}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logout() logout()
.then(() => { .then(() => {
@ -120,7 +124,7 @@ const actions = {
}, },
// 前端 登出 // 前端 登出
fedLogout({ commit }) { fedLogout({commit}) {
return new Promise(resolve => { return new Promise(resolve => {
commit(types.RECEIVE_ADMIN_ID, ""); commit(types.RECEIVE_ADMIN_ID, "");
commit(types.RECEIVE_ADMIN_TOKEN, ""); commit(types.RECEIVE_ADMIN_TOKEN, "");
@ -136,8 +140,8 @@ const actions = {
* @param data * @param data
* @returns {Promise} * @returns {Promise}
*/ */
filterRouter({ commit }, data) { filterRouter({commit}, data) {
const { accessedRouters } = data; const {accessedRouters} = data;
if (accessedRouters && accessedRouters.length > 0) { if (accessedRouters && accessedRouters.length > 0) {
commit(types.RECEIVE_ROUTERS, accessedRouters); commit(types.RECEIVE_ROUTERS, accessedRouters);
} }
@ -201,6 +205,12 @@ const mutations = {
[types.RECEIVE_LOCSUBINVCODE](state, locSubInvCode) { [types.RECEIVE_LOCSUBINVCODE](state, locSubInvCode) {
state.locSubInvCode = locSubInvCode; state.locSubInvCode = locSubInvCode;
}, },
[types.RECEIVE_LOCINVNAME](state, locInvName) {
state.locInvName = locInvName;
},
[types.RECEIVE_LOCSUBINVNAME](state, locSubInvName) {
state.locSubInvName = locSubInvName;
},
}; };
export default { export default {

@ -19,3 +19,6 @@ export const RECEIVE_COMPANYNAME = "RECEIVE_COMPANYNAME"; // 企业名称
export const RECEIVE_LOCINVCODE = "RECEIVE_LOCINVCODE"; // 当前仓库 export const RECEIVE_LOCINVCODE = "RECEIVE_LOCINVCODE"; // 当前仓库
export const RECEIVE_LOCSUBINVCODE = "RECEIVE_LOCSUBINVCODE"; // 当前分库 export const RECEIVE_LOCSUBINVCODE = "RECEIVE_LOCSUBINVCODE"; // 当前分库
export const RECEIVE_LOCINVNAME = "RECEIVE_LOCINVNAME"; // 当前仓库
export const RECEIVE_LOCSUBINVNAME = "RECEIVE_LOCSUBINVNAME"; // 当前分库

@ -71,7 +71,7 @@
<span style="margin-right: 10px; margin-top: 2px">{{ company.Name }}</span> <span style="margin-right: 10px; margin-top: 2px">{{ company.Name }}</span>
<el-dropdown trigger="click"> <el-dropdown trigger="click">
<!--<i class="el-icon-setting" style="margin-right: 15px"></i>--> <!--<i class="el-icon-setting" style="margin-right: 15px"></i>-->
<span>{{ username }}<i class="el-icon-arrow-down el-icon--right"></i></span> <span>{{ title }}<i class="el-icon-arrow-down el-icon--right"></i></span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item><span @click="changeInv"></span></el-dropdown-item> <el-dropdown-item><span @click="changeInv"></span></el-dropdown-item>
<el-dropdown-item><span @click="handlePassword"></span></el-dropdown-item> <el-dropdown-item><span @click="handlePassword"></span></el-dropdown-item>
@ -328,6 +328,7 @@ export default {
selInvVisible: false, selInvVisible: false,
locInvName: "", locInvName: "",
locSubInvName: "", locSubInvName: "",
title: "",
}; };
}, },
components: { components: {
@ -342,9 +343,7 @@ export default {
return this.$route.path; return this.$route.path;
}, },
username() { username() {
let username = this.$store.state.admin.userName; return this.$store.state.admin.employeeName + "" + this.$store.getters.locInvName + " " + this.$store.getters.locSubInvName + "";
let rUserName = !username ? this.name : username;
return this.$store.state.admin.employeeName + "" + this.locInvName + " " + this.locSubInvName + "";
}, },
isCollapse() { isCollapse() {
return false; return false;
@ -457,7 +456,9 @@ export default {
} }
); );
this.$store.commit(types.RECEIVE_LOCINVNAME, this.locInvName);
this.$store.commit(types.RECEIVE_LOCSUBINVNAME, this.locSubInvName);
this.title = this.$store.state.admin.employeeName + "(" + this.locInvName + " " + this.locSubInvName + ")";
this.getStorage(); this.getStorage();
} }
} }

Loading…
Cancel
Save