|
|
@@ -68,13 +68,17 @@
|
|
|
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
+ created() {
|
|
|
//默认数据
|
|
|
this.getCookies();
|
|
|
- //监听enter键
|
|
|
- this.$refs.loginForm.$el.addEventListener('keydown',this.handleEnter);
|
|
|
//获取账套信息
|
|
|
this.getMasters();
|
|
|
+ //获取工作中心数据
|
|
|
+ // this.getWorkCenter();
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ //监听enter键
|
|
|
+ this.$refs.loginForm.$el.addEventListener('keydown',this.handleEnter);
|
|
|
},
|
|
|
beforeDestroy(){
|
|
|
this.$refs.loginForm.$el.removeEventListener('keydown',this.handleEnter);
|
|
|
@@ -89,7 +93,25 @@
|
|
|
this.options.push({label: res[i].ma_function, value: res[i].ma_user});
|
|
|
}
|
|
|
//设置默认值
|
|
|
- this.loginForm.sob = res[0].ma_user;
|
|
|
+ if("" == this.loginForm.sob || !result.data.masters.some(item => item.ma_function === this.loginForm.sob) ){
|
|
|
+ this.loginForm.sob = res[0].ma_user;
|
|
|
+ }
|
|
|
+ },(result)=>{
|
|
|
+ console.error(result)
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //获取工作中心
|
|
|
+ getWorkCenter(){
|
|
|
+ this.$http.get("kanban/getAllWorkCenter.action").then(
|
|
|
+ (result)=>{
|
|
|
+ var res = JSON.parse(JSON.stringify(result.data.workCenter));
|
|
|
+ for (let i = 0; i < res.length; i++) {
|
|
|
+ this.workshopoptions.push({label: res[i].wc_code, value: res[i].wc_name});
|
|
|
+ }
|
|
|
+ //设置默认值
|
|
|
+ if("" == this.loginForm.workshop || !result.data.workCenter.some(item => item.ma_function === this.loginForm.workshop) ){
|
|
|
+ this.loginForm.workshop = res[0].ma_user;
|
|
|
+ }
|
|
|
},(result)=>{
|
|
|
console.error(result)
|
|
|
});
|
|
|
@@ -116,46 +138,10 @@
|
|
|
this.$store.commit('setUser',res);
|
|
|
this.setCookieData();
|
|
|
if(this.loginForm.workshop =='SMT'){
|
|
|
- if(res.linedata) {
|
|
|
- if(this.$cookie.get("SMT_LI_CODE") && res.linedata.some(item => item.LI_CODE === this.$cookie.get("SMT_LI_CODE")) ){
|
|
|
- sessionStorage.setItem('li_code', this.$cookie.get("SMT_LI_CODE"));
|
|
|
- }else {
|
|
|
- sessionStorage.setItem('li_code', res.linedata[0].LI_CODE);
|
|
|
- this.$cookie.set("SMT_LI_CODE", res.linedata[0].LI_CODE, {
|
|
|
- expires: 30,
|
|
|
- });
|
|
|
- }
|
|
|
- }else{
|
|
|
- sessionStorage.setItem('li_code','');
|
|
|
- }
|
|
|
this.$router.push({path: this.redirect || '/smt'});
|
|
|
}else if(this.loginForm.workshop =='包装'){
|
|
|
- if(res.linedata) {
|
|
|
- if(this.$cookie.get("PC_LI_CODE") && res.linedata.some(item => item.LI_CODE === this.$cookie.get("PC_LI_CODE")) ){
|
|
|
- sessionStorage.setItem('li_code', this.$cookie.get("PC_LI_CODE"));
|
|
|
- }else {
|
|
|
- sessionStorage.setItem('li_code', res.linedata[0].LI_CODE);
|
|
|
- this.$cookie.set("PC_LI_CODE", res.linedata[0].LI_CODE, {
|
|
|
- expires: 30,
|
|
|
- });
|
|
|
- }
|
|
|
- }else{
|
|
|
- sessionStorage.setItem('li_code','');
|
|
|
- }
|
|
|
this.$router.push({path: this.redirect || '/package'});
|
|
|
}else if(this.loginForm.workshop =='组装'){
|
|
|
- if(res.linedata) {
|
|
|
- if(this.$cookie.get("AS_LI_CODE") && res.linedata.some(item => item.LI_CODE === this.$cookie.get("AS_LI_CODE")) ){
|
|
|
- sessionStorage.setItem('li_code', this.$cookie.get("AS_LI_CODE"));
|
|
|
- }else {
|
|
|
- sessionStorage.setItem('li_code', res.linedata[0].LI_CODE);
|
|
|
- this.$cookie.set("AS_LI_CODE", res.linedata[0].LI_CODE, {
|
|
|
- expires: 30,
|
|
|
- });
|
|
|
- }
|
|
|
- }else{
|
|
|
- sessionStorage.setItem('li_code','');
|
|
|
- }
|
|
|
this.$router.push({path: this.redirect || '/assembly'});
|
|
|
}
|
|
|
}else{
|
|
|
@@ -210,6 +196,9 @@
|
|
|
});
|
|
|
},
|
|
|
getCookies(){
|
|
|
+ if(this.$cookie.get("sob")) {
|
|
|
+ this.loginForm.sob = this.$cookie.get("sob");
|
|
|
+ }
|
|
|
this.loginForm.username = this.$cookie.get("username");
|
|
|
if (this.$cookie.get("password")) {
|
|
|
this.loginForm.password = CryptoJS.AES.decrypt(
|