dataease-dm/frontend/src/views/panel/index.vue

106 lines
3.0 KiB
Vue
Raw Normal View History

2021-03-08 14:31:09 +08:00
<template>
2021-05-05 23:48:05 +08:00
<de-container v-loading="$store.getters.loadingMap[$store.getters.currentPath]" style="background-color: #f7f8fa">
<de-main-container>
2021-07-02 19:19:38 +08:00
<panel-main v-show="componentName==='PanelMain'" ref="panel_main" />
2021-05-25 19:11:00 +08:00
<chart-edit v-if="componentName==='ChartEdit'" :param="param" />
<panel-edit v-if="componentName==='PanelEdit'" />
<!-- <component :is="component" :param="param" />-->
</de-main-container>
</de-container>
2021-03-08 14:31:09 +08:00
</template>
<script>
2021-04-01 17:40:12 +08:00
import bus from '@/utils/bus'
import DeMainContainer from '@/components/dataease/DeMainContainer'
import DeContainer from '@/components/dataease/DeContainer'
2021-04-01 17:40:12 +08:00
import PanelMain from '@/views/panel/list/PanelMain'
import ChartEdit from '@/views/chart/view/ChartEdit'
import PanelEdit from '@/views/panel/edit'
2021-03-08 14:31:09 +08:00
2021-03-08 21:10:16 +08:00
export default {
name: 'Panel',
2021-04-01 17:40:12 +08:00
components: { DeMainContainer, DeContainer, PanelMain, ChartEdit, PanelEdit },
2021-03-08 21:10:16 +08:00
data() {
return {
2021-04-01 17:40:12 +08:00
component: PanelMain,
componentName: 'PanelMain',
2021-04-01 17:40:12 +08:00
param: {}
2021-03-08 21:10:16 +08:00
}
},
2021-07-06 15:24:34 +08:00
watch: {
$route(to, from) {
console.log(to)
console.log(from)
// 对路由变化作出响应...
}
},
2021-04-01 17:40:12 +08:00
mounted() {
2021-07-06 15:24:34 +08:00
bus.$on('to-msg-share', params => {
this.toMsgShare(params)
})
2021-04-01 17:40:12 +08:00
bus.$on('PanelSwitchComponent', (c) => {
this.param = c.param
this.componentName = c.name
this.$store.dispatch('panel/setMainActiveName', c.name)
// switch (c.name) {
// case 'PanelEdit':
// this.component = PanelEdit
// this.componentName = 'PanelEdit'
// break
// case 'ChartEdit':
// this.component = ChartEdit
// this.componentName = 'ChartEdit'
// break
// default:
// this.component = PanelMain
// this.componentName = 'PanelMain'
// break
// }
2021-04-01 17:40:12 +08:00
})
},
2021-07-02 19:19:38 +08:00
created() {
this.$store.dispatch('app/toggleSideBarHide', true)
2021-07-06 15:24:34 +08:00
const routerParam = this.$router.currentRoute.params
// if ((routerParam = this.$router.currentRoute.params) !== null && routerParam.msgNotification) {
// // 说明是从消息通知跳转过来的
// if (routerParam.msgType === 0) { // 是仪表板分享
// this.componentName = 'PanelMain'
// this.$nextTick(() => {
// this.$refs.panel_main.msg2Current(routerParam.sourceParam)
// })
// }
// }
this.toMsgShare(routerParam)
},
methods: {
toMsgShare(routerParam) {
if (routerParam !== null && routerParam.msgNotification) {
2021-07-02 19:19:38 +08:00
// 说明是从消息通知跳转过来的
2021-07-06 15:24:34 +08:00
if (routerParam.msgType === 0) { // 是仪表板分享
this.componentName = 'PanelMain'
this.$nextTick(() => {
this.$refs.panel_main.msg2Current(routerParam.sourceParam)
})
}
2021-07-02 19:19:38 +08:00
}
}
2021-04-01 17:40:12 +08:00
2021-03-08 14:31:09 +08:00
}
2021-03-08 21:10:16 +08:00
}
2021-03-08 14:31:09 +08:00
</script>
<style scoped>
.ms-aside-container {
height: calc(100vh - 56px);
2021-04-08 16:54:37 +08:00
padding: 0px;
2021-03-08 14:31:09 +08:00
min-width: 260px;
max-width: 460px;
}
.ms-main-container {
height: calc(100vh - 56px);
2021-04-01 17:40:12 +08:00
padding: 0;
2021-03-08 14:31:09 +08:00
}
</style>