From 3f3817a39238b262155cd5ec76fa351bb344602d Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期三, 01 一月 2025 21:33:57 +0800
Subject: [PATCH] 打印工单流程卡

---
 src/views/sys/login/LoginForm.vue |   71 ++++++++++++-----------------------
 1 files changed, 25 insertions(+), 46 deletions(-)

diff --git a/src/views/sys/login/LoginForm.vue b/src/views/sys/login/LoginForm.vue
index d8102e6..8420c4c 100644
--- a/src/views/sys/login/LoginForm.vue
+++ b/src/views/sys/login/LoginForm.vue
@@ -26,6 +26,15 @@
     </FormItem>
     <FormItem name="factory" class="enter-x dept">
       <ApiSelect
+        v-if="byOrg"
+        :api="getTreeList"
+        v-model:value="formData.factory"
+        labelField="deptName"
+        valueField="deptCode"
+        placeholder="璇烽�夋嫨宸ュ巶"
+      />
+      <ApiSelect
+        v-if="byProd"
         :api="getProdTreeList"
         v-model:value="formData.factory"
         labelField="deptName"
@@ -104,11 +113,12 @@
   import { ApiSelect } from '/@/components/Form/index';
   import { useI18n } from '@/hooks/web/useI18n';
   import { useMessage } from '@/hooks/web/useMessage';
-  import { getProdTreeList } from '/@/api/tigerapi/dept';
+  import { getProdTreeList, getTreeList } from '/@/api/tigerapi/dept';
   import { useUserStore } from '@/store/modules/user';
   import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin';
   import { useDesign } from '@/hooks/web/useDesign';
   import { AccountInfo } from '/@/api/tigerapi/model/systemModel';
+  import { getSysParam } from '/@/api/tigerapi/system';
   //import { onKeyStroke } from '@vueuse/core';
 
   const ACol = Col;
@@ -126,6 +136,8 @@
   const formRef = ref();
   const loading = ref(false);
   const rememberMe = ref(false);
+  const byOrg = ref(false); 
+  const byProd = ref(false);
 
   const formData = reactive({
     account: '',
@@ -139,50 +151,17 @@
 
   const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN);
 
-  // const status = ref('Connecting...');
-  // const message = ref('');
-
-  // let ws = null;
-
-  // const connectWebSocket = () => {
-  //   ws = new WebSocket('ws://192.168.124.9:7519');
-
-  //   ws.onopen = () => {
-  //     status.value = 'Connected';
-  //     // 鍙戦�佸垵濮嬫秷鎭垨杩涜鍏朵粬鎿嶄綔
-  //     ws.send('wsSubStrings 6c24aff98e274eeda74da0c57267f0b4_#_E:\\Data\\鏈師\\鏉$爜妯℃澘\\鏉$爜妯℃澘\\鍞竴ID.btw');
-  //   };
-
-  //   ws.onmessage = (event) => {
-  //     status.value = 'Received';
-  //     message.value = event.data;
-  //   };
-
-  //   ws.onerror = (error) => {
-  //     status.value = 'Error';
-  //     console.error('WebSocket Error:', error);
-  //   };
-
-  //   ws.onclose = (event) => {
-  //     status.value = 'Closed';
-  //     if (event.wasClean) {
-  //       console.log(
-  //         `WebSocket connection closed cleanly, code=${event.code} reason=${event.reason}`,
-  //       );
-  //     } else {
-  //       console.error('WebSocket connection died');
-  //     }
-  //   };
-  // };
-  // onMounted(() => {
-  //   connectWebSocket();
-  // });
-
-  // onUnmounted(() => {
-  //   if (ws) {
-  //     ws.close();
-  //   }
-  // });
+  onMounted(async () => {
+    var action = await getSysParam({ group: 'ByAuthActive' });
+    if (action.IsSuccessed) {
+      if (action.Data.filter((x) => x.PARAM_CODE == 'ByOrgActive')[0].PARAM_VALUE == 'Y') {
+        byOrg.value = true;
+      }
+      if (action.Data.filter((x) => x.PARAM_CODE == 'ByProdActive')[0].PARAM_VALUE == 'Y') {
+        byProd.value = true;
+      }
+    }
+  });
 
   async function handleLogin() {
     const data = await validForm();
@@ -193,7 +172,7 @@
       const accountInfo: AccountInfo = {
         useR_CODE: data.account,
         password: data.password,
-        ORG_CODE: '', //globSetting.useOrg == 'Y' ? orgData.dept : '',
+        ORG_CODE: data.factory, //globSetting.useOrg == 'Y' ? orgData.dept : '',
         ad_info: Info.ad_info,
         ip: Info.ip,
         PROD_CODE: data.factory, //globSetting.useOrg == 'N' ? orgData.dept : '',

--
Gitblit v1.9.3