zhangwencui
5 天以前 766ce6b9beedcc89ee83fe5daed0523bbd8c7e33
src/views/procurementManagement/procurementReport/index.vue
@@ -73,12 +73,14 @@
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue'
import { ref, reactive, onMounted, getCurrentInstance } from 'vue'
import { ElMessage } from 'element-plus'
import { Download } from '@element-plus/icons-vue'
import PIMTable from '@/components/PIMTable/PIMTable.vue'
import { procurementBusinessSummaryListPage } from '@/api/procurementManagement/procurementReport'
import { productTreeList } from '@/api/basicData/product'
const { proxy } = getCurrentInstance()
// 响应式数据
const loading = ref(false)
@@ -95,8 +97,7 @@
// 统计数据
const businessSummaryStats = ref({
  totalAmount: 0,
  productTypes: 0,
  supplierCount: 0
  productTypes: 0
})
// 表格列配置(根据后端字段定义)
@@ -104,12 +105,10 @@
  {
    label: '产品大类',
    prop: 'productCategory',
    width: 150,
  },
  {
    label: '规格型号',
    prop: 'specificationModel',
    width: 180
  },
  {
    label: '采购数量',
@@ -122,7 +121,6 @@
  {
    label: '采购金额',
    prop: 'purchaseAmount',
    width: 140,
    formatData: (val) => {
      return val ? `¥${parseFloat(val).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : '¥0.00'
    }
@@ -143,7 +141,6 @@
  {
    label: '供应商名称',
    prop: 'supplierName',
    width: 200
  },
  {
    label: '录入日期',
@@ -243,12 +240,10 @@
          return sum + (parseFloat(item.purchaseAmount) || 0)
        }, 0)
        businessSummaryStats.value.productTypes = new Set(businessSummaryData.value.map(item => item.productCategory)).size
        businessSummaryStats.value.supplierCount = new Set(businessSummaryData.value.map(item => item.supplierName).filter(Boolean)).size
      } else {
        businessSummaryStats.value = {
          totalAmount: 0,
          productTypes: 0,
          supplierCount: 0
          productTypes: 0
        }
      }
    }
@@ -276,7 +271,23 @@
}
const exportReport = () => {
  ElMessage.success('导出功能开发中...')
  const params = {}
  // 时间范围
  if (searchForm.dateRange && searchForm.dateRange.length === 2) {
    params.entryDateStart = searchForm.dateRange[0]
    params.entryDateEnd = searchForm.dateRange[1]
  }
  // 产品类别
  if (searchForm.productCategory) {
    const categoryName = findNodeLabelById(productOptions.value, searchForm.productCategory)
    if (categoryName) {
      params.productCategory = categoryName
    }
  }
  proxy.download("/procurementBusinessSummary/export", params, "采购业务汇总表.xlsx")
}