|
@@ -6,6 +6,7 @@ import {
|
|
|
dingdingdetail,
|
|
|
usergetinfo,
|
|
|
roleProcessInfo,
|
|
|
+ requsetCompanyList
|
|
|
} from "@/apis/user";
|
|
|
import {
|
|
|
getToken,
|
|
@@ -43,6 +44,8 @@ const state = {
|
|
|
business_companyNo: get_business_companyNo() || "",
|
|
|
private_field: get_private_field() || [],
|
|
|
roleProcess: get_action_data() || [],
|
|
|
+ currentCompany: null,
|
|
|
+ companyList: []
|
|
|
};
|
|
|
const mutations = {
|
|
|
SET_TOKEN: (state, token) => {
|
|
@@ -66,6 +69,11 @@ const mutations = {
|
|
|
SET_ROLES: (state, roles) => {
|
|
|
state.roles = roles;
|
|
|
},
|
|
|
+ SET_COMPANY_LIST: (state, companyList) => {
|
|
|
+ state.companyList = companyList;
|
|
|
+ //设置当前公司
|
|
|
+ state.currentCompany = companyList[0].companyNo;
|
|
|
+ },
|
|
|
// mainListFn(state, val) {
|
|
|
// if (!val) {
|
|
|
// val = [];
|
|
@@ -73,6 +81,9 @@ const mutations = {
|
|
|
// state.mainList = val;
|
|
|
// setMainList(val)
|
|
|
// },
|
|
|
+ setCurrentCompany(state, currentCompany) {
|
|
|
+ state.currentCompany = currentCompany;
|
|
|
+ },
|
|
|
navListFn(state, val) {
|
|
|
if (!val) {
|
|
|
val = [];
|
|
@@ -144,6 +155,25 @@ const actions = {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
+ //保存用户的业务公司列表
|
|
|
+ // isSuperUser 是否超管用户
|
|
|
+ async getCompanyList({ commit }, isSuperUser) {
|
|
|
+ const result = await requsetCompanyList({});
|
|
|
+
|
|
|
+ const { code, data } = result;
|
|
|
+
|
|
|
+ if (code === 0) {
|
|
|
+ commit("SET_COMPANY_LIST", data.list);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (code >= 100 && code <= 104) {
|
|
|
+ return "noToken"
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+
|
|
|
async getMenuList({ commit, that }) {
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
if (!getToken()) {
|
|
@@ -250,10 +280,10 @@ async function getUserInfo() {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-async function initalUserInfo(){
|
|
|
+async function initalUserInfo() {
|
|
|
const { data } = await usergetinfo({});
|
|
|
console.log(data.nickname)
|
|
|
- store.commit('user/SET_NAME',data.nickname);
|
|
|
+ store.commit('user/SET_NAME', data.nickname);
|
|
|
}
|
|
|
|
|
|
async function getRoleProcess(roleid) {
|