From db42d47f5692ef64e5436c5a6d29dcb537b44596 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期一, 26 一月 2026 16:36:13 +0800
Subject: [PATCH] 浪潮对接单点登录:mis调整

---
 src/views/procurementManagement/procurementReport/index.vue |  380 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 380 insertions(+), 0 deletions(-)

diff --git a/src/views/procurementManagement/procurementReport/index.vue b/src/views/procurementManagement/procurementReport/index.vue
new file mode 100644
index 0000000..8c8f3f6
--- /dev/null
+++ b/src/views/procurementManagement/procurementReport/index.vue
@@ -0,0 +1,380 @@
+<template>
+  <div class="app-container">
+    <!-- 鏌ヨ鏉′欢 -->
+    <el-form :model="searchForm" :inline="true" class="search-form">
+        <el-form-item label="鏃堕棿鑼冨洿锛�">
+          <el-date-picker
+            v-model="searchForm.dateRange"
+            type="daterange"
+            range-separator="鑷�"
+            start-placeholder="寮�濮嬫棩鏈�"
+            end-placeholder="缁撴潫鏃ユ湡"
+            format="YYYY-MM-DD"
+            value-format="YYYY-MM-DD"
+            style="width: 240px"
+          />
+        </el-form-item>
+        <el-form-item label="浜у搧澶х被锛�">
+          <el-tree-select
+            v-model="searchForm.productCategory"
+            placeholder="璇烽�夋嫨鍟嗗搧绫诲埆"
+            clearable
+            check-strictly
+            :data="productOptions"
+            :render-after-expand="false"
+            style="width: 200px"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="handleSearch" :loading="loading">
+            鏌ヨ
+          </el-button>
+          <el-button @click="resetSearch">
+            閲嶇疆
+          </el-button>
+          <el-button type="info" @click="exportReport">
+            <el-icon><Download /></el-icon>
+            瀵煎嚭
+          </el-button>
+        </el-form-item>
+      </el-form>
+
+    <!-- 鎶ヨ〃鍐呭 -->
+    <el-card class="report-content" shadow="never">
+      <!-- 閲囪喘涓氬姟姹囨�昏〃 -->
+      <div class="report-section">
+        <div class="section-header">
+          <h3>閲囪喘涓氬姟姹囨�昏〃</h3>
+          <div class="summary-stats">
+            <div class="stat-item">
+              <span class="stat-label">閲囪喘鎬婚锛�</span>
+              <span class="stat-value">楼{{ businessSummaryStats.totalAmount.toLocaleString() }}</span>
+            </div>
+            <div class="stat-item">
+              <span class="stat-label">鍟嗗搧绉嶇被锛�</span>
+              <span class="stat-value">{{ businessSummaryStats.productTypes }}</span>
+            </div>
+          </div>
+        </div>
+        
+        <PIMTable
+          :table-data="businessSummaryData"
+          :column="tableColumns"
+          :table-loading="loading"
+          :is-selection="false"
+          :border="true"
+          :is-show-pagination="true"
+          :page="page"
+          @pagination="handlePagination"
+        />
+      </div>
+    </el-card>
+  </div>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted } 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 loading = ref(false)
+
+// 鎼滅储琛ㄥ崟
+const searchForm = reactive({
+  dateRange: [],
+  productCategory: ''
+})
+
+// 浜у搧绫诲埆鏍戦�夐」
+const productOptions = ref([])
+
+// 缁熻鏁版嵁
+const businessSummaryStats = ref({
+  totalAmount: 0,
+  productTypes: 0
+})
+
+// 琛ㄦ牸鍒楅厤缃紙鏍规嵁鍚庣瀛楁瀹氫箟锛�
+const tableColumns = ref([
+  {
+    label: '浜у搧澶х被',
+    prop: 'productCategory',
+    width: 150,
+  },
+  {
+    label: '瑙勬牸鍨嬪彿',
+    prop: 'specificationModel',
+    width: 180
+  },
+  {
+    label: '閲囪喘鏁伴噺',
+    prop: 'purchaseNum',
+    width: 120,
+    formatData: (val) => {
+      return val ? parseFloat(val).toLocaleString() : '0'
+    }
+  },
+  {
+    label: '閲囪喘閲戦',
+    prop: 'purchaseAmount',
+    width: 140,
+    formatData: (val) => {
+      return val ? `楼${parseFloat(val).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : '楼0.00'
+    }
+  },
+  {
+    label: '閲囪喘娆℃暟',
+    prop: 'purchaseTimes',
+    width: 100
+  },
+  {
+    label: '骞冲潎鍗曚环',
+    prop: 'averagePrice',
+    width: 120,
+    formatData: (val) => {
+      return val ? `楼${parseFloat(val).toFixed(2)}` : '楼0.00'
+    }
+  },
+  {
+    label: '渚涘簲鍟嗗悕绉�',
+    prop: 'supplierName',
+    width: 200
+  },
+  {
+    label: '褰曞叆鏃ユ湡',
+    prop: 'entryDate',
+    width: 120
+  }
+])
+
+// 閲囪喘涓氬姟姹囨�昏〃鏁版嵁
+const businessSummaryData = ref([])
+
+// 鍒嗛〉鍙傛暟锛堝悗绔繑鍥烇細total/size/current/pages锛�
+const page = reactive({
+  total: 0,
+  current: 1,
+  size: 50,
+})
+
+// 杞崲浜у搧鏍戞暟鎹紝灏� id 鏀逛负 value
+function convertIdToValue(data) {
+  return data.map((item) => {
+    const { id, children, ...rest } = item
+    const newItem = {
+      ...rest,
+      value: id,
+    }
+    if (children && children.length > 0) {
+      newItem.children = convertIdToValue(children)
+    }
+    return newItem
+  })
+}
+
+// 鑾峰彇浜у搧绫诲埆鏍戞暟鎹�
+const getProductOptions = () => {
+  return productTreeList().then((res) => {
+    productOptions.value = convertIdToValue(res)
+  }).catch((error) => {
+    console.error('鑾峰彇浜у搧鏍戝け璐�:', error)
+    ElMessage.error('鑾峰彇浜у搧绫诲埆澶辫触')
+  })
+}
+
+// 鏍规嵁 id 鏌ユ壘浜у搧绫诲埆鍚嶇О
+const findNodeLabelById = (nodes, id) => {
+  if (!id) return null
+  for (let i = 0; i < nodes.length; i++) {
+    if (nodes[i].value === id) {
+      return nodes[i].label
+    }
+    if (nodes[i].children && nodes[i].children.length > 0) {
+      const found = findNodeLabelById(nodes[i].children, id)
+      if (found) return found
+    }
+  }
+  return null
+}
+
+// 鏌ヨ鍒楄〃
+const handleSearch = async () => {
+  try {
+    loading.value = true
+    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
+      }
+    }
+    
+    // 鍒嗛〉鍙傛暟
+    params.current = page.current
+    params.size = page.size
+
+    const res = await procurementBusinessSummaryListPage(params)
+    if (res && res.data) {
+      // 鍏煎鍚庣鍙兘鐩存帴杩斿洖鏁扮粍/鎴栬繑鍥炲垎椤靛璞�
+      businessSummaryData.value = Array.isArray(res.data) ? res.data : (res.data.records || [])
+
+      if (!Array.isArray(res.data)) {
+        page.total = Number(res.data.total ?? 0)
+        page.current = Number(res.data.current ?? page.current)
+        page.size = Number(res.data.size ?? page.size)
+      }
+      
+      // 璁$畻缁熻鏁版嵁
+      if (businessSummaryData.value.length > 0) {
+        businessSummaryStats.value.totalAmount = businessSummaryData.value.reduce((sum, item) => {
+          return sum + (parseFloat(item.purchaseAmount) || 0)
+        }, 0)
+        businessSummaryStats.value.productTypes = new Set(businessSummaryData.value.map(item => item.productCategory)).size
+      } else {
+        businessSummaryStats.value = {
+          totalAmount: 0,
+          productTypes: 0
+        }
+      }
+    }
+  } catch (error) {
+    console.error('鏌ヨ澶辫触:', error)
+  } finally {
+    loading.value = false
+  }
+}
+
+// 缈婚〉/鍒囨崲姣忛〉鏉℃暟
+const handlePagination = ({ page: current, limit }) => {
+  page.current = current
+  page.size = limit
+  handleSearch()
+}
+
+const resetSearch = () => {
+  Object.assign(searchForm, {
+    dateRange: [],
+    productCategory: ''
+  })
+  page.current = 1
+  handleSearch()
+}
+
+const exportReport = () => {
+  ElMessage.success('瀵煎嚭鍔熻兘寮�鍙戜腑...')
+}
+
+
+onMounted(() => {
+  // 鍒濆鍖栦骇鍝佺被鍒爲
+  getProductOptions()
+  
+  // 璁剧疆榛樿鏃堕棿鑼冨洿涓烘渶杩�30澶�
+  const endDate = new Date()
+  const startDate = new Date()
+  startDate.setDate(startDate.getDate() - 30)
+  
+  searchForm.dateRange = [
+    startDate.toISOString().split('T')[0],
+    endDate.toISOString().split('T')[0]
+  ]
+  
+  // 鍒濆鍔犺浇鏁版嵁
+  handleSearch()
+})
+</script>
+
+<style scoped>
+.app-container {
+  padding: 20px;
+  background-color: #f5f7fa;
+  min-height: 100vh;
+}
+
+.page-header {
+  text-align: center;
+  margin-bottom: 20px;
+  padding: 20px;
+  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+  border-radius: 10px;
+  color: white;
+}
+
+.page-header h2 {
+  margin: 0 0 10px 0;
+  font-size: 28px;
+  font-weight: 600;
+}
+
+.page-header p {
+  margin: 0;
+  font-size: 16px;
+  opacity: 0.9;
+}
+
+.report-content {
+  border-radius: 8px;
+}
+
+.report-section {
+  min-height: 400px;
+}
+
+.section-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 20px;
+  padding-bottom: 15px;
+  border-bottom: 2px solid #e4e7ed;
+}
+
+.section-header h3 {
+  margin: 0;
+  font-size: 20px;
+  font-weight: 600;
+  color: #303133;
+}
+
+.summary-stats {
+  display: flex;
+  gap: 30px;
+}
+
+.stat-item {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.stat-label {
+  font-size: 14px;
+  color: #606266;
+  margin-bottom: 5px;
+}
+
+.stat-value {
+  font-size: 18px;
+  font-weight: 600;
+  color: #409EFF;
+}
+
+.delay-text {
+  color: #F56C6C;
+  font-weight: 600;
+}
+
+
+</style>

--
Gitblit v1.9.3