+
-
+
@@ -128,141 +131,36 @@ const setOption = (options) => {
const initChart = () => {
const data = toRaw(currentChart.value)
if (data) {
- const { chart_options } = data
- if (chart_options.type == 'line') lineChart(data)
- if (chart_options.type == 'bar') barChart(data)
+ setChart(data)
}
}
-const lineChart = (data) => {
- const { chart_data, chart_options, title } = data
+const setChart = (data) => {
+ const { chart_data, title } = data
+
const xAxis = chart_data.xAxis.list
- const series = chart_data.data.filter((item) => item.list.some((value) => value !== null)).map((e) => {
-
- return {
- name: e.name,
- type: chart_options.type,
- color: chart_options.color,
- smooth: true,
- areaStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(
- 0,
- 0,
- 0,
- 1,
- [
- {
- offset: 0,
- color: hexToRgba(chart_options.color ?? '#ffffff','0.3'),
- },
- {
- offset: 0.8,
- color: hexToRgba(chart_options.color ?? '#ffffff','0'),
- },
- ],
- false
- ),
- shadowColor: 'rgba(54, 98, 254, 0.1)',
- shadowBlur: 10,
- },
- },
- symbol: 'circle',
- symbolSize: 5,
- data: e.list,
- }
- })
+ const series = chart_data.data
+ .filter((item) => item.list.some((value) => value !== null))
+ .map((e) => {
+ const { type } = e
+ if (type == 'line') return lineSeries(e)
+ if (type == 'bar') return barSeries(e)
+ })
setOption({
- grid: {
- left: '2%',
- right: '3%',
- top: '22%',
- bottom: '2%',
- containLabel: true,
- },
- tooltip: {
- trigger: 'axis',
- },
- title: {
- text: title,
- left: '2%',
- top: '3%',
+ legend: {
+ top: '4%',
+ right: '4%',
textStyle: {
color: '#fff',
- fontSize: 18,
- fontWeight: 'bold',
},
},
- xAxis: {
- type: 'category',
- boundaryGap: false,
- data: xAxis,
- axisLabel: {
- color: 'rgba(255, 255, 255, .4)',
- fontSize: 14,
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: 'rgba(65, 69, 72, 1)',
- },
- },
- },
- yAxis: {
- type: 'value',
- name: '单位',
- position: 'left',
- nameTextStyle: {
- color: 'rgba(255, 255, 255, .4)',
- fontSize: 14,
- },
- axisLabel: {
- color: 'rgba(255, 255, 255, .4)',
- fontSize: 14,
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: 'rgba(65, 69, 72, 1)',
- },
- },
- splitLine: {
- lineStyle: {
- type: 'dashed',
- color: 'rgba(255, 255, 255, .4)',
- },
- },
- },
- series: series,
- })
-}
-
-const barChart = (data) => {
- const { chart_data, chart_options, title } = data
-
- const xAxis = chart_data.xAxis.list
-
- const series = chart_data.data.filter((item) => item.list.some((value) => value !== null)).map((e) => {
- return {
- name: e.name,
- type: chart_options.type,
- color: chart_options.color,
- smooth: true,
-
- symbol: 'circle',
- symbolSize: 5,
- data: e.list,
- }
- })
-
- setOption({
grid: {
- left: '2%',
+ left: '4%',
right: '3%',
- top: '22%',
- bottom: '2%',
+ top: '20%',
+ bottom: '5%',
containLabel: true,
},
tooltip: {
@@ -322,12 +220,60 @@ const barChart = (data) => {
})
}
+function lineSeries(e) {
+ const { type, color, list, name } = e
+ return {
+ name: name,
+ type: type,
+ color: color,
+ smooth: true,
+ areaStyle: {
+ normal: {
+ color: new echarts.graphic.LinearGradient(
+ 0,
+ 0,
+ 0,
+ 1,
+ [
+ {
+ offset: 0,
+ color: hexToRgba(color ?? '#ffffff', '0.3'),
+ },
+ {
+ offset: 0.8,
+ color: hexToRgba(color ?? '#ffffff', '0'),
+ },
+ ],
+ false
+ ),
+ shadowColor: 'rgba(54, 98, 254, 0.1)',
+ shadowBlur: 10,
+ },
+ },
+ symbol: 'circle',
+ symbolSize: 5,
+ data: list,
+ }
+}
-function hexToRgba(hexColor,opacity) {
- const hex = hexColor.replace('#', '')
- const r = parseInt(hex.substring(0, 2), 16)
- const g = parseInt(hex.substring(2, 4), 16)
- const b = parseInt(hex.substring(4, 6), 16)
- return `rgba(${r}, ${g}, ${b}, ${opacity})`
+function barSeries(e) {
+ const { type, color, list, name } = e
+ return {
+ name: name,
+ type: type,
+ color: color,
+ smooth: true,
+ symbol: 'circle',
+ symbolSize: 5,
+ data: list,
+ }
+}
+
+function hexToRgba(hexColor, opacity) {
+ const hex = hexColor.replace('#', '')
+ const r = parseInt(hex.substring(0, 2), 16)
+ const g = parseInt(hex.substring(2, 4), 16)
+ const b = parseInt(hex.substring(4, 6), 16)
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`
}
diff --git a/src/views/chat/components/ai-assistant.vue b/src/views/chat/components/ai-assistant.vue
index 236f7cc..9666d8a 100644
--- a/src/views/chat/components/ai-assistant.vue
+++ b/src/views/chat/components/ai-assistant.vue
@@ -277,7 +277,7 @@ const sendMessage = async () => {
{
// prompt: message,
prompt:`"""
- ${content?.substring(0, 3900)}
+ ${props.content?.substring(0, 3900)}
"""
Question: ${message}`
},
diff --git a/src/views/chat/components/message.vue b/src/views/chat/components/message.vue
index 918d4f1..802e298 100644
--- a/src/views/chat/components/message.vue
+++ b/src/views/chat/components/message.vue
@@ -27,6 +27,9 @@
:as-raw-text="asRawText"
/>
+
+
+