11<script setup lang="ts">
22import icon_add_outlined from ' @/assets/svg/icon_add_outlined.svg'
3- import {reactive , ref , toRefs , onBeforeMount , computed } from ' vue'
4- import {load_resource_prepare } from ' @/views/dashboard/utils/canvasUtils'
5- import {Icon } from ' @/components/icon-custom'
6- import ResourceTree from " @/views/dashboard/common/ResourceTree.vue" ;
7- import SQPreview from " @/views/dashboard/preview/SQPreview.vue" ;
8- import SQPreviewHead from " @/views/dashboard/preview/SQPreviewHead.vue" ;
9- import EmptyBackground from " @/views/dashboard/common/EmptyBackground.vue" ;
10- import {dashboardStoreWithOut } from " @/stores/dashboard/dashboard.ts" ;
3+ import { reactive , ref , toRefs , onBeforeMount , computed } from ' vue'
4+ import { load_resource_prepare } from ' @/views/dashboard/utils/canvasUtils'
5+ import { Icon } from ' @/components/icon-custom'
6+ import ResourceTree from ' @/views/dashboard/common/ResourceTree.vue'
7+ import SQPreview from ' @/views/dashboard/preview/SQPreview.vue'
8+ import SQPreviewHead from ' @/views/dashboard/preview/SQPreviewHead.vue'
9+ import EmptyBackground from ' @/views/dashboard/common/EmptyBackground.vue'
10+ import { dashboardStoreWithOut } from ' @/stores/dashboard/dashboard.ts'
1111
1212const dashboardStore = dashboardStoreWithOut ()
1313const previewCanvasContainer = ref (null )
@@ -19,27 +19,27 @@ const state = reactive({
1919 canvasDataPreview: [],
2020 canvasStylePreview: {},
2121 canvasViewInfoPreview: {},
22- dashboardInfo: {},
22+ dashboardInfo: {} as any ,
2323 showOffset: {
2424 top: 110 ,
25- left: 280
26- }
25+ left: 280 ,
26+ },
2727})
2828
2929const props = defineProps ({
3030 showPosition: {
3131 required: false ,
3232 type: String ,
33- default: ' preview'
33+ default: ' preview' ,
3434 },
3535 noClose: {
3636 required: false ,
3737 type: Boolean ,
38- default: false
39- }
38+ default: false ,
39+ },
4040})
4141
42- const {showPosition} = toRefs (props )
42+ const { showPosition } = toRefs (props )
4343
4444const resourceTreeRef = ref ()
4545
@@ -54,22 +54,22 @@ const mounted = computed(() => {
5454 return resourceTreeRef .value ?.mounted
5555})
5656
57-
5857function createNew() {
5958 resourceTreeRef .value ?.createNewObject ()
6059}
6160
6261const loadCanvasData = (params : any ) => {
6362 dataInitState .value = false
64- load_resource_prepare ({id: params .id },
65- // @ts-ignore
66- function ({dashboardInfo , canvasDataResult , canvasStyleResult , canvasViewInfoPreview }) {
67- state .canvasDataPreview = canvasDataResult
68- state .canvasStylePreview = canvasStyleResult
69- state .canvasViewInfoPreview = canvasViewInfoPreview
70- state .dashboardInfo = dashboardInfo
71- dataInitState .value = true
72- }
63+ load_resource_prepare (
64+ { id: params .id },
65+ // @ts-ignore
66+ function ({ dashboardInfo , canvasDataResult , canvasStyleResult , canvasViewInfoPreview }) {
67+ state .canvasDataPreview = canvasDataResult
68+ state .canvasStylePreview = canvasStyleResult
69+ state .canvasViewInfoPreview = canvasViewInfoPreview
70+ state .dashboardInfo = dashboardInfo
71+ dataInitState .value = true
72+ }
7373 )
7474}
7575const getPreviewStateInfo = () => {
@@ -93,55 +93,55 @@ onBeforeMount(() => {
9393})
9494const sideTreeStatus = ref (true )
9595defineExpose ({
96- getPreviewStateInfo
96+ getPreviewStateInfo ,
9797})
9898 </script >
9999
100100<template >
101101 <div class =" dv-preview dv-teleport-query" >
102102 <el-aside
103- class =" resource-area"
104- :class =" { 'close-side': !slideShow, retract: !sideTreeStatus }"
105- ref =" node"
103+ class =" resource-area"
104+ :class =" { 'close-side': !slideShow, retract: !sideTreeStatus }"
105+ ref =" node"
106106 >
107107 <resource-tree
108- ref =" resourceTreeRef"
109- v-show =" slideShow"
110- :cur-canvas-type =" 'dashboard'"
111- :show-position =" showPosition"
112- @node-click =" resourceNodeClick"
108+ ref =" resourceTreeRef"
109+ v-show =" slideShow"
110+ :cur-canvas-type =" 'dashboard'"
111+ :show-position =" showPosition"
112+ @node-click =" resourceNodeClick"
113113 />
114114 </el-aside >
115115 <el-container
116- class =" preview-area"
117- :class =" { 'no-data': !state.dashboardInfo }"
118- v-loading =" !dataInitState"
116+ class =" preview-area"
117+ :class =" { 'no-data': !state.dashboardInfo }"
118+ v-loading =" !dataInitState"
119119 >
120120 <template v-if =" previewShowFlag " >
121- <SQPreviewHead :dashboard-info =" state.dashboardInfo" @reload =" reload" />
121+ <SQPreviewHead :dashboard-info =" state.dashboardInfo" @reload =" reload" />
122122 <div ref =" previewCanvasContainer" class =" content" id =" sq-preview-content" >
123123 <SQPreview
124- ref =" dashboardPreview"
125- v-if =" state.canvasStylePreview && dataInitState"
126- :dashboard-info =" state.dashboardInfo"
127- :component-data =" state.canvasDataPreview"
128- :canvas-style-data =" state.canvasStylePreview"
129- :canvas-view-info =" state.canvasViewInfoPreview"
130- :show-position =" showPosition"
131- :download-status =" downloadStatus"
132- :show-linkage-button =" false"
124+ ref =" dashboardPreview"
125+ v-if =" state.canvasStylePreview && dataInitState"
126+ :dashboard-info =" state.dashboardInfo"
127+ :component-data =" state.canvasDataPreview"
128+ :canvas-style-data =" state.canvasStylePreview"
129+ :canvas-view-info =" state.canvasViewInfoPreview"
130+ :show-position =" showPosition"
131+ :download-status =" downloadStatus"
132+ :show-linkage-button =" false"
133133 ></SQPreview >
134134 </div >
135135 </template >
136136 <template v-else-if =" hasTreeData && mounted " >
137- <EmptyBackground :description =" 'Please Select Resource'" img-type =" select" />
137+ <EmptyBackground :description =" 'Please Select Resource'" img-type =" select" />
138138 </template >
139139 <template v-else-if =" mounted " >
140140 <EmptyBackground :description =" 'No Resource'" img-type =" none" >
141141 <el-button v-if =" rootManage" @click =" createNew" type =" primary" >
142142 <template #icon >
143143 <Icon name =" icon_add_outlined" >
144- <icon _add_outlined class =" svg-icon" />
144+ <icon _add_outlined class =" svg-icon" />
145145 </Icon >
146146 </template >
147147 Create Dashboard
0 commit comments