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 props = defineProps({
componentName: propTypes.string.def('DashboardEditor')
componentName: propTypes.string.def('Iframe')
})
const currentComponent = shallowRef()

View File

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

View File

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

View File

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