lof_project-main/front/vite-project/dist/assets/HistoryDetail-D5rZnL2Q.js
2026-06-09 10:34:24 +08:00

1 line
2.5 KiB
JavaScript

import{C as e,E as t,S as n,T as r,_ as i,b as a,d as o,f as s,g as c,h as l,i as u,n as d,p as f,r as p,t as m,x as h,y as g}from"./index-B7jxak6r.js";import{t as _}from"./axios-CMXECuIF.js";var v={class:`history-app`},y={class:`history-header`},b={class:`header-left`},x=`/api/lof/history`,S=m({__name:`HistoryDetail`,setup(m){let S=d(),C=p(),w=e(S.query.fundCode||``),T=e(S.query.fundName||``),E=e([]),D=e(!1);function O(){C.push(`/`)}async function k(){if(!w.value){u.error(`缺少基金代码参数`);return}D.value=!0;try{let e=await _.get(x,{params:{fund_code:w.value,fund_name:T.value}});e.data.code===200?(E.value=e.data.data,T.value=e.data.fundName||T.value):u.error(e.data.msg||`获取历史数据失败`)}catch{u.error(`请求失败:请确认 Python 后端已启动`)}finally{D.value=!1}}function A(e){if(e==null)return`-`;let t=parseFloat(e);return isNaN(t)?`-`:(t>0?`+`:``)+t+`%`}function j(e){if(e==null)return`-`;let t=parseFloat(e);return isNaN(t)?`-`:(t>0?`+`:``)+t.toFixed(3)+`%`}function M(e){if(e==null)return`-`;let t=parseFloat(e);return isNaN(t)?`-`:(t>0?`+`:``)+t.toFixed(2)}function N(e){let t=parseFloat(e)||0;return t>0?`rate-up`:t<0?`rate-down`:`rate-zero`}return c(()=>{k()}),(e,c)=>{let u=g(`el-table-column`),d=g(`el-table`),p=a(`loading`);return i(),f(`div`,v,[o(`div`,y,[o(`div`,b,[o(`h2`,null,t(T.value)+` (`+t(w.value)+`) 历史数据`,1)]),o(`a`,{class:`back-link`,onClick:O},`← 返回看板`)]),n((i(),s(d,{data:E.value,border:``,height:`calc(100vh - 200px)`,style:{width:`100%`}},{default:h(()=>[l(u,{prop:`date`,label:`价格日期`,align:`center`,"min-width":`110`}),l(u,{prop:`price`,label:`收盘价`,align:`center`,"min-width":`90`}),l(u,{prop:`navDate`,label:`净值日期`,align:`center`,"min-width":`110`}),l(u,{prop:`nav`,label:`净值`,align:`center`,"min-width":`90`}),l(u,{label:`溢价率`,align:`center`,"min-width":`100`},{default:h(({row:e})=>[o(`span`,{class:r(N(e.premiumRate))},t(A(e.premiumRate)),3)]),_:1}),l(u,{prop:`turnover`,label:`成交额(万元)`,align:`center`,"min-width":`120`}),l(u,{prop:`shareVolume`,label:`场内份额(万份)`,align:`center`,"min-width":`130`}),l(u,{label:`场内新增(万份)`,align:`center`,"min-width":`120`},{default:h(({row:e})=>[o(`span`,{class:r(N(e.changeAmount))},t(e.changeAmount==null?`-`:M(e.changeAmount)),3)]),_:1}),l(u,{label:`份额涨幅`,align:`center`,"min-width":`100`},{default:h(({row:e})=>[o(`span`,{class:r(N(e.changePct))},t(e.changePct==null?`-`:j(e.changePct)),3)]),_:1})]),_:1},8,[`data`])),[[p,D.value]])])}}},[[`__scopeId`,`data-v-93aff09e`]]);export{S as default};