gongchunyi
5 小时以前 df7b96871d485eb1e0146eabe0e61277be8c7853
src/views/reportAnalysis/productionAnalysis/components/right-bottom.vue
@@ -73,7 +73,7 @@
  formatter(params) {
    let result = params[0].axisValueLabel + '<br/>'
    params.forEach((item) => {
      result += `<div>${item.marker} ${item.seriesName}: ${item.value} 元</div>`
      result += `<div>${item.marker} ${item.seriesName}: ${item.value} 件</div>`
    })
    return result
  },
@@ -83,7 +83,7 @@
  { type: 'category', axisTick: { show: false }, axisLabel: { color: '#B8C8E0' }, data: [] },
])
const yAxis1 = [
  { type: 'value', name: '单位: 元', axisLabel: { color: '#B8C8E0' }, nameTextStyle: { color: '#B8C8E0' }, splitLine: { lineStyle: { color: 'rgba(184, 200, 224, 0.2)' } } },
  { type: 'value', name: '单位: 件', axisLabel: { color: '#B8C8E0' }, nameTextStyle: { color: '#B8C8E0' }, splitLine: { lineStyle: { color: 'rgba(184, 200, 224, 0.2)' } } },
]
const handleDateTypeChange = () => {
@@ -93,10 +93,13 @@
const fetchData = () => {
  productionAccountingAnalysis({ dateType: dateType.value })
    .then((res) => {
      if (res.code !== 200 || !Array.isArray(res.data)) return
      const items = res.data
      xAxis1.value[0].data = items.map((d) => d.name)
      chartSeries.value[0].data = items.map((d) => parseFloat(d.value) || 0)
      if (res.code !== 200) return
      const items = Array.isArray(res.data) ? res.data : []
      // 兼容字段:有的接口返回 dateStr,有的返回 date
      xAxis1.value[0].data = items.map((d) => d.dateStr ?? d.date ?? '')
      chartSeries.value[0].data = items.map((d) => parseFloat(d.numberOfCompleted) || 0)
    })
    .catch((err) => {
      console.error('获取生产核算分析失败:', err)