22import type { ChatMessage } from ' @/api/chat.ts'
33import DisplayChartBlock from ' @/views/chat/component/DisplayChartBlock.vue'
44import ChartPopover from ' @/views/chat/chat-block/ChartPopover.vue'
5- import { computed , ref } from ' vue'
5+ import { computed , ref , watch } from ' vue'
66import { concat } from ' lodash-es'
77import type { ChartTypes } from ' @/views/chat/component/BaseChart.ts'
88import ICON_BAR from ' @/assets/svg/chart/icon_bar_outlined.svg'
@@ -246,6 +246,7 @@ function exportToExcel() {
246246 })
247247 exportRef .value ?.hide ()
248248}
249+
249250function exportToImage() {
250251 const obj = document .getElementById (' chart-component-' + chartId .value )
251252 if (obj ) {
@@ -265,6 +266,15 @@ function exportToImage() {
265266 }
266267 exportRef .value ?.hide ()
267268}
269+
270+ watch (
271+ () => chartObject .value .type ,
272+ (val ) => {
273+ if (val ) {
274+ currentChartType .value = val
275+ }
276+ }
277+ )
268278 </script >
269279
270280<template >
@@ -316,7 +326,7 @@ function exportToImage() {
316326 </el-button >
317327 </el-tooltip >
318328 </div >
319- <div >
329+ <div v-if = " message?.record?.sql && data.length > 0 && message?.record?.chart " >
320330 <el-popover
321331 ref =" exportRef"
322332 trigger =" click"
@@ -357,7 +367,7 @@ function exportToImage() {
357367 </div >
358368 </el-popover >
359369 </div >
360- <div >
370+ <div v-if = " message?.record?.sql && data.length > 0 && message?.record?.chart " >
361371 <el-tooltip effect =" dark" :content =" t('chat.add_to_dashboard')" placement =" top" >
362372 <el-button class =" tool-btn" text @click =" addToDashboard" >
363373 <el-icon size =" 16" >
@@ -445,12 +455,15 @@ function exportToImage() {
445455.chart-fullscreen-dialog {
446456 padding : 0 ;
447457}
458+
448459.chart-fullscreen-dialog-header {
449460 display : none ;
450461}
462+
451463.chart-fullscreen-dialog-body {
452464 padding : 0 ;
453465}
466+
454467.chart-sql-drawer-body {
455468 padding : 24px ;
456469}
@@ -478,6 +491,7 @@ function exportToImage() {
478491 color : #8f959e ;
479492 }
480493 }
494+
481495 .popover-item {
482496 height : 32px ;
483497 display : flex ;
@@ -488,9 +502,11 @@ function exportToImage() {
488502 position : relative ;
489503 border-radius : 4px ;
490504 cursor : pointer ;
505+
491506 & :last-child {
492507 margin-bottom : 0 ;
493508 }
509+
494510 & :hover {
495511 background : #1f23291a ;
496512 }
@@ -575,6 +591,7 @@ function exportToImage() {
575591 & :hover {
576592 background : rgba (31 , 35 , 41 , 0.1 );
577593 }
594+
578595 & :active {
579596 background : rgba (31 , 35 , 41 , 0.1 );
580597 }
@@ -588,12 +605,15 @@ function exportToImage() {
588605 :deep(.ed-select__wrapper ) {
589606 background : transparent ;
590607 }
608+
591609 :deep(.ed-select__input ) {
592610 color : rgba (28 , 186 , 144 , 1 );
593611 }
612+
594613 :deep(.ed-select__placeholder ) {
595614 color : rgba (28 , 186 , 144 , 1 );
596615 }
616+
597617 :deep(.ed-select__caret ) {
598618 color : rgba (28 , 186 , 144 , 1 );
599619 }
@@ -648,10 +668,12 @@ function exportToImage() {
648668 & :hover {
649669 background : rgba (31 , 35 , 41 , 0.1 );
650670 }
671+
651672 & :active {
652673 background : rgba (31 , 35 , 41 , 0.1 );
653674 }
654675 }
676+
655677 :deep(.ed-select__caret ) {
656678 font-size : 12px !important ;
657679 }
@@ -681,6 +703,7 @@ function exportToImage() {
681703
682704 border-color : #dee0e3 ;
683705 box-shadow : 0px 4px 8px 0px #1f23291a ;
706+
684707 & :hover ,
685708 & :focus {
686709 color : #1cba90 ;
@@ -690,6 +713,7 @@ function exportToImage() {
690713 color : #189e7a ;
691714 }
692715 }
716+
693717 & :hover {
694718 .input-icon {
695719 display : flex ;
0 commit comments