Commit cea7d5df authored by xxx's avatar xxx

修改登录退出系统时人员与车辆绑定问题

parent ccf18a0d
......@@ -43,6 +43,7 @@ export default {
defaultwd:52.158,
realjd:140.71212,
realwd:52.158,
carnumber:'',
}
},
......@@ -85,8 +86,8 @@ export default {
methods: {
//获取车辆设备名和车牌号
getCarInforFn(){
getCarInforFn(carnumber){
this.carnumber = carnumber;
//获取车辆类型
httpGet(apiCarClassQuery,{size:9999}).then((res) => {
if(res.code == 200){
......
......@@ -38,7 +38,7 @@
</template>
<script>
import { httpGet, httpPostForJson } from "@/common/httpBean.js";
import { httpGet, httpPostForJson, putForJson } from "@/common/httpBean.js";
import { login, code, apiEquipmentQuery, vehicleInformationQuery} from "@/axios/api.js";
import { encrypt } from "@/utils/rsaEncrypt.js";
import Cookies from "js-cookie";
......@@ -62,6 +62,8 @@ export default {
deviceOAID:'',
//判断设备是否与车绑定
bindingStatus:false,
//绑定的车牌号
bindingCar:'',
};
},
created() {
......@@ -149,6 +151,7 @@ export default {
//查询车辆表中设备是否与车辆绑定
httpGet(vehicleInformationQuery,{equipmentName:this.deviceOAID}).then((resCar) => {
if(resCar.code == 200 && resCar.data.totalElements != 0){
this.bindingCar = resCar.data.content[0].number;
this.bindingStatus = true;
this.LoginInitiation();
}else{
......@@ -180,33 +183,41 @@ export default {
});
}else{
this.$refs.loginForm.validate( valid => {
const user = {
username: this.loginForm.username,
password: this.loginForm.password,
uuid: this.loginForm.uuid
}
if (user.password !== this.cookiePass) {
user.password = encrypt(user.password)
}
if(valid){
httpPostForJson(login, user).then( res =>{
let that = this;
if(res.status === 400){
that.$message.warning('用户名和密码错误,请重新输入');
}else{
localStorage.setItem(appConfig.TOKEN_KEY,res.token);
localStorage.setItem(appConfig.USER_KEY,JSON.stringify(res.user));
if (user.rememberMe) {
Cookies.set('username', user.username, { expires: Config.passCookieExpires })
Cookies.set('password', user.password, { expires: Config.passCookieExpires })
} else {
Cookies.remove('username')
Cookies.remove('password')
}
//that.$router.push({path: '/MLargeScreen/index'});
that.$router.push({ path: '/MLargeScreen/index?' + user.username});
const user = {
username: this.loginForm.username,
password: this.loginForm.password,
uuid: this.loginForm.uuid
}
if (user.password !== this.cookiePass) {
user.password = encrypt(user.password)
}
if(valid){
httpPostForJson(login, user).then( res =>{
let that = this;
if(res.status === 400){
that.$message.warning('用户名和密码错误,请重新输入');
}else{
localStorage.setItem(appConfig.TOKEN_KEY,res.token);
localStorage.setItem(appConfig.USER_KEY,JSON.stringify(res.user));
if (user.rememberMe) {
Cookies.set('username', user.username, { expires: Config.passCookieExpires })
Cookies.set('password', user.password, { expires: Config.passCookieExpires })
} else {
Cookies.remove('username')
Cookies.remove('password')
}
})
//修改人员表中绑定的车辆personalCenterInforQuery
httpGet(personalCenterInforQuery,{userName:user.username}).then((respersonal) => {
if(respersonal.code == 200 && respersonal.data.totalElements != 0){
let lastpersonalData = respersonal.data.content[0];
lastpersonalData.car = this.bindingCar;
putForJson(personalCenterInforQuery,lastpersonalData).then((res)=>{
that.$router.push({ path: '/MLargeScreen/index?' + user.username});
})
}
});
}
})
} else {
this.$message({
message: "用户名密码错误 ",
......
......@@ -154,7 +154,10 @@ export default {
}else{
//修改车辆状态为离线
putForJson(vehicleInformationUpdate,{id:res1.data.content[0].id,odo:0,oddStatus:1}).then((res2) => {
this.logout();
//人员信息表中与车辆解绑
putForJson(personalCenterInforQuery,{id:this.personalInformationData.id,car:''}).then((res3) => {
this.logout();
})
});
}
}
......@@ -242,6 +245,8 @@ export default {
}else{
//修改车辆状态为离线
putForJson(vehicleInformationUpdate,{id:res1.data.content[0].id,odo:0,oddStatus:1}).then((res2) => {});
//人员信息表中与车辆解绑
putForJson(personalCenterInforQuery,{id:this.personalInformationData.id,car:''}).then((res3) => {})
}
}
});
......
......@@ -234,8 +234,13 @@ export default {
if(res.code == 200 && res.data.totalElements != 0){
this.carnumber = res.data.content[0].car;
this.personalName = res.data.content[0].name;
//展示二维地图
this.$refs.mars3dViewerMapMethod.getCarInforFn(this.carnumber);
//开启接受订单
this.$refs.startOrderReceivingMethod.loadData(this.carnumber);
//开启语音接收
this.$refs.voiceApplicationMethod.loadData3(this.carnumber);
//获取车辆信息
httpGet(vehicleInformationQuery,{number:this.carnumber}).then((res1) => {
if(res1.code == 200){
if(res1.data.totalElements == 0){
......@@ -266,9 +271,7 @@ export default {
this.controlPointData = res.data.content;
}
})
//展示二维地图
this.$refs.mars3dViewerMapMethod.getCarInforFn();
},
//获取待装卡车列表
loadData1(){
......
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