Skip to content

Commit 233c790

Browse files
committed
refactor: dashboard canvas edit update
1 parent b498355 commit 233c790

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

frontend/src/views/dashboard/canvas/CanvasCore.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ import { useEmitt, useEmittLazy } from '@/utils/useEmitt.ts'
1010
import html2canvas from 'html2canvas'
1111
import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
1212
import { useI18n } from 'vue-i18n'
13+
import { isMainCanvas } from '@/views/dashboard/utils/canvasUtils.ts'
1314
1415
const { t } = useI18n()
1516
const dashboardStore = dashboardStoreWithOut()
1617
const canvasLocked = ref(false) // Is the canvas movement locked, Default false
1718
const emits = defineEmits(['parentAddItemBox'])
18-
const { curComponentId, curComponent } = storeToRefs(dashboardStore)
19+
const { curComponentId, curComponent, fullscreenFlag } = storeToRefs(dashboardStore)
1920
let currentInstance: any
2021
const props = defineProps({
2122
canvasId: {
@@ -1178,14 +1179,15 @@ defineExpose({
11781179
@mousemove="moving()"
11791180
>
11801181
<EmptyBackground
1181-
v-if="!canvasComponentData.length"
1182+
v-if="!canvasComponentData.length && isMainCanvas(canvasId)"
11821183
:description="t('dashboard.add_component_tips')"
11831184
img-type="selectDashboard"
11841185
/>
11851186
<template v-if="renderOk">
11861187
<CanvasShape
11871188
v-for="(item, index) in canvasComponentData"
11881189
:key="'item' + index"
1190+
:can-edit="!fullscreenFlag"
11891191
:active="curComponentId === item.id"
11901192
:config-item="item"
11911193
:draggable="draggable"

frontend/src/views/dashboard/canvas/CanvasShape.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ const props = defineProps({
1212
type: Object as PropType<CanvasItem>,
1313
required: true,
1414
},
15+
canEdit: {
16+
type: Boolean,
17+
default: true,
18+
},
1519
active: {
1620
type: Boolean,
1721
default: false,
@@ -69,14 +73,16 @@ const shapeClick = (e: MouseEvent) => {
6973
>
7074
<component-bar
7175
:config-item="configItem"
72-
:active="active"
76+
:active="active && canEdit"
7377
:show-position="'canvas'"
7478
:canvas-id="canvasId"
7579
></component-bar>
76-
<drag-handle></drag-handle>
80+
<template v-if="canEdit">
81+
<drag-handle></drag-handle>
82+
</template>
7783
<slot></slot>
7884
<resize-handle
79-
v-if="active"
85+
v-if="active && canEdit"
8086
:start-resize="
8187
(event: MouseEvent, point: string) => startResize(event, point, configItem, itemIndex)
8288
"

frontend/src/views/dashboard/common/SQFullscreen.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { dashboardStoreWithOut } from '@/stores/dashboard/dashboard.ts'
33
44
const dashboardStore = dashboardStoreWithOut()
5-
import { nextTick, onBeforeUnmount, onMounted } from 'vue'
5+
import { onBeforeUnmount, onMounted } from 'vue'
66
import { useEmitt } from '@/utils/useEmitt.ts'
77
defineProps({
88
themes: {
@@ -37,8 +37,7 @@ const toggleFullscreen = () => {
3737
}
3838
}
3939
40-
// 针对钉钉windows版无法退出全屏问题 这里主动退出
41-
const handleKeydown = (event) => {
40+
const handleKeydown = (event: KeyboardEvent) => {
4241
if (event.key === 'Escape' && document.fullscreenElement) {
4342
document.exitFullscreen()
4443
}

frontend/src/views/dashboard/editor/Toolbar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ const addChatChart = (views: any) => {
141141
142142
const previewInner = () => {
143143
if (fullScreeRef.value) {
144+
// @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
144145
fullScreeRef.value.toggleFullscreen()
145146
}
146147
}

frontend/src/views/dashboard/utils/canvasUtils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export const load_resource_prepare = (params: any, callBack: (obj: any) => void)
3434
})
3535
}
3636

37+
export const isMainCanvas = (canvasId: string) => {
38+
return canvasId === 'canvas-main'
39+
}
40+
3741
export const initCanvasData = (params: any, callBack: () => void) => {
3842
load_resource_prepare(params, function (result: any) {
3943
dashboardStore.setDashboardInfo(result?.dashboardInfo)

0 commit comments

Comments
 (0)