gongchunyi
2026-08-12 0e6db4c630d8db3eacb4aef7abd142be78f9028a
src/views/reportAnalysis/PSIDataAnalysis/components/center-top.vue
@@ -24,7 +24,7 @@
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { ref, onMounted, inject, watch } from 'vue'
import { salesPurchaseStorageProductCount } from '@/api/viewIndex.js'
const statItems = ref([])
@@ -36,12 +36,15 @@
const compareClass = (val) => (val >= 0 ? 'compare-up' : 'compare-down')
const dateRange = inject('psiDateRange', null)
const fetchData = () => {
  salesPurchaseStorageProductCount()
  const params = dateRange?.value || {}
  salesPurchaseStorageProductCount(params.startDate, params.endDate)
    .then((res) => {
      if (res.code === 200 && Array.isArray(res.data)) {
        statItems.value = res.data.map((item) => ({
          name: item.name,
          name: item.name === '销售产品数' ? '销售订单数' : item.name,
          value: item.value,
          rate: item.rate,
        }))
@@ -52,6 +55,13 @@
    })
}
const dataDashboardRefreshTick = inject('dataDashboardRefreshTick', null)
if (dataDashboardRefreshTick) {
  watch(dataDashboardRefreshTick, () => {
    fetchData()
  })
}
onMounted(() => {
  fetchData()
})