1 line
2.6 KiB
JavaScript
1 line
2.6 KiB
JavaScript
import{C as e,_ as t,b as n,d as r,h as i,i as a,l as o,m as s,n as c,p as l,r as u,t as d,u as f,v as p,w as m,x as h,y as g}from"./index-CmLn5x9L.js";import{t as _}from"./axios-6M3K5Uho.js";var v={class:`history-app`},y={class:`history-header`},b={class:`header-left`},x=`http://127.0.0.1:8000/api/lof/history`,S=d({__name:`HistoryDetail`,setup(d){let S=c(),C=u(),w=h(S.query.fundCode||``),T=h(S.query.fundName||``),E=h([]),D=h(!1);function O(){C.push(`/`)}async function k(){if(!w.value){a.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):a.error(e.data.msg||`获取历史数据失败`)}catch{a.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 s(()=>{k()}),(a,s)=>{let c=t(`el-table-column`),u=t(`el-table`),d=p(`loading`);return i(),r(`div`,v,[o(`div`,y,[o(`div`,b,[o(`h2`,null,m(T.value)+` (`+m(w.value)+`) 历史数据`,1)]),o(`a`,{class:`back-link`,onClick:O},`← 返回看板`)]),n((i(),f(u,{data:E.value,border:``,height:`calc(100vh - 200px)`,style:{width:`100%`}},{default:g(()=>[l(c,{prop:`date`,label:`价格日期`,align:`center`,"min-width":`110`}),l(c,{prop:`price`,label:`收盘价`,align:`center`,"min-width":`90`}),l(c,{prop:`navDate`,label:`净值日期`,align:`center`,"min-width":`110`}),l(c,{prop:`nav`,label:`净值`,align:`center`,"min-width":`90`}),l(c,{label:`溢价率`,align:`center`,"min-width":`100`},{default:g(({row:t})=>[o(`span`,{class:e(N(t.premiumRate))},m(A(t.premiumRate)),3)]),_:1}),l(c,{prop:`turnover`,label:`成交额(万元)`,align:`center`,"min-width":`120`}),l(c,{prop:`shareVolume`,label:`场内份额(万份)`,align:`center`,"min-width":`130`}),l(c,{label:`场内新增(万份)`,align:`center`,"min-width":`120`},{default:g(({row:t})=>[o(`span`,{class:e(N(t.changeAmount))},m(t.changeAmount==null?`-`:M(t.changeAmount)),3)]),_:1}),l(c,{label:`份额涨幅`,align:`center`,"min-width":`100`},{default:g(({row:t})=>[o(`span`,{class:e(N(t.changePct))},m(t.changePct==null?`-`:j(t.changePct)),3)]),_:1})]),_:1},8,[`data`])),[[d,D.value]])])}}},[[`__scopeId`,`data-v-d143755c`]]);export{S as default}; |