Commit ccf18a0d authored by xxx's avatar xxx

登录前查询设备编号等操作

parent cf2202d2
...@@ -45,3 +45,4 @@ export const apiPathmapNavigationQuery = '/api/Pathmap/navigation'; //获取关 ...@@ -45,3 +45,4 @@ export const apiPathmapNavigationQuery = '/api/Pathmap/navigation'; //获取关
export const apiManmadesRealCarQuery = '/api/Manmades/RealCar'; //点击车辆小弹框 export const apiManmadesRealCarQuery = '/api/Manmades/RealCar'; //点击车辆小弹框
export const apiManmadesChanJxQuery = '/api/Manmades/ChanJx'; //铲车绩效上面 export const apiManmadesChanJxQuery = '/api/Manmades/ChanJx'; //铲车绩效上面
export const apiManmadesChanCheRealQuery = '/api/Manmades/ChanCheReal'; //铲车车辆信息实时数据 export const apiManmadesChanCheRealQuery = '/api/Manmades/ChanCheReal'; //铲车车辆信息实时数据
export const apiEquipmentQuery = '/api/Equipment'; //获取设备表
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
></el-input> ></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<button class="loginBtn" @click="LoginInitiation">安全登录</button> <button class="loginBtn" @click="loginBeforeFn">安全登录</button>
</div> </div>
</div> </div>
<!-- <keyboard v-on:updatekey="GetKeyVal" class="keyboardStyle" v-show="keyboardShow"></keyboard> --> <!-- <keyboard v-on:updatekey="GetKeyVal" class="keyboardStyle" v-show="keyboardShow"></keyboard> -->
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<script> <script>
import { httpGet, httpPostForJson } from "@/common/httpBean.js"; import { httpGet, httpPostForJson } from "@/common/httpBean.js";
import { login, code } from "@/axios/api.js"; import { login, code, apiEquipmentQuery, vehicleInformationQuery} from "@/axios/api.js";
import { encrypt } from "@/utils/rsaEncrypt.js"; import { encrypt } from "@/utils/rsaEncrypt.js";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import { config as appConfig } from "../config.js"; import { config as appConfig } from "../config.js";
...@@ -60,6 +60,8 @@ export default { ...@@ -60,6 +60,8 @@ export default {
keyboardShowType:'', keyboardShowType:'',
//设备OAID //设备OAID
deviceOAID:'', deviceOAID:'',
//判断设备是否与车绑定
bindingStatus:false,
}; };
}, },
created() { created() {
...@@ -84,7 +86,35 @@ export default { ...@@ -84,7 +86,35 @@ export default {
success:function(e){ success:function(e){
console.log(e.oaid); console.log(e.oaid);
this.deviceOAID = e.oaid; this.deviceOAID = e.oaid;
//查询设备表是否存在该设备编号
httpGet(apiEquipmentQuery,{name:this.deviceOAID}).then((resSheiBei) => {
if(resSheiBei.code == 200 && resSheiBei.data.totalElements != 0){
//查询车辆表中设备是否与车辆绑定
httpGet(vehicleInformationQuery,{equipmentName:this.deviceOAID}).then((resCar) => {
if(resCar.code == 200 && resCar.data.totalElements != 0){
this.$message({
message: "设备检索完毕,可进行登录!",
type: 'success'
});
this.bindingStatus = true;
}else{
this.$message({
message: "请在后台系统中将该设备与车辆绑定后再进行登录!",
type: 'error'
});
this.bindingStatus = false;
}
})
}else{
httpPostForJson(apiEquipmentQuery,{name:this.deviceOAID,status:'正常'}).then((res)=>{
this.$message({
message: "请在后台系统中将该设备与车辆绑定后再进行登录!",
type: 'error'
});
this.bindingStatus = false;
})
}
});
}, },
fail:function(e){ fail:function(e){
console.log('getDeviceInfo failed: '+JSON.stringify(e)); console.log('getDeviceInfo failed: '+JSON.stringify(e));
...@@ -92,12 +122,12 @@ export default { ...@@ -92,12 +122,12 @@ export default {
message: "获取设备信息失败,请退出系统并且开启权限后重试!", message: "获取设备信息失败,请退出系统并且开启权限后重试!",
type: 'error' type: 'error'
}); });
this.bindingStatus = false;
} }
}) })
}, },
getCode() { getCode() {
httpGet(code).then((res) => { httpGet(code).then((res) => {
//console.log(res);
this.loginForm.uuid = res.uuid; this.loginForm.uuid = res.uuid;
}); });
}, },
...@@ -112,6 +142,35 @@ export default { ...@@ -112,6 +142,35 @@ export default {
password: password, password: password,
} }
}, },
//登录前操作判断
loginBeforeFn() {
httpGet(apiEquipmentQuery,{name:this.deviceOAID}).then((resSheiBei) => {
if(resSheiBei.code == 200 && resSheiBei.data.totalElements != 0){
//查询车辆表中设备是否与车辆绑定
httpGet(vehicleInformationQuery,{equipmentName:this.deviceOAID}).then((resCar) => {
if(resCar.code == 200 && resCar.data.totalElements != 0){
this.bindingStatus = true;
this.LoginInitiation();
}else{
this.$message({
message: "请在后台系统中将该设备与车辆绑定后再进行登录!",
type: 'error'
});
this.bindingStatus = false;
}
})
}else{
httpPostForJson(apiEquipmentQuery,{name:this.deviceOAID,status:'正常'}).then((res)=>{
this.$message({
message: "请在后台系统中将该设备与车辆绑定后再进行登录!",
type: 'error'
});
this.bindingStatus = false;
})
}
});
},
//进行登录
LoginInitiation(){ LoginInitiation(){
this.loading = true; this.loading = true;
if(this.loginForm.userName == "" || this.loginForm.password == ""){ if(this.loginForm.userName == "" || this.loginForm.password == ""){
...@@ -135,7 +194,6 @@ export default { ...@@ -135,7 +194,6 @@ export default {
if(res.status === 400){ if(res.status === 400){
that.$message.warning('用户名和密码错误,请重新输入'); that.$message.warning('用户名和密码错误,请重新输入');
}else{ }else{
//console.log(res);
localStorage.setItem(appConfig.TOKEN_KEY,res.token); localStorage.setItem(appConfig.TOKEN_KEY,res.token);
localStorage.setItem(appConfig.USER_KEY,JSON.stringify(res.user)); localStorage.setItem(appConfig.USER_KEY,JSON.stringify(res.user));
if (user.rememberMe) { if (user.rememberMe) {
...@@ -150,11 +208,10 @@ export default { ...@@ -150,11 +208,10 @@ export default {
} }
}) })
} else { } else {
this.$message({ this.$message({
message: "用户名密码错误 ", message: "用户名密码错误 ",
type: 'error' type: 'error'
}); });
//console.log('error submit!!')
return false return false
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment