作者 朱兆平

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

@@ -889,6 +889,7 @@ @@ -889,6 +889,7 @@
889 import loginUserInfo from '@/api/base.js' 889 import loginUserInfo from '@/api/base.js'
890 import {mapActions, mapGetters} from 'vuex' 890 import {mapActions, mapGetters} from 'vuex'
891 import {loginedUserInfo} from "../../api/user"; 891 import {loginedUserInfo} from "../../api/user";
  892 + import jsutil from "@/common/js/util";
892 export default { 893 export default {
893 name:'Origmaster', 894 name:'Origmaster',
894 data() { 895 data() {
@@ -1397,11 +1398,19 @@ @@ -1397,11 +1398,19 @@
1397 }, 1398 },
1398 /*获取默认值*/ 1399 /*获取默认值*/
1399 getDefaultData(){ 1400 getDefaultData(){
1400 - this.defaultQuery.flightno = JSON.parse(this.$route.query.flightno);  
1401 - this.defaultQuery.flightdate = JSON.parse(this.$route.query.flightdate);  
1402 - this.defaultQuery.originstation = JSON.parse(this.$route.query.originstation);  
1403 - this.defaultQuery.destinationstation = JSON.parse(this.$route.query.destinationstation);  
1404 - this.defaultQuery.awba=JSON.parse(this.$route.query.awba); 1401 + if(
  1402 + jsutil.checkNull(this.$route.query)
  1403 + && jsutil.checkNull(this.$route.query.flightno)
  1404 + && jsutil.checkNull(this.$route.query.flightdate)
  1405 + && jsutil.checkNull(this.$route.query.originstation)
  1406 + && jsutil.checkNull(this.$route.query.destinationstation)
  1407 + ) {
  1408 + this.defaultQuery.flightno = JSON.parse(this.$route.query.flightno);
  1409 + this.defaultQuery.flightdate = JSON.parse(this.$route.query.flightdate);
  1410 + this.defaultQuery.originstation = JSON.parse(this.$route.query.originstation);
  1411 + this.defaultQuery.destinationstation = JSON.parse(this.$route.query.destinationstation);
  1412 + this.defaultQuery.awba = JSON.parse(this.$route.query.awba);
  1413 + }
1405 1414
1406 }, 1415 },
1407 /*获取默认数据列表*/ 1416 /*获取默认数据列表*/