Skip to content

Commit 35e0a36

Browse files
committed
refactor: dashboard view enlarge
1 parent de5ffe4 commit 35e0a36

File tree

9 files changed

+81
-6
lines changed

9 files changed

+81
-6
lines changed

frontend/src/i18n/en.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
"password_reset_successful": "Password reset successful"
3333
},
3434
"dashboard": {
35+
"exit_preview": "Exit preview",
36+
"no_chat": "No conversations",
37+
"today": "Today",
38+
"this_week": "This week",
39+
"earlier": "Earlier",
3540
"add_component_tips": "Select components from the top toolbar and add them here to create a dashboard",
3641
"add_view": "Add Chart",
3742
"delete_dashboard_warn": "Delete This Dashboard: {0}",

frontend/src/i18n/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"password_reset_successful": "重置密码成功"
3535
},
3636
"dashboard": {
37+
"exit_preview": "退出预览",
3738
"no_chat": "暂无对话",
3839
"today": "今日",
3940
"this_week": "本周",

frontend/src/views/chat/component/DisplayChartBlock.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ defineExpose({
8181
.chart-base-container {
8282
height: 100%;
8383
width: 100%;
84+
border-radius: 12px;
8485
background: rgba(224, 224, 226, 0.29);
8586
}
8687
</style>

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,11 @@ onMounted(() => {
11491149
currentInstance = getCurrentInstance()
11501150
})
11511151
1152+
const enlargeView = (itemId: string) => {
1153+
const refTabInstance = currentInstance.refs['shape_component_' + itemId][0]
1154+
refTabInstance.enlargeView()
1155+
}
1156+
11521157
defineExpose({
11531158
getRenderState,
11541159
init,
@@ -1194,6 +1199,7 @@ defineExpose({
11941199
:start-resize="startResize"
11951200
:canvas-id="canvasId"
11961201
:style="nowItemStyle(item)"
1202+
@enlarge-view="() => enlargeView(item.id)"
11971203
>
11981204
<component
11991205
:is="findComponent(item.component)"

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ref, toRefs, type PropType } from 'vue'
44
import ResizeHandle from '@/views/dashboard/canvas/ResizeHandle.vue'
55
import DragHandle from '@/views/dashboard/canvas/DragHandle.vue'
66
import ComponentBar from '@/views/dashboard/canvas/ComponentBar.vue'
7-
7+
const emits = defineEmits(['enlargeView'])
88
const shapeRef = ref(null)
99
// Props
1010
const props = defineProps({
@@ -76,6 +76,7 @@ const shapeClick = (e: MouseEvent) => {
7676
:active="active && canEdit"
7777
:show-position="'canvas'"
7878
:canvas-id="canvasId"
79+
@enlarge-view="() => emits('enlargeView')"
7980
></component-bar>
8081
<template v-if="canEdit">
8182
<drag-handle></drag-handle>

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useI18n } from 'vue-i18n'
77
import icon_more_outlined from '@/assets/svg/icon_more_outlined.svg'
88
import icon_chart_preview from '@/assets/svg/icon_chart_preview.svg'
99
const { t } = useI18n()
10+
const emits = defineEmits(['enlargeView'])
1011
1112
const props = defineProps({
1213
active: {
@@ -32,6 +33,7 @@ const { configItem } = toRefs(props)
3233
3334
const doPreview = () => {
3435
// do preview
36+
emits('enlargeView')
3537
}
3638
3739
const doDeleteComponent = (e: MouseEvent) => {
@@ -52,9 +54,12 @@ const doDeleteComponent = (e: MouseEvent) => {
5254
</el-icon>
5355
<template #dropdown>
5456
<el-dropdown-menu>
55-
<el-dropdown-item :icon="icon_chart_preview" @click="doPreview">{{
56-
t('dashboard.preview')
57-
}}</el-dropdown-item>
57+
<el-dropdown-item
58+
v-if="configItem.component === 'SQView'"
59+
:icon="icon_chart_preview"
60+
@click="doPreview"
61+
>{{ t('dashboard.preview') }}</el-dropdown-item
62+
>
5863
<el-dropdown-item divided :icon="icon_delete" @click="doDeleteComponent">{{
5964
t('dashboard.delete')
6065
}}</el-dropdown-item>

frontend/src/views/dashboard/components/sq-view/index.vue

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
<script setup lang="ts">
22
import ChartComponent from '@/views/chat/component/ChartComponent.vue'
3+
import icon_window_mini_outlined from '@/assets/svg/icon_window-mini_outlined.svg'
4+
import SqViewDisplay from '@/views/dashboard/components/sq-view/index.vue'
35
defineProps({
46
viewInfo: {
57
type: Object,
68
required: true,
79
},
10+
outerId: {
11+
type: String,
12+
required: false,
13+
default: null,
14+
},
815
})
916
1017
import { ref } from 'vue'
18+
import { useI18n } from 'vue-i18n'
19+
const { t } = useI18n()
1120
const chartRef = ref(null)
1221
const renderChart = () => {
1322
//@ts-expect-error eslint-disable-next-line @typescript-eslint/no-unused-expressions
1423
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
1524
chartRef.value?.renderChart
1625
}
26+
const enlargeDialogVisible = ref(false)
1727
28+
const enlargeView = () => {
29+
enlargeDialogVisible.value = true
30+
}
1831
defineExpose({
1932
renderChart,
33+
enlargeView,
2034
})
2135
</script>
2236

@@ -30,7 +44,7 @@ defineExpose({
3044
<div class="chart-show-area">
3145
<ChartComponent
3246
v-if="viewInfo.id"
33-
:id="viewInfo.id"
47+
:id="outerId || viewInfo.id"
3448
ref="chartRef"
3549
:type="viewInfo.chart.type"
3650
:columns="viewInfo.chart.columns"
@@ -40,15 +54,54 @@ defineExpose({
4054
:data="viewInfo.data?.data"
4155
/>
4256
</div>
57+
<el-dialog
58+
v-if="enlargeDialogVisible"
59+
v-model="enlargeDialogVisible"
60+
fullscreen
61+
:show-close="false"
62+
class="chart-fullscreen-dialog-view"
63+
header-class="chart-fullscreen-dialog-header-view"
64+
body-class="chart-fullscreen-dialog-body-view"
65+
>
66+
<div style="position: absolute; right: 15px; top: 15px; cursor: pointer">
67+
<el-tooltip effect="dark" :content="t('dashboard.exit_preview')" placement="top">
68+
<el-button
69+
class="tool-btn"
70+
style="width: 26px"
71+
text
72+
@click="() => (enlargeDialogVisible = false)"
73+
>
74+
<el-icon size="16">
75+
<icon_window_mini_outlined />
76+
</el-icon>
77+
</el-button>
78+
</el-tooltip>
79+
</div>
80+
<SqViewDisplay :view-info="viewInfo" :outer-id="'enlarge-' + viewInfo.id" />
81+
</el-dialog>
4382
</div>
4483
</template>
4584

85+
<style lang="less">
86+
.chart-fullscreen-dialog-view {
87+
padding: 0;
88+
}
89+
.chart-fullscreen-dialog-header-view {
90+
display: none;
91+
}
92+
.chart-fullscreen-dialog-body-view {
93+
padding: 0;
94+
height: 100%;
95+
}
96+
</style>
97+
4698
<style scoped lang="less">
4799
.chart-base-container {
48100
width: 100%;
49101
height: 100%;
50102
background: #fff;
51103
padding: 12px !important;
104+
border-radius: 12px;
52105
.header-bar {
53106
height: 32px;
54107
display: flex;

frontend/src/views/dashboard/css/CanvasStyle.less

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
height: 100px;
2525
background-color: #fff;
2626
cursor: move;
27+
border-radius: 12px;
2728
.resizeHandle {
2829
position: absolute;
2930
background: #fff;
@@ -56,8 +57,9 @@
5657
z-index: 100;
5758

5859
transition: none;
59-
60+
border-radius: 12px;
6061
opacity: .5;
62+
overflow: hidden;
6163
}
6264

6365
.movingItem {

frontend/src/views/dashboard/preview/SQComponentWrapper.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const viewDemoInnerId = computed(() => 'enlarge-inner-content-' + configItem.val
5757
.wrapper-outer {
5858
position: absolute;
5959
overflow: hidden;
60+
border-radius: 12px;
6061
.wrapper-inner {
6162
width: 100%;
6263
height: 100%;

0 commit comments

Comments
 (0)