yusheng 1 год назад
Родитель
Сommit
55e2e17c27

+ 14 - 0
src/api/system/user/index.js

@@ -221,3 +221,17 @@ export async function checkExistence (field, value, id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+/**
+ * 工厂详情
+ * @param id 用户id
+ */
+export async function factoryareaId (id) {
+  const res = await request.get('main/factoryarea/getById/'+id);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

+ 0 - 1
src/layout/components/header-notice.vue

@@ -153,7 +153,6 @@ export default {
       let url = 'ws://' + window.location.host + '/ws/websocket/UnreadNotifyMessageCount?token=' + getToken()
       let socket = new WebSocket(url);
       socket.onmessage = (event) => {
-        console.log(event.data)
         this.noticeCount = event.data * 1 || 0;
       };
     }

+ 107 - 97
src/layout/components/header-tools.vue

@@ -17,8 +17,16 @@
     <div class="ele-admin-header-tool-item">
       <header-notice />
     </div>
+    <div class="ele-admin-header-tool-item" style="font-size: 14px;" v-if="loginUser?.factoryName">
+      {{ loginUser?.factoryName }}
+    </div>
+
     <div class="ele-admin-header-tool-item">
-      <el-select v-model="groupId" @change="groupIdChange" style="width: 180px;padding:0 5px">
+      <el-select
+        v-model="groupId"
+        @change="groupIdChange"
+        style="width: 180px; padding: 0 5px"
+      >
         <el-option
           v-for="item in loginChangeGroupVOList"
           :key="item.groupId"
@@ -29,7 +37,11 @@
       </el-select>
     </div>
     <div class="ele-admin-header-tool-item">
-      <el-select v-model="roleId" @change="roleChange" style="width: 130px;padding:0 5px">
+      <el-select
+        v-model="roleId"
+        @change="roleChange"
+        style="width: 130px; padding: 0 5px"
+      >
         <el-option
           v-for="item in loginChangeRoleVOList"
           :key="item.roleId"
@@ -86,106 +98,104 @@
 </template>
 
 <script>
-import HeaderNotice from './header-notice.vue';
-import PasswordModal from './password-modal.vue';
-import SettingDrawer from './setting-drawer.vue';
-import { logout } from '@/utils/page-tab-util';
-import { userLogout } from '@/api/system/user';
-import router from '@/router/index';
-import { getCurrentUser,setCurrentUser } from '@/utils/token-util';
-
-export default {
-  components: { HeaderNotice, PasswordModal, SettingDrawer },
-  props: {
-    // 是否是全屏
-    fullscreen: Boolean
-  },
-  data() {
-    return {
-      // 是否显示修改密码弹窗
-      passwordVisible: false,
-      // 是否显示主题设置抽屉
-      settingVisible: false,
-      groupId: '',
-      roleId: '',
-      currentUser: {
-        currentGroupId: '',
-        currentRoleId: ''
-      }
-    };
-  },
-  created() {
-    this.currentUser = getCurrentUser()
-    this.groupId = this.currentUser.currentGroupId;
-    this.roleId = this.currentUser.currentRoleId;
-  },
-
-  computed: {
-    // 当前用户信息
-    loginUser() {
-      return this.$store.state.user.info;
+  import HeaderNotice from './header-notice.vue';
+  import PasswordModal from './password-modal.vue';
+  import SettingDrawer from './setting-drawer.vue';
+  import { logout } from '@/utils/page-tab-util';
+  import { userLogout } from '@/api/system/user';
+  import router from '@/router/index';
+  import { getCurrentUser, setCurrentUser } from '@/utils/token-util';
+  export default {
+    components: { HeaderNotice, PasswordModal, SettingDrawer },
+    props: {
+      // 是否是全屏
+      fullscreen: Boolean
     },
-    // 部门下拉
-    loginChangeGroupVOList() {
-      return this.$store.state.user?.info?.loginChangeGroupVOList;
+    data() {
+      return {
+        // 是否显示修改密码弹窗
+        passwordVisible: false,
+        // 是否显示主题设置抽屉
+        settingVisible: false,
+        groupId: '',
+        roleId: '',
+        currentUser: {
+          currentGroupId: '',
+          currentRoleId: ''
+        }
+      };
     },
-    // 角色下拉
-    loginChangeRoleVOList() {
-      return this.$store.state.user?.info?.loginChangeGroupVOList.find(
-        (item) => item.groupId == this.groupId
-      )?.loginChangeRoleVOList;
-    }
-  },
-  methods: {
-    groupIdChange(val) {
-      this.roleChange(this.loginChangeRoleVOList[0].roleId);
+    created() {
+      this.currentUser = getCurrentUser();
+      this.groupId = this.currentUser.currentGroupId;
+      this.roleId = this.currentUser.currentRoleId;
     },
-    roleChange(val) {
-    
-      this.roleId = val;
-      this.currentUser.currentGroupId = this.groupId;
-      this.currentUser.currentRoleId = val;
-      setCurrentUser(this.currentUser)
-      this.$store
-        .dispatch('user/fetchUserInfo')
-        .then(({ menus, homePath, authoritiesRouter }) => {
-          router.roleChange({ menus, homePath, authoritiesRouter });
-        });
+
+    computed: {
+      // 当前用户信息
+      loginUser() {
+        return this.$store.state.user.info;
+      },
+      // 部门下拉
+      loginChangeGroupVOList() {
+        return this.$store.state.user?.info?.loginChangeGroupVOList;
+      },
+      // 角色下拉
+      loginChangeRoleVOList() {
+        return this.$store.state.user?.info?.loginChangeGroupVOList.find(
+          (item) => item.groupId == this.groupId
+        )?.loginChangeRoleVOList;
+      }
     },
-    /* 用户信息下拉点击事件 */
-    onUserDropClick(command) {
-      if (command === 'password') {
-        this.passwordVisible = true;
-      } else if (command === 'profile') {
-        if (this.$route.fullPath !== '/user/profile') {
-          // this.$router.push('/user/profile');
-          window.history.pushState(null, '', '/page-wt/user/profile');
+    methods: {
+      groupIdChange(val) {
+        this.roleChange(this.loginChangeRoleVOList[0].roleId);
+      },
+      roleChange(val) {
+        this.roleId = val;
+        this.currentUser.currentGroupId = this.groupId;
+        this.currentUser.currentRoleId = val;
+        setCurrentUser(this.currentUser);
+        this.$store
+          .dispatch('user/fetchUserInfo')
+          .then(({ menus, homePath, authoritiesRouter }) => {
+            router.roleChange({ menus, homePath, authoritiesRouter });
+          });
+      },
+      /* 用户信息下拉点击事件 */
+      onUserDropClick(command) {
+        if (command === 'password') {
+          this.passwordVisible = true;
+        } else if (command === 'profile') {
+          if (this.$route.fullPath !== '/user/profile') {
+            // this.$router.push('/user/profile');
+            window.history.pushState(null, '', '/page-wt/user/profile');
+          }
+        } else if (command === 'logout') {
+          // 退出登录
+          this.$confirm(
+            this.$t('layout.logout.message'),
+            this.$t('layout.logout.title'),
+            { type: 'warning' }
+          )
+            .then(() => {
+              userLogout().then((res) => {
+                localStorage.removeItem('userId');
+                localStorage.removeItem('LogoName');
+                logout();
+              });
+            })
+            .catch(() => {});
         }
-      } else if (command === 'logout') {
-        // 退出登录
-        this.$confirm(
-          this.$t('layout.logout.message'),
-          this.$t('layout.logout.title'),
-          { type: 'warning' }
-        )
-          .then(() => {
-            userLogout().then((res) => {
-              localStorage.removeItem('userId');
-              localStorage.removeItem('LogoName');
-              logout();
-            });
-          })
-          .catch(() => {});
+      },
+      /* 全屏切换 */
+      toggleFullscreen() {
+        this.$emit('fullscreen');
+      },
+      /* 打开设置抽屉 */
+      openSetting() {
+        this.settingVisible = true;
       }
-    },
-    /* 全屏切换 */
-    toggleFullscreen() {
-      this.$emit('fullscreen');
-    },
-    /* 打开设置抽屉 */
-    openSetting() {
-      this.settingVisible = true;
     }
-  }
-};
+  };
 </script>

+ 4 - 4
src/store/modules/theme.js

@@ -179,7 +179,7 @@ export default {
       }
       const components = new Set();
       const { reloadPath, reloadHome } = state.routeReload || {};
-      console.log(state.tabs, 'state.tabs');
+      // console.log(state.tabs, 'state.tabs');
 
       state.tabs?.forEach((t) => {
         const isAlive = t.meta?.keepAlive !== false;
@@ -187,9 +187,9 @@ export default {
 
         const isExclude = KEEP_ALIVE_EXCLUDES.includes(t.path);
         const isReload = reloadPath && reloadPath === t.fullPath;
-        console.log(isAlive, 'isAlive');
-        console.log(isExclude, 'isAlive');
-        console.log(isReload, 'isAlive');
+        // console.log(isAlive, 'isAlive');
+        // console.log(isExclude, 'isAlive');
+        // console.log(isReload, 'isAlive');
         if (isAlive && !isExclude && !isReload && t.components) {
           t.components.forEach((c) => {
             if (typeof c === 'string' && c) {

+ 1 - 1
src/utils/page-tab-util.js

@@ -155,7 +155,7 @@ export function cleanPageTabs() {
  * @param data 页签数据
  */
 export function addPageTab(data) {
-  console.log(data,'data')
+  // console.log(data,'data')
   store.dispatch('theme/tabAdd', data);
 }