فهرست منبع

通过 路径参数 ?isOut 区分是内侧屏幕还是外侧屏幕

liuyanpeng 7 ماه پیش
والد
کامیت
8a24dc87c5
4فایلهای تغییر یافته به همراه72 افزوده شده و 47 حذف شده
  1. 8 1
      src/common/PageHeader.vue
  2. 38 43
      src/login/UserHome.vue
  3. 18 2
      src/login/UserLogin.vue
  4. 8 1
      src/util/request.js

+ 8 - 1
src/common/PageHeader.vue

@@ -55,7 +55,14 @@ const handleLogout = () => {
     localStorage.removeItem('#LoginInfo');
     localStorage.removeItem('#token');
     localStorage.removeItem('#accountId');
-    router.push('/login');
+    
+    // 检查localStorage中的isOut值,如果为true则在登录页面添加isOut参数
+    const isOut = localStorage.getItem('isOut') === 'true';
+    if (isOut) {
+        router.push({ path: '/login', query: { isOut: 'true' } });
+    } else {
+        router.push('/login');
+    }
 };
 </script>
 

+ 38 - 43
src/login/UserHome.vue

@@ -120,7 +120,7 @@
 </template>
 
 <script setup>
-import { ref, reactive } from 'vue';
+import { ref, reactive, onMounted } from 'vue';
 import { useRouter } from 'vue-router';
 import PageHeader from '../common/PageHeader.vue';
 import { cfStockInLeave } from '../api/stockIn.js';
@@ -137,7 +137,15 @@ const loading = ref(false);
 const pickingModalVisible = ref(false);
 
 // 是否为外侧屏幕
-const isOut = ref(true);
+const isOut = ref(false);
+
+// 初始化时从localStorage读取isOut值
+onMounted(() => {
+    const storedIsOut = localStorage.getItem('isOut');
+    if (storedIsOut !== null) {
+        isOut.value = storedIsOut === 'true';
+    }
+});
 
 // 统计数据
 const statistics = reactive([
@@ -312,70 +320,57 @@ const outButtons = reactive([
         color: 'green',
         action: 'materialReturn',
     },
-    {
-        label: '出库确认',
-        icon: 'fa-arrow-down',
-        color: 'yellow',
-        action: 'materialOutLeave',
-    },
-
     {
         label: '还料',
         icon: 'fa-arrow-up',
-        color: 'red',
-        action: 'materialIn',
-    },
-    {
-        label: '还料离开',
-        icon: 'fa-arrow-down',
         color: 'yellow',
-        action: 'materialInLeave',
+        action: 'materialIn',
     },
     {
         label: 'AGV RFID校验',
         icon: 'fa-wifi',
-        color: 'blue',
+        color: 'red',
         action: 'agvRfidRecognition',
     },
-
-    //  测试待删除
-    {
-        label: '还料区管理',
-        icon: 'fa-undo',
-        color: 'green',
-        action: 'returnManagement',
-    },
     {
-        label: '取料区管理',
-        icon: 'fa-arrow-down',
-        color: 'red',
-        action: 'deliverManagement',
+        label: '成品入库',
+        icon: 'fa-boxes',
+        color: 'blue',
+        action: 'finishedProductIn',
     },
+
+    //  测试待删除
+    // {
+    //     label: '还料区管理',
+    //     icon: 'fa-undo',
+    //     color: 'green',
+    //     action: 'returnManagement',
+    // },
+    // {
+    //     label: '取料区管理',
+    //     icon: 'fa-arrow-down',
+    //     color: 'red',
+    //     action: 'deliverManagement',
+    // },
 ]);
 const inButtons = reactive([
     {
-        label: '还料',
-        icon: 'fa-hand-holding',
-        color: 'blue',
-        action: 'materialIn',
-    },
-    {
-        label: '拣货',
+        label: '出库确认',
         icon: 'fa-undo',
-        color: 'green',
-        action: 'materialReturn',
+        color: 'blue',
+        action: 'materialOutLeave',
     },
     {
         label: '还料离开',
         icon: 'fa-arrow-down',
-        color: 'yellow',
+        color: 'green',
         action: 'materialInLeave',
     },
     {
-        label: 'AGV RFID校验',
-        icon: 'fa-wifi',
-        color: 'blue',
-        action: 'agvRfidRecognition',
+        label: '成品出库',
+        icon: 'fa-boxes',
+        color: 'red',
+        action: 'finishedProductOut',
     },
 ]);
 

+ 18 - 2
src/login/UserLogin.vue

@@ -79,20 +79,36 @@
 </template>
 
 <script setup>
-import { ref } from 'vue';
-import { useRouter } from 'vue-router';
+import { ref, onMounted } from 'vue';
+import { useRouter, useRoute } from 'vue-router';
 import { message } from 'ant-design-vue';
 import { loginApi } from '../api/login.js';
 import { getFormattedDateTime } from '../common/Common.js';
 import { UserOutlined, LockOutlined } from '@ant-design/icons-vue';
 
 const router = useRouter();
+const route = useRoute();
 
 // 表单数据
 const username = ref('');
 const password = ref('');
 const loading = ref(false);
 
+onMounted(() => {
+    // 检查URL参数中是否包含isOut=true,如果有则存储到localStorage
+    const isOutParam = route.query.isOut;
+    if (isOutParam !== undefined) {
+        const isOutValue = String(isOutParam) === 'true' ? 'true' : 'false';
+        if(isOutValue == 'true') {
+            localStorage.setItem('isOut', isOutValue);
+        } else {
+            localStorage.setItem('isOut', isOutValue);
+        }
+    } else {
+        localStorage.setItem('isOut', 'false');
+    }
+});
+
 // 登录处理函数
 const handleLogin = async () => {
     if (!username.value || !password.value) {

+ 8 - 1
src/util/request.js

@@ -59,8 +59,15 @@ const responseErrorHandler = error => {
         const currentUrl = window.location.href;
         if (currentUrl.indexOf('login') < 0 && currentUrl.indexOf('redirectUrl=') < 0) {
 
-            window.location = Common.getRedirectUrl('#/login?redirectUrl=' + encodeURIComponent(currentUrl));
+            // window.location = Common.getRedirectUrl('#/login?redirectUrl=' + encodeURIComponent(currentUrl));
 
+            const isOut = localStorage.getItem('isOut');
+            console.log(isOut, '9999999999999');
+            if (isOut == 'true') {
+                window.location = Common.getRedirectUrl('#/login?isOut=true&redirectUrl=' + encodeURIComponent(currentUrl));
+            } else {
+                window.location = Common.getRedirectUrl('#/login?isOut=false&redirectUrl=' + encodeURIComponent(currentUrl));
+            }
         }
     }
     if (error.response.status === 504) {