| | |
| | | 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.amount) || 0) |
| | | }) |
| | | .catch((err) => { |
| | | console.error('获取生产核算分析失败:', err) |