Commit cea7d5df authored by xxx's avatar xxx

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

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