Merge pull request #10922 from dataease/pr@dev-v2_st

fix(系统设置): Copilot滚动区域不合理
This commit is contained in:
dataeaseShu 2024-07-12 11:52:11 +08:00 committed by GitHub
commit 62ebd0c896
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 42 additions and 27 deletions

View File

@ -26,7 +26,7 @@ const DashboardPanel = defineAsyncComponent(
const Preview = defineAsyncComponent(() => import('@/views/data-visualization/PreviewCanvas.vue')) const Preview = defineAsyncComponent(() => import('@/views/data-visualization/PreviewCanvas.vue'))
const props = defineProps({ const props = defineProps({
componentName: propTypes.string.def('DashboardEditor') componentName: propTypes.string.def('Iframe')
}) })
const currentComponent = shallowRef() const currentComponent = shallowRef()

View File

@ -48,8 +48,8 @@ onMounted(() => {
const chartType = chart.type === 'bar' ? Column : Line const chartType = chart.type === 'bar' ? Column : Line
columnPlot = new chartType(`de-${id}-ed`, { columnPlot = new chartType(`de-${id}-ed`, {
data: chartData.data.data, data: chartData.data.data,
xField: chart.axis?.x, xField: chart.axis?.x?.value,
yField: chart.axis?.y, yField: chart.axis?.y?.value,
legend: { legend: {
layout: 'horizontal', layout: 'horizontal',
position: 'left' position: 'left'
@ -61,17 +61,17 @@ onMounted(() => {
columnPlot = new Pie(`de-${id}-ed`, { columnPlot = new Pie(`de-${id}-ed`, {
appendPadding: 10, appendPadding: 10,
data: chartData.data.data, data: chartData.data.data,
angleField: chart.axis?.y, angleField: chart.axis?.y?.value,
colorField: chart.axis?.x, colorField: chart.axis?.x?.value,
radius: 0.9, radius: 0.9,
interactions: [{ type: 'element-active' }] interactions: [{ type: 'element-active' }]
}) })
columnPlot.render() columnPlot.render()
} else { } else {
columns.value = chartData.data.fields.map(_ => ({ columns.value = chart.columns.map(_ => ({
key: `${_.originName}`, key: `${_.value}`,
dataKey: `${_.originName}`, dataKey: `${_.value}`,
title: `${_.originName}`, title: `${_.name}`,
width: 150 width: 150
})) }))
@ -97,10 +97,10 @@ const exportExcel = () => {
const workbook = new ExcelJS.Workbook() const workbook = new ExcelJS.Workbook()
const worksheet = workbook.addWorksheet('Sheet1') const worksheet = workbook.addWorksheet('Sheet1')
// //
worksheet.columns = chartData.data.fields.map(ele => { worksheet.columns = chart.columns.map(ele => {
return { header: ele.originName, key: ele.originName } return { header: ele.name, key: ele.value }
}) })
const arr = chartData.data.fields.map(ele => ele.originName) const arr = chart.columns.map(ele => ele.value)
chartData.data.data.forEach(item => { chartData.data.data.forEach(item => {
worksheet.addRow(arr.map(ele => item[ele])) worksheet.addRow(arr.map(ele => item[ele]))
}) })
@ -142,8 +142,8 @@ const switchChartType = type => {
const chartType = type === 'bar' ? Column : Line const chartType = type === 'bar' ? Column : Line
const columnPlot = new chartType(`de-${id}-ed`, { const columnPlot = new chartType(`de-${id}-ed`, {
data: chartData.data.data, data: chartData.data.data,
xField: chart.axis?.x, xField: chart.axis?.x?.value,
yField: chart.axis?.y, yField: chart.axis?.y?.value,
legend: { legend: {
layout: 'horizontal', layout: 'horizontal',
position: 'left' position: 'left'
@ -157,8 +157,8 @@ const switchChartType = type => {
columnPlot = new Pie(`de-${id}-ed`, { columnPlot = new Pie(`de-${id}-ed`, {
appendPadding: 10, appendPadding: 10,
data: chartData.data.data, data: chartData.data.data,
angleField: chart.axis?.y, angleField: chart.axis?.y?.value,
colorField: chart.axis?.x, colorField: chart.axis?.x?.value,
radius: 0.9, radius: 0.9,
interactions: [{ type: 'element-active' }] interactions: [{ type: 'element-active' }]
}) })
@ -166,10 +166,10 @@ const switchChartType = type => {
return return
} }
columns.value = chartData.data.fields.map(_ => ({ columns.value = chart.columns.map(_ => ({
key: `${_.originName}`, key: `${_.value}`,
dataKey: `${_.originName}`, dataKey: `${_.value}`,
title: `${_.originName}`, title: `${_.name}`,
width: 150 width: 150
})) }))
@ -411,7 +411,7 @@ const tips = computed(() => {
margin-left: 8px; margin-left: 8px;
border-radius: 8px; border-radius: 8px;
.question-or-title { .question-or-title {
font-family: PingFang SC; font-family: '阿里巴巴普惠体 3.0 55 Regular L3';
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
line-height: 22px; line-height: 22px;
@ -445,7 +445,7 @@ const tips = computed(() => {
} }
.is-welcome { .is-welcome {
font-family: PingFang SC; font-family: '阿里巴巴普惠体 3.0 55 Regular L3';
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
line-height: 22px; line-height: 22px;

View File

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef, computed, watch } from 'vue' import { ref, shallowRef, computed, watch, onBeforeUnmount } from 'vue'
import { ElMessageBox } from 'element-plus-secondary' import { ElMessageBox } from 'element-plus-secondary'
import { import {
getDatasetTree, getDatasetTree,
@ -63,7 +63,7 @@ let oldId = ''
let currentId = '' let currentId = ''
let oldName = '' let oldName = ''
const handleDatasetChange = () => { const handleDatasetChange = () => {
if (!!oldId) { if (!!oldId && !!historyArr.value.length) {
currentId = datasetId.value currentId = datasetId.value
datasetId.value = oldId datasetId.value = oldId
const msg = `当前数据集为【${oldName}】,切换数据集将清空当前会话。` const msg = `当前数据集为【${oldName}】,切换数据集将清空当前会话。`
@ -115,8 +115,16 @@ watch(
} }
) )
const copilotChatLoading = ref(false) const copilotChatLoading = ref(false)
const inputRef = ref()
let time = null
const queryAnswer = () => { const queryAnswer = () => {
let copyAuestionInput = questionInput.value
if (!isActive.value || copilotChatLoading.value) return if (!isActive.value || copilotChatLoading.value) return
clearTimeout(time)
time = setTimeout(() => {
questionInput.value = copyAuestionInput
inputRef.value.blur()
}, 0)
historyArr.value.push({ historyArr.value.push({
msgType: 'user', msgType: 'user',
chart: {}, chart: {},
@ -142,6 +150,9 @@ const queryAnswer = () => {
copilotChatLoading.value = false copilotChatLoading.value = false
}) })
} }
onBeforeUnmount(() => {
clearTimeout(time)
})
</script> </script>
<template> <template>
@ -162,6 +173,9 @@ const queryAnswer = () => {
<div class="question-input" :class="overHeight && 'over-height'" ref="questionInputRef"> <div class="question-input" :class="overHeight && 'over-height'" ref="questionInputRef">
<el-input <el-input
v-model="questionInput" v-model="questionInput"
@keydown.stop
ref="inputRef"
@keydown.enter="queryAnswer"
:autosize="{ minRows: 1, maxRows: 8 }" :autosize="{ minRows: 1, maxRows: 8 }"
type="textarea" type="textarea"
:placeholder="$t('common.inputText')" :placeholder="$t('common.inputText')"
@ -284,6 +298,7 @@ const queryAnswer = () => {
padding: 16px 24px; padding: 16px 24px;
display: flex; display: flex;
align-items: center; align-items: center;
font-weight: 500;
border-bottom: 1px solid #1f232926; border-bottom: 1px solid #1f232926;
} }
@ -294,9 +309,9 @@ const queryAnswer = () => {
overflow-y: auto; overflow-y: auto;
.dialogue { .dialogue {
flex: 1; flex: 1;
padding: 0 160px;
position: relative; position: relative;
.copilot-dialogue { .copilot-dialogue {
padding: 0 160px;
padding-top: 24px; padding-top: 24px;
position: relative; position: relative;
overflow-y: auto; overflow-y: auto;
@ -440,7 +455,7 @@ const queryAnswer = () => {
.title-dataset_select { .title-dataset_select {
width: 100%; width: 100%;
margin: 16px 16px 12px 16px; margin: 16px 16px 12px 16px;
font-family: PingFang SC; font-family: '阿里巴巴普惠体 3.0 55 Regular L3';
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
line-height: 22px; line-height: 22px;

View File

@ -374,7 +374,7 @@ onMounted(() => {
display: flex; display: flex;
align-items: center; align-items: center;
color: #1f2329; color: #1f2329;
font-family: PingFang SC; font-family: '阿里巴巴普惠体 3.0 55 Regular L3';
font-weight: 500; font-weight: 500;
font-size: 14px; font-size: 14px;
.ticket-title { .ticket-title {