Commit ccf18a0d authored by xxx's avatar xxx

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

parent cf2202d2
......@@ -45,3 +45,4 @@ export const apiPathmapNavigationQuery = '/api/Pathmap/navigation'; //获取关
export const apiManmadesRealCarQuery = '/api/Manmades/RealCar'; //点击车辆小弹框
export const apiManmadesChanJxQuery = '/api/Manmades/ChanJx'; //铲车绩效上面
export const apiManmadesChanCheRealQuery = '/api/Manmades/ChanCheReal'; //铲车车辆信息实时数据
export const apiEquipmentQuery = '/api/Equipment'; //获取设备表
......@@ -30,7 +30,7 @@
></el-input>
</el-form-item>
</el-form>
<button class="loginBtn" @click="LoginInitiation">安全登录</button>
<button class="loginBtn" @click="loginBeforeFn">安全登录</button>
</div>
</div>
<!-- <keyboard v-on:updatekey="GetKeyVal" class="keyboardStyle" v-show="keyboardShow"></keyboard> -->
......@@ -39,7 +39,7 @@
<script>
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 Cookies from "js-cookie";
import { config as appConfig } from "../config.js";
......@@ -60,6 +60,8 @@ export default {
keyboardShowType:'',
//设备OAID
deviceOAID:'',
//判断设备是否与车绑定
bindingStatus:false,
};
},
created() {
......@@ -84,7 +86,35 @@ export default {
success:function(e){
console.log(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){
console.log('getDeviceInfo failed: '+JSON.stringify(e));
......@@ -92,12 +122,12 @@ export default {
message: "获取设备信息失败,请退出系统并且开启权限后重试!",
type: 'error'
});
this.bindingStatus = false;
}
})
},
getCode() {
httpGet(code).then((res) => {
//console.log(res);
this.loginForm.uuid = res.uuid;
});
},
......@@ -112,6 +142,35 @@ export default {
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(){
this.loading = true;
if(this.loginForm.userName == "" || this.loginForm.password == ""){
......@@ -135,7 +194,6 @@ export default {
if(res.status === 400){
that.$message.warning('用户名和密码错误,请重新输入');
}else{
//console.log(res);
localStorage.setItem(appConfig.TOKEN_KEY,res.token);
localStorage.setItem(appConfig.USER_KEY,JSON.stringify(res.user));
if (user.rememberMe) {
......@@ -150,11 +208,10 @@ export default {
}
})
} else {
this.$message({
message: "用户名密码错误 ",
type: 'error'
});
//console.log('error submit!!')
this.$message({
message: "用户名密码错误 ",
type: 'error'
});
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