Authored by 鲁尚清

搭建的页面路由跳转设置及返回上级页面

@@ -50,6 +50,22 @@ export const monitorCustomPiePercentageCard = { @@ -50,6 +50,22 @@ export const monitorCustomPiePercentageCard = {
50 placeholder: '', 50 placeholder: '',
51 value: '', 51 value: '',
52 }, 52 },
  53 + {
  54 + type: 'el-switch',
  55 + label: '是否有跳转',
  56 + name: 'isNextPage',
  57 + required: false,
  58 + placeholder: '',
  59 + value: true,
  60 + },
  61 + {
  62 + type: 'el-input-text',
  63 + label: '跳转路由',
  64 + name: 'nextRouter',
  65 + required: false,
  66 + placeholder: '',
  67 + value: '',
  68 + },
53 [ 69 [
54 { 70 {
55 name: '标题设置', 71 name: '标题设置',
1 <template> 1 <template>
2 <div class="button-container" :style="styleObj"> 2 <div class="button-container" :style="styleObj">
3 - <div class="button-title" :style="titleStyle"> 3 + <div class="button-title" :style="titleStyle" @click="goBack">
4 <img :src="imgStyle.titleIcon" alt="" class="icon-title"> 4 <img :src="imgStyle.titleIcon" alt="" class="icon-title">
5 {{ transStyle.titleName }} 5 {{ transStyle.titleName }}
6 </div> 6 </div>
@@ -111,6 +111,9 @@ export default { @@ -111,6 +111,9 @@ export default {
111 111
112 }, 112 },
113 methods: { 113 methods: {
  114 + goBack() {
  115 + this.$router.go(-1)
  116 + },
114 //计算按钮是否显示 117 //计算按钮是否显示
115 btnDisplay(){ 118 btnDisplay(){
116 this.btnGroup.map((item,index)=>{ 119 this.btnGroup.map((item,index)=>{
@@ -181,6 +184,7 @@ export default { @@ -181,6 +184,7 @@ export default {
181 padding:5px; 184 padding:5px;
182 display: flex; 185 display: flex;
183 align-items: center; 186 align-items: center;
  187 + cursor: pointer;
184 } 188 }
185 .icon-title{ 189 .icon-title{
186 margin-right:5px; 190 margin-right:5px;
@@ -142,6 +142,7 @@ export default { @@ -142,6 +142,7 @@ export default {
142 left: this.optionsStyle.left + "px", 142 left: this.optionsStyle.left + "px",
143 top: this.optionsStyle.top + "px", 143 top: this.optionsStyle.top + "px",
144 background: this.optionsSetup.background, 144 background: this.optionsSetup.background,
  145 + cursor:this.optionsSetup.isNextPage?'pointer':''
145 }; 146 };
146 }, 147 },
147 flexStyle(){ 148 flexStyle(){
@@ -415,20 +416,20 @@ export default { @@ -415,20 +416,20 @@ export default {
415 }, 416 },
416 goJump(){ 417 goJump(){
417 let locationUrl=this.$route.query; 418 let locationUrl=this.$route.query;
418 - console.log("reportCode",locationUrl.second_router)  
419 - //二级路由传递给iframe父页面  
420 - /*let param={  
421 - type:'second_router',  
422 - data:{  
423 - reportCode: this.$route.query.second_router 419 + if(this.optionsSetup.isNextPage){
  420 + let nextRouter=this.optionsSetup.nextRouter;
  421 + if( this.$route.query.second_router){
  422 + nextRouter=this.$route.query.second_router
424 } 423 }
  424 + if(nextRouter){
  425 + this.$router.push({
  426 + path: `/bigscreen/viewer`,
  427 + query: { reportCode: nextRouter },
  428 + })
  429 + }
  430 +
425 } 431 }
426 - window.parent.postMessage(param, '*')  
427 -*/  
428 - this.$router.push({  
429 - path: `/bigscreen/viewer`,  
430 - query: { reportCode: this.$route.query.second_router },  
431 - }) 432 +
432 } 433 }
433 } 434 }
434 }; 435 };
@@ -31,6 +31,11 @@ export default { @@ -31,6 +31,11 @@ export default {
31 widgets: [] 31 widgets: []
32 }; 32 };
33 }, 33 },
  34 + //start 监听路由变化,刷新页面 lsq 2022-03-18
  35 + watch:{
  36 + "$route":'getData'
  37 + },
  38 + //end lsq 2022-03-18
34 mounted() { 39 mounted() {
35 this.getData(); 40 this.getData();
36 }, 41 },