Browse Source

style:优化 大数额显示不全

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

45
src/components/workspace/CashManagement.vue

@ -74,6 +74,22 @@ const cashData = ref({
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 workDataUpdateTime = ref('')
const totalIncome = ref(0) const totalIncome = ref(0)
@ -108,9 +124,14 @@ const fetchCashData = async () => {
}, 0); }, 0);
// //
if (marksFlag.value) { 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 { } else {
// 1. // 1.
@ -141,7 +162,6 @@ const fetchCashData = async () => {
} }
// //
cashData.value.markets = markets.value cashData.value.markets = markets.value
console.log("cashData", cashData.value.markets) console.log("cashData", cashData.value.markets)
@ -273,7 +293,7 @@ onMounted(() => {
.market-data { .market-data {
display: flex; display: flex;
width: 180px;
width: 230px;
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
gap: 20px; gap: 20px;
@ -282,29 +302,32 @@ onMounted(() => {
} }
.market-item { .market-item {
margin: 10px 0;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
width: 100%; width: 100%;
font-family: "PingFang SC"; font-family: "PingFang SC";
font-size: 16px; font-size: 16px;
color: #040a2d; color: #040a2d;
line-height: 1.5;
white-space: nowrap; /* 禁止换行 */
overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis; /* 溢出显示省略号 */
margin-bottom: 8px; /* 增加项间距,提升可读性 */
} }
.market-name { .market-name {
text-align: left; /* 左边文本左对齐 */
flex: 0 0 auto; /* 名称部分自适应宽度 */
margin-right: 16px; /* 与金额保持距离 */
} }
.market-value { .market-value {
text-align: right; /* 右边数字右对齐 */
flex: 1; /* 金额部分占剩余宽度 */
text-align: right;
} }
.chart { .chart {
flex: 1; flex: 1;
height: 300px; height: 300px;
width: auto;
margin-top: 10px; margin-top: 10px;
} }

Loading…
Cancel
Save