作者 朱兆平

优化页面传参,切换页面参数丢失后,对象为空的校验

... ... @@ -145,12 +145,18 @@
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$router.push({path:'/origmaster',query:
{flightno:JSON.stringify(this.ruleForm.flightno),
flightdate:JSON.stringify(this.dateConversion(this.ruleForm.flightdate)),
originstation:JSON.stringify(this.ruleForm.originstation),
destinationstation:JSON.stringify(this.ruleForm.destinationstation),
awba:JSON.stringify("")}});
this.$router.push(
{
path:'/origmaster',
query:{
flightno: this.ruleForm.flightno,
flightdate: this.ruleForm.flightdate,
originstation: this.ruleForm.originstation,
destinationstation: this.ruleForm.destinationstation,
awba: ''
}
}
);
} else {
console.log('error submit!!');
return false;
... ...
... ... @@ -1058,7 +1058,7 @@
temprows:{},
dialogTableVisible:false,
gridData:[],
tableloading:true,
tableloading:false,
htmlTitle:'',
batich:true,
batichboolean:false,
... ... @@ -1405,23 +1405,28 @@
&& jsutil.checkNull(this.$route.query.originstation)
&& jsutil.checkNull(this.$route.query.destinationstation)
) {
this.defaultQuery.flightno = JSON.parse(this.$route.query.flightno);
this.defaultQuery.flightdate = JSON.parse(this.$route.query.flightdate);
this.defaultQuery.originstation = JSON.parse(this.$route.query.originstation);
this.defaultQuery.destinationstation = JSON.parse(this.$route.query.destinationstation);
this.defaultQuery.awba = JSON.parse(this.$route.query.awba);
this.defaultQuery.flightno =this.$route.query.flightno;
this.defaultQuery.flightdate = this.$route.query.flightdate;
this.defaultQuery.originstation = this.$route.query.originstation;
this.defaultQuery.destinationstation = this.$route.query.destinationstation;
this.defaultQuery.awba = this.$route.query.awba;
this.getList();
}else {
this.$router.push({
path:'/enter'
})
}
},
/*获取默认数据列表*/
getList(){
let _this = this;
this.tableloading=true;
getMt1201List(this.defaultQuery).then(res =>{
this.sumNmmsCount=0;
this.sumNmmsPrice=0;
this.sumNmmsWeight=0;
let response=res.data.data;
console.log(response)
this.tableData=response;
this.tableloading=false;
response.forEach((item,i) => {
... ... @@ -1430,6 +1435,13 @@
this.sumNmmsPrice=Number(this.sumNmmsPrice)+Number(item.piece);
this.sumNmmsWeight=Number(Number(this.sumNmmsWeight)+Number(item.weight)).toFixed(2);
})
}).catch(error => {
_this.tableloading=false;
_this.$message({
// 饿了么的消息弹窗组件
message: error,
type: "error"
});
});
},
/*获取国家代码*/
... ... @@ -1579,7 +1591,6 @@
/*渲染方法*/
activated(){
this.getDefaultData();
this.getList();
}
}
</script>
... ...