| | |
| | | <template> |
| | | <div> |
| | | <PanelHeader title="工序产出分析" /> |
| | | <PanelHeader title="工序产出分析" to="/productionManagement/processStatistics" /> |
| | | <div class="main-panel panel-item-customers"> |
| | | <div class="filters-row"> |
| | | <DateTypeSwitch v-model="dateType" @change="handleDateTypeChange" /> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, onMounted, onBeforeUnmount, computed } from 'vue' |
| | | import { ref, onMounted, onBeforeUnmount, computed, inject, watch } from 'vue' |
| | | import { processOutputAnalysis } from '@/api/viewIndex.js' |
| | | import PanelHeader from './PanelHeader.vue' |
| | | import Echarts from '@/components/Echarts/echarts.vue' |
| | |
| | | const pieWrapperRef = ref(null) |
| | | const pieBackgroundRef = ref(null) |
| | | |
| | | const dateType = ref(1) // 1=周 2=月 3=季度 |
| | | const dateType = ref(3) // 1=周 2=月 3=季度 |
| | | |
| | | function array2obj(array, key) { |
| | | const resObj = {} |
| | |
| | | icon: 'circle', |
| | | textStyle: { |
| | | fontSize: 18, |
| | | color: pieColors[idx % pieColors.length], |
| | | color: d.color || pieColors[idx % pieColors.length], |
| | | }, |
| | | })) |
| | | |
| | |
| | | .then((res) => { |
| | | if (res.code === 200 && Array.isArray(res.data)) { |
| | | const items = res.data |
| | | pieDatas.value = items.map((item) => ({ |
| | | name: item.name, |
| | | value: parseFloat(item.value) || 0, |
| | | rate: item.rate, |
| | | })) |
| | | pieDatas.value = items.map((item) => { |
| | | const point = { |
| | | name: item.name, |
| | | value: parseFloat(item.value) || 0, |
| | | rate: item.rate, |
| | | } |
| | | if (item.color) { |
| | | point.color = item.color |
| | | point.itemStyle = { color: item.color } |
| | | } |
| | | return point |
| | | }) |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | |
| | | |
| | | const handleDateTypeChange = () => { |
| | | fetchData() |
| | | } |
| | | |
| | | const dataDashboardRefreshTick = inject('dataDashboardRefreshTick', null) |
| | | if (dataDashboardRefreshTick) { |
| | | watch(dataDashboardRefreshTick, () => { |
| | | fetchData() |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | |
| | | |
| | | .panel-item-customers { |
| | | border: 1px solid #1a58b0; |
| | | border-radius: 16px; |
| | | padding: 18px; |
| | | width: 100%; |
| | | height: 449px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .filters-row { |