From 1406d5efe7b47d45e988fcb0a6092b3bb9dc0443 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期一, 08 七月 2024 17:40:14 +0800
Subject: [PATCH] feat:部门树形结构
---
src/views/login/index.vue | 35 +++++++++++++++++++++++++++++++----
1 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index c3b3a26..cebc277 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -3,7 +3,7 @@
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
<div class="title-container">
- <h3 class="title">闈掔緤鍦ㄧ嚎鑰冭瘯绠$悊绯荤粺</h3>
+ <h3 class="title">鍦ㄧ嚎鑰冭瘯绠$悊绯荤粺</h3>
</div>
<el-form-item prop="userName">
@@ -60,13 +60,15 @@
<script>
import { mapMutations } from 'vuex'
import loginApi from '@/api/login'
+import departmentApi from '@/api/department'
+import enumItem from '@/store/modules/enumItem'
export default {
name: 'Login',
data () {
const validateUsername = (rule, value, callback) => {
- if (value.length < 5) {
- callback(new Error('鐢ㄦ埛鍚嶄笉鑳藉皯浜�5涓瓧绗�'))
+ if (value.length < 1) {
+ callback(new Error('鐢ㄦ埛鍚嶄笉鑳戒负绌�'))
} else {
callback()
}
@@ -79,6 +81,12 @@
}
}
return {
+ depart:[],
+ queryParam: {
+ level: null,
+ pageIndex: 1,
+ pageSize: 100
+ },
loginForm: {
userName: '',
password: '',
@@ -131,6 +139,22 @@
this.$refs.password.focus()
})
},
+ async seachPageDepartMentList () {
+ let that = this
+ await departmentApi.pageList(this.queryParam).then(res => {
+ console.log(res)
+ if (res.code == 1) {
+ that.depart = res.response.list
+ console.log(that.depart)
+ this.depart.map(item=>{
+ item.key = item.id
+ item.value = item.name
+ })
+ enumItem.state.user.levelEnum = that.depart
+
+ }
+ })
+ },
handleLogin () {
let _this = this
this.$refs.loginForm.validate(valid => {
@@ -138,8 +162,11 @@
this.loading = true
loginApi.login(this.loginForm).then(function (result) {
if (result && result.code === 1) {
+ console.log(result)
+ _this.seachPageDepartMentList()
_this.setUserName(_this.loginForm.userName)
- _this.$router.push({ path: '/' })
+ sessionStorage.setItem('deptAdmin', result.response.deptAdmin)
+ _this.$router.push({ path: '/dashboard' })
} else {
_this.loading = false
_this.$message({
--
Gitblit v1.8.0