From b497a0b35c09e6b53324c14b7697c1e9e0ed36a9 Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期三, 04 六月 2025 09:39:13 +0800
Subject: [PATCH] 销售台账/采购台账计算重写

---
 src/views/login.vue |   31 ++++++++++++++++++++++++++-----
 1 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/src/views/login.vue b/src/views/login.vue
index 437093e..cc98f6b 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -10,6 +10,7 @@
           size="large"
           auto-complete="off"
           placeholder="璐﹀彿"
+          @input="deptListSearch"
         >
           <template #prefix><el-icon><User /></el-icon></template>
         </el-input>
@@ -26,6 +27,11 @@
         >
           <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
         </el-input>
+      </el-form-item>
+      <el-form-item prop="currentFatoryId">
+        <el-select v-model="loginForm.currentFatoryId" placeholder="璇烽�夋嫨鍏徃" >
+          <el-option  v-for="item in factoryList" :key="item.deptId" :label="item.deptName" :value="item.deptId" />
+        </el-select>
       </el-form-item>
 <!--      <el-form-item prop="code" v-if="captchaEnabled">-->
 <!--        <el-input-->
@@ -67,10 +73,11 @@
 </template>
 
 <script setup>
-import { getCodeImg } from "@/api/login"
+import {getCodeImg} from "@/api/login"
 import Cookies from "js-cookie"
 import { encrypt, decrypt } from "@/utils/jsencrypt"
 import useUserStore from '@/store/modules/user'
+import {userDeptList} from "@/api/system/user.js"
 
 const title = import.meta.env.VITE_APP_TITLE
 const userStore = useUserStore()
@@ -82,8 +89,7 @@
   username: "admin",
   password: "admin123",
   rememberMe: false,
-  // code: "",
-  uuid: ""
+  currentFatoryId:'',
 })
 
 const loginRules = {
@@ -99,6 +105,9 @@
 // 娉ㄥ唽寮�鍏�
 const register = ref(false)
 const redirect = ref(undefined)
+
+const factoryList = ref([])
+const currentFatoryId = ref('')
 
 watch(route, (newRoute) => {
     redirect.value = newRoute.query && newRoute.query.redirect
@@ -119,8 +128,7 @@
         Cookies.remove("password")
         Cookies.remove("rememberMe")
       }
-      // 璋冪敤action鐨勭櫥褰曟柟娉�
-      userStore.login(loginForm.value).then(() => {
+      userStore.loginCheckFactory(loginForm.value).then(res => {
         const query = route.query
         const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
           if (cur !== "redirect") {
@@ -161,8 +169,21 @@
   }
 }
 
+function deptListSearch() {
+  if(loginForm.value.username){
+    userDeptList({userName:loginForm.value.username}).then(res => {
+      console.log('res', res)
+      factoryList.value = res.data
+    })
+  }else {
+    factoryList.value = []
+  }
+
+}
+
 getCode()
 getCookie()
+deptListSearch()
 </script>
 
 <style lang='scss' scoped>

--
Gitblit v1.9.3