This commit is contained in:
lVAL 2021-02-26 16:23:41 +08:00
commit d908de6d7c
3 changed files with 13 additions and 4 deletions

View File

@ -10,7 +10,7 @@
<el-dropdown-item> <el-dropdown-item>
<span style="display:block;" @click="handleDetail">{{ $t('global.personalDetails') }}</span> <span style="display:block;" @click="handleDetail">{{ $t('global.personalDetails') }}</span>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-if="companyAdmin"> <el-dropdown-item v-if="companyAdmin && isSameProject">
<span style="display:block;" @click="handleOrganization">教学管理</span> <span style="display:block;" @click="handleOrganization">教学管理</span>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item> <el-dropdown-item>
@ -24,6 +24,7 @@
<script> <script>
import userInfo from './userInfo'; import userInfo from './userInfo';
import { UrlConfig } from '@/scripts/ConstDic'; import { UrlConfig } from '@/scripts/ConstDic';
import { getSessionStorage } from '@/utils/auth';
export default { export default {
name: 'Logout', name: 'Logout',
@ -40,6 +41,9 @@ export default {
}, },
companyAdmin() { companyAdmin() {
return this.$store.state.user.companyAdmin; return this.$store.state.user.companyAdmin;
},
isSameProject() {
return this.$store.state.user.companyProject === getSessionStorage('project');
} }
}, },
mounted() { mounted() {

View File

@ -21,7 +21,8 @@ const user = {
projectDevice: '', projectDevice: '',
companyId: '', companyId: '',
companyAdmin: false, companyAdmin: false,
companyName: '' companyName: '',
companyProject: ''
}, },
mutations: { mutations: {
@ -61,6 +62,9 @@ const user = {
SET_COMPANYNAME: (state, companyName) => { SET_COMPANYNAME: (state, companyName) => {
state.companyName = companyName; state.companyName = companyName;
}, },
SET_COMPANYPROJECT: (state, companyProject) => {
state.companyProject = companyProject;
},
CLEAR_AUTO_PARAMS: () => { CLEAR_AUTO_PARAMS: () => {
Cookies.remove('UserDesignName'); Cookies.remove('UserDesignName');
Cookies.remove('UserDesignToken'); Cookies.remove('UserDesignToken');
@ -138,6 +142,7 @@ const user = {
commit('SET_COMPANYID', user.companyId); commit('SET_COMPANYID', user.companyId);
commit('SET_COMPANYADMIN', user.companyAdmin); commit('SET_COMPANYADMIN', user.companyAdmin);
commit('SET_COMPANYNAME', user.companyName); commit('SET_COMPANYNAME', user.companyName);
commit('SET_COMPANYPROJECT', user.projectCode);
resolve(user); resolve(user);
}).catch(error => { }).catch(error => {
reject(error); reject(error);

View File

@ -87,7 +87,7 @@ export default {
this.dialogVisible = false; this.dialogVisible = false;
this.$emit('reloadTable'); this.$emit('reloadTable');
}).catch(e => { }).catch(e => {
this.$message.error('更新单位信息失败'); this.$message.error('更新单位信息失败' + e.message);
}); });
} else { } else {
addCompany(this.formModel).then(resp => { addCompany(this.formModel).then(resp => {
@ -95,7 +95,7 @@ export default {
this.dialogVisible = false; this.dialogVisible = false;
this.$emit('reloadTable'); this.$emit('reloadTable');
}).catch(e => { }).catch(e => {
this.$message.error('添加单位信息失败'); this.$message.error('添加单位信息失败' + e.message);
}); });
} }
}); });