|
|
|
@ -122,6 +122,8 @@ |
|
|
|
const sign = num > 0 ? '+' : '' |
|
|
|
return `${sign}${num.toFixed(2)}%` |
|
|
|
} |
|
|
|
// 默认根据涨幅( pctChg )由大到小排序 |
|
|
|
const sortByPctDesc = (arr) => arr.sort((a, b) => (Number(b.pctChg) || -Infinity) - (Number(a.pctChg) || -Infinity)) |
|
|
|
|
|
|
|
// 按名称加载(抄底卖顶/波段行情/价值投资/资金及仓位管理) |
|
|
|
const loadByName = async (apiName) => { |
|
|
|
@ -146,6 +148,8 @@ |
|
|
|
if ((!Array.isArray(list) || !list.length) && Array.isArray(raw)) { |
|
|
|
list = raw |
|
|
|
} |
|
|
|
// 排序:涨幅由大到小 |
|
|
|
if (Array.isArray(list)) list = sortByPctDesc(list) |
|
|
|
if (Array.isArray(list) && list.length) { |
|
|
|
strategyData.value = list.map(item => ({ |
|
|
|
name: item.tsCode ?? item.tscode ?? '', |
|
|
|
@ -191,6 +195,8 @@ |
|
|
|
const arrays = Object.values(raw).filter(Array.isArray) |
|
|
|
if (arrays.length) list = arrays.flat() |
|
|
|
} |
|
|
|
// 排序:涨幅由大到小 |
|
|
|
if (Array.isArray(list)) list = sortByPctDesc(list) |
|
|
|
if (Array.isArray(list) && list.length) { |
|
|
|
strategyData.value = list.map(item => ({ |
|
|
|
name: item.tsCode ?? item.tscode ?? '', |
|
|
|
@ -205,7 +211,7 @@ |
|
|
|
highestPrice: item.high ?? '', |
|
|
|
lowestPrice: item.low ?? '' |
|
|
|
})) |
|
|
|
console.log('stockSelectDetail 加载成功,条数:', strategyData.value.length, '首项:', strategyData.value[0]) |
|
|
|
console.log('stockSelectDetail 加载成功(已按涨幅降序),条数:', strategyData.value.length, '首项:', strategyData.value[0]) |
|
|
|
} else { |
|
|
|
console.warn('stockSelectDetail 接口返回空列表或结构不匹配', raw) |
|
|
|
} |
|
|
|
@ -262,7 +268,7 @@ |
|
|
|
|
|
|
|
.tableContent { |
|
|
|
width: 100%; |
|
|
|
|
|
|
|
background-color: #fff; |
|
|
|
position: relative; |
|
|
|
|
|
|
|
.showAll { |
|
|
|
|