From d2192e6e8b6a8d0f2fb68dd554c065a436e22c71 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期二, 20 十月 2026 09:47:51 +0800
Subject: [PATCH] feat: 添加康森商砼的图标
---
src/views/procurementManagement/procurementReport/index.vue | 97 ++++++++++++++++++++++++++++++++++--------------
1 files changed, 68 insertions(+), 29 deletions(-)
diff --git a/src/views/procurementManagement/procurementReport/index.vue b/src/views/procurementManagement/procurementReport/index.vue
index 60a900d..37ca1f8 100644
--- a/src/views/procurementManagement/procurementReport/index.vue
+++ b/src/views/procurementManagement/procurementReport/index.vue
@@ -48,11 +48,15 @@
<div class="summary-stats">
<div class="stat-item">
<span class="stat-label">閲囪喘鎬婚锛�</span>
- <span class="stat-value">楼{{ businessSummaryStats.totalAmount.toLocaleString() }}</span>
+ <span class="stat-value">楼{{ formatStatAmount(businessSummaryStats.totalAmount) }}</span>
</div>
<div class="stat-item">
<span class="stat-label">鍟嗗搧绉嶇被锛�</span>
<span class="stat-value">{{ businessSummaryStats.productTypes }}</span>
+ </div>
+ <div class="stat-item">
+ <span class="stat-label">閫�娆炬�婚锛�</span>
+ <span class="stat-value">楼{{ formatStatAmount(businessSummaryStats.returnAmount) }}</span>
</div>
</div>
</div>
@@ -73,12 +77,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,37 +101,61 @@
// 缁熻鏁版嵁
const businessSummaryStats = ref({
totalAmount: 0,
- productTypes: 0,
- supplierCount: 0
+ returnAmount: 0,
+ productTypes: 0
})
+
+// 鏁板�煎睍绀哄彛寰勶細鍚庣杩斿洖 6 浣嶅皬鏁帮紙濡� 211.970000銆伮�3,420,674.200000锛夛紝
+// 椤甸潰鎸夊悗绔疄闄呬綅鏁板睍绀哄嵆鍙紝涓嶅啀琛ラ綈 6 浣嶁�斺�斿浣欑殑缁撳熬 0 涓�寰嬪幓鎺夈��
+// maximumFractionDigits 淇濈暀 6锛屾槸涓轰簡鍏滀綇鍓嶇鑷繁 reduce 姹傚拰鏃剁殑娴偣灏炬暟锛堝 3420674.2000000002锛夈��
+const NUM_FMT = { maximumFractionDigits: 6 }
+
+// 鏁伴噺/閲戦缁熶竴鏍煎紡鍖栵細甯﹀崈鍒嗕綅锛屽幓鎺夌粨灏惧浣欑殑 0锛涚┖鍊兼寜 0 澶勭悊
+const formatNum = (val, prefix = '') => {
+ const num = parseFloat(val)
+ if (val === null || val === undefined || val === '' || Number.isNaN(num)) {
+ return `${prefix}0`
+ }
+ return `${prefix}${num.toLocaleString('zh-CN', NUM_FMT)}`
+}
+
+// 姹囨�婚噾棰濆睍绀�
+const formatStatAmount = (val) => {
+ return formatNum(val)
+}
// 琛ㄦ牸鍒楅厤缃紙鏍规嵁鍚庣瀛楁瀹氫箟锛�
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'
- }
+ formatData: (val) => formatNum(val)
},
{
- label: '閲囪喘閲戦',
+ label: '閫�璐ф暟閲�',
+ prop: 'returnQuantity',
+ width: 120,
+ formatData: (val) => formatNum(val)
+ },
+ {
+ label: '閫�璐ч噾棰�',
+ prop: 'returnAmount',
+ width: 120,
+ formatData: (val) => formatNum(val, '楼')
+ },
+ {
+ label: '閫�娆惧偍閲�',
prop: 'purchaseAmount',
- width: 140,
- formatData: (val) => {
- return val ? `楼${parseFloat(val).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : '楼0.00'
- }
+ formatData: (val) => formatNum(val, '楼')
},
{
label: '閲囪喘娆℃暟',
@@ -136,14 +166,11 @@
label: '骞冲潎鍗曚环',
prop: 'averagePrice',
width: 120,
- formatData: (val) => {
- return val ? `楼${parseFloat(val).toFixed(2)}` : '楼0.00'
- }
+ formatData: (val) => formatNum(val, '楼')
},
{
label: '渚涘簲鍟嗗悕绉�',
prop: 'supplierName',
- width: 200
},
{
label: '褰曞叆鏃ユ湡',
@@ -242,13 +269,15 @@
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
- businessSummaryStats.value.supplierCount = new Set(businessSummaryData.value.map(item => item.supplierName).filter(Boolean)).size
+ businessSummaryStats.value.returnAmount = businessSummaryData.value.reduce((sum, item) => {
+ return sum + (parseFloat(item.returnAmount) || 0)
+ }, 0)
+ businessSummaryStats.value.productTypes = businessSummaryData.value.length
} else {
businessSummaryStats.value = {
totalAmount: 0,
- productTypes: 0,
- supplierCount: 0
+ returnAmount: 0,
+ productTypes: 0
}
}
}
@@ -276,7 +305,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")
}
@@ -300,12 +345,6 @@
</script>
<style scoped>
-.app-container {
- padding: 20px;
- background-color: #f5f7fa;
- min-height: 100vh;
-}
-
.page-header {
text-align: center;
margin-bottom: 20px;
--
Gitblit v1.9.3