| | |
| | | <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', |
| | |
| | | } |
| | | } |
| | | return { |
| | | depart:[], |
| | | queryParam: { |
| | | level: null, |
| | | pageIndex: 1, |
| | | pageSize: 100 |
| | | }, |
| | | loginForm: { |
| | | userName: '', |
| | | password: '', |
| | |
| | | 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 => { |
| | |
| | | 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: '/' }) |
| | | } else { |