From 00ec5af9784585ebc2dab13d56c0bfedc8693fee Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 05 二月 2026 11:58:21 +0800
Subject: [PATCH] fix: 生产核算分析修改对接接口
---
src/views/reportAnalysis/productionAnalysis/components/right-bottom.vue | 137 +++++++++++++++++++++------------------------
1 files changed, 64 insertions(+), 73 deletions(-)
diff --git a/src/views/reportAnalysis/productionAnalysis/components/right-bottom.vue b/src/views/reportAnalysis/productionAnalysis/components/right-bottom.vue
index 8ecd507..b8a289f 100644
--- a/src/views/reportAnalysis/productionAnalysis/components/right-bottom.vue
+++ b/src/views/reportAnalysis/productionAnalysis/components/right-bottom.vue
@@ -5,18 +5,9 @@
<div class="filters-row">
<DateTypeSwitch v-model="dateType" @change="handleDateTypeChange" />
</div>
- <Echarts
- ref="chart"
- :chartStyle="chartStyle"
- :grid="grid"
- :legend="barLegend"
- :series="chartSeries"
- :tooltip="tooltip"
- :xAxis="xAxis1"
- :yAxis="yAxis1"
- :options="{ backgroundColor: 'transparent', textStyle: { color: '#B8C8E0' } }"
- style="height: 260px"
- />
+ <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="barLegend" :series="chartSeries"
+ :tooltip="tooltip" :xAxis="xAxis1" :yAxis="yAxis1"
+ :options="{ backgroundColor: 'transparent', textStyle: { color: '#B8C8E0' } }" style="height: 320px" />
</div>
</div>
</template>
@@ -28,81 +19,88 @@
import DateTypeSwitch from './DateTypeSwitch.vue'
import Echarts from '@/components/Echarts/echarts.vue'
-const dateType = ref(1) // 1=鍛� 2=鏈� 3=瀛e害
+const dateType = ref(1)
-const chartStyle = {
- width: '100%',
- height: '140%',
-}
-
-const grid = { left: '10%', right: '4%', bottom: '3%', top: '10%', containLabel: true }
+const chartStyle = { width: '100%', height: '100%' }
+const grid = { left: '3%', right: '4%', bottom: '3%', top: '15%', containLabel: true }
const barLegend = {
show: true,
textStyle: { color: '#B8C8E0' },
- data: ['鐢熶骇鏍哥畻'],
+ data: ['瀹屾垚鏁伴噺', '宸ヨ祫閲戦', '鍚堟牸鐜�'],
+ top: '0%'
}
-// 鏌辩姸鍥撅細鐢熶骇鏍哥畻
+// 鍒濆鍖� series 缁撴瀯
const chartSeries = ref([
{
- name: '鐢熶骇鏍哥畻',
+ name: '瀹屾垚鏁伴噺',
type: 'bar',
- barWidth: 30,
- emphasis: { focus: 'series' },
- itemStyle: {
- color: {
- type: 'linear',
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- colorStops: [
- { offset: 1, color: 'rgba(0, 164, 237, 0)' },
- { offset: 0, color: 'rgba(78, 228, 255, 1)' },
- ],
- },
- },
- data: [],
+ barWidth: 15,
+ itemStyle: { color: '#4EE4FF' },
+ data: []
},
+ {
+ name: '宸ヨ祫閲戦',
+ type: 'bar',
+ barWidth: 15,
+ itemStyle: { color: '#00A4ED' },
+ data: []
+ },
+ {
+ name: '鍚堟牸鐜�',
+ type: 'line',
+ yAxisIndex: 1,
+ smooth: true,
+ itemStyle: { color: '#FFD339' },
+ data: []
+ }
])
+
+const xAxis1 = ref([
+ { type: 'category', axisTick: { show: false }, axisLabel: { color: '#B8C8E0' }, data: [] }
+])
+
+const yAxis1 = [
+ { type: 'value', name: '鏁伴噺/閲戦', axisLabel: { color: '#B8C8E0' }, splitLine: { lineStyle: { color: 'rgba(184, 200, 224, 0.2)' } } },
+ { type: 'value', name: '鍚堟牸鐜�(%)', max: 100, axisLabel: { formatter: '{value}%', color: '#B8C8E0' }, splitLine: { show: false } }
+]
const tooltip = {
trigger: 'axis',
- axisPointer: { type: 'cross' },
+ axisPointer: { type: 'shadow' },
formatter(params) {
- let result = params[0].axisValueLabel + '<br/>'
- params.forEach((item) => {
- result += `<div>${item.marker} ${item.seriesName}: ${item.value} 鍏�</div>`
+ let res = params[0].axisValueLabel + '<br/>'
+ params.forEach(item => {
+ const unit = item.seriesName === '鍚堟牸鐜�' ? '%' : (item.seriesName === '宸ヨ祫閲戦' ? ' 鍏�' : ' 涓�')
+ res += `${item.marker} ${item.seriesName}: ${item.value}${unit}<br/>`
})
- return result
- },
+ return res
+ }
}
-
-const xAxis1 = ref([
- { 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)' } } },
-]
const handleDateTypeChange = () => {
fetchData()
}
const fetchData = () => {
- productionAccountingAnalysis({ dateType: dateType.value })
+ productionAccountingAnalysis({ type: 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 && Array.isArray(res.data)) {
+ const items = res.data
+
+ xAxis1.value[0].data = items.map(item => item.dateStr)
+ chartSeries.value[0].data = items.map(item => Number(item.numberOfCompleted) || 0)
+ chartSeries.value[1].data = items.map(item => Number(item.amount) || 0)
+ chartSeries.value[2].data = items.map(item => Number(item.passRate) || 0)
+
+ console.log('鏇存柊鍚庣殑鏁版嵁:', chartSeries.value)
+ }
})
.catch((err) => {
- console.error('鑾峰彇鐢熶骇鏍哥畻鍒嗘瀽澶辫触:', err)
+ console.error('鏁版嵁鍔犺浇澶辫触', err)
})
}
-
onMounted(() => {
fetchData()
@@ -110,24 +108,17 @@
</script>
<style scoped>
-.main-panel {
- display: flex;
- flex-direction: column;
- gap: 20px;
-}
-
-.filters-row {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- gap: 12px;
- margin-bottom: 10px;
-}
-
.panel-item-customers {
border: 1px solid #1a58b0;
padding: 18px;
width: 100%;
height: 449px;
+ box-sizing: border-box;
}
-</style>
+
+.filters-row {
+ display: flex;
+ justify-content: flex-end;
+ margin-bottom: 10px;
+}
+</style>
\ No newline at end of file
--
Gitblit v1.9.3