需求背景: 当搜索项目名称后 点击查看详情 在回到项目管理页面 需要把 项目名称的值回传到项目管理页面
// 1. 在项目管理页面 把 项目名称的值 传到查看详情页面
this.$router.push("./managementDetails?pageType=1&projectName="+
that.value1+"&id=" + e + "&projectNo="+that.value5);
// managementDetails 是路由地址
{
path: "/managementDetails",
name: "managementDetails",
component: managementDetails,
meta: {
title: "查看详情",
requiredAuth: true,
keepAlive: false
}
},
// 2. 查看详情页面 获取到相应的值
created() {
//console.log("页面加载---------------", this.$router);
let that = this;
that.id = that.$route.query.id;
that.pageType = that.$route.query.pageType;
that.projectName = that.$route.query.projectName;
that.projectNo = that.$route.query.projectNo;
this.ajaxload();
// this.getList1();
},
// 3. 将 项目名称的值回传到 项目管理页面
// 查看详情页面
back() {
if(this.projectName == undefined || this.projectName == null || this.projectName == ""){
this.projectName = ""
}
if(this.projectNo == undefined || this.projectNo == null || this.projectNo == ""){
this.projectNo = ""
}
this.$router.push("./projectManagement?projectName="+this.projectName + "&projectNo="+this.projectNo);
},
// 项目管理页面
// 创建完毕状态(里面是操作)
created() {
//console.log("页面加载---------------", this.$router);
this.getList();
// this.ajaxload();
// 获取组别
this.getGroup();
this.setValue();
},
setValue(){
// 设置项目名称
let projectName = this.$route.query.projectName;
// 注意 这里的 null 是字符串
if(projectName == 'null' || projectName == 'undefined'){
this.value1 = ""
}else {
this.value1 = this.$route.query.projectName
}
// 设置项目单号
let projectNo = this.$route.query.projectNo;
if(projectNo == 'null' || projectNo == 'undefined'){
this.value5 = ""
}else {
this.value5 = this.$route.query.projectNo
}
},
持续更新…