表格支撑位和阻力位拆为四列:支撑位一/二、阻力位一/二

This commit is contained in:
fish
2026-05-11 22:21:21 +08:00
parent b91bffdb4c
commit 5dad7a6a02

View File

@@ -96,6 +96,11 @@ function parseLevels(json: string): number[] {
} }
} }
function levelAt(json: string, i: number): string {
const arr = parseLevels(json)
return arr[i] != null ? String(arr[i]) : '-'
}
function openDrawer(row: DailyDirection) { function openDrawer(row: DailyDirection) {
selectedRow.value = row selectedRow.value = row
drawerOpen.value = true drawerOpen.value = true
@@ -145,17 +150,17 @@ onMounted(fetchList)
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="支撑位" width="160"> <el-table-column label="支撑位" width="100" align="right">
<template #default="{ row }"> <template #default="{ row }">{{ levelAt(row.support, 0) }}</template>
<span v-for="(v, i) in parseLevels(row.support)" :key="'s'+i" class="level-chip sup">S{{ i + 1 }} {{ v }}</span>
<span v-if="!parseLevels(row.support).length">-</span>
</template>
</el-table-column> </el-table-column>
<el-table-column label="阻力位" width="160"> <el-table-column label="支撑位二" width="100" align="right">
<template #default="{ row }"> <template #default="{ row }">{{ levelAt(row.support, 1) }}</template>
<span v-for="(v, i) in parseLevels(row.resistance)" :key="'r'+i" class="level-chip res">R{{ i + 1 }} {{ v }}</span> </el-table-column>
<span v-if="!parseLevels(row.resistance).length">-</span> <el-table-column label="阻力位一" width="100" align="right">
</template> <template #default="{ row }">{{ levelAt(row.resistance, 0) }}</template>
</el-table-column>
<el-table-column label="阻力位二" width="100" align="right">
<template #default="{ row }">{{ levelAt(row.resistance, 1) }}</template>
</el-table-column> </el-table-column>
<el-table-column label="明细" width="80" align="center"> <el-table-column label="明细" width="80" align="center">
<template #default="{ row }"> <template #default="{ row }">
@@ -232,24 +237,6 @@ onMounted(fetchList)
font-size: 18px; font-size: 18px;
} }
.level-chip {
display: inline-block;
font-size: 12px;
padding: 1px 6px;
border-radius: 3px;
margin-right: 4px;
margin-bottom: 2px;
font-weight: 600;
}
.level-chip.sup {
background: #ecf5ff;
color: #409eff;
}
.level-chip.res {
background: #fef0f0;
color: #f56c6c;
}
.drawer-section { .drawer-section {
margin-bottom: 20px; margin-bottom: 20px;
} }