PageSourceSearch

https://cfadata.com/assets/Securities-trWgBauM.js

js cfadata.com collected 2026-10-03 02:32:06 UTC 41,585 bytes, 1 lines download raw bytes

1import{a4 as x,k as dt,a as ut,ac as ue,j as e,a7 as Le,c7 as Yt,M as mt,m as xt,a0 as pt,a5 as Ot,B as Ze,s as U,u as Bt,ad as qt,ae as Ht,c8 as Kt,c9 as ze,au as De,r as Ut,W as Gt,d as Qt,i as Jt,ca as Wt,cb as Zt,cc as zt,cd as Xt,ce as es,a6 as Xe,ai as ts}from"./index-BgOx-y6Z.js";import{a as n}from"./echarts-DgtDMHXn.js";import{F as ss}from"./FileSaver.min-CsfSA8fv.js";import{C as ls,a as ns}from"./ConsoleHeader-CPjrsrnl.js";import{C as rs}from"./ConsoleStats-C3UqZ92Z.js";import{C as os}from"./ConsoleToolbar-BbBdHQtA.js";import{I as as}from"./IndexList-BnaYICGV.js";import{D as Ie}from"./DetailPane-Co2tJBoy.js";import{C as W}from"./ConsoleBadge-DCgg_VHp.js";import{D as f}from"./DetailRow-gj5uvQBt.js";import{C as V,M as et}from"./IndexChips-Dr5yOrBM.js";import{c as cs,a as de,b as tt}from"./buttons-B-td5m2n.js";import{T as Ve,S}from"./consoleMotifs-DztxQt8X.js";import{a as is}from"./consoleSplit-DYESYKMN.js";import{m as Me,u as ht,c as st,g as ds,r as us,a as ms,b as xs,A as lt,d as ps,e as hs,f as fs,h as gs}from"./investmentAlerts-C1Ywr9Uv.js";import{u as ft}from"./useMoneyFormatter-nQgPhkeI.js";import{F as bs,u as js}from"./useAutoAdd-BPJdnE0M.js";import{u as ys}from"./useEnterToSubmit-CbWc2UAa.js";import{r as nt}from"./accountColor-BO-lFcba.js";import{S as Cs,c as Ns,r as rt}from"./StrategyFormFields-Uqz2vz4q.js";import{L as gt}from"./LooseDatePicker-CY1-Gb6o.js";import{A as Ye}from"./AttrSwitch-VNlvIg7l.js";import{A as ks}from"./AccountSelector-CWkV2wZd.js";import{D as Ss}from"./index-C99cO1PC.js";import{T as te}from"./index-B22ZqzuR.js";import{S as me}from"./index-DrBcIRVV.js";import{A as Fs}from"./index-DgOHJ2jm.js";import{D as Is}from"./index-Codo6CCy.js";import{e as Ms,a as vs,I as ws}from"./ImportFundModal-Ch6G_ofn.js";import{R as Rs}from"./ReloadOutlined-C0ZR_3Sp.js";import{R as As}from"./DownloadOutlined-9yYWFJzE.js";import{R as $s}from"./ScheduleOutlined-DaOO4bWG.js";import{R as Ps}from"./InfoCircleOutlined-DZC8WRsa.js";import{E as ve}from"./index-CwuBtv0e.js";import{S as Ts}from"./index-BTZEaxC7.js";import{P as ot}from"./index-CgX3Ei35.js";import{R as Es}from"./DeleteOutlined-D2rzDTkW.js";import"./useIsDark-iZe97-MD.js";import"./ArrowLeftOutlined-C0w1fwDH.js";import"./DownOutlined-BQJivuOt.js";import"./UpOutlined-BOTXMvQY.js";import"./index-aVI8qjFB.js";import"./index-fJz-wRm3.js";import"./index-RbzkweVC.js";import"./xlsx-BrcMyRkh.js";import"./papaparse.min-D_ATfZhF.js";import"./papaparse-DHZrpM8D.js";import"./CheckCircleOutlined-B2_VVzJa.js";const bt="jywg.marketLastRefreshAt",jt=()=>{try{return typeof globalThis.localStorage>"u"?null:globalThis.localStorage}catch{return null}},at=()=>jt()?.getItem(bt)??null,_s=i=>{jt()?.setItem(bt,i)},Ls=i=>{if(!i)return null;const u=new Date(i);if(Number.isNaN(u.getTime()))return null;const N=o=>String(o).padStart(2,"0");return`${N(u.getMonth()+1)}-${N(u.getDate())} ${N(u.getHours())}:${N(u.getMinutes())}`},ct=i=>{const u=i.trim().toUpperCase();if(u.includes(".")){const N=u.split(".").pop();return["SZ","SH","BJ","HK","US"].includes(N||"")?N:void 0}if(/^(600|601|603|605|688|689|900)/.test(u))return"SH";if(/^(000|001|002|003|200|300|301)/.test(u))return"SZ";if(/^(4|8|92)/.test(u))return"BJ"},Ds=({open:i,onCancel:u,onSave:N,type:o,initialValues:g,confirmLoading:$=!1,width:Z=600,bare:se=!1,form:E,leading:O})=>{const[ne]=x.useForm(),c=E??ne,{accounts:z}=dt(),{currencies:j,mainCurrency:_}=ut();n.useEffect(()=>{i&&(c.resetFields(),g?(c.setFieldsValue({...g,purchaseDate:ue(g.purchaseDate),maturityDate:g.maturityDate?ue(g.maturityDate):void 0,isSharesMode:!!g.shares||!!g.isMoneyFund||o==="fund"}),g.isMoneyFund&&!g.purchaseAmount&&c.setFieldsValue({purchaseAmount:g.currentValue})):c.setFieldsValue({currency:_.code,purchaseDate:ue(),isSharesMode:!0,isMoneyFund:!1,costPrice:1,currentPrice:1}))},[i,g,c,_]);const xe=d=>{const h={...d,purchaseDate:d.purchaseDate.format("YYYY-MM-DD"),maturityDate:d.maturityDate?.format("YYYY-MM-DD"),type:o},I=d.accountId?z.find(F=>F.id===d.accountId):null;h.memberId=I?.memberId||"self";const M=d.isSharesMode||d.isMoneyFund||o==="fund"||o==="stock";if(d.isMoneyFund){const F=d.purchaseAmount||0;h.currentValue=F,h.purchaseAmount=F,h.shares=F,h.costPrice=1,h.currentPrice
1=1}else if(M){const F=d.shares||0,w=d.currentPrice||0,Re=d.costPrice||0;h.currentValue=Number((F*w).toFixed(2)),h.purchaseAmount=Number((F*Re).toFixed(2))}N(h)},pe=()=>{c.submit()},he=x.useWatch("isSharesMode",c),L=x.useWatch("isMoneyFund",c),p=n.useRef(null),D=n.useRef(0),[ae,G]=n.useState(!1);n.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const Q=async(d,h)=>{G(!0);try{if(o==="fund"){if(L)return;const I=()=>h!==D.current||c.getFieldValue("code")?.trim()!==d;await Promise.all([Me.getFundBasic(d).catch(()=>null).then(M=>{I()||!M?.name||c.setFieldsValue({name:M.name})}),Me.getFundPrice(d).catch(()=>null).then(M=>{const F=M?.nav===void 0||M?.nav===null?void 0:Number(M.nav);I()||F===void 0||!Number.isFinite(F)||c.setFieldsValue({currentPrice:F})})])}else if(o==="stock"){const I=await Me.getStockBasic(d);if(h!==D.current||c.getFieldValue("code")?.trim()!==d)return;const M=I?.exchange||ct(I?.code||d);c.setFieldsValue({...I?.name?{name:I.name}:{},...M?{exchangeCode:M.toUpperCase()}:{}});try{const F=await Me.getStockPrice(I?.code||d);if(h!==D.current||c.getFieldValue("code")?.trim()!==d)return;const w=F?.close===void 0||F?.close===null?void 0:Number(F.close);w!==void 0&&Number.isFinite(w)&&c.setFieldValue("currentPrice",w)}catch{}}}catch{}finally{h===D.current&&G(!1)}},fe=d=>{p.current&&clearTimeout(p.current);const h=d.trim(),I=++D.current;if(G(!1),!h){c.setFieldsValue({name:void 0,exchangeCode:void 0,currentPrice:void 0});return}o==="stock"&&c.setFieldsValue({name:void 0,exchangeCode:ct(h),currentPrice:void 0}),p.current=setTimeout(()=>{Q(h,I)},400)};n.useEffect(()=>{(L||o==="fund"||o==="stock")&&c.setFieldsValue({isSharesMode:!0})},[L,o,c]);const Y=()=>{c.resetFields(),u()},P=e.jsxs(x,{form:c,layout:"vertical",initialValues:{currency:_.code,purchaseDate:ue()},autoComplete:"off",onFinish:xe,children:[e.jsx("button",{type:"submit",style:{display:"none"}}),O||o!=="stock"?e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-x-5 gap-y-2 rounded-console border border-console-border bg-console-surface-tint px-3 py-2",children:[O?e.jsx("div",{className:"flex items-center",children:O}):null,o!=="stock"?e.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-2",children:[e.jsx(Ye,{form:c,name:"isForRetirement",label:"归入养老钱包"}),o==="fund"?e.jsx(Ye,{form:c,name:"isMoneyFund",label:"货币基金"}):null,o==="bond"?e.jsx(Ye,{form:c,name:"isSharesMode",label:"按份额计价"}):null]}):null]}):null,e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(x.Item,{name:"code",label:"代码",rules:o==="fund"||o==="stock"?[{required:!0,message:`请输入${o==="fund"?"基金":"股票"}代码`}]:[],children:e.jsx(Le,{placeholder:o==="fund"?"请输入基金代码(必填)":o==="stock"?"请输入股票代码(必填)":"可选",autoComplete:"off",onChange:d=>fe(d.target.value),suffix:e.jsx("span",{className:"inline-flex w-4 items-center justify-center",children:ae?e.jsx(Yt,{size:"small"}):null})})}),e.jsx(x.Item,{name:"name",label:"名称",rules:[{required:!0,message:"请输入名称"}],children:e.jsx(Le,{placeholder:o==="stock"?ae?"正在匹配股票名称":"输入股票代码后自动显示":L?"如:余额宝、零钱通":"如:沪深300指数基金",autoComplete:"off"})})]}),e.jsx(Ss,{className:"my-2"}),L?e.jsx(x.Item,{name:"purchaseAmount",label:"当前持有总额",rules:[{required:!0,message:"请输入当前金额"}],tooltip:"由于货币基金净值通常固定为1.0,您只需输入当前账户显示的资产总额即可。",children:e.jsx(te,{className:"w-full",precision:2,autoComplete:"off",placeholder:"请输入当前总金额",controls:!1})}):!he&&o!=="fund"&&o!=="stock"?e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(x.Item,{name:"purchaseAmount",label:"购买金额",rules:[{required:!0,message:"请输入购买金额"}],children:e.jsx(te,{className:"w-full",precision:2,autoComplete:"off",controls:!1})}),e.jsx(x.Item,{name:"currentValue",label:"当前市值",rules:[{required:!0,message:"请输入当前市值"}],children:e.jsx(te,{className:"w-full",precision:2,autoComplete:"off",controls:!1})})]}):e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(x.Item,{name:"shares",label:"持有份额",rules:[{required:!0,message:"请输入份额"}],children:e.jsx(te,{className:"w-full",precision:o==="stock"?0:2,autoComplete:"off",controls:!1})}),e.jsx(x.Item,{name:"costPrice",label:o==="stock"?"买入均价":"成本价 (元/份)",rules:[{required:!0,message:"请输入成本/均价"}],children:e.jsx(te,{className:"w-full",precision:4,autoComplete:"off",controls:!1})}),e.jsx(x.Item,{name:"currentPrice",label:o==="stock"?"当前市价":"当前净值 (元/份)",rules:[{required:!1}],children:e.jsx(te,{className:"w-full",precision:o==="stock"?2:4,placeholder:"不填则稍后自动同步",autoComplete:"off",controls:!1})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(x.Item,{name:"accountId",label:"关联账户",rules:[{required:L,message:"请选择资金存放的账户(如支付宝)"}],children:e.jsx(ks,{placeholder:L?"必填":"可选 (影响账户余额)",allowClear:!L})}),L?e.jsx(x.Item,{name:"annualYield7d",label:"七日年化收益率 (%)",children:e.jsx(te,{className:"w-full",precision:4,placeholder:"自动显示",autoComplete:"off",controls:!1})}):o==="stock"?e.jsx(x.Item,{name:"exchangeCode",label:"交易所",children:e.jsx(me,{disabled:!0,placeholder:ae?"正在匹配交易所":"输入股票代码后自动匹配",options:[{value:"SZ",label:"深交所(SZ)"},{value:"SH",label:"上交所(SH)"},{value:"BJ",label:"北交所(BJ)"},{value:"HK",label:"港交所(HK)"}
1,{value:"US",label:"美国市场(US)"}]})}):o==="fund"?e.jsx(x.Item,{name:"liquidityTier",label:"流动性分级",tooltip:"货币基金自动计入速动资产;普通基金默认不计入。若某只基金(如短债、同业存单)你想把它当随时能动的钱看待,可在此标为「随时可动」。「长期持有」表示不参与流动性统计。",children:e.jsx(me,{allowClear:!0,placeholder:"未标注 —— 不计入速动资产",options:[{value:"quick",label:"随时可动(T+0 可赎回)"},{value:"liquid",label:"短期持有(暂不打算用)"},{value:"locked",label:"长期持有(不参与流动性统计)"}]})}):null,e.jsx(x.Item,{name:"purchaseDate",label:"建仓日期",rules:[{required:!0,message:"请选择日期"}],children:e.jsx(gt,{className:"w-full"})})]}),e.jsxs(bs,{children:[e.jsx(x.Item,{name:"currency",label:"币种",rules:[{required:!0,message:"请选择币种"}],children:e.jsx(me,{children:j.map(d=>e.jsxs(me.Option,{value:d.code,children:[d.name," (",d.code,")"]},d.code))})}),e.jsx(x.Item,{name:"notes",label:"备注",className:"sm:col-span-2",children:e.jsx(Le.TextArea,{rows:2,autoSize:!0,placeholder:"可选",autoComplete:"off"})})]})]});return se?P:e.jsx(mt,{title:`${g?"编辑":"添加"}${o==="fund"?"基金":o==="stock"?"股票":"债券"}`,open:i,onCancel:Y,onOk:pe,confirmLoading:$,width:Z,destroyOnHidden:!0,children:P})},Vs=({open:i,investment:u,onCancel:N,onConfirm:o,confirmLoading:g=!1})=>{const[$]=x.useForm(),Z=ft();n.useEffect(()=>{i&&u&&$.setFieldsValue({soldDate:ue(),soldValue:u.currentValue})},[i,u,$]);const se=async()=>{try{const E=await $.validateFields();o(E.soldDate.format("YYYY-MM-DD"),E.soldValue)}catch(E){console.error("Validation failed:",E)}};return u?e.jsx(mt,{title:`卖出/赎回 - ${u.name}`,open:i,onCancel:N,onOk:se,confirmLoading:g,destroyOnHidden:!0,children:e.jsxs(x,{form:$,layout:"vertical",children:[e.jsx(Fs,{message:"卖出确认",description:`当前持仓本金: ${Z(u.purchaseAmount,u.currency)}`,type:"info",showIcon:!0,className:"mb-4"}),e.jsx(x.Item,{name:"soldDate",label:"卖出日期",rules:[{required:!0,message:"请选择卖出日期"}],children:e.jsx(gt,{className:"w-full"})}),e.jsx(x.Item,{name:"soldValue",label:"卖出金额",rules:[{required:!0,message:"请输入卖出金额"}],children:e.jsx(te,{className:"w-full",precision:2,controls:!1})})]})}):null},Ys=({open:i,onClose:u,investmentId:N})=>{const[o]=x.useForm(),[g,$]=n.useState(!1),{getInvestmentById:Z,updateInvestmentStrategy:se}=xt(),{marketSentiment:E}=pt(),{getMarketIndicators:O}=ht(),ne=n.useMemo(()=>O(E?.value),[O,E?.value]),c=N?Z(N):null;n.useEffect(()=>{i&&c?o.setFieldsValue({operationPlan:c.operationPlan||"",alertLines:c.alertLines||[]}):o.resetFields()},[i,c,o]);const z=async()=>{if(N)try{const _=await o.validateFields();$(!0),await se(N,_.operationPlan||"",_.alertLines||[]),U.success("保存成功"),u()}catch(_){_?.errorFields||U.error(_?.message||"保存失败,请稍后重试")}finally{$(!1)}},j=()=>{g||(o.resetFields(),u())};return e.jsx(Is,{title:e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate",children:`策略配置 - ${c?.name||""}`}),c?.code?e.jsx("div",{className:"text-[12px] font-normal text-console-muted",children:c.code}):null]}),width:560,onClose:j,open:i,destroyOnHidden:!0,extra:e.jsxs(Ot,{children:[e.jsx(Ze,{onClick:j,disabled:g,children:"取消"}),e.jsx(Ze,{type:"primary",onClick:z,loading:g,children:"保存"})]}),children:c?e.jsx(x,{form:o,layout:"vertical",onValuesChange:Ns(o),className:"console-pane-form",children:e.jsx(Cs,{investment:c,form:o,disabled:g,operationPlanRows:7,market:ne})}):null})},it=["fund","stock","bond"],we={fund:"基金",stock:"股票",bond:"债券"},Os=[{value:"value",label:"按市值"},{value:"profitRate",label:"按收益率"},{value:"name",label:"按名称"}],Bs={maturity:"到期一次还本付息",monthly:"按月付息",quarterly:"按季付息",annually:"按年付息"},qs={SZ:"深交所",SH:"上交所",BJ:"北交所",HK:"港交所",US:"美国市场"},Hs={quick:"随时可动",liquid:"短期持有",locked:"长期持有"},Ks=i=>{if(i.state==="none")return"尚未取到行情";const u=i.disclosure==="lagged"?" · 披露滞后":"";return`行情 ${i.dateText} · 落后 ${i.tradeDays} 个交易日${u}`},Us=i=>{const u=i.slice(0,3).join("、");return i.length>3?`${u} 等 ${i.length} 条`:u},Gs=i=>i.type==="fund"||i.type==="stock"||i.type==="bond",Bl=()=>{const i=Bt(),u=qt(),{investments:N,loadInvestments:o,addInvestment:g,updateInvestment:$,deleteInvestment:Z,sellInvestment:se,refreshMarketPrices:E}=xt(),{mainCurrency:O,convertAmount:ne}=ut(),{accounts:c}=dt(),z=Ht(t=>t.members),{globalMoneyFundAlertThreshold:j,marketSentiment:_,fundAccountOrder:xe,setAccountOrder:pe}=pt(),{loadMetalPrices:he,getMarketIndicators:L}=ht(),p=ft(),[D]=x.useForm(),ae=ys(D),[G,Q]=n.useState(null),[fe,Y]=n.useState("view"),[P,d]=n.useState(null),[h,I]=n.useState("fund"),[M,F]=n.useState(""),[w,Re]=n.useState("all"),[ge,yt]=n.useState("value"),[Oe,B]=n.useState(!1),[be,je]=n.useState(null),[Be,ye]=n.useState(null),[J,Ce]=n.useState(null),[Ct,qe]=n.useState(!1),[re,He]=n.useState(!1),[oe,Ae]=n.useState({done:0,total:0}),[Nt,kt]=n.useState(!1),[Ke,St]=n.useState(()=>at()),k=O.code,v=n.useCallback((t,r)=>ne(t??0,r??k,k),[ne,k]);n.useEffect(()=>{o().catch(()=>U.error("持仓数据加载失败"))},[o]),n.useEffect(()=>{he().catch(()=>{})},[he]);const y=n.useMemo(()=>N.filter(Gs),[N]),q=n.useMemo(()=>L(_?.value),[L,_?.value]),$e=n.useMemo(()=>st(y,j,q),[y,j,q]),le=n.useMemo(()=>Kt(y),[y]),Ue=n.useMemo(()=>new Set(le.ids),[le.ids]),Ge=n.useMemo(()=>{const t=new Map;
1return y.forEach(r=>t.set(r.id,ze(r))),t},[y]),Qe=n.useMemo(()=>Ls(Ke),[Ke]),H=Nt&&le.total>0,T=n.useMemo(()=>{const t=y.filter(b=>b.status==="holding"),r=t.reduce((b,l)=>b+v(l.currentValue,l.currency),0),a=t.reduce((b,l)=>b+v(l.purchaseAmount,l.currency),0),C=r-a,ee=t.filter(b=>b.isMoneyFund&&b.annualYield7d!==void 0&&b.annualYield7d!==null),m=ee.reduce((b,l)=>b+v(l.currentValue,l.currency),0),R=m>0?ee.reduce((b,l)=>b+l.annualYield7d*v(l.currentValue,l.currency),0)/m:null;return{holdingCount:t.length,soldCount:y.length-t.length,marketValue:r,cost:a,profit:C,profitRate:a>0?C/a*100:null,moneyFundYield:R}},[y,v]),X=n.useMemo(()=>{const t=M.trim().toLowerCase();return[...y.filter(a=>H&&!Ue.has(a.id)?!1:w==="money"?!!a.isMoneyFund:!(w!=="all"&&a.type!==w||t&&!(a.name.toLowerCase().includes(t)||(a.code??"").toLowerCase().includes(t)||(a.notes??"").toLowerCase().includes(t))))].sort((a,C)=>ge==="name"?a.name.localeCompare(C.name,"zh-Hans-CN"):ge==="profitRate"?(C.profitRate??0)-(a.profitRate??0):v(C.currentValue,C.currency)-v(a.currentValue,a.currency))},[y,w,M,ge,v,H,Ue]),Ft=w!=="all"||M.trim().length>0||H,It=n.useMemo(()=>X.filter(t=>t.status==="holding").reduce((t,r)=>t+v(r.currentValue,r.currency),0),[X,v]),s=n.useMemo(()=>y.find(t=>t.id===G)??null,[y,G]),A=n.useMemo(()=>{if(!J)return null;const t=y.filter(m=>(m.accountId??"__none__")===J),r=t.filter(m=>m.status==="holding"),a=r.reduce((m,R)=>m+v(R.currentValue,R.currency),0),C=r.reduce((m,R)=>m+v(R.purchaseAmount,R.currency),0),ee=a-C;return{list:t,holdingCount:r.length,soldCount:t.length-r.length,marketValue:a,cost:C,profit:ee,profitRate:C>0?ee/C*100:null,triggeredCount:st(r,j,q)}},[J,y,v,j,q]),Pe=n.useMemo(()=>J?c.find(t=>t.id===J):void 0,[J,c]),Mt=J==="__none__"?"未关联账户":Pe?.name??"账户",vt=n.useMemo(()=>{const t=[{key:"all",label:"全部",count:y.length,active:w==="all"}];for(const a of it)t.push({key:a,label:we[a],count:y.filter(C=>C.type===a).length,active:w===a,dotColor:Ve.investType[a].color});const r=y.filter(a=>a.isMoneyFund).length;return r>0&&t.push({key:"money",label:"货币基金",count:r,active:w==="money"}),t},[y,w]),ce=t=>c.find(r=>r.id===t)?.name,wt=t=>z.find(r=>r.id===t)?.name,ie=t=>t==null||t===0?void 0:t>0?S.gain:S.loss,Te=n.useCallback(t=>{Q(t.id),d(t),I(t.type),Y("form"),B(!0)},[]),Rt=n.useMemo(()=>{const t=(m,R,b=!0)=>m.map(l=>{const K=l.profitRate,Dt=K===void 0||K===0?void 0:K>0?S.gain:S.loss,We=R(l),ke=b?ce(l.accountId):void 0,Se=H?Ge.get(l.id):void 0,Vt=Se&&Se.state!=="synced"?e.jsx(V,{style:{color:Se.state==="delayed"?S.warning:void 0},children:Ks(Se)}):null;return{id:l.id,spineColor:We.color,spineRgb:We.rgb,title:l.name,subtitle:l.isMoneyFund?e.jsxs("span",{className:"flex flex-wrap items-center gap-1",children:[e.jsxs(V,{children:["七日年化 ",l.annualYield7d===void 0?"--":`${l.annualYield7d}%`]}),ke?e.jsx(V,{children:ke}):null,l.memberId?e.jsx(et,{ids:[l.memberId],members:z}):null,l.isForRetirement?e.jsx(V,{children:"养老"}):null]}):e.jsxs("span",{className:"flex flex-col gap-0.5 min-w-0",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-1 min-w-0",children:[Vt,l.code?e.jsx(V,{children:l.code}):null,K!==void 0?e.jsxs(V,{style:{color:Dt},children:[K>=0?"+":"",K.toFixed(2),"%"]}):null,ke?e.jsx(V,{children:ke}):null,l.memberId?e.jsx(et,{ids:[l.memberId],members:z}):null,l.costPrice!==void 0?e.jsxs(V,{className:"hidden xl:inline-flex",children:["成本 ",l.costPrice]}):null,l.type==="bond"&&l.maturityDate?e.jsxs(V,{className:"hidden xl:inline-flex",children:[l.maturityDate," 到期"]}):null,l.type==="bond"&&l.interestRate!==void 0?e.jsxs(V,{className:"hidden xl:inline-flex",children:["票面 ",l.interestRate,"%"]}):null,l.status==="sold"?e.jsx(V,{className:"hidden xl:inline-flex",children:"已清仓"}):null,l.isForRetirement?e.jsx(V,{className:"hidden xl:inline-flex",children:"养老"}):null]}),e.jsxs("span",{className:"xl:hidden flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[11px] leading-4 min-w-0",children:[l.costPrice!==void 0?e.jsxs("span",{children:["成本 ",l.costPrice]}):null,l.type==="bond"&&l.maturityDate?e.jsxs("span",{children:[l.maturityDate," 到期"]}):null,l.type==="bond"&&l.interestRate!==void 0?e.jsxs("span",{children:["票面 ",l.interestRate,"%"]}):null,l.status==="sold"?e.jsx("span",{children:"已清仓"}):null,l.isForRetirement?e.jsx("span",{children:"养老"}):null]})]}),value:l.isMoneyFund?p(l.currentValue,l.currency):e.jsxs("span",{className:"block leading-4",children:[p(l.currentValue,l.currency),l.profit===void 0?null:e.jsxs("span",{className:"mt-0.5 block text-[12px] tabular-nums",style:{color:ie(l.profit)},children:[l.profit>=0?"+":"-",p(Math.abs(l.profit),l.currency)]})]}),states:(()=>{const Fe=[];return l.status==="sold"&&Fe.push("sold"),rt(l,j,q).triggered&&Fe.push("triggered"),Fe.length>0?Fe:void 0})(),quickActions:[{key:"edit",icon:e.jsx(Xe,{}),label:"编辑",onClick:()=>Te(l)},...l.status==="holding"?[{key:"sell",icon:e.jsx(ts,{}),label:"清仓",onClick:()=>je(l)}]:[]]}}),r=m=>p(m.reduce((R,b)=>R+v(b.currentValue,b.currency),0),k),a=xe??[],C=Array.from(new Set(X.map(m=>m.accountId??"__none__")));return[...a.filter(m=>C.includes(m)),...C.filter(m=>!a.includes(m))].map(m=>{const R=X.filter(K=>(K.accountId??"__none__")===m),b=m==="__none__"?void 0:c.find(K=>K.id===m),l=b?nt(b.color).color:S.active;return{key:`account:${m}`,label:b?.name??"未关联账户",count:R.length,summary:r(R),rows:t(R,()=>({color:l}),!1)}}).filter(m=>m.rows.length>0)},[X,p,c,ce,z,xe,q,j,Te,v,k,H,Ge]),Ee=n.useCallback(()=>{Q(null),d(null),I("fund"),D.resetFields(),Y("form"),B(!0)},[D]);js(()=>Ee()),n.useEffect(()=>{const t=u.state;!t||!(t.accountId||t.autoAdd||t.highlightId)||(t.accountId&&(t.autoAdd&&Ee(),D.setFieldsValue({accountId:t.accountId})),t.highlightId&&(Q(t.highlightId),Y("view"),B(!0)),i(u.pathname,{replace:!0,state:{}}))},[u.state,i,u.pathname]);const _e=n.useCallback(()=>{Y("view"),d(null),G||B(!1)},[G]),At=n.useCallback(t=>{const r={...t,type:h};!P&&!r.currency&&(r.currency=O.code),P?$(P.id,r):g(r),_e()},[P,h,g,$,O.code,_e]),Je=n.useCallback(t=>{Z(t.id),Q(null),Y("view"),B(!1)}
1,[Z]),$t=n.useCallback(async()=>{if(!re){He(!0),Ae({done:0,total:0});try{const t=await E({onProgress:Ae});_s(new Date().toISOString()),St(at()),t.attempted===0?U.info("没有需要更新的持仓(债券与货币基金没有行情源)"):t.staleNames.length>0?U.warning(`有 ${t.staleNames.length} 条仍是旧行情:${Us(t.staleNames)}`):U.success(`行情已更新 ${t.updated} 条`)}catch{U.error("行情更新失败")}finally{He(!1),Ae({done:0,total:0})}}},[E,re]),Pt=n.useCallback(t=>Re(t),[]),Tt=n.useCallback(t=>{const r=t.replace(/^account:/,"");Ce(r),Q(null),Y("view"),B(!0)},[]),Et=n.useCallback(t=>{const r=t.map(a=>a.replace(/^account:/,"")).filter(a=>a!=="__none__");pe("fund",r).catch(()=>U.error("账户排序保存失败"))},[pe]),_t=n.useCallback(()=>{const t=Ms(X,{accountName:a=>ce(a)??void 0}),r=new Blob(["\uFEFF"+t],{type:"text/csv;charset=utf-8;"});ss.saveAs(r,`证券清单_${new Date().toISOString().slice(0,10)}.csv`)},[X,ce]),Lt=t=>{$(t.id,{ignoreMoneyFundAlert:!t.ignoreMoneyFundAlert}),U.success(t.ignoreMoneyFundAlert?"已取消忽略收益率提醒":"已忽略收益率提醒")},Ne=t=>{const r=rt(t,j,q);return{hasContent:r.hasContent,triggered:r.triggered,triggeredLines:r.triggeredLines.length,hasPlan:r.hasPlan,alertCount:r.alertCount}};return e.jsxs(ls,{motif:"securities",fill:!0,children:[e.jsx(ns,{backTo:"/assets/invest",title:"证券持仓",subtitle:`${T.holdingCount} 笔在持 · 市值 ${p(T.marketValue,k)} · 累计盈亏 ${p(T.profit,k)}`,icon:e.jsx($s,{}),actions:[{key:"refresh",label:re&&oe.total>0?`更新中 ${oe.done}/${oe.total}`:re?"更新中…":"更新行情",icon:e.jsx(Rs,{}),disabled:re,onClick:()=>{$t()}},{key:"strategy",label:$e>0?`策略中心 · 待处理 ${$e}`:"策略中心",icon:e.jsx(Ut,{}),onClick:()=>i($e>0?`${De.strategy}?segment=triggered`:De.strategy)},{key:"import",label:"导入基金",icon:e.jsx(vs,{}),onClick:()=>qe(!0)},{key:"export",label:"导出 CSV",icon:e.jsx(As,{}),onClick:_t},{key:"create",label:"新增持仓",icon:e.jsx(Gt,{}),primary:!0,onClick:Ee}]}),e.jsx(rs,{items:[{key:"value",label:`持仓市值 (${k})`,value:p(T.marketValue,k),hint:"所有在持的基金 / 股票 / 债券按当前汇率折算主币求和,不随上方筛选变化"},{key:"profit",label:`累计盈亏 (${k})`,value:e.jsxs("span",{style:{color:ie(T.profit)},children:[T.profit>=0?"+":"-",p(Math.abs(T.profit),k)]}),hint:"当前市值合计 − 买入本金合计"},{key:"rate",label:"总收益率",value:T.profitRate===null?"--":`${T.profitRate.toFixed(2)}%`,hint:"按本金加权(总盈亏 ÷ 总本金),不是各笔收益率的算术平均——算术平均会被小仓位的高收益率严重拉高"},{key:"count",label:"在持 / 已清仓",value:`${T.holdingCount} / ${T.soldCount}`,hint:"已清仓的条目保留在列表中,可查看卖出记录"},...T.moneyFundYield!==null?[{key:"moneyYield",label:"货基七日年化 (加权)",value:`${T.moneyFundYield.toFixed(2)}%`,hint:"货币基金按当前市值加权,不是各笔七日年化的算术平均——小余额产品的高收益率不会拉高整体"}]:[]]}),e.jsxs(os,{search:{value:M,onChange:F,placeholder:"搜索名称 / 代码 / 备注"},chips:vt,onChip:Pt,children:[Ft?e.jsxs("span",{className:"text-[13px] tabular-nums text-console-muted",children:["筛选出 ",X.length," 笔 · ",p(It,k)]}):null,re&&oe.total>0?e.jsxs("span",{className:"text-[13px] tabular-nums text-console-muted",children:["正在更新行情 ",oe.done,"/",oe.total]}):Qe?e.jsxs("span",{className:"text-[13px] tabular-nums text-console-muted",children:["行情更新于 ",Qe]}):null,e.jsx(Qt,{placement:"bottom",title:"服务端定时拉取:基金净值每晚 20:30,21:30 再兜底一次(QDII / FOF 披露更晚);货币基金七日年化 20:40(当日数据要等结转完成,16:00 后才出);股票收盘后 15:05。上面的「更新行情」是手动即时刷新,平时不必每天点。",children:e.jsx("span",{role:"img","aria-label":"行情自动更新节奏:基金每晚 20:30、21:30,货基七日年化 20:40,股票 15:05",className:"inline-flex cursor-help items-center text-console-muted",children:e.jsx(Ps,{})})}),le.total>0?e.jsxs("button",{type:"button",onClick:()=>kt(t=>!t),"aria-pressed":H,title:`延迟 ${le.delayed} 条(超出该条披露节律的容忍度:普通品种 1 个交易日,QDII / FOF 3 个交易日)· 从未同步 ${le.none} 条(有代码但取不到行情)|点击${H?"取消筛选":"只看这几条"}`,className:H?"inline-flex items-center gap-1 rounded-full bg-console-accent-soft px-2.5 py-1 text-[13px] font-medium text-console-accent-strong transition-colors":"inline-flex items-center gap-1 rounded-full border border-console-border px-2.5 py-1 text-[13px] transition-colors hover:bg-console-surface-tint",style:H?void 0:{color:S.warning},children:["行情待更新 ",le.total," 条",H?e.jsx(Jt,{}):null]}):null,e.jsxs("label",{className:"flex items-center gap-1.5 text-[13px] text-console-muted",children:[e.jsx("span",{children:"排序"}),e.jsx(me,{size:"small",value:ge,onChange:yt,options:Os,className:"w-28"})]})]}),e.jsxs("div",{className:"flex gap-3 lg:flex-1 lg:min-h-0",children:[e.jsx("aside",{className:`min-w-0 flex-1 rounded-console border border-console-border bg-console-surface transition-opacity ${is} lg:self-start lg:overflow-y-auto lg:max-h-full ${fe==="form"?"pointer-events-none opacity-60":""} ${Oe?"hidden lg:block":""}`,children:e.jsx(as,{groups:Rt,selectedId:G,onSelect:t=>{Q(t),Ce(null),Y("view"),B(!0)},onGroupSelect:Tt,selectedGroupKey:J?`account:${J}`:null,groupDraggable:!0,onGroupReorder:Et,collapsible:!0,empty:e.jsx(ve,{description:y.length===0?"还没有持仓,点击右上角「新增持仓」"
1:"没有匹配的持仓",image:ve.PRESENTED_IMAGE_SIMPLE})})}),e.jsx("div",{className:`min-w-0 flex-1 lg:h-full lg:overflow-hidden ${Oe?"":"hidden lg:block"}`,children:fe==="form"?e.jsx(Ie,{accentColor:"var(--console-accent)",title:P?`编辑${we[h]}`:"新增持仓",subtitle:P?P.name:"选择品种后填写",actions:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>D.submit(),className:cs,children:"保存"}),e.jsx("button",{type:"button",onClick:()=>_e(),className:de,children:"取消"}),P?e.jsx(ot,{title:"确定删除这条持仓吗?",okText:"删除",cancelText:"取消",okButtonProps:{danger:!0},onConfirm:()=>Je(P),children:e.jsx("button",{type:"button",className:tt,children:"删除"})}):null]}),children:e.jsx("div",{className:"console-pane-form",onKeyDown:ae,children:e.jsx(Ds,{bare:!0,open:!0,form:D,type:h,leading:e.jsx(Ts,{value:h,onChange:t=>I(t),options:it.map(t=>({label:we[t],value:t}))}),initialValues:P??void 0,onSave:At,onCancel:()=>{Y("view"),d(null)}})})}):A?e.jsx(Ie,{accentColor:Pe?nt(Pe.color).color:"var(--console-accent)",title:Mt,subtitle:`该账户下 ${A.list.length} 笔持仓`,onClose:()=>{Ce(null),B(!1)},children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[{label:`持仓市值 (${k})`,value:p(A.marketValue,k),color:void 0,hint:"仅计在持条目,按当前汇率折算主币"},{label:`累计盈亏 (${k})`,value:`${A.profit>=0?"+":"-"}${p(Math.abs(A.profit),k)}`,color:ie(A.profit),hint:"在持市值合计 − 买入本金合计"},{label:"总收益率",value:A.profitRate===null?"--":`${A.profitRate.toFixed(2)}%`,color:ie(A.profitRate??void 0),hint:"按本金加权(总盈亏 ÷ 总本金),不是各笔收益率的算术平均"},{label:"在持 / 已清仓",value:`${A.holdingCount} / ${A.soldCount}`,color:void 0,hint:"已清仓条目保留在该账户下"}].map(t=>e.jsxs("div",{className:"rounded-console border border-console-border bg-console-surface-tint px-3 py-2",title:t.hint,children:[e.jsx("div",{className:"text-[12px] text-console-muted",children:t.label}),e.jsx("div",{className:"text-[16px] leading-6 tabular-nums text-console-ink",style:{color:t.color},children:t.value})]},t.label))}),A.triggeredCount>0?e.jsxs("div",{className:"flex items-center gap-1.5 rounded-console border px-3 py-2 text-[13px]",style:{borderColor:S.danger,color:S.danger,backgroundColor:"rgba(220,38,38,0.06)"},children:[e.jsx("span",{className:"h-[6px] w-[6px] animate-pulse rounded-full",style:{backgroundColor:S.danger},"aria-hidden":!0}),e.jsxs("span",{children:[A.triggeredCount," 笔持仓已触发预警线"]}),e.jsx("button",{type:"button",className:"ml-auto underline underline-offset-2",onClick:()=>i(`${De.strategy}?segment=triggered`),children:"去处理"})]}):null,e.jsxs("div",{className:"border-t border-console-border pt-2",children:[e.jsx("div",{className:"mb-1 text-[12px] text-console-muted",children:"该账户持仓"}),e.jsx("div",{className:"flex flex-col",children:A.list.map(t=>{const r=Ne(t);return e.jsxs("button",{type:"button",onClick:()=>{Ce(null),Q(t.id),Y("view")},className:"flex items-center gap-2 rounded-console-sm px-2 py-1.5 text-left transition-colors hover:bg-console-surface-tint",children:[e.jsx("span",{className:"h-4 w-[3px] shrink-0 rounded-full",style:{backgroundColor:Ve.investType[t.type].color},"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-console-ink",children:t.name}),r.triggered?e.jsx("span",{className:"h-[6px] w-[6px] shrink-0 animate-pulse rounded-full",style:{backgroundColor:S.danger},"aria-hidden":!0}):null,t.status==="sold"?e.jsx("span",{className:"shrink-0 text-[12px] text-console-muted",children:"已清仓"}):null,e.jsx("span",{className:"shrink-0 text-[13px] tabular-nums text-console-ink",children:p(t.currentValue,t.currency)})]},t.id)})})]})]})}):s?e.jsx(Ie,{accentColor:Ve.investType[s.type].color,title:s.name,subtitle:`${we[s.type]}${s.code?` · ${s.code}`:""}`,badge:s.status==="sold"?e.jsx(W,{tone:"neutral",children:"已清仓"}):s.isMoneyFund&&!s.ignoreMoneyFundAlert&&(s.annualYield7d??0)<j?e.jsx(W,{tone:"danger",title:`七日年化 ${s.annualYield7d}% 低于提醒阈值 ${j}%`,children:"收益率偏低"}):e.jsx(W,{tone:"success",children:"持仓中"}),onClose:()=>B(!1),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>Te(s),className:de,children:[e.jsx(Xe,{}),e.jsx("span",{children:"编辑"})]}),s.status==="holding"?e.jsx("button",{type:"button",onClick:()=>je(s),className:de,children:e.jsx("span",{children:"清仓"})}
1):null,s.isMoneyFund?e.jsx("button",{type:"button",onClick:()=>Lt(s),className:Ne(s).triggered&&!s.ignoreMoneyFundAlert?"inline-flex items-center gap-1.5 rounded-console-sm border px-2.5 py-1 text-[13px] transition-colors":de,style:Ne(s).triggered&&!s.ignoreMoneyFundAlert?{borderColor:S.danger,color:S.danger,backgroundColor:"rgba(220,38,38,0.06)"}:void 0,title:s.ignoreMoneyFundAlert?"已忽略全局收益率提醒,点此恢复":`七日年化低于 ${j}% 时提醒,点此忽略该基金`,children:s.ignoreMoneyFundAlert?"取消忽略":"忽略提醒"}):(()=>{const t=Ne(s);return t.triggered?e.jsxs("button",{type:"button",onClick:()=>ye(s.id),className:"inline-flex items-center gap-1.5 rounded-console-sm border px-2.5 py-1 text-[13px] transition-colors",style:{borderColor:S.danger,color:S.danger,backgroundColor:"rgba(220,38,38,0.06)"},title:t.triggeredLines>0?`已触发 ${t.triggeredLines} 条预警线`:"已触发七日年化提醒",children:[e.jsx("span",{className:"h-[6px] w-[6px] animate-pulse rounded-full",style:{backgroundColor:S.danger},"aria-hidden":!0}),e.jsxs("span",{children:["操作计划",t.triggeredLines>0?` · 触发 ${t.triggeredLines}`:" · 待处理"]})]}):t.hasContent?e.jsxs("button",{type:"button",onClick:()=>ye(s.id),className:"inline-flex items-center gap-1.5 rounded-console-sm border px-2.5 py-1 text-[13px] transition-colors",style:{borderColor:"var(--console-accent)",color:"var(--console-accent)",backgroundColor:"rgba(79,70,229,0.06)"},title:`已配置${t.hasPlan?"操作计划":""}${t.hasPlan&&t.alertCount>0?"与":""}${t.alertCount>0?`${t.alertCount} 条预警线`:""}`,children:[e.jsx("span",{className:"h-[6px] w-[6px] rounded-full",style:{backgroundColor:"var(--console-accent)"},"aria-hidden":!0}),e.jsx("span",{children:"操作计划 · 已配置"})]}):e.jsx("button",{type:"button",onClick:()=>ye(s.id),className:de,title:"尚未配置操作计划与预警线",children:e.jsx("span",{className:"text-console-muted",children:"操作计划 · 未配置"})})})(),e.jsx("span",{className:"mx-0.5 h-4 w-px shrink-0 self-center bg-console-border","aria-hidden":!0}),e.jsx(ot,{title:"确定删除这条持仓吗?",okText:"删除",cancelText:"取消",okButtonProps:{danger:!0},onConfirm:()=>Je(s),children:e.jsxs("button",{type:"button",className:tt,children:[e.jsx(Es,{}),e.jsx("span",{children:"删除"})]})})]}),children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-3",children:[e.jsxs("div",{className:"sm:flex-1",children:[e.jsx("div",{className:"text-[12px] text-console-muted",children:"当前市值"}),e.jsx("div",{className:"text-[22px] leading-7 tabular-nums text-console-ink",children:p(s.currentValue,s.currency)}),s.currency!==k?e.jsxs("div",{className:"mt-0.5 text-[12px] text-console-muted",children:["≈ ",p(v(s.currentValue,s.currency),k)]}):null]}),e.jsxs("div",{className:"rounded-console border border-console-border bg-console-surface-tint px-3 py-2 sm:w-[42%] sm:max-w-[300px] sm:flex-none",children:[e.jsx("div",{className:"text-[12px] text-console-muted",children:"累计盈亏"}),e.jsxs("div",{className:"text-[18px] leading-6 tabular-nums",style:{color:ie(s.profit)},children:[s.profit===void 0?"--":`${s.profit>=0?"+":"-"}${p(Math.abs(s.profit),s.currency)}`,s.profitRate===void 0?null:e.jsxs("span",{className:"ml-1.5 text-[13px]",children:[s.profitRate>=0?"+":"",s.profitRate.toFixed(2),"%"]})]})]})]}),e.jsxs("div",{className:"border-t border-console-border pt-1 sm:grid sm:grid-cols-2 sm:gap-x-6",children:[e.jsx(f,{label:"买入本金",children:p(s.purchaseAmount,s.currency)}),s.costPrice!==void 0?e.jsx(f,{label:"成本价",children:s.costPrice}):null,s.shares!==void 0?e.jsx(f,{label:"持仓份额",children:s.shares}
1):null,s.currentPrice!==void 0?e.jsx(f,{label:"现价 / 净值",children:s.currentPrice}):null,e.jsx(f,{label:"建仓日期",children:s.purchaseDate||"--"}),s.type==="stock"&&s.exchangeCode?e.jsx(f,{label:"交易所",children:qs[s.exchangeCode]??s.exchangeCode}):null,s.type==="fund"&&s.fundType?e.jsx(f,{label:"基金类型",children:s.fundType}):null,s.type==="fund"&&!s.isMoneyFund?e.jsx(f,{label:"流动性分级",children:s.liquidityTier?Hs[s.liquidityTier]:e.jsx("span",{className:"text-console-muted",children:"未标注(不计入速动资产)"})}):null,s.isMoneyFund?e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"七日年化",children:s.annualYield7d===void 0?"--":e.jsxs("span",{className:"flex flex-wrap items-baseline gap-1.5",children:[e.jsxs("span",{children:[s.annualYield7d,"%"]}),e.jsx("span",{className:"text-[12px] text-console-muted",children:Wt(zt(s),Zt(s))})]})}),e.jsxs(f,{label:"全局提醒阈值",children:[j,"%"]}),e.jsx(f,{label:"收益率提醒",children:s.ignoreMoneyFundAlert?e.jsx("span",{className:"text-console-muted",children:"已忽略"}):(s.annualYield7d??0)<j?e.jsx("span",{style:{color:S.danger},children:"低于阈值,待处理"}):e.jsx("span",{children:"正常"})})]}):null,s.type==="bond"?e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"到期日",children:s.maturityDate||"--"}),e.jsx(f,{label:"票面利率",children:s.interestRate===void 0?"--":`${s.interestRate}%`}),e.jsx(f,{label:"付息方式",children:s.interestPayment?Bs[s.interestPayment]??s.interestPayment:"--"}),e.jsx(f,{label:"应计利息",children:s.accruedInterest===void 0?"--":p(s.accruedInterest,s.currency)})]}):null,e.jsx(f,{label:"关联账户",children:ce(s.accountId)||"--"}),e.jsx(f,{label:"归属成员",children:wt(s.memberId)||"--"}),e.jsx(f,{label:"币种",children:s.currency||k}),Xt(s)?e.jsx(f,{label:"行情状态",children:es(ze(s))}):s.currentPriceDate?e.jsx(f,{label:"行情日期",children:s.currentPriceDate}):null,e.jsx(f,{label:"归入养老钱包",children:s.isForRetirement?"是":"否"}),s.status==="sold"?e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"清仓日期",children:s.soldDate||"--"}),e.jsx(f,{label:"清仓金额",children:s.soldValue===void 0?"--":p(s.soldValue,s.currency)})]}):null,e.jsx(f,{label:"备注",className:"sm:col-span-2",children:s.notes||"--"})]}),e.jsxs("div",{className:"border-t border-console-border pt-3",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-[13px] font-medium text-console-ink",children:"策略配置"}),s.isMoneyFund?s.ignoreMoneyFundAlert?e.jsx(W,{tone:"neutral",children:"已忽略提醒"}):(s.annualYield7d??0)<j?e.jsx(W,{tone:"danger",children:"收益率偏低"}):e.jsx(W,{tone:"success",children:"正常"}):(()=>{const t=ds(s,q).length,r=!!s.operationPlan?.trim()||!!s.alertLines?.length;return t>0?e.jsxs(W,{tone:"danger",children:["触发 ",t," 条"]}):r?e.jsx(W,{tone:"success",children:"未触发"}):e.jsx(W,{tone:"neutral",children:"未配置"})})()]}),s.isMoneyFund?e.jsxs("p",{className:"text-[12px] leading-5 text-console-muted",children:["货币基金不开放单只预警线,仅受全局七日年化阈值(",j,"%)约束。",s.ignoreMoneyFundAlert?" 当前已忽略提醒。":(s.annualYield7d??0)<j?` 当前七日年化 ${s.annualYield7d??"--"}%,低于阈值,待处理。`:` 当前七日年化 ${s.annualYield7d??"--"}%,正常。`]}):!s.operationPlan?.trim()&&!s.alertLines?.length?e.jsx("p",{className:"text-[12px] text-console-muted",children:"尚未配置操作计划与预警线。"}):e.jsxs("div",{className:"flex flex-col gap-3",children:[s.operationPlan?.trim()?e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-[12px] text-console-muted",children:"操作计划"}),e.jsx("div",{className:"max-h-[240px] overflow-y-auto whitespace-pre-wrap rounded-console border border-console-border bg-console-surface px-3 py-2 text-[13px] leading-5 text-console-ink",children:s.operationPlan})]}):null,s.alertLines&&s.alertLines.length>0?e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 text-[12px] text-console-muted",children:["预警线(",s.alertLines.length,")"]}),e.jsx("ul",{className:"flex flex-col gap-2",children:s.alertLines.map(t=>{const r=us(t),a=ms(s,t,q),C=xs(s,t,q),ee=C===null?"数据不足":`${C.toFixed(ps[r])}${lt[r]}`;return e.jsxs("li",{className:`rounded-console border px-3 py-2${a?"":" border-console-border"}`,style:a?{borderColor:S.danger,backgroundColor:"rgba(220,38,38,0.05)",borderLeftWidth:3}:void 0,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"text-[13px] font-medium text-console-ink",children:[hs[t.type],e.jsxs("span",{className:"ml-1 font-normal text-console-muted",children:[fs[r]," ",gs[t.condition]," ",t.value,lt[r]]})]}),e.jsx("span",{className:"shrink-0 text-[12px] font-medium",style:a?{c
1olor:S.danger}:void 0,children:a?"已触发":"未触发"})]}),e.jsxs("div",{className:"mt-1 text-[12px] text-console-muted",children:["当前:",e.jsx("span",{className:"tabular-nums text-console-ink",children:ee}),t.actionHint?` · 操作:${t.actionHint}`:""]})]},t.id)})})]}):null]})]})]})}):e.jsx(Ie,{accentColor:"var(--console-accent)",title:"证券持仓",onClose:()=>B(!1),empty:e.jsx(ve,{description:"从左侧选择一条持仓查看明细,或点击「新增持仓」",image:ve.PRESENTED_IMAGE_SIMPLE})})})]}),e.jsx(Vs,{open:!!be,investment:be,onCancel:()=>je(null),onConfirm:(t,r)=>{be&&se(be.id,t,r),je(null)}}),e.jsx(Ys,{open:!!Be,investmentId:Be,onClose:()=>ye(null)}),e.jsx(ws,{open:Ct,onClose:()=>qe(!1),onSuccess:async()=>{U.success("导入完成,正在刷新数据…");try{await o()}catch(t){console.error("导入后刷新失败:",t)}}})]})};export{Bl as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.