Browse Source

style:优化 大数额显示不全

zhangyong/milestone-20250913-现金管理
lihui 1 month ago
parent
commit
6bc3b680a2
  1. 59
      src/components/workspace/CashManagement.vue

59
src/components/workspace/CashManagement.vue

@ -3,9 +3,9 @@
<div class="cash-title">
<div class="text1">
现金管理
<!-- <span class="text1-update-time">-->
<!-- 最后更新时间{{ workDataUpdateTime || '该地区暂无数据' }}-->
<!-- </span>-->
<!-- <span class="text1-update-time">-->
<!-- 最后更新时间{{ workDataUpdateTime || '该地区暂无数据' }}-->
<!-- </span>-->
<el-popover
placement="top-start"
title="数据说明"
@ -23,7 +23,7 @@
transition: all 0.3s ease;
"
>
<Service />
<Service/>
</el-icon>
</template>
</el-popover>
@ -32,7 +32,7 @@
</div>
<div class="text2">
<span class="text2-income">总营收{{ totalIncome}} 新币</span>
<span class="text2-income">总营收{{ totalIncome }} 新币</span>
</div>
<div class="chart-container">
@ -72,7 +72,23 @@ const cashData = ref({
markets: []
})
const markets =ref()
const markets = ref()
//
const defaultMarkets = [
{name: '新加坡', value: 0},
{name: '马来西亚', value: 0},
{name: '香港', value: 0},
{name: '加拿大', value: 0},
{name: '泰国', value: 0},
{name: '越南HCM', value: 0},
{name: '韩国', value: 0},
{name: '未知', value: 0},
// { name: '', value: 0 },
{name: '市场部', value: 0},
// { name: '', value: 0 },
// { name: '', value: 0 },
]
const workDataUpdateTime = ref('')
const totalIncome = ref(0)
@ -103,14 +119,19 @@ const fetchCashData = async () => {
console.log("jjjjjjj", res)
//
console.log("totalIncome", res)
totalIncome.value= res.reduce((sum, item) => {
totalIncome.value = res.reduce((sum, item) => {
return sum + (item.totalSGD || 0);
}, 0);
//
if (marksFlag.value) {
markets.value = res.map(item => ({
name: item.market,
value: item.totalSGD ? Number(item.totalSGD) : 0
//
const resMap = new Map(
res.map(item => [item.market, Number(item.totalSGD) || 0])
)
// 0
markets.value = defaultMarkets.map(m => ({
name: m.name,
value: resMap.get(m.name) ?? 0
}))
} else {
// 1.
@ -141,7 +162,6 @@ const fetchCashData = async () => {
}
//
cashData.value.markets = markets.value
console.log("cashData", cashData.value.markets)
@ -273,7 +293,7 @@ onMounted(() => {
.market-data {
display: flex;
width: 180px;
width: 230px;
flex-direction: column;
align-items: flex-start;
gap: 20px;
@ -282,29 +302,32 @@ onMounted(() => {
}
.market-item {
margin: 10px 0;
display: flex;
justify-content: space-between;
width: 100%;
font-family: "PingFang SC";
font-size: 16px;
color: #040a2d;
line-height: 1.5;
white-space: nowrap; /* 禁止换行 */
overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis; /* 溢出显示省略号 */
margin-bottom: 8px; /* 增加项间距,提升可读性 */
}
.market-name {
text-align: left; /* 左边文本左对齐 */
flex: 0 0 auto; /* 名称部分自适应宽度 */
margin-right: 16px; /* 与金额保持距离 */
}
.market-value {
text-align: right; /* 右边数字右对齐 */
flex: 1; /* 金额部分占剩余宽度 */
text-align: right;
}
.chart {
flex: 1;
height: 300px;
width: auto;
margin-top: 10px;
}

Loading…
Cancel
Save