wujingjing
2024-09-25 ea53838c8ba303cea39b23732f245efde987822c
默认 chartType
已修改3个文件
27 ■■■■■ 文件已修改
src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chat/chatComponents/summaryCom/components/recordSet/types.ts 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chat/chatComponents/types.ts 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue
@@ -45,7 +45,6 @@
import { ChartTypeEnum } from '../../../types';
const chartRef = ref<HTMLDivElement>(null);
const defaultDisplayType = 'line';
const yRange = ref({
    min: null as number,
    max: null as number,
@@ -117,8 +116,7 @@
let preData = null;
let activeChartType: ChartTypeEnum = ChartTypeEnum.Line;
let activeChartType: ChartTypeEnum = props.data.chart_type ?? ChartTypeEnum.Line;
const getChartTypeSeriesOption = (type: ChartTypeEnum) => {
    let result = {};
    switch (type) {
@@ -161,9 +159,7 @@
            return {
                name: item === 'default' ? '' : item,
                data: values.map((item) => [item[timeIndex], item[valueIndex]]),
                type: defaultDisplayType,
                symbol: 'none',
                smooth: true,
                ...getChartTypeSeriesOption(activeChartType)
            };
        });
    }
src/components/chat/chatComponents/summaryCom/components/recordSet/types.ts
@@ -1,6 +1,7 @@
import List from './components/List.vue';
import Timestamp from './components/Timestamp.vue';
import TimeRange from './components/TimeRange.vue';
import { ChartTypeEnum } from '../../../types';
export const enum RecordSetParamsType {
    List = 'list',
@@ -37,10 +38,7 @@
} & BaseParam;
//#endregion
//#region ====================== 整合 start 和 end,得到前端格式 ======================
export  type  TimeRangeParamValue = [
    string,
    string
]
export type TimeRangeParamValue = [string, string];
export type TimeRangeParam = {
    type: RecordSetParamsType.TimeRange;
    value: TimeRangeParamValue;
@@ -50,15 +48,15 @@
} & BaseParam;
//#endregion
export type RecordSetParamsItem = ListParam | TimeRangeParam | TimeRangeBackEndParam;
export type RecordSet = {
    params?: RecordSetParamsItem[];
    chartType?: ChartTypeEnum;
} & Record<string, any>;
export const recordSetMapCom = {
    [RecordSetParamsType.List]: List,
    [RecordSetParamsType.TimeRange]: TimeRange,
    [RecordSetParamsType.StartTime]:Timestamp,
    [RecordSetParamsType.EndTime]:Timestamp
    [RecordSetParamsType.StartTime]: Timestamp,
    [RecordSetParamsType.EndTime]: Timestamp,
};
src/components/chat/chatComponents/types.ts
@@ -1,8 +1,7 @@
export const enum ChartTypeEnum {
    Scatter,
    Line,
    Bar,
    Scatter = 'scatter',
    Line = 'line',
    Bar = 'bar',
}
export const chartTypeMapName = {