Browse Source

优化产品和项目路由问题

master
陈裕财 4 years ago
parent
commit
a624c4a4c5
  1. 2
      src/views/mdp/sys/user/UsersSelect.vue
  2. 7
      src/views/xm/core/xmProduct/XmProductInfo.vue
  3. 48
      src/views/xm/core/xmProduct/XmProductInfoRoute.vue
  4. 3
      src/views/xm/core/xmProduct/XmProductMng.vue
  5. 19
      src/views/xm/core/xmProject/XmProjectInfo.vue
  6. 48
      src/views/xm/core/xmProject/XmProjectInfoRoute.vue
  7. 3
      src/views/xm/core/xmProject/XmProjectMng.vue

2
src/views/mdp/sys/user/UsersSelect.vue

@ -1,5 +1,5 @@
<template> <template>
<section>
<section class="padding-left">
<el-tabs v-model="activeTabPane"> <el-tabs v-model="activeTabPane">
<el-tab-pane name="1" label="常用"> <el-tab-pane name="1" label="常用">
<el-row style="height:30px;"> <el-row style="height:30px;">

7
src/views/xm/core/xmProduct/XmProductInfo.vue

@ -302,6 +302,8 @@
this.infotype=infotype; this.infotype=infotype;
if(infotype=='返回'){ if(infotype=='返回'){
this.goBack() this.goBack()
}else{
localStorage.setItem('product-infotype',infotype);
} }
}, },
handleExport() { handleExport() {
@ -418,6 +420,7 @@
} }
}, },
goBack(){ goBack(){
localStorage.setItem('product-infotype',"产品概览");
this.$router.back() this.$router.back()
} }
@ -452,6 +455,10 @@
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
var infotype=localStorage.getItem('product-infotype');
if(infotype){
this.infotype=infotype
}
}); });
} }
} }

48
src/views/xm/core/xmProduct/XmProductInfoRoute.vue

@ -7,6 +7,7 @@
<script> <script>
import util from '@/common/js/util';// import util from '@/common/js/util';//
import { listXmProductWithState } from '@/api/xm/core/xmProduct';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import XmProductInfo from './XmProductInfo' import XmProductInfo from './XmProductInfo'
@ -28,6 +29,35 @@
methods: { methods: {
initByQueryId(){
if(this.$route.query && this.$route.query.id){
var localStorageProduct=localStorage.getItem("xm-product-info-route")
var product=null;
if(localStorageProduct){
product=JSON.parse(localStorageProduct)
if(product && product.id==this.$route.query.id){
this.xmProduct=product
this.showInfo=true;
}else{
this.getProduct(this.$route.query.id);
}
}else{
this.getProduct(this.$route.query.id);
}
}
},
getProduct(id){
listXmProductWithState({id:id}).then(res=>{
var tips = res.data.tips;
if(tips.isOk){
this.xmProduct=res.data.data[0]
localStorage.setItem("xm-product-info-route",JSON.stringify(this.xmProduct))
this.showInfo=true;
}else{
}
})
}
},//end methods },//end methods
components: { components: {
@ -35,24 +65,10 @@
// //
}, },
activated(){ activated(){
if(this.$route.params && this.$route.params.id){
this.xmProduct=this.$route.params
this.showInfo=true;
localStorage.setItem('xm-product-info-route',JSON.stringify(this.xmProduct));
}else{
this.xmProduct=JSON.parse(localStorage.getItem("xm-product-info-route"))
this.showInfo=true;
}
this.initByQueryId();
}, },
mounted() { mounted() {
if(this.$route.params && this.$route.params.id){
this.xmProduct=this.$route.params
this.showInfo=true;
localStorage.setItem('xm-product-info-route',JSON.stringify(this.xmProduct));
}else{
this.xmProduct=JSON.parse(localStorage.getItem("xm-product-info-route"))
this.showInfo=true;
}
this.initByQueryId();
} }
} }
</script> </script>

3
src/views/xm/core/xmProduct/XmProductMng.vue

@ -532,7 +532,8 @@
//info //info
intoInfo(row) { intoInfo(row) {
this.editForm = row; this.editForm = row;
this.$router.push({ name:'XmProductInfoRoute', params: row })
this.$router.push({ name:'XmProductInfoRoute', query: {id:row.id} })
localStorage.setItem("xm-product-info-route",JSON.stringify(row));
//this.showInfo = true; //this.showInfo = true;
}, },
//xmProduct //xmProduct

19
src/views/xm/core/xmProject/XmProjectInfo.vue

@ -186,15 +186,7 @@
]), ]),
}, },
watch:{ watch:{
selProject:function(selProject){
var oldInfotype=this.infotype
this.infotype=''
this.$nextTick(()=>{
this.infotype=oldInfotype
})
}
}, },
data() { data() {
return { return {
@ -230,9 +222,6 @@
} }
}); });
}, },
handleMenuSelect(menuId){
this.infotype=menuId
},
onUserSelected:function(users){ onUserSelected:function(users){
if(this.groupUserVisible==true){ if(this.groupUserVisible==true){
var query={} var query={}
@ -261,6 +250,8 @@
if(infotype=='返回'){ if(infotype=='返回'){
this.goBack() this.goBack()
}else{
localStorage.setItem('project-infotype',infotype);
} }
}, },
handleExport() { handleExport() {
@ -377,6 +368,7 @@
} }
}, },
goBack(){ goBack(){
localStorage.setItem('project-infotype',"项目概览");
this.$router.back() this.$router.back()
} }
@ -408,7 +400,10 @@
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
var infotype=localStorage.getItem('project-infotype');
if(infotype){
this.infotype=infotype
}
}); });
} }
} }

48
src/views/xm/core/xmProject/XmProjectInfoRoute.vue

@ -9,6 +9,7 @@
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import XmProjectInfo from './XmProjectInfo' import XmProjectInfo from './XmProjectInfo'
import { listXmProject} from '@/api/xm/core/xmProject';
export default { export default {
computed: { computed: {
@ -30,6 +31,35 @@
this.selProject=project; this.selProject=project;
localStorage.setItem('xm-project-info-route',JSON.stringify(this.selProject)); localStorage.setItem('xm-project-info-route',JSON.stringify(this.selProject));
this.$emit('submit',project) this.$emit('submit',project)
},
initByQueryId(){
if(this.$route.query && this.$route.query.id){
var localStorageProject=localStorage.getItem("xm-project-info-route")
var project=null;
if(localStorageProject){
project=JSON.parse(localStorageProject)
if(project && project.id==this.$route.query.id){
this.selProject=project
this.showInfo=true;
}else{
this.getProject(this.$route.query.id);
}
}else{
this.getProject(this.$route.query.id);
}
}
},
getProject(id){
listXmProject({id:id}).then(res=>{
var tips = res.data.tips;
if(tips.isOk){
this.selProject=res.data.data[0]
localStorage.setItem("xm-project-info-route",JSON.stringify(this.selProject))
this.showInfo=true;
}else{
}
})
} }
@ -39,24 +69,10 @@
// //
}, },
activated(){ activated(){
if(this.$route.params && this.$route.params.id){
this.selProject=this.$route.params
this.showInfo=true;
localStorage.setItem('xm-project-info-route',JSON.stringify(this.selProject));
}else{
this.selProject=JSON.parse(localStorage.getItem("xm-project-info-route"))
this.showInfo=true;
}
this.initByQueryId();
}, },
mounted() { mounted() {
if(this.$route.params && this.$route.params.id){
this.selProject=this.$route.params
this.showInfo=true;
localStorage.setItem('xm-project-info-route',JSON.stringify(this.selProject));
}else{
this.selProject=JSON.parse(localStorage.getItem("xm-project-info-route"))
this.showInfo=true;
}
this.initByQueryId();
} }
} }
</script> </script>

3
src/views/xm/core/xmProject/XmProjectMng.vue

@ -616,7 +616,8 @@
//info //info
intoInfo(row) { intoInfo(row) {
this.selectProject = row; this.selectProject = row;
this.$router.push({ name:'XmProjectInfoRoute', params: row })
this.$router.push({ name:'XmProjectInfoRoute', query: {id:row.id} })
localStorage.setItem("xm-project-info-route",JSON.stringify(row))
//this.showInfo = true; //this.showInfo = true;
}, },

Loading…
Cancel
Save