Skip to content

Commit 21789e0

Browse files
committed
feat: Charts can be directly added to the dashboard
1 parent bc9576d commit 21789e0

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

frontend/src/views/chat/chat-block/ChartBlock.vue

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import icon_sql_outlined from '@/assets/svg/icon_sql_outlined.svg'
1515
import icon_export_outlined from '@/assets/svg/icon_export_outlined.svg'
1616
import icon_file_image_colorful from '@/assets/svg/icon_file-image_colorful.svg'
1717
import icon_file_excel_colorful from '@/assets/svg/icon_file-excel_colorful.svg'
18-
// import icon_into_item_outlined from '@/assets/svg/icon_into-item_outlined.svg'
18+
import icon_into_item_outlined from '@/assets/svg/icon_into-item_outlined.svg'
1919
import icon_window_max_outlined from '@/assets/svg/icon_window-max_outlined.svg'
2020
import icon_window_mini_outlined from '@/assets/svg/icon_window-mini_outlined.svg'
2121
import icon_copy_outlined from '@/assets/svg/icon_copy_outlined.svg'
@@ -205,27 +205,27 @@ function showSql() {
205205
sqlShow.value = true
206206
}
207207
208-
// function addToDashboard() {
209-
// const recordeInfo = {
210-
// id: '1-1',
211-
// data: {
212-
// data: data.value,
213-
// },
214-
// chart: {},
215-
// }
216-
// // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
217-
// const chartBaseInfo = JSON.parse(props.message?.record?.chart)
218-
// recordeInfo['chart'] = {
219-
// type: chartBaseInfo.type,
220-
// title: chartBaseInfo.title,
221-
// columns: chartBaseInfo.columns,
222-
// xAxis: chartBaseInfo.axis?.x ? [chartBaseInfo.axis.x] : [],
223-
// yAxis: chartBaseInfo.axis?.y ? [chartBaseInfo.axis.y] : [],
224-
// series: chartBaseInfo.axis?.series ? [chartBaseInfo.axis.series] : [],
225-
// }
226-
// // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
227-
// addViewRef.value?.optInit(recordeInfo)
228-
// }
208+
function addToDashboard() {
209+
const recordeInfo = {
210+
id: '1-1',
211+
data: {
212+
data: data.value,
213+
},
214+
chart: {},
215+
}
216+
// @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
217+
const chartBaseInfo = JSON.parse(props.message?.record?.chart)
218+
recordeInfo['chart'] = {
219+
type: chartBaseInfo.type,
220+
title: chartBaseInfo.title,
221+
columns: chartBaseInfo.columns,
222+
xAxis: chartBaseInfo.axis?.x ? [chartBaseInfo.axis.x] : [],
223+
yAxis: chartBaseInfo.axis?.y ? [chartBaseInfo.axis.y] : [],
224+
series: chartBaseInfo.axis?.series ? [chartBaseInfo.axis.series] : [],
225+
}
226+
// @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
227+
addViewRef.value?.optInit(recordeInfo)
228+
}
229229
230230
function copyText() {
231231
if (props.message?.record?.sql) {
@@ -395,15 +395,15 @@ watch(
395395
</div>
396396
</el-popover>
397397
</div>
398-
<!-- <div v-if="message?.record?.chart">
398+
<div v-if="message?.record?.chart">
399399
<el-tooltip effect="dark" :content="t('chat.add_to_dashboard')" placement="top">
400400
<el-button class="tool-btn" text @click="addToDashboard">
401401
<el-icon size="16">
402402
<icon_into_item_outlined />
403403
</el-icon>
404404
</el-button>
405405
</el-tooltip>
406-
</div> -->
406+
</div>
407407
<div class="divider" />
408408
<div v-if="!enlarge">
409409
<el-tooltip

0 commit comments

Comments
 (0)