dengzedong
2025-06-06 2476a19dc152a7a048441be5402796a47504de1b
src/views/model/sche/suggest/suggestSnapshot.vue
@@ -40,19 +40,20 @@
  const loading = ref(false)
  const open = async (id: string) => {
  const open = async (suggestId: string) => {
    visible.value = true
    await getDataList(id)
    await getDataList(suggestId)
  }
  defineExpose({ open })
  /** 获取数据列表 */
  const getDataList = async (id: string) => {
  const getDataList = async (suggestId: string) => {
    try {
      const res = await suggestSnapshotApi.getList(id)
      const res = await suggestSnapshotApi.getList(suggestId)
      dataList.value = res
      selectedData.value = [] // 清空已选项
      refreshCharts()
    } catch (error) {
      console.error(error)
      message.error('获取数据列表失败')
@@ -112,6 +113,64 @@
      if (!chartInfo) return chart
      const markLineData = [
          {
            yAxis: chartInfo.data?.limitH, // 上限
            label: {
              show: true,
              formatter: '上限',
              position: 'insideStartTop',
              color: '#FF9A3D'
            },
            lineStyle: {
              color: '#FF9A3D',
              type: 'dashed'
            },
          },
          {
            yAxis: chartInfo.data?.limitL, // 下限
            label: {
              show: true,
              formatter: '下限',
              position: 'insideStartBottom',
              color: '#00C2FF'
            },
            lineStyle: {
              color: '#00C2FF',
              type: 'dashed'
            },
          },
          {
            xAxis: chartInfo.data?.scheduleTime || 0, // 真实数据分割线
            label: {
              show: true,
              formatter: '预测时间',
              position: 'end',
              color: '#5DFF9E'
            },
            lineStyle: {
              color: '#5DFF9E',
            },
          }
        ]
      // 冲顶触底时间
      if (chartInfo.data?.overLimitTimes?.length > 0) {
        chartInfo.data?.overLimitTimes.forEach(overLimitTime => {
          markLineData.push({
            xAxis: overLimitTime, // 真实数据分割线
            label: {
              show: false,
              formatter: '预测时间',
              position: 'end',
              color: '#5DFF9E'
            },
            lineStyle: {
              color: '#ff0000',
            },
          })
        })
      }
      const option = {
        title: {
          text: chartInfo.name,
@@ -125,13 +184,26 @@
        series: [{
          type: 'line',
          data: chartInfo.data?.dataList || [],
          lineStyle: { color: '#5B8FF9', width: 1 }
          lineStyle: { color: '#5B8FF9', width: 1 },
          markLine: {
            silent: true,
            symbol: ['none', 'none'],
            lineStyle: {
              type: 'solid',
              width: 1,
              color: '#95E6FF',
            },
            label: {
              show: false,
            },
            data: markLineData,
          },
        }]
      }
      chart.setOption(option)
      return chart
    }).filter(Boolean) as echarts.ECharts[]
    })
  }
</script>