常熟吴彦祖 1 week ago
parent
commit
1c7a1585ae
  1. 2
      src/api/base/site.js
  2. 27
      src/views/common/login.vue
  3. 3
      src/views/main.vue

2
src/api/base/site.js

@ -31,3 +31,5 @@ export const getSiteBuByUserNameRQ = data => createAPI(`/base/getSiteBuByUserNam
export const getBaseQuarterRecently = data => createAPI(`/base/getBaseQuarterRecently`,'post',data) export const getBaseQuarterRecently = data => createAPI(`/base/getBaseQuarterRecently`,'post',data)
export const getSiteDataActive = data => createAPI(`/base/getSiteDataActive`,'post',data)

27
src/views/common/login.vue

@ -12,6 +12,18 @@
</div> </div>
<h3 class="login-title">用户登录</h3> <h3 class="login-title">用户登录</h3>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" status-icon> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" status-icon>
<el-form-item>
<el-select v-model="dataForm.site" style="width: 230px"
placeholder="请选择工厂">
<el-option
v-for="(item,index) in siteList"
:key="index"
:label="item.siteID+' - '+item.siteName"
:value="item.siteID"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="userName"> <el-form-item prop="userName">
<div class="input-with-label"> <div class="input-with-label">
<span class="input-label">用户名</span> <span class="input-label">用户名</span>
@ -48,7 +60,9 @@
<script> <script>
import { getConfigParams } from '@/api/sysConfig.js'; import { getConfigParams } from '@/api/sysConfig.js';
import { getUUID } from '@/utils'; import { getUUID } from '@/utils';
import {
getSiteDataActive,
} from "@/api/base/site.js"
export default { export default {
data () { data () {
return { return {
@ -59,6 +73,7 @@ export default {
uuid: '', uuid: '',
captcha: '' captcha: ''
}, },
siteList:[],
dataRule: { dataRule: {
userName: [ userName: [
{ required: true, message: '帐号不能为空', trigger: 'blur' } { required: true, message: '帐号不能为空', trigger: 'blur' }
@ -96,6 +111,7 @@ export default {
}, },
created () { created () {
this.userName(); this.userName();
this.getSiteData();
const currentPath = localStorage.getItem('redirectPath'); const currentPath = localStorage.getItem('redirectPath');
if (!currentPath) { if (!currentPath) {
localStorage.setItem('redirectPath', this.$route.fullPath); localStorage.setItem('redirectPath', this.$route.fullPath);
@ -105,6 +121,15 @@ export default {
userName(){ userName(){
this.dataForm.userName = localStorage.getItem('userName'); this.dataForm.userName = localStorage.getItem('userName');
}, },
getSiteData(){
let data={};
getSiteDataActive(data).then(({data}) => {
this.siteList = data.rows
if(this.siteList.length>0){
this.dataForm.site=this.siteList[0].siteID
}
})
},
dataFormSubmit () { dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {

3
src/views/main.vue

@ -122,9 +122,8 @@
this.loading = false this.loading = false
this.userId = data.user.userId this.userId = data.user.userId
this.userName = data.user.username this.userName = data.user.username
this.site = data.user.site
this.languageDefault = data.user.languageDefault this.languageDefault = data.user.languageDefault
this.site = data.user.site
this.site =localStorage.getItem("accessSite")
this.userDisplay = data.user.userDisplay this.userDisplay = data.user.userDisplay
} }
}) })

Loading…
Cancel
Save