From 519211ac232866afe6b081ae4a97916ad5f1d7d2 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 27 一月 2026 17:58:57 +0800
Subject: [PATCH] fix: 排名样式修改
---
src/views/reportAnalysis/dataDashboard/components/basic/right-top.vue | 40 +++++++++++++++++++++++++---------------
1 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/src/views/reportAnalysis/dataDashboard/components/basic/right-top.vue b/src/views/reportAnalysis/dataDashboard/components/basic/right-top.vue
index 4c023ff..94ea975 100644
--- a/src/views/reportAnalysis/dataDashboard/components/basic/right-top.vue
+++ b/src/views/reportAnalysis/dataDashboard/components/basic/right-top.vue
@@ -25,7 +25,7 @@
import Echarts from '@/components/Echarts/echarts.vue'
import PanelHeader from '../PanelHeader.vue'
import DateTypeSwitch from '../DateTypeSwitch.vue'
-import { statisticsReceivablePayable } from '@/api/viewIndex.js'
+import { supplierPurchaseRanking } from '@/api/viewIndex.js'
const chartStyle = {
width: '100%',
@@ -151,12 +151,21 @@
inverse: false,
data: xdataName.value,
axisLabel: {
- formatter: (params) => {
- return `{a|${params}}`
+ formatter: (value) => {
+ if (!value) return ''
+ const maxLen = 6 // 姣忚鏈�澶氬瓧绗︽暟锛屽彲鎸夐渶璋冩暣
+ if (value.length <= maxLen) return `{a|${value}}`
+
+ const lines = []
+ for (let i = 0; i < value.length; i += maxLen) {
+ lines.push(value.slice(i, i + maxLen))
+ }
+ // 澶氳鏂囨湰锛屾瘡琛岄兘濂楀悓涓�涓� rich 鏍峰紡
+ return lines.map((line) => `{a|${line}}`).join('\n')
},
rich: {
a: {
- width: 160,
+ width: 120,
fontSize: 14,
color: '#fff',
padding: [5, 4, 5, 0],
@@ -242,6 +251,7 @@
z: 6,
type: 'bar',
barWidth: 25,
+ tooltip: { show: false },
itemStyle: {
color: 'rgba(255,255,255,.1)',
barBorderRadius: [0, 20, 20, 0],
@@ -252,6 +262,7 @@
type: 'bar',
barWidth: 25,
barGap: '-100%',
+ tooltip: { show: false },
itemStyle: {
color: {
type: 'linear',
@@ -282,16 +293,15 @@
]
})
-// 搴斾粯搴旀敹缁熻
-const statisticsReceivable = () => {
- statisticsReceivablePayable({ type: radio1.value })
+// 渚涘簲鍟嗛噰璐帓鍚�
+const fetchSupplierRanking = () => {
+ supplierPurchaseRanking({ type: radio1.value })
.then((res) => {
- // 鍋囪 API 杩斿洖鐨勬暟鎹牸寮忎负鏁扮粍锛屽寘鍚� NAME 鍜� NUM 瀛楁
- // 濡傛灉杩斿洖鏍煎紡涓嶅悓锛岄渶瑕佹牴鎹疄闄� API 璋冩暣
- if (res.data && Array.isArray(res.data)) {
- dataArr.value = res.data
- } else if (res.data && res.data.list) {
- dataArr.value = res.data.list
+ if (res.code === 200 && Array.isArray(res.data)) {
+ dataArr.value = res.data.map(item => ({
+ NAME: item.supplierName,
+ NUM: item.totalAmount
+ }))
} else {
// 濡傛灉娌℃湁鏁版嵁锛屼娇鐢ㄦā鎷熸暟鎹�
dataArr.value = [
@@ -318,11 +328,11 @@
// 澶勭悊鏃ユ湡绫诲瀷鍒囨崲
const handleDateTypeChange = (value) => {
- statisticsReceivable()
+ fetchSupplierRanking()
}
onMounted(() => {
- statisticsReceivable()
+ fetchSupplierRanking()
})
</script>
--
Gitblit v1.9.3