@lumyne/omni-desktop-app 0.1.16 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/assets/{CartesianChart-CGNvk6St.js → CartesianChart-aa0EJ6w3.js} +1 -1
- package/app/assets/{CollaborationWorkspace-YQKm5DVb.js → CollaborationWorkspace-mIgLrpSm.js} +1 -1
- package/app/assets/{CompetitorAnalysis-BGZeiXTW.js → CompetitorAnalysis-Ct6wLjw6.js} +1 -1
- package/app/assets/EmptyState-CpQOdGYD.js +1 -0
- package/app/assets/{ErrorBarContext-BRHs6mfT.js → ErrorBarContext-BeuyujN4.js} +1 -1
- package/app/assets/{EvidenceSourceGuide-ByFna5T0.js → EvidenceSourceGuide-BeBcvVcI.js} +1 -1
- package/app/assets/{FavoritePicker-DLuTORpI.js → FavoritePicker-LfvebaXO.js} +1 -1
- package/app/assets/{Favorites-BL-1v7QD.js → Favorites-C6Xd2Vyz.js} +1 -1
- package/app/assets/{HelpTip-DaIyNCfF.js → HelpTip-BfrAVfV_.js} +1 -1
- package/app/assets/{LineChart-Dg6rxQct.js → LineChart-tppycNHl.js} +1 -1
- package/app/assets/{Opportunities-Dw5CnA2W.js → Opportunities-BfmikZ5o.js} +1 -1
- package/app/assets/{ProgressiveRows-DfUZC_6R.js → ProgressiveRows-CNmxc71t.js} +1 -1
- package/app/assets/{ShopLayoutPage-AkChJyxu.js → ShopLayoutPage-B943t2t1.js} +1 -1
- package/app/assets/{TrendChart-DURd5oGd.js → TrendChart-Doe6C5Aa.js} +1 -1
- package/app/assets/arrow-down-Dm8ejo47.js +1 -0
- package/app/assets/arrow-left-CrtjcWhu.js +1 -0
- package/app/assets/arrow-up-right-FAUwydEi.js +1 -0
- package/app/assets/{book-open-Bce54GC0.js → book-open-BHnwW_0N.js} +1 -1
- package/app/assets/{calendar-days-A-WQG43X.js → calendar-days-DQXKth-z.js} +1 -1
- package/app/assets/{chart-column-DueDyWTO.js → chart-column-B3ugUaKH.js} +1 -1
- package/app/assets/{chart-no-axes-combined-0SqHx_x6.js → chart-no-axes-combined-DbjiVuVa.js} +1 -1
- package/app/assets/check-B7m80-Hk.js +1 -0
- package/app/assets/chevron-down-9e3l9_Db.js +1 -0
- package/app/assets/chevron-right-DyOe1NsY.js +1 -0
- package/app/assets/{clock-3-BpHSopJF.js → clock-3-TXgD8tS6.js} +1 -1
- package/app/assets/{components-HGHI0_0I.js → components-DMbkJLkK.js} +2 -2
- package/app/assets/{download-Dsft-5wR.js → download-BMipQ3n8.js} +1 -1
- package/app/assets/entry-C4p4TKbJ.js +1 -0
- package/app/assets/{entry-TXFczQeM.js → entry-CGu91Jpg.js} +2 -2
- package/app/assets/{entry-CJFtoBLa.js → entry-CeW_5ZGi.js} +1 -1
- package/app/assets/{entry-CNxdnf29.js → entry-Cxj3NkyT.js} +3 -3
- package/app/assets/{entry-CZo_9EKi.js → entry-DcwBlAO0.js} +2 -2
- package/app/assets/{entry-DQEAnjCp.js → entry-aDwWfs__.js} +1 -1
- package/app/assets/{favorites.module-D06hxuat.js → favorites.module-CaTR2ido.js} +1 -1
- package/app/assets/{file-text-BpkjdOot.js → file-text-D6meDmAz.js} +1 -1
- package/app/assets/{getRadiusAndStrokeWidthFromDot-BX82bq7e.js → getRadiusAndStrokeWidthFromDot-zEte6bM_.js} +1 -1
- package/app/assets/{grid-2x2-Cb1v7yqK.js → grid-2x2-sRKLAhuD.js} +1 -1
- package/app/assets/{index-CShNDEcL.js → index-Dfy2jMWq.js} +2 -2
- package/app/assets/{layers-C4KI3Uxn.js → layers-B4gCFnEm.js} +1 -1
- package/app/assets/{layout-dashboard-CTmjmcDE.js → layout-dashboard-C54_ZKS5.js} +1 -1
- package/app/assets/{link-2-BrR_cwPw.js → link-2-CC7rgyRC.js} +1 -1
- package/app/assets/{list-Djz-XKts.js → list-DI2UZ46g.js} +1 -1
- package/app/assets/{module-host-rk0glcaW.js → module-host-BIy_fI1T.js} +1 -1
- package/app/assets/{orbit-Bw_YF8Ru.js → orbit-tMF8WRbG.js} +1 -1
- package/app/assets/{package-b8jiLApm.js → package-rnaOiBPn.js} +1 -1
- package/app/assets/play-DjZ3mG-r.js +1 -0
- package/app/assets/plus-_W4OFi32.js +1 -0
- package/app/assets/{products-DTLdF8-b.js → products-6S_LnOq6.js} +1 -1
- package/app/assets/{project-public-DQMVYsEz.js → project-public-B9DNEfwS.js} +1 -1
- package/app/assets/{project-public-CnKWSlv4.js → project-public-DN0-E_G2.js} +1 -1
- package/app/assets/public-Csb687JC.js +1 -0
- package/app/assets/{refresh-cw-BwEoF6sI.js → refresh-cw-CiIEylYp.js} +1 -1
- package/app/assets/search-DlLds8Ae.js +1 -0
- package/app/assets/{star-CjnKtEU7.js → star-CcsEzP_q.js} +1 -1
- package/app/assets/trending-up-CWfLLrC6.js +1 -0
- package/app/assets/{triangle-alert-3SxL0RNM.js → triangle-alert-CEMUxCrJ.js} +1 -1
- package/app/assets/{ui-public-4hoRHIFG.js → ui-public-DVwBGbKN.js} +1 -1
- package/app/assets/{workbench-DRbHsOSr.js → workbench-jvMSCBRw.js} +2 -2
- package/app/assets/{workspace-view-state-DRhGUGLj.js → workspace-view-state-BuK4-c0r.js} +1 -1
- package/app/desktop/main.mjs +10 -9
- package/app/index.html +1 -1
- package/app/tools/bootstrap.bin +0 -0
- package/package.json +1 -1
- package/release.json +1 -1
- package/release.sig +1 -1
- package/app/assets/EmptyState-BrzYB6Fm.js +0 -1
- package/app/assets/arrow-down-f54IiPCV.js +0 -1
- package/app/assets/arrow-left-D6ZJJ6TV.js +0 -1
- package/app/assets/arrow-up-right-D1eLXOum.js +0 -1
- package/app/assets/check-DpavxwQP.js +0 -1
- package/app/assets/chevron-down-DjHGm5jP.js +0 -1
- package/app/assets/chevron-right-D8cbEJBE.js +0 -1
- package/app/assets/entry-bIaBkZxY.js +0 -1
- package/app/assets/play-eKkJOouQ.js +0 -1
- package/app/assets/plus-CuQU-dIh.js +0 -1
- package/app/assets/public-D27wclc8.js +0 -1
- package/app/assets/search-BDEOXxcW.js +0 -1
- package/app/assets/trending-up-BPVwzUjj.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./orbit-Bw_YF8Ru.js";import{t as n}from"./arrow-left-D6ZJJ6TV.js";import{n as r}from"./clock-3-BpHSopJF.js";import{t as i}from"./arrow-up-right-D1eLXOum.js";import{t as a}from"./chart-no-axes-combined-0SqHx_x6.js";import{t as o}from"./check-DpavxwQP.js";import{t as s}from"./chevron-right-D8cbEJBE.js";import{n as c,r as l,t as u}from"./ui-public-4hoRHIFG.js";import{r as d}from"./CollaborationWorkspace-YQKm5DVb.js";import{a as f,n as p,o as m,r as h}from"./products-DTLdF8-b.js";import{t as g}from"./layers-C4KI3Uxn.js";import{t as _}from"./refresh-cw-BwEoF6sI.js";import{t as v}from"./search-BDEOXxcW.js";import{c as y,h as b,l as x,v as S,x as C}from"./index-CShNDEcL.js";import{n as w}from"./module-host-rk0glcaW.js";import{n as T}from"./workspace-view-state-DRhGUGLj.js";import"./public-D27wclc8.js";import{t as E}from"./group-DIi_QccB.js";var D=b(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),O=b(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),k=b(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),A=b(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),j=C(S(),1);function M(e){return e.flatMap(e=>e.route.filter(e=>[`attention`,`review`].includes(e.state)).map(t=>({project:e,step:t})))}function N(e){return e.flatMap(e=>e.activity.map(t=>({project:e,event:t}))).sort((e,t)=>t.event.at.localeCompare(e.event.at))}var P={activity:`_activity_k9yph_1`,panel:`_panel_k9yph_1`},F=y();function I({mode:e,api:t,onOpen:n}){let i=w().archiveScope||`real`,[a,o]=(0,j.useState)([]),[s,c]=(0,j.useState)(!0),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(0),[p,m]=T(`workbench.`+e+`.search`,``);(0,j.useEffect)(()=>{let e=!0;return t(`/command-center`).then(t=>{let n=t?.projects;if(!Array.isArray(n))throw Error(`项目状态返回格式异常`);e&&(o(n.filter(e=>i===`stored-demo`?e.simulated:!e.simulated)),u(``))}).catch(t=>{e&&(o([]),u(t instanceof Error?t.message:`项目状态读取失败`))}).finally(()=>{e&&c(!1)}),()=>{e=!1}},[t,d,i]);let h=M(a),g=N(a),_=e=>e.toLowerCase().includes(p.trim().toLowerCase());return(0,F.jsxs)(`section`,{className:P.activity,children:[(0,F.jsxs)(`header`,{children:[(0,F.jsx)(`h1`,{children:e===`tasks`?`待处理事项`:`执行记录`}),(0,F.jsxs)(`label`,{children:[(0,F.jsx)(v,{size:16}),(0,F.jsx)(`input`,{"aria-label":`搜索工作台事项与记录`,value:p,onChange:e=>m(e.target.value),placeholder:`搜索项目或事项`})]})]}),l&&(0,F.jsxs)(`p`,{role:`alert`,children:[l,` `,(0,F.jsx)(`button`,{onClick:()=>{c(!0),f(e=>e+1)},children:`重试`})]}),s?(0,F.jsx)(`p`,{role:`status`,children:`正在读取项目状态…`}):(0,F.jsx)(`div`,{className:P.panel,children:e===`tasks`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`h2`,{children:[`需要你处理 · `,h.length,` 项`]}),h.filter(({project:e,step:t})=>_(e.name+t.name)).slice(0,30).map(({project:e,step:t})=>(0,F.jsxs)(`button`,{onClick:()=>n(e.id,t.target),children:[(0,F.jsxs)(`span`,{children:[(0,F.jsxs)(`b`,{children:[t.name,` · `,t.state===`attention`?`待复核`:`待确认`]}),(0,F.jsxs)(`small`,{children:[e.name,` · `,t.description]})]}),(0,F.jsx)(r,{size:16})]},e.id+t.id)),!h.length&&(0,F.jsx)(`p`,{children:l?`连接恢复后显示待处理事项。`:`当前没有待复核或待确认的阶段。`})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`h2`,{children:`项目执行与确认记录`}),g.filter(({project:e,event:t})=>_(e.name+t.name)).slice(0,50).map(({project:e,event:t},i)=>(0,F.jsxs)(`button`,{onClick:()=>n(e.id,{tab:`wiki`}),children:[(0,F.jsxs)(`span`,{children:[(0,F.jsxs)(`b`,{children:[t.name,` · `,t.state]}),(0,F.jsxs)(`small`,{children:[e.name,` · `,new Date(t.at).toLocaleString(`zh-CN`)]})]}),(0,F.jsx)(r,{size:16})]},e.id+t.at+i)),!g.length&&(0,F.jsx)(`p`,{children:l?`连接恢复后显示执行记录。`:`当前没有执行记录。`})]})})]})}async function ee(e,t,n){let r=e=>{n?.aborted||t?.(e)},i=[e(`/growth-center?view=overview`).then(e=>{let t=e;if(!Array.isArray(t?.products)||!Array.isArray(t?.catalog))throw Error(`经营资料返回格式异常`);return r({growth:t}),t}),e(`/command-center`).then(e=>{let t=e?.projects;if(!Array.isArray(t))throw Error(`项目资料返回格式异常`);return r({projects:t}),t}),l(1e4,n,e).then(e=>(r({activity:e}),e))],a=(await Promise.allSettled(i)).filter(e=>e.status===`rejected`);if(a.length)throw Error(a.map(e=>e.reason instanceof Error?e.reason.message:`资料读取失败`).join(`;`));let[o,s,c]=await Promise.all(i);return{growth:o,projects:s,activity:c}}var te={refunds:`同期支付订单的退款`,product:`货品成本`,fulfillment:`运费与履约`,platform:`平台费用`,ads:`广告花费`,tax:`税费`,other:`其他变动费用`,fixed:`固定费用分摊`};function L(e){try{let t=JSON.parse(e||`{}`);return t.version!==1||!t.orders||typeof t.orders!=`object`||Array.isArray(t.orders)?{}:Object.fromEntries(Object.entries(t.orders).slice(0,20).filter(([e,t])=>e.length<100&&Array.isArray(t)).map(([e,t])=>[e,[...new Set(t.filter(e=>typeof e==`string`&&e.length<200))].slice(0,2500)]))}catch{return{}}}function R(e,t){let n=new Set(t);return[...(e||[]).filter(e=>n.delete(e)),...t.filter(e=>n.delete(e))]}function z(e,t,n,r){let i=[...new Set([...e||[],...t])];if(!t.includes(n)||!t.includes(r)||n===r)return i;let a=i.indexOf(n),o=i.indexOf(r);return i.splice(a,1),i.splice(o,0,n),i}var B=(0,j.createContext)(null);function ne({scope:e,onDirty:t,children:n}){let r=e?`omni.dashboard-layout.v1:`+encodeURIComponent(e):null,[i]=(0,j.useState)(()=>{try{return r?L(localStorage.getItem(r)):{}}catch{return{}}}),[a,o]=T(`dashboard.layout.`+(e||`session`),i),[s,c]=(0,j.useState)(a),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(``),[p,m]=(0,j.useState)(null),h=l&&JSON.stringify(s)!==JSON.stringify(a);(0,j.useEffect)(()=>(t?.(h),()=>t?.(!1)),[h,t]);let g=()=>{u(!1),m(null)};function _(){try{r&&localStorage.setItem(r,JSON.stringify({version:1,orders:s})),o(s),g(),f(r?`布局已保存到当前账号的此台设备。`:`布局已保存,本次会话内有效。`)}catch{f(`布局保存失败,请检查本机存储后重试;当前调整仍保留。`)}}let v={editing:l,orders:s,drag:p,setDrag:m,scope:e,message:d,begin:()=>{c(a),u(!0),f(`拖动卡片左上角,或用前移、后移按钮调整顺序。`)},save:_,cancel:()=>{c(a),g(),f(`已取消本次布局修改。`)},reset:e=>{c(t=>Object.fromEntries(Object.entries(t).filter(([t])=>!e.includes(t)))),f(`当前页已恢复默认排列,点击保存后生效。`)},move:(e,t,n,r)=>{c(i=>({...i,[e]:z(i[e],t,n,r)})),f(`顺序已调整,保存后记住布局。`)}};return(0,F.jsx)(B.Provider,{value:v,children:(0,F.jsx)(`div`,{className:l?`dashboard-editing`:``,onClickCapture:e=>{l&&!e.target.closest(`[data-layout-control]`)&&(e.preventDefault(),e.stopPropagation())},children:n})})}function re({enabled:e=!0,groups:t=[]}){let n=(0,j.useContext)(B);return!n||!e&&!n.editing?null:(0,F.jsxs)(`div`,{className:`dl-toolbar`,"data-layout-control":!0,children:[(0,F.jsx)(`div`,{className:`dl-toolbar-actions`,children:n.editing?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{children:`调整卡片顺序`}),(0,F.jsxs)(`button`,{onClick:()=>n.reset(t),children:[(0,F.jsx)(k,{size:13}),`恢复默认`]}),(0,F.jsxs)(`button`,{onClick:n.cancel,children:[(0,F.jsx)(x,{size:13}),`取消`]}),(0,F.jsxs)(`button`,{className:`dl-save`,onClick:n.save,children:[(0,F.jsx)(o,{size:14}),`保存布局`]})]}):(0,F.jsxs)(`button`,{onClick:n.begin,children:[(0,F.jsx)(d,{size:14}),`编辑页面`]})}),n.message&&(0,F.jsx)(`small`,{role:`status`,children:n.message})]})}function ie({group:e,className:t=``,children:i}){let a=(0,j.useContext)(B),o=j.Children.toArray(i).filter(j.isValidElement).map((e,t)=>({id:String(e.key??t).replace(/^\.\$/,``),el:e})),s=o.map(e=>e.id),c=R(a?.orders[e],s);return(0,F.jsx)(`div`,{className:t,children:c.map((t,i)=>{let l=o.find(e=>e.id===t).el,u=l.props[`data-layout-label`]||`卡片`;return(0,j.cloneElement)(l,{key:t,"data-layout-card":t,"data-layout-group":e,className:[l.props.className,`dl-card`,a?.editing?`dl-editable`:``,a?.drag?.group===e&&a.drag.id===t?`dl-dragging`:``].filter(Boolean).join(` `),onDragOver:t=>{a?.editing&&a.drag?.group===e&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`)},onDrop:n=>{a?.editing&&a.drag?.group===e&&(n.preventDefault(),n.stopPropagation(),a.move(e,s,a.drag.id,t),a.setDrag(null))}},a?.editing?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`dl-card-controls`,"data-layout-control":!0,children:[(0,F.jsxs)(`button`,{className:`dl-grip`,"aria-label":`拖动`+u,title:`拖动调整顺序`,onPointerDown:n=>{n.button===0&&(n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture(n.pointerId),a.setDrag({group:e,id:t}))},onPointerUp:n=>{if(!n.currentTarget.hasPointerCapture(n.pointerId))return;n.currentTarget.releasePointerCapture(n.pointerId);let r=document.elementFromPoint(n.clientX,n.clientY)?.closest(`[data-layout-group]`);for(;r&&r.dataset.layoutGroup!==e;)r=r.parentElement?.closest(`[data-layout-group]`);let i=r?.dataset.layoutCard;i&&i!==t&&a.move(e,s,t,i),a.setDrag(null)},onPointerCancel:()=>a.setDrag(null),children:[(0,F.jsx)(O,{size:14}),(0,F.jsx)(`span`,{children:u})]}),(0,F.jsx)(`button`,{disabled:i===0,"aria-label":`前移`+u,title:`前移`,onClick:()=>a.move(e,s,t,c[i-1]),children:(0,F.jsx)(n,{size:13})}),(0,F.jsx)(`button`,{disabled:i===c.length-1,"aria-label":`后移`+u,title:`后移`,onClick:()=>a.move(e,s,t,c[i+1]),children:(0,F.jsx)(r,{size:13})})]}),l.props.children]}):l.props.children)})})}var V=e=>Math.round(Number(e)*100),H=e=>e.shopIds?.length===1?e.shopIds[0]:null,U=e=>e.slice().sort((e,t)=>String(t.created).localeCompare(String(e.created)));function W(e,t){let n=new Set;return U(e).filter(e=>{let r=t(e);return n.has(r)?!1:(n.add(r),!0)})}function G(e){let[t]=e;return e.length===1?t:{...t,id:`shops:`+JSON.stringify([t.mode,t.start,t.end,e.map(H).sort()]),aggregated:!0,shopIds:e.map(H),memberReports:e,scopeLabel:`${e.length} 家店铺汇总`,identity:e.map(e=>e.scopeLabel).join(`、`),total:e.reduce((e,t)=>e+V(t.total),0)/100,count:e.reduce((e,t)=>e+t.count,0),breakdown:e.flatMap(e=>e.breakdown.map(t=>({...t,name:e.scopeLabel+` · `+t.name,shopId:H(e)}))),basis:`同一统计期间的各店铺支付金额之和,不重复叠加历史账本;不扣退款。`}}function K(e,t){let n=e.filter(e=>t&&e.start===t.start&&e.end===t.end&&e.mode===t.mode&&(t.shopIds?.length?H(e)&&t.shopIds.includes(H(e)):!e.shopIds?.length&&e.project===t.project)),r=W(n.filter(e=>e.scope?.type===`item`),e=>(H(e)||e.project)+`|`+e.scope.id),i=W(n.filter(e=>e.scope?.type===`shop`),e=>H(e)||e.scope.id),a=i[0];if(t?.aggregated){let e=i.length===t.shopIds.length&&i.every(e=>e.complete),n=Object.keys(i[0]?.amounts||{});a={...t,aggregated:!0,memberReports:i,complete:e,gaps:e?[]:[`部分店铺缺少完整同期成本账本`],amounts:e?Object.fromEntries(n.map(e=>[e,i.reduce((t,n)=>t+V(n.amounts[e]),0)/100])):{},profit:e?i.reduce((e,t)=>e+V(t.profit),0)/100:null}}return{shop:a,itemBooks:r}}function q(e={},t=``){let n=W(e.sales||[],e=>H(e)?JSON.stringify([e.mode,H(e),e.start,e.end]):e.id),r=e.finance||[],i=new Map;for(let e of n){let t=H(e)?JSON.stringify([e.mode,e.start,e.end]):e.id;i.has(t)||i.set(t,[]),i.get(t).push(e)}let a=[...i.values()].map(e=>G(W(e,e=>H(e)||e.id))),o=W([...a.filter(e=>e.aggregated),...n],e=>e.id).map(e=>({...e,financeComplete:!!K(r,e).shop?.complete})),s=a[0],c=new Set(n.filter(e=>e.mode===s?.mode).map(H).filter(Boolean)),l=a.find(e=>e.mode===s?.mode&&(!c.size||e.shopIds?.length===c.size)&&K(r,e).shop?.complete)||s,u=o.find(e=>e.id===t),d=u||o.find(e=>e.id===l?.id);return{sales:o,report:d,...K(r,d),newestReport:s,automatic:!u,usingPreviousPeriod:!u&&!!d&&d.id!==s?.id}}var J=e=>typeof e==`number`?e.toLocaleString(`zh-CN`,{maximumFractionDigits:2}):`—`;function ae({metrics:n,products:r,projects:o,ready:s,onOpen:c,onNav:l,onAssign:u,demo:d,projectActivity:f}){let[p,m]=(0,j.useState)(``),[h,_]=(0,j.useState)(``),{sales:v,report:y,shop:b,itemBooks:S,newestReport:C,automatic:w,usingPreviousPeriod:T}=(0,j.useMemo)(()=>q(n,h),[n,h]),E=S.filter(e=>e.complete),O=E.filter(e=>e.profit>0),k=E.filter(e=>e.profit<0),A=E.filter(e=>e.profit===0),M=n?.incubation||[],N=M.filter(e=>e.success),P=f?.running,I=[{id:`sales`,label:`店铺销售额`,value:y?J(y.total):`暂无记录`,unit:y?`元`:``,note:y?`${y.shopIds?.length||1} 家店铺 · ${y.start} — ${y.end}`:`先归档全店销售数据`,Icon:a},{id:`profit`,label:`店铺利润`,value:b?.complete?J(b.profit):`缺成本资料`,unit:b?.complete?`元`:``,note:`已列成本口径经营结余 · 点击核对`,Icon:D},{id:`links`,label:`盈利 / 亏损链接`,value:E.length?`${O.length} / ${k.length}`:`尚未核算`,unit:E.length?`个`:``,note:`${E.length} 个有核算结果 · ${A.length} 个持平`,Icon:g},{id:`incubation`,label:`孵化晋级记录`,value:M.length?`${N.length} / ${M.length}`:`尚无记录`,unit:M.length?`个`:``,note:`已记录晋级 / 累计纳入 · 不代表成功率`,Icon:t},{id:`tasks`,label:`正在推进的任务`,value:s&&P!==void 0?P:`—`,unit:`个`,note:f?`${f.complete} 个项目已完成 · 任务看板进行中`:`正在读取项目任务`,Icon:e}],ee=I.map(e=>!s&&e.id!==`tasks`?{...e,value:`读取中`,unit:``,note:`正在读取经营资料`}:e);function L(e){if(e===`tasks`){l(`projects`);return}m(p===e?``:e)}let R=e=>d||e.aggregated?`data:application/json;charset=utf-8,`+encodeURIComponent(JSON.stringify(e,null,2)):`/api/workbench/`+e.project+`/file/`+(e.artifactId||e.id);return(0,F.jsxs)(F.Fragment,{children:[v.length>1&&(0,F.jsxs)(`div`,{className:`gb-period`,children:[(0,F.jsxs)(`label`,{children:[`销售与核算周期`,(0,F.jsxs)(`select`,{"aria-label":`销售与核算周期`,value:w?``:y?.id||``,onChange:e=>_(e.target.value),children:[(0,F.jsx)(`option`,{value:``,children:`自动选择 · 优先完整核算`}),v.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[e.scopeLabel||e.projectName,` · `,e.start,` ~ `,e.end,` · `,e.financeComplete?`成本齐全`:`成本待补齐`]},e.id))]})]}),T&&(0,F.jsxs)(`p`,{role:`status`,children:[`最新销售归档(`,C.start,` — `,C.end,`)尚未完成全部店铺的同期核算,当前展示最近完整核算周期(`,y.start,` — `,y.end,`)。`]})]}),(0,F.jsx)(ie,{group:`cockpit.kpis`,className:`gc-kpis`,children:ee.map(e=>(0,F.jsx)(`div`,{"data-layout-label":e.label,children:(0,F.jsxs)(`button`,{className:`gc-kpi gc-kpi-`+e.id+` `+(p===e.id?`is-open`:``),onClick:()=>L(e.id),"aria-expanded":p===e.id,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`gc-kpi-icon`,children:(0,F.jsx)(e.Icon,{size:21})}),(0,F.jsx)(`span`,{children:e.label}),(0,F.jsx)(i,{size:13})]}),(0,F.jsxs)(`strong`,{className:String(e.value).length>9?`gc-long-value`:``,children:[e.value,(0,F.jsx)(`small`,{children:e.unit})]}),(0,F.jsx)(`p`,{children:e.note})]},e.id)},e.id))}),p&&(0,F.jsxs)(`section`,{className:`gb-detail`,"aria-label":`经营指标明细`,children:[(0,F.jsxs)(`header`,{children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`small`,{children:d?`演示数据 · 不代表真实经营结果`:`归档数据 · 以原件日期和来源为准`}),(0,F.jsxs)(`h2`,{children:[I.find(e=>e.id===p)?.label,` · 明细与下一步`]})]}),(0,F.jsx)(`button`,{"aria-label":`关闭指标明细`,onClick:()=>m(``),children:(0,F.jsx)(x,{size:18})})]}),p===`sales`&&(0,F.jsxs)(F.Fragment,{children:[y?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{children:y.basis}),(0,F.jsxs)(`p`,{children:[`统计范围:`,y.scopeLabel,` · `,y.count,` 个链接 · `,y.identity,`。`,y.mode===`unverified`?`来源未完成独立核验。`:``]}),(0,F.jsx)(`div`,{className:`gb-table`,children:(0,F.jsxs)(`table`,{children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`商品 / 分类`}),(0,F.jsx)(`th`,{children:`支付销售额`}),(0,F.jsx)(`th`,{children:`链接数`}),(0,F.jsx)(`th`,{children:`下一步`})]})}),(0,F.jsx)(`tbody`,{children:y.breakdown.map(e=>(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{children:e.name}),(0,F.jsxs)(`td`,{children:[`¥ `,J(e.sales)]}),(0,F.jsx)(`td`,{children:e.count}),(0,F.jsx)(`td`,{children:(0,F.jsx)(`button`,{onClick:()=>e.itemId?c(e.project,{tab:`monitor`,itemId:e.itemId}):c(y.project,{tab:`data`}),children:e.itemId?`看商品表现`:`核对来源数据`})})]},e.name))})]})}),(0,F.jsx)(`p`,{className:`gb-next`,children:`下一步:先看销售贡献高的商品,再核对退款和成本,决定继续推广还是调整商品。`}),(0,F.jsx)(`a`,{href:R(y),download:d?`模拟销售账本.json`:void 0,children:`查看原始记录`})]}):(0,F.jsx)(`p`,{children:`当前没有全店销售记录。先到数据中心归档同一店铺、同一统计窗口的数据。`}),(0,F.jsx)(`button`,{onClick:()=>l(`data`),children:`进入数据中心`})]}),p===`profit`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{children:`计算:支付销售额 − 同支付订单退款 − 货品、履约、平台、广告、税费、其他费用 − 固定费用分摊。结果是已列成本口径经营结余。`}),b?.complete?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`gb-costs`,children:[Object.entries(b.amounts).map(([e,t])=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{children:e===`gross`?`支付销售额`:te[e]}),(0,F.jsxs)(`b`,{children:[`¥ `,J(t)]})]},e)),(0,F.jsxs)(`div`,{className:`gb-profit`,children:[(0,F.jsx)(`span`,{children:`经营结余`}),(0,F.jsxs)(`b`,{children:[`¥ `,J(b.profit)]})]})]}),(0,F.jsx)(`a`,{href:R(b),download:d?`模拟利润账本.json`:void 0,children:`查看核算原件`})]}):(0,F.jsxs)(`div`,{className:`gb-gap`,children:[(0,F.jsx)(`b`,{children:`当前所选周期缺少完整店铺成本账本,不能计算利润。`}),(0,F.jsx)(`p`,{children:`需要补齐:货品、运费、平台、广告、税费、其他费用、固定费用分摊,以及同支付订单退款。明确没有发生的费用填0,未知项留空。`})]}),(0,F.jsx)(`p`,{className:`gb-next`,children:`下一步:核对金额和凭证;若亏损,先查看费用占比与亏损商品,再进入商品优化评估原因。`}),(0,F.jsx)(`button`,{onClick:()=>c(b?.project||y?.project||o[0]?.id,{tab:`finance`}),disabled:!o.length,children:`打开经营核算`})]}),p===`links`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{children:`按同周期、完整成本账本判断:结余大于0为盈利,小于0为亏损,等于0为持平;缺成本的商品不计入盈亏。当前仅统计有账本的范围。`}),(0,F.jsx)(`div`,{className:`gb-table`,children:(0,F.jsxs)(`table`,{children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`商品`}),(0,F.jsx)(`th`,{children:`销售额`}),(0,F.jsx)(`th`,{children:`经营结余`}),(0,F.jsx)(`th`,{children:`状态`}),(0,F.jsx)(`th`,{children:`下一步`})]})}),(0,F.jsx)(`tbody`,{children:S.map(e=>(0,F.jsxs)(`tr`,{children:[(0,F.jsxs)(`td`,{children:[e.projectName,(0,F.jsx)(`small`,{children:e.scope.id})]}),(0,F.jsxs)(`td`,{children:[`¥ `,J(e.gross)]}),(0,F.jsx)(`td`,{children:e.complete?`¥ `+J(e.profit):`费用不全`}),(0,F.jsx)(`td`,{children:(0,F.jsx)(`span`,{className:e.profit<0?`gb-loss`:`gb-win`,children:e.complete?e.profit>0?`盈利`:e.profit<0?`亏损`:`持平`:`待核算`})}),(0,F.jsx)(`td`,{children:(0,F.jsx)(`button`,{onClick:()=>c(e.project,{tab:e.complete?`optimization`:`finance`,itemId:e.scope.id}),children:e.complete?`查看并优化`:`补齐费用`})})]},e.id))})]})}),!S.length&&(0,F.jsx)(`p`,{children:`当前所选周期没有商品成本账本,不能仅凭销售额判定盈亏。`}),(0,F.jsx)(`button`,{disabled:!o.length,onClick:()=>c(y?.project||o[0]?.id,{tab:`finance`}),children:`补充商品成本账本`})]}),p===`incubation`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{children:`这里只统计已保存的运营晋级记录与累计纳入数量,不计算经营成功率。未晋级可能仍在观察,不代表失败;每条记录需要核对标准、证据和观察时间,不能推断可复制收益。`}),(0,F.jsxs)(`div`,{className:`gb-inc-summary`,children:[(0,F.jsxs)(`b`,{children:[N.length,(0,F.jsx)(`small`,{children:`达标晋级`})]}),(0,F.jsx)(`span`,{children:`/`}),(0,F.jsxs)(`b`,{children:[M.length,(0,F.jsx)(`small`,{children:`纳入孵化`})]})]}),(0,F.jsx)(`div`,{className:`gb-table`,children:(0,F.jsxs)(`table`,{children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`商品`}),(0,F.jsx)(`th`,{children:`加入时间`}),(0,F.jsx)(`th`,{children:`结果`}),(0,F.jsx)(`th`,{children:`老师标准与依据`}),(0,F.jsx)(`th`,{children:`下一步`})]})}),(0,F.jsx)(`tbody`,{children:M.map(e=>(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{children:e.itemId}),(0,F.jsx)(`td`,{children:e.started.slice(0,10)}),(0,F.jsx)(`td`,{children:e.success?`达标晋级`:`继续观察`}),(0,F.jsxs)(`td`,{className:`gb-wrap`,children:[e.standard||`待记录老师标准`,(0,F.jsx)(`small`,{children:e.evidence||`尚无达标证据`})]}),(0,F.jsx)(`td`,{children:(0,F.jsx)(`button`,{onClick:()=>{let t=r.find(t=>t.itemId===e.itemId&&t.project===e.project);t?u(t):c(e.project,{tab:`data`})},children:e.success?`查看运营分组`:`核对并晋级`})})]},e.key))})]})}),!M.length&&(0,F.jsx)(`p`,{children:`还没有新品进入孵化的记录,暂不能评价。`}),(0,F.jsx)(`p`,{className:`gb-next`,children:`下一步:先把新品加入“新品测试”;达标后选择下一运营分组,填写老师标准与达标依据。单纯换组不计为已记录达标晋级。`}),(0,F.jsx)(`button`,{disabled:!r.length,onClick:()=>u(r.find(e=>e.tier===`unassigned`)||r[0],`test`),children:`登记新品,开始孵化`})]})]})]})}var oe=e=>Math.abs(e)>=1e4?(e/1e4).toFixed(1)+`万`:Y(e),Y=e=>typeof e==`number`?e.toLocaleString(`zh-CN`,{maximumFractionDigits:2}):`—`,se={scale:`#35dcca`,incubate:`#9880ff`,test:`#438bff`,unassigned:`var(--omni-muted,#91a9bd)`},X={scale:`重点推广`,incubate:`持续孵化`,test:`新品测试`,unassigned:`待分组`},Z=[{id:`business`,label:`经营分析`,note:`查看商品经营趋势、销售构成和运营分组。`},{id:`projects`,label:`项目总览`,note:`全局看进度,卡片看状态,进入节点主流程继续推进。`},{id:`tasks`,label:`待办与任务`,note:`集中查看运营任务、巡店提醒和需要你处理的事项。`},{id:`history`,label:`复盘动态`,note:`回看项目阶段与历史记录,核对过程和依据。`}],ce={done:`已确认`,review:`待确认`,attention:`需处理`,todo:`未开始`,stopped:`已停止`};function Q({title:e,sub:t,children:n}){return(0,F.jsxs)(`div`,{className:`gc-panel-head`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h2`,{children:[(0,F.jsx)(`span`,{}),` `,e]}),(0,F.jsx)(`small`,{children:t})]}),n]})}function le({series:e,days:t,onOpen:n}){let[r,o]=(0,j.useState)(null),s=e?.points||[],c=Date.parse(s.at(-1)?.date)-(t-1)*864e5,l=s.filter(e=>Date.parse(e.date)>=c),u=l.filter(e=>e.value!==null).map(e=>e.value);if(!u.length)return(0,F.jsxs)(`div`,{className:`gc-chart-empty`,children:[(0,F.jsx)(a,{size:38}),(0,F.jsx)(`b`,{children:`这段时间还没有可用数据`}),(0,F.jsx)(`span`,{children:`进入商品监控,查看数据来源与日期`}),(0,F.jsxs)(`button`,{onClick:n,children:[`查看商品监控 `,(0,F.jsx)(i,{size:13})]})]});let d=Math.min(0,...u),f=Math.max(1,...u)-d,p=e=>54+(Date.parse(e.date)-c)/(Math.max(1,t-1)*864e5)*690,m=e=>220-(e-d)/f*180,h=null,g=[];return l.forEach(e=>{if(e.value===null){h=null;return}h&&Date.parse(e.date)-Date.parse(h.date)===864e5&&g.push((0,F.jsx)(`line`,{x1:p(h),y1:m(h.value),x2:p(e),y2:m(e.value)},e.date)),h=e}),(0,F.jsxs)(`div`,{className:`gc-chart`,children:[(0,F.jsxs)(`div`,{className:`gc-chart-reading`,children:[(0,F.jsxs)(`strong`,{children:[Y(r?.value??l.at(-1)?.value),(0,F.jsx)(`small`,{children:e.unit})]}),(0,F.jsxs)(`span`,{children:[r?.date||l.at(-1)?.date,` · `,e.name]}),(0,F.jsx)(`i`,{children:`柱与线均为同一指标`})]}),(0,F.jsxs)(`svg`,{viewBox:`0 0 780 255`,role:`img`,"aria-label":`${e.name},最近${t}天归档趋势,缺失不补零`,children:[(0,F.jsx)(`defs`,{children:(0,F.jsxs)(`linearGradient`,{id:`gc-bar`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,F.jsx)(`stop`,{stopColor:`var(--omni-chart-primary,#5ec9ff)`}),(0,F.jsx)(`stop`,{offset:`1`,stopColor:`var(--omni-chart-primary,#2857d6)`,stopOpacity:`.3`})]})}),[0,.25,.5,.75,1].map(e=>(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`line`,{className:`gc-gridline`,x1:`54`,x2:`750`,y1:m(d+f*e),y2:m(d+f*e)}),(0,F.jsx)(`text`,{x:`42`,y:m(d+f*e)+4,textAnchor:`end`,children:oe(d+f*e)})]},e)),l.map(n=>n.value===null?null:(0,F.jsxs)(`g`,{onMouseEnter:()=>o(n),onMouseLeave:()=>o(null),children:[(0,F.jsx)(`rect`,{x:p(n)-Math.min(8,230/t),y:Math.min(m(0),m(n.value)),width:Math.min(16,460/t),height:Math.max(1,Math.abs(m(0)-m(n.value))),rx:`2`,fill:`url(#gc-bar)`}),(0,F.jsx)(`circle`,{cx:p(n),cy:m(n.value),r:`3`,fill:`var(--omni-chart-primary,#6ceeff)`}),(0,F.jsxs)(`title`,{children:[n.date,`:`,Y(n.value),` `,e.unit]})]},n.date)),(0,F.jsx)(`g`,{className:`gc-line`,children:g}),[0,.25,.5,.75,1].map(e=>(0,F.jsx)(`text`,{x:54+690*e,y:`247`,textAnchor:`middle`,children:new Date(c+(t-1)*864e5*e).toISOString().slice(5,10)},e))]})]})}function $(e){return(0,F.jsx)(ne,{scope:e.layoutScope,onDirty:e.onDirty,children:(0,F.jsx)(ue,{...e})})}function ue({products:e,projects:t,catalog:n,ready:r,onAction:a,onAssign:o,onOpen:l,onNav:u,onTier:d,onCreate:p,onExecute:h,metrics:g,demo:_,projectActivity:v,projectPreview:y,onRefreshProjects:b}){let[x,S]=T(`workbench.cockpit.tab`,`business`),C=Z.find(e=>e.id===x)||Z[0],w=(0,j.useRef)(null);function E(e){let t=Z.findIndex(e=>e.id===C.id),n=e.key===`ArrowRight`?(t+1)%Z.length:e.key===`ArrowLeft`?(t+Z.length-1)%Z.length:e.key===`Home`?0:e.key===`End`?Z.length-1:-1;n<0||(e.preventDefault(),S(Z[n].id),(w.current?.querySelectorAll(`[role=tab]`)[n])?.focus())}let[D,O]=T(`workbench.productKey`,``),[k,M]=T(`workbench.metric`,``),[N,P]=T(`workbench.days`,30),[I,ee]=T(`workbench.timelineDays`,14),[te,L]=(0,j.useState)(null),R=e.find(e=>e.key===D)||e.find(e=>e.demoCurrent)||e[0],z=R?.series.find(e=>e.key===k)||R?.series.find(e=>[`paid`,`payAmt`,`sales`,`gmv`].includes(e.metric))||R?.series.find(e=>e.metric===`buyers`)||R?.series[0],B=v?.running??0,ne=v?.pending??0,V=e.filter(e=>f(e)),H=Object.keys(X).map(t=>({id:t,name:X[t],count:e.filter(e=>e.tier===t).length})),U=0,W=H.map(t=>{let n={...t,offset:U,length:e.length?t.count/e.length*314.16:0};return U+=n.length,n}),G=t.filter(e=>e.replay?.some(e=>Number.isFinite(Date.parse(e.at)))).sort((e,t)=>String(t.updated).localeCompare(String(e.updated))),K=Math.max(0,...G.flatMap(e=>e.replay.map(e=>Date.parse(e.at)).filter(Number.isFinite))),q=K-(I-1)*864e5,J=[{label:`待选择运营分组`,items:e.filter(e=>e.tier===`unassigned`),color:`#8097b8`},{label:`数据需更新`,items:e.filter(e=>e.work?.needsUpdate),color:`#f3ba66`},{label:`任务需检查`,items:e.filter(e=>e.work?.problems?.length),color:`#f581a7`},{label:`近期运行中`,items:e.filter(e=>e.work?.active?.length),color:`#3ddad7`}],Y=g?.sales?.[0],$=(Y?.breakdown||[]).filter(e=>typeof e.sales==`number`).slice().sort((e,t)=>t.sales-e.sales).slice(0,8),ue=$.length>0&&$.every(e=>e.itemId),me=Math.max(1,...$.map(e=>e.sales));return(0,F.jsxs)(`div`,{className:`gc`,children:[(0,F.jsx)(re,{enabled:[`business`,`projects`].includes(C.id),groups:[`cockpit.kpis`,...C.id===`projects`?[`projects.modules`,`projects.stats`,`projects.cards`]:[`cockpit.business`]]}),(0,F.jsx)(ae,{metrics:g,products:e,projects:t,ready:r,onOpen:l,onNav:u,onAssign:o,demo:_,projectActivity:v}),(0,F.jsxs)(`div`,{className:`gc-tabs-heading`,children:[(0,F.jsx)(`div`,{role:`tablist`,"aria-label":`工作台分类`,className:`gc-tabs`,"data-layout-control":!0,ref:w,onKeyDown:E,children:Z.map(e=>(0,F.jsx)(`button`,{role:`tab`,id:`gc-tab-`+e.id,"aria-controls":`gc-panel-`+e.id,"aria-selected":C.id===e.id,tabIndex:C.id===e.id?0:-1,onClick:()=>S(e.id),children:e.label},e.id))}),C.id===`projects`&&(0,F.jsxs)(`div`,{className:`pb-heading-actions`,children:[(0,F.jsxs)(`button`,{className:`pb-all-projects`,onClick:()=>u(`projects`),children:[`查看全部项目 `,(0,F.jsx)(i,{size:14})]}),(0,F.jsx)(`button`,{className:`pb-create`,onClick:p,children:`+ 新建项目`})]})]}),(0,F.jsx)(`p`,{className:`gc-tab-description`,children:C.note}),(0,F.jsxs)(`div`,{role:`tabpanel`,id:`gc-panel-`+C.id,"aria-labelledby":`gc-tab-`+C.id,tabIndex:0,className:`gc-tab-panel gc-tab-`+C.id,children:[C.id===`projects`&&(0,F.jsx)(c,{previewData:y,onRefresh:b,onExecute:h,projects:t,ready:r,onOpen:l,onCreate:p,showHeading:!1,previewLimit:8,onAllProjects:()=>u(`projects`)}),C.id===`tasks`&&(0,F.jsx)(`div`,{className:`gc-quick-tiers`,"aria-label":`运营策略任务速览`,children:[`test`,`incubate`,`scale`].map(t=>{let n=e.filter(e=>e.tier===t),r=n.filter(e=>e.work?.active?.length),c=n.filter(e=>f(e)),l=n.find(e=>e.demoCurrent)||r[0]||n[0];return(0,F.jsxs)(`section`,{style:{"--tier":se[t]},children:[(0,F.jsxs)(`header`,{children:[(0,F.jsx)(`b`,{children:X[t]}),(0,F.jsxs)(`span`,{children:[n.length,`个商品 · `,r.length,`个运行中`]}),(0,F.jsx)(`button`,{onClick:()=>d(t),"aria-label":`查看`+X[t]+`全部商品`,children:(0,F.jsx)(s,{size:14})})]}),(0,F.jsxs)(`button`,{className:`gc-quick-line`,disabled:!l,onClick:()=>a(l,`work`),children:[(0,F.jsx)(`em`,{children:`正在做`}),(0,F.jsxs)(`span`,{children:[l?l.demoCurrent||m(l):`等待商品加入`,l&&(0,F.jsx)(`small`,{children:l.projectName})]})]}),(0,F.jsxs)(`button`,{className:`gc-quick-line`,onClick:()=>l?a(l,`data`):o(null,t),children:[(0,F.jsx)(`em`,{children:`下一步`}),(0,F.jsx)(`span`,{children:l?.demoNext||(t===`test`?`核对点击和加购,选出潜力款`:t===`incubate`?`核对转化与成本,确认是否赚钱`:`检查推广效果,优化计划`)}),(0,F.jsx)(s,{size:12})]}),(0,F.jsxs)(`button`,{className:`gc-quick-alert `+(c.length?`has-issues`:``),onClick:()=>c.length?a(c[0],`work`):d(t),children:[c.length?`需要你处理 `+c.length+` 项 · `+f(c[0]):`暂无待处理提醒`,(0,F.jsx)(i,{size:12})]})]},t)})}),(0,F.jsxs)(ie,{group:`cockpit.`+C.id,className:`gc-main-grid`,children:[C.id===`business`&&(0,F.jsxs)(`section`,{"data-layout-label":`商品经营趋势`,className:`gc-panel gc-sales`,children:[(0,F.jsx)(Q,{title:`商品经营趋势`,sub:`按商品查看归档数据,保留真实波动`,children:(0,F.jsx)(`div`,{className:`gc-toggle`,children:[7,30].map(e=>(0,F.jsxs)(`button`,{"aria-pressed":N===e,onClick:()=>P(e),children:[e,`天`]},e))})}),(0,F.jsxs)(`div`,{className:`gc-selects`,children:[(0,F.jsx)(`select`,{"aria-label":`驾驶舱商品`,value:R?.key||``,onChange:e=>{O(e.target.value),M(``)},children:e.map(e=>(0,F.jsxs)(`option`,{value:e.key,children:[e.title||e.projectName,` · `,e.shopName||e.itemId]},e.key))}),(0,F.jsx)(`select`,{"aria-label":`驾驶舱趋势指标`,value:z?.key||``,onChange:e=>M(e.target.value),children:R?.series.map(e=>(0,F.jsx)(`option`,{value:e.key,children:e.name},e.key))}),(0,F.jsxs)(`button`,{disabled:!R,onClick:()=>a(R,`data`),children:[`明细 `,(0,F.jsx)(s,{size:12})]})]}),(0,F.jsx)(le,{series:z,days:N,onOpen:()=>R?a(R,`monitor`):u(`projects`)},R?.key+`|`+z?.key+`|`+N),(0,F.jsx)(`p`,{className:`gc-footnote`,children:`单商品数据,不等于全店销售额 · 缺失日期不连线 · 来源见归档详情`})]},`sales`),C.id===`business`&&(0,F.jsxs)(`section`,{"data-layout-label":`商品运营分组`,className:`gc-panel gc-structure`,children:[(0,F.jsx)(Q,{title:`商品运营分组`,sub:`点击分类,查看商品和下一步`}),(0,F.jsxs)(`div`,{className:`gc-ring`,children:[(0,F.jsxs)(`svg`,{viewBox:`0 0 160 160`,role:`img`,"aria-label":H.map(e=>e.name+e.count+`个`).join(`,`),children:[(0,F.jsx)(`circle`,{cx:`80`,cy:`80`,r:`62`,fill:`none`,stroke:`var(--omni-chart-track,#1e355b)`,strokeWidth:`1`,strokeDasharray:`2 4`}),(0,F.jsx)(`circle`,{cx:`80`,cy:`80`,r:`50`,fill:`none`,stroke:`var(--omni-chart-track,#152849)`,strokeWidth:`18`}),W.filter(e=>e.count>0).map(e=>(0,F.jsx)(`circle`,{cx:`80`,cy:`80`,r:`50`,fill:`none`,stroke:se[e.id],strokeWidth:`18`,strokeDasharray:`${e.length} ${314.16-e.length}`,strokeDashoffset:-e.offset,transform:`rotate(-90 80 80)`},e.id)),(0,F.jsx)(`text`,{x:`80`,y:`80`,textAnchor:`middle`,className:`gc-ring-number`,children:r?e.length:`—`}),(0,F.jsx)(`text`,{x:`80`,y:`98`,textAnchor:`middle`,children:`商品观察对象`})]}),(0,F.jsx)(`div`,{className:`gc-ring-legend`,children:H.map(t=>(0,F.jsxs)(`button`,{onClick:()=>d(t.id),children:[(0,F.jsx)(`i`,{style:{background:se[t.id]}}),(0,F.jsx)(`span`,{children:t.name}),(0,F.jsx)(`b`,{children:t.count}),(0,F.jsxs)(`small`,{children:[e.length?Math.round(t.count/e.length*100):0,`%`]}),(0,F.jsx)(s,{size:12})]},t.id))})]}),(0,F.jsx)(`p`,{className:`gc-footnote`,children:`同一商品在不同项目中分别记录;人工策略分组以保存记录为准,不代表全店经营梯队。`})]},`structure`),C.id===`business`&&(0,F.jsxs)(`section`,{"data-layout-label":`销售构成`,className:`gc-panel gc-ranking`,children:[(0,F.jsx)(Q,{title:ue?`商品销售排行`:`销售构成`,sub:Y?Y.start+` — `+Y.end+` · 同一份销售账本`:`按同一统计期的销售账本排名`}),(0,F.jsx)(`div`,{className:`gc-rank-list`,children:$.map((e,t)=>(0,F.jsxs)(`button`,{onClick:()=>l(e.project||Y.project,{tab:e.itemId?`monitor`:`data`,itemId:e.itemId}),children:[(0,F.jsx)(`i`,{children:t+1}),(0,F.jsxs)(`span`,{title:e.name||e.itemId,children:[e.name||e.itemId,(0,F.jsx)(`small`,{children:e.itemId||e.count+`个商品`})]}),(0,F.jsx)(`div`,{children:(0,F.jsx)(`b`,{style:{width:Math.max(2,e.sales/me*100)+`%`}})}),(0,F.jsxs)(`strong`,{children:[`¥`,oe(e.sales)]})]},e.project+`|`+(e.itemId||e.name)))}),!$.length&&(0,F.jsxs)(`p`,{className:`gc-no-data`,children:[`还没有同期商品销售明细。`,(0,F.jsx)(`button`,{onClick:()=>u(`data`),children:`查看已有资料`})]}),(0,F.jsx)(`p`,{className:`gc-footnote`,children:ue?`点击商品核对明细 · 销售排名不代表盈利排名`:`原件按品类汇总,点击查看归档;不是单品排名`})]},`ranking`),C.id===`tasks`&&(0,F.jsxs)(`section`,{"data-layout-label":`巡店检查`,className:`gc-panel gc-inspect`,children:[(0,F.jsx)(Q,{title:`巡店检查`,sub:`基于归档与任务状态 · 点击查看待办`,children:(0,F.jsx)(A,{size:17})}),(0,F.jsx)(`div`,{className:`gc-checks`,children:J.map(t=>(0,F.jsxs)(`button`,{disabled:!t.items.length,onClick:()=>t.label===`待选择运营分组`?o(t.items[0]):a(t.items[0],`work`),children:[(0,F.jsx)(`span`,{children:t.label}),(0,F.jsx)(`div`,{children:(0,F.jsx)(`i`,{style:{width:`${e.length?t.items.length/e.length*100:0}%`,background:t.color}})}),(0,F.jsx)(`b`,{children:r?t.items.length:`—`}),(0,F.jsx)(s,{size:12})]},t.label))}),(0,F.jsx)(`p`,{className:`gc-footnote`,children:`同一商品可有多项提醒,数量不可相加;点击先处理一项。`}),(0,F.jsxs)(`div`,{className:`gc-archive`,children:[(0,F.jsx)(de,{count:n.length}),(0,F.jsxs)(`button`,{onClick:()=>u(`data`),children:[`查看来源 `,(0,F.jsx)(i,{size:12})]})]})]},`inspect`),C.id===`history`&&(0,F.jsxs)(`section`,{"data-layout-label":`项目阶段记录`,className:`gc-panel gc-matrix`,children:[(0,F.jsx)(Q,{title:`项目阶段记录`,sub:`节点流程与历史六步记录分别保留,点击核对对应阶段`,children:(0,F.jsxs)(`button`,{onClick:()=>u(`projects`),children:[`全部项目 `,(0,F.jsx)(i,{size:12})]})}),(0,F.jsx)(`div`,{className:`gc-state-legend`,children:Object.entries(ce).map(([e,t])=>(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`i`,{className:e}),t]},e))}),(0,F.jsxs)(`div`,{className:`gc-matrix-scroll`,children:[t.slice(0,8).map(e=>(0,F.jsxs)(`div`,{className:`gc-matrix-row`,children:[(0,F.jsxs)(`button`,{className:`gc-project-name`,title:e.name,onClick:()=>l(e.id,{tab:`overview`}),children:[e.name,(0,F.jsxs)(`small`,{children:[e.done,`/`,e.total,` 阶段已确认`]})]}),(0,F.jsx)(`div`,{children:e.route.map((t,n)=>(0,F.jsx)(`button`,{className:`gc-cell `+t.state,"aria-label":`${e.name}:${t.name},${ce[t.state]}`,title:`${t.name} · ${ce[t.state]}`,onClick:()=>l(e.id,t.target),children:String(n+1).padStart(2,`0`)},t.id))})]},e.id)),!t.length&&(0,F.jsx)(`p`,{className:`gc-no-data`,children:`当前范围还没有项目。`})]})]},`matrix`),C.id===`history`&&(0,F.jsxs)(`section`,{"data-layout-label":`项目历史时间轴`,className:`gc-panel gc-history`,children:[(0,F.jsx)(Q,{title:`项目历史时间轴`,sub:_?`模拟历史记录;每天的记录合并为一个色块`:`按真实归档时间显示;每天的记录合并为一个色块`,children:(0,F.jsx)(`div`,{className:`gc-toggle`,children:[14,30].map(e=>(0,F.jsxs)(`button`,{"aria-pressed":I===e,onClick:()=>ee(e),children:[e,`天`]},e))})}),K>0?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`gc-time-header`,children:[(0,F.jsx)(`span`,{children:`项目 / 点击查看记录`}),(0,F.jsx)(`div`,{children:[0,.25,.5,.75,1].map(e=>(0,F.jsx)(`span`,{children:new Date(q+(K-q)*e).toISOString().slice(5,10)},e))})]}),(0,F.jsx)(`div`,{className:`gc-time-scroll`,children:G.filter(e=>e.replay.some(e=>Date.parse(e.at)>=q)).slice(0,7).map(e=>(0,F.jsxs)(`div`,{className:`gc-time-row`,children:[(0,F.jsx)(`button`,{title:e.name,onClick:()=>L({project:e,events:e.replay}),children:e.name}),(0,F.jsx)(`div`,{children:fe(e.replay.filter(e=>Date.parse(e.at)>=q)).map(t=>(0,F.jsx)(`button`,{className:`gc-event `+(t.events.some(e=>/失败|停止/.test(e.state))?`bad`:t.events.some(e=>/确认|完成/.test(e.state))?`done`:`saved`),style:{left:`${(Date.parse(t.events[0].at)-q)/(K-q)*100}%`},title:`${t.date} · ${t.events.length} 条记录`,"aria-label":`${e.name}:${t.date},${t.events.length}条记录`,onClick:()=>L({project:e,events:t.events,date:t.date}),children:t.events.length},t.date))})]},e.id))}),(0,F.jsxs)(`p`,{className:`gc-footnote`,children:[`最近有记录的日期窗口 · 每个项目最多展示最近120条记录 · 点击色块展开当天记录,不代表运行时长;`,_?`演示操作会追加记录。`:`完整回放在项目执行页。`]})]}):(0,F.jsx)(`p`,{className:`gc-no-data`,children:`暂无可回放的历史记录。`})]},`history`),C.id===`tasks`&&(0,F.jsxs)(`section`,{"data-layout-label":`需要你处理`,className:`gc-panel gc-todo`,children:[(0,F.jsx)(Q,{title:`需要你处理`,sub:`先做这一件,再继续下一步`,children:(0,F.jsxs)(`span`,{className:`gc-badge`,children:[V.length,` 项`]})}),(0,F.jsxs)(`div`,{className:`gc-todo-list`,children:[V.map((e,t)=>(0,F.jsxs)(`button`,{onClick:()=>e.tier===`unassigned`?o(e):a(e,`work`),children:[(0,F.jsx)(`span`,{className:`gc-todo-num`,children:String(t+1).padStart(2,`0`)}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`b`,{children:f(e)}),(0,F.jsxs)(`span`,{children:[e.title||e.projectName,` · `,e.shopName||e.itemId]}),(0,F.jsx)(`small`,{children:m(e)})]}),(0,F.jsx)(s,{size:15})]},e.key)),!V.length&&(0,F.jsx)(`p`,{className:`gc-no-data`,children:r?`当前没有商品待办。`:`正在读取…`}),(0,F.jsx)(`h3`,{className:`gc-next-label`,children:`接下来可以做`}),t.slice(0,5).map(e=>(0,F.jsxs)(`button`,{onClick:()=>l(e.id,{tab:`overview`}),children:[(0,F.jsx)(`span`,{className:`gc-next-dot`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`b`,{children:e.name}),(0,F.jsx)(`span`,{children:`查看项目节点与下一步`})]}),(0,F.jsx)(s,{size:13})]},`next-`+e.id))]})]},`todo`)]})]}),te&&(0,F.jsx)(pe,{...te,onClose:()=>L(null),onOpen:l}),(0,F.jsxs)(`div`,{className:`gc-status-strip`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`i`,{}),` `,_?`教学模拟`:`归档数据`,` · `,e.length,` 个商品`]}),(0,F.jsxs)(`span`,{children:[t.length,` 个项目 · `,v?.started??0,` 个已开展 · `,v?.complete??0,` 个项目已完成`]}),(0,F.jsxs)(`span`,{children:[B,` 项推进中 · `,ne,` 项待开始`]}),(0,F.jsxs)(`button`,{onClick:()=>u(`products`),children:[`展开运营工作清单 `,(0,F.jsx)(i,{size:13})]})]})]})}function de({count:e}){return(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{children:e}),` 份归档资料可追溯`]})}function fe(e){let t=new Map;for(let n of e){let e=new Date(Date.parse(n.at)+8*36e5).toISOString().slice(0,10);t.set(e,[...t.get(e)||[],n])}return[...t].map(([e,t])=>({date:e,events:t}))}function pe({project:e,events:t,date:n,onClose:r,onOpen:i}){let a=(0,j.useRef)(null);return(0,j.useEffect)(()=>{a.current?.showModal()},[]),(0,F.jsxs)(`dialog`,{className:`ta-dialog gc-history-dialog`,ref:a,onClose:r,"aria-labelledby":`gc-history-title`,children:[(0,F.jsxs)(`div`,{className:`ta-dialog-head`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`small`,{children:e.name}),(0,F.jsxs)(`h2`,{id:`gc-history-title`,children:[n||`项目历史`,` · `,t.length,` 条记录`]})]}),(0,F.jsx)(`button`,{"aria-label":`关闭历史记录`,onClick:r,children:`×`})]}),(0,F.jsx)(`p`,{children:`按发生时间排列。展开记录,查看当时做了什么。`}),(0,F.jsx)(`div`,{className:`gc-records`,children:t.map((t,n)=>(0,F.jsxs)(`details`,{children:[(0,F.jsxs)(`summary`,{children:[(0,F.jsx)(`span`,{children:new Date(t.at).toLocaleString(`zh-CN`,{timeZone:`Asia/Shanghai`})}),(0,F.jsx)(`b`,{children:t.name}),(0,F.jsx)(`em`,{children:t.state})]}),(0,F.jsx)(`p`,{children:t.detail||`此记录没有保存详细说明,可进入对应阶段核对原始资料。`}),(0,F.jsx)(`button`,{onClick:()=>{r(),i(e.id,e.route.find(e=>e.id===t.routeId)?.target||{tab:`data`})},children:`进入对应阶段 / 资料`})]},n))})]})}function me(){let e=w(),[t,n]=T(`workbench.loadedData`,{growth:null,projects:null,activity:null}),[r,i]=(0,j.useState)(!0),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,d]=(0,j.useState)(0),f=e.archiveScope||`real`,[m,g]=(0,j.useState)(null),[v,y]=(0,j.useState)(null);(0,j.useEffect)(()=>{let t=new AbortController;return ee(e.api,e=>n(t=>({...t,...e})),t.signal).then(()=>{t.signal.aborted||o(``)}).catch(e=>{t.signal.aborted||o(e instanceof Error?e.message:`经营资料读取失败`)}).finally(()=>{t.signal.aborted||i(!1)}),()=>t.abort()},[e.api,l,n]);let b=e=>f===`stored-demo`?e.mode===`simulated`:e.mode!==`simulated`,x=t.growth?.products.filter(b)||[],S=t.growth?.catalog.filter(b)||[],C=t.projects?.filter(e=>f===`stored-demo`?e.simulated:!e.simulated)||[],D=t.projects&&t.activity?t.activity.items.filter(e=>C.some(t=>t.id===e.id)):null,O=D?{running:D.reduce((e,t)=>e+t.activeTasks,0),pending:D.reduce((e,t)=>e+t.pendingTasks,0),started:D.filter(e=>e.started>0).length,complete:D.filter(e=>e.status===`complete`).length}:null,k=(0,j.useMemo)(()=>{let e=e=>f===`stored-demo`?e.mode===`simulated`:e.mode!==`simulated`;return{sales:t.growth?.metrics?.sales?.filter(e)||[],finance:t.growth?.metrics?.finance?.filter(e)||[],incubation:t.growth?.metrics?.incubation?.filter(e)||[]}},[t.growth,f]),A=(0,j.useCallback)(()=>{i(!0),d(e=>e+1)},[]);u(C.some(e=>e.execution?.state===`running`),A);function M(t,n){n===`work`?y(t):n===`data`?e.onProductGroup(`all`,t,f):e.onOpen(t.project,{tab:n,itemId:t.itemId})}return(0,F.jsx)(`div`,{className:`workbench-module`,children:(0,F.jsx)(`div`,{className:`gw`,children:(0,F.jsxs)(`div`,{className:`gw-body`,children:[(0,F.jsxs)(`header`,{className:`gw-header`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`small`,{children:`工作台 / 经营总览`}),(0,F.jsx)(`h1`,{children:`电商运营作战台`})]}),(0,F.jsxs)(`div`,{className:`gw-header-actions`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`i`,{className:`gw-dot`}),`归档数据 · 非实时`]}),(0,F.jsxs)(`button`,{disabled:r,onClick:A,children:[(0,F.jsx)(_,{size:14}),r?`读取中`:`刷新数据`]})]})]}),(0,F.jsx)(`div`,{className:`gw-scope`,children:(0,F.jsx)(`span`,{children:t.growth?`${new Date(t.growth.updatedAt).toLocaleString(`zh-CN`)} 读取归档`:`正在读取归档…`})}),a&&(0,F.jsxs)(`p`,{role:`alert`,className:`gw-message`,children:[a,` `,(0,F.jsx)(`button`,{onClick:A,children:`重试`})]}),s&&(0,F.jsx)(`p`,{role:`status`,className:`gw-message`,children:s}),(0,F.jsx)($,{layoutScope:e.layoutScope,onDirty:e.onDirty,onCreate:e.onCreate,products:x,projects:C,catalog:S,metrics:k,projectActivity:O,projectPreview:t.activity,onRefreshProjects:A,ready:!!t.growth,demo:!1,onOpen:e.onOpen,onNav:e.onModule,onTier:t=>e.onProductGroup(t,void 0,f),onAction:M,onAssign:(e,t)=>g({product:e,suggestedTier:t})}),m&&(0,F.jsx)(p,{...m,products:x,onDirty:e.onDirty,onBusy:e.onBusy,onClose:()=>g(null),onSave:async(t,n,r,i)=>{await E(e.api,t,n,r,i),c(`分组已保存,正在更新看板。`),A()}}),v&&(0,F.jsx)(h,{product:v,onOpen:e.onOpen,onClose:()=>y(null)})]})})})}function he({section:e}){let t=w();return e===`tasks`||e===`records`?(0,F.jsx)(I,{mode:e,api:t.api,onOpen:t.onOpen},e):(0,F.jsx)(me,{})}export{he as default};
|
|
1
|
+
import{n as e,t}from"./orbit-tMF8WRbG.js";import{t as n}from"./arrow-left-CrtjcWhu.js";import{n as r}from"./clock-3-TXgD8tS6.js";import{t as i}from"./arrow-up-right-FAUwydEi.js";import{t as a}from"./chart-no-axes-combined-DbjiVuVa.js";import{t as o}from"./check-B7m80-Hk.js";import{t as s}from"./chevron-right-DyOe1NsY.js";import{n as c,r as l,t as u}from"./ui-public-DVwBGbKN.js";import{r as d}from"./CollaborationWorkspace-mIgLrpSm.js";import{a as f,n as p,o as m,r as h}from"./products-6S_LnOq6.js";import{t as g}from"./layers-B4gCFnEm.js";import{t as _}from"./refresh-cw-CiIEylYp.js";import{t as v}from"./search-DlLds8Ae.js";import{c as y,h as b,l as x,v as S,x as C}from"./index-Dfy2jMWq.js";import{n as w}from"./module-host-BIy_fI1T.js";import{n as T}from"./workspace-view-state-BuK4-c0r.js";import"./public-Csb687JC.js";import{t as E}from"./group-DIi_QccB.js";var D=b(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),O=b(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),k=b(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),A=b(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),j=C(S(),1);function M(e){return e.flatMap(e=>e.route.filter(e=>[`attention`,`review`].includes(e.state)).map(t=>({project:e,step:t})))}function N(e){return e.flatMap(e=>e.activity.map(t=>({project:e,event:t}))).sort((e,t)=>t.event.at.localeCompare(e.event.at))}var P={activity:`_activity_k9yph_1`,panel:`_panel_k9yph_1`},F=y();function I({mode:e,api:t,onOpen:n}){let i=w().archiveScope||`real`,[a,o]=(0,j.useState)([]),[s,c]=(0,j.useState)(!0),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(0),[p,m]=T(`workbench.`+e+`.search`,``);(0,j.useEffect)(()=>{let e=!0;return t(`/command-center`).then(t=>{let n=t?.projects;if(!Array.isArray(n))throw Error(`项目状态返回格式异常`);e&&(o(n.filter(e=>i===`stored-demo`?e.simulated:!e.simulated)),u(``))}).catch(t=>{e&&(o([]),u(t instanceof Error?t.message:`项目状态读取失败`))}).finally(()=>{e&&c(!1)}),()=>{e=!1}},[t,d,i]);let h=M(a),g=N(a),_=e=>e.toLowerCase().includes(p.trim().toLowerCase());return(0,F.jsxs)(`section`,{className:P.activity,children:[(0,F.jsxs)(`header`,{children:[(0,F.jsx)(`h1`,{children:e===`tasks`?`待处理事项`:`执行记录`}),(0,F.jsxs)(`label`,{children:[(0,F.jsx)(v,{size:16}),(0,F.jsx)(`input`,{"aria-label":`搜索工作台事项与记录`,value:p,onChange:e=>m(e.target.value),placeholder:`搜索项目或事项`})]})]}),l&&(0,F.jsxs)(`p`,{role:`alert`,children:[l,` `,(0,F.jsx)(`button`,{onClick:()=>{c(!0),f(e=>e+1)},children:`重试`})]}),s?(0,F.jsx)(`p`,{role:`status`,children:`正在读取项目状态…`}):(0,F.jsx)(`div`,{className:P.panel,children:e===`tasks`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`h2`,{children:[`需要你处理 · `,h.length,` 项`]}),h.filter(({project:e,step:t})=>_(e.name+t.name)).slice(0,30).map(({project:e,step:t})=>(0,F.jsxs)(`button`,{onClick:()=>n(e.id,t.target),children:[(0,F.jsxs)(`span`,{children:[(0,F.jsxs)(`b`,{children:[t.name,` · `,t.state===`attention`?`待复核`:`待确认`]}),(0,F.jsxs)(`small`,{children:[e.name,` · `,t.description]})]}),(0,F.jsx)(r,{size:16})]},e.id+t.id)),!h.length&&(0,F.jsx)(`p`,{children:l?`连接恢复后显示待处理事项。`:`当前没有待复核或待确认的阶段。`})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`h2`,{children:`项目执行与确认记录`}),g.filter(({project:e,event:t})=>_(e.name+t.name)).slice(0,50).map(({project:e,event:t},i)=>(0,F.jsxs)(`button`,{onClick:()=>n(e.id,{tab:`wiki`}),children:[(0,F.jsxs)(`span`,{children:[(0,F.jsxs)(`b`,{children:[t.name,` · `,t.state]}),(0,F.jsxs)(`small`,{children:[e.name,` · `,new Date(t.at).toLocaleString(`zh-CN`)]})]}),(0,F.jsx)(r,{size:16})]},e.id+t.at+i)),!g.length&&(0,F.jsx)(`p`,{children:l?`连接恢复后显示执行记录。`:`当前没有执行记录。`})]})})]})}async function ee(e,t,n){let r=e=>{n?.aborted||t?.(e)},i=[e(`/growth-center?view=overview`).then(e=>{let t=e;if(!Array.isArray(t?.products)||!Array.isArray(t?.catalog))throw Error(`经营资料返回格式异常`);return r({growth:t}),t}),e(`/command-center`).then(e=>{let t=e?.projects;if(!Array.isArray(t))throw Error(`项目资料返回格式异常`);return r({projects:t}),t}),l(1e4,n,e).then(e=>(r({activity:e}),e))],a=(await Promise.allSettled(i)).filter(e=>e.status===`rejected`);if(a.length)throw Error(a.map(e=>e.reason instanceof Error?e.reason.message:`资料读取失败`).join(`;`));let[o,s,c]=await Promise.all(i);return{growth:o,projects:s,activity:c}}var te={refunds:`同期支付订单的退款`,product:`货品成本`,fulfillment:`运费与履约`,platform:`平台费用`,ads:`广告花费`,tax:`税费`,other:`其他变动费用`,fixed:`固定费用分摊`};function L(e){try{let t=JSON.parse(e||`{}`);return t.version!==1||!t.orders||typeof t.orders!=`object`||Array.isArray(t.orders)?{}:Object.fromEntries(Object.entries(t.orders).slice(0,20).filter(([e,t])=>e.length<100&&Array.isArray(t)).map(([e,t])=>[e,[...new Set(t.filter(e=>typeof e==`string`&&e.length<200))].slice(0,2500)]))}catch{return{}}}function R(e,t){let n=new Set(t);return[...(e||[]).filter(e=>n.delete(e)),...t.filter(e=>n.delete(e))]}function z(e,t,n,r){let i=[...new Set([...e||[],...t])];if(!t.includes(n)||!t.includes(r)||n===r)return i;let a=i.indexOf(n),o=i.indexOf(r);return i.splice(a,1),i.splice(o,0,n),i}var B=(0,j.createContext)(null);function ne({scope:e,onDirty:t,children:n}){let r=e?`omni.dashboard-layout.v1:`+encodeURIComponent(e):null,[i]=(0,j.useState)(()=>{try{return r?L(localStorage.getItem(r)):{}}catch{return{}}}),[a,o]=T(`dashboard.layout.`+(e||`session`),i),[s,c]=(0,j.useState)(a),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(``),[p,m]=(0,j.useState)(null),h=l&&JSON.stringify(s)!==JSON.stringify(a);(0,j.useEffect)(()=>(t?.(h),()=>t?.(!1)),[h,t]);let g=()=>{u(!1),m(null)};function _(){try{r&&localStorage.setItem(r,JSON.stringify({version:1,orders:s})),o(s),g(),f(r?`布局已保存到当前账号的此台设备。`:`布局已保存,本次会话内有效。`)}catch{f(`布局保存失败,请检查本机存储后重试;当前调整仍保留。`)}}let v={editing:l,orders:s,drag:p,setDrag:m,scope:e,message:d,begin:()=>{c(a),u(!0),f(`拖动卡片左上角,或用前移、后移按钮调整顺序。`)},save:_,cancel:()=>{c(a),g(),f(`已取消本次布局修改。`)},reset:e=>{c(t=>Object.fromEntries(Object.entries(t).filter(([t])=>!e.includes(t)))),f(`当前页已恢复默认排列,点击保存后生效。`)},move:(e,t,n,r)=>{c(i=>({...i,[e]:z(i[e],t,n,r)})),f(`顺序已调整,保存后记住布局。`)}};return(0,F.jsx)(B.Provider,{value:v,children:(0,F.jsx)(`div`,{className:l?`dashboard-editing`:``,onClickCapture:e=>{l&&!e.target.closest(`[data-layout-control]`)&&(e.preventDefault(),e.stopPropagation())},children:n})})}function re({enabled:e=!0,groups:t=[]}){let n=(0,j.useContext)(B);return!n||!e&&!n.editing?null:(0,F.jsxs)(`div`,{className:`dl-toolbar`,"data-layout-control":!0,children:[(0,F.jsx)(`div`,{className:`dl-toolbar-actions`,children:n.editing?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{children:`调整卡片顺序`}),(0,F.jsxs)(`button`,{onClick:()=>n.reset(t),children:[(0,F.jsx)(k,{size:13}),`恢复默认`]}),(0,F.jsxs)(`button`,{onClick:n.cancel,children:[(0,F.jsx)(x,{size:13}),`取消`]}),(0,F.jsxs)(`button`,{className:`dl-save`,onClick:n.save,children:[(0,F.jsx)(o,{size:14}),`保存布局`]})]}):(0,F.jsxs)(`button`,{onClick:n.begin,children:[(0,F.jsx)(d,{size:14}),`编辑页面`]})}),n.message&&(0,F.jsx)(`small`,{role:`status`,children:n.message})]})}function ie({group:e,className:t=``,children:i}){let a=(0,j.useContext)(B),o=j.Children.toArray(i).filter(j.isValidElement).map((e,t)=>({id:String(e.key??t).replace(/^\.\$/,``),el:e})),s=o.map(e=>e.id),c=R(a?.orders[e],s);return(0,F.jsx)(`div`,{className:t,children:c.map((t,i)=>{let l=o.find(e=>e.id===t).el,u=l.props[`data-layout-label`]||`卡片`;return(0,j.cloneElement)(l,{key:t,"data-layout-card":t,"data-layout-group":e,className:[l.props.className,`dl-card`,a?.editing?`dl-editable`:``,a?.drag?.group===e&&a.drag.id===t?`dl-dragging`:``].filter(Boolean).join(` `),onDragOver:t=>{a?.editing&&a.drag?.group===e&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`)},onDrop:n=>{a?.editing&&a.drag?.group===e&&(n.preventDefault(),n.stopPropagation(),a.move(e,s,a.drag.id,t),a.setDrag(null))}},a?.editing?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`dl-card-controls`,"data-layout-control":!0,children:[(0,F.jsxs)(`button`,{className:`dl-grip`,"aria-label":`拖动`+u,title:`拖动调整顺序`,onPointerDown:n=>{n.button===0&&(n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture(n.pointerId),a.setDrag({group:e,id:t}))},onPointerUp:n=>{if(!n.currentTarget.hasPointerCapture(n.pointerId))return;n.currentTarget.releasePointerCapture(n.pointerId);let r=document.elementFromPoint(n.clientX,n.clientY)?.closest(`[data-layout-group]`);for(;r&&r.dataset.layoutGroup!==e;)r=r.parentElement?.closest(`[data-layout-group]`);let i=r?.dataset.layoutCard;i&&i!==t&&a.move(e,s,t,i),a.setDrag(null)},onPointerCancel:()=>a.setDrag(null),children:[(0,F.jsx)(O,{size:14}),(0,F.jsx)(`span`,{children:u})]}),(0,F.jsx)(`button`,{disabled:i===0,"aria-label":`前移`+u,title:`前移`,onClick:()=>a.move(e,s,t,c[i-1]),children:(0,F.jsx)(n,{size:13})}),(0,F.jsx)(`button`,{disabled:i===c.length-1,"aria-label":`后移`+u,title:`后移`,onClick:()=>a.move(e,s,t,c[i+1]),children:(0,F.jsx)(r,{size:13})})]}),l.props.children]}):l.props.children)})})}var V=e=>Math.round(Number(e)*100),H=e=>e.shopIds?.length===1?e.shopIds[0]:null,U=e=>e.slice().sort((e,t)=>String(t.created).localeCompare(String(e.created)));function W(e,t){let n=new Set;return U(e).filter(e=>{let r=t(e);return n.has(r)?!1:(n.add(r),!0)})}function G(e){let[t]=e;return e.length===1?t:{...t,id:`shops:`+JSON.stringify([t.mode,t.start,t.end,e.map(H).sort()]),aggregated:!0,shopIds:e.map(H),memberReports:e,scopeLabel:`${e.length} 家店铺汇总`,identity:e.map(e=>e.scopeLabel).join(`、`),total:e.reduce((e,t)=>e+V(t.total),0)/100,count:e.reduce((e,t)=>e+t.count,0),breakdown:e.flatMap(e=>e.breakdown.map(t=>({...t,name:e.scopeLabel+` · `+t.name,shopId:H(e)}))),basis:`同一统计期间的各店铺支付金额之和,不重复叠加历史账本;不扣退款。`}}function K(e,t){let n=e.filter(e=>t&&e.start===t.start&&e.end===t.end&&e.mode===t.mode&&(t.shopIds?.length?H(e)&&t.shopIds.includes(H(e)):!e.shopIds?.length&&e.project===t.project)),r=W(n.filter(e=>e.scope?.type===`item`),e=>(H(e)||e.project)+`|`+e.scope.id),i=W(n.filter(e=>e.scope?.type===`shop`),e=>H(e)||e.scope.id),a=i[0];if(t?.aggregated){let e=i.length===t.shopIds.length&&i.every(e=>e.complete),n=Object.keys(i[0]?.amounts||{});a={...t,aggregated:!0,memberReports:i,complete:e,gaps:e?[]:[`部分店铺缺少完整同期成本账本`],amounts:e?Object.fromEntries(n.map(e=>[e,i.reduce((t,n)=>t+V(n.amounts[e]),0)/100])):{},profit:e?i.reduce((e,t)=>e+V(t.profit),0)/100:null}}return{shop:a,itemBooks:r}}function q(e={},t=``){let n=W(e.sales||[],e=>H(e)?JSON.stringify([e.mode,H(e),e.start,e.end]):e.id),r=e.finance||[],i=new Map;for(let e of n){let t=H(e)?JSON.stringify([e.mode,e.start,e.end]):e.id;i.has(t)||i.set(t,[]),i.get(t).push(e)}let a=[...i.values()].map(e=>G(W(e,e=>H(e)||e.id))),o=W([...a.filter(e=>e.aggregated),...n],e=>e.id).map(e=>({...e,financeComplete:!!K(r,e).shop?.complete})),s=a[0],c=new Set(n.filter(e=>e.mode===s?.mode).map(H).filter(Boolean)),l=a.find(e=>e.mode===s?.mode&&(!c.size||e.shopIds?.length===c.size)&&K(r,e).shop?.complete)||s,u=o.find(e=>e.id===t),d=u||o.find(e=>e.id===l?.id);return{sales:o,report:d,...K(r,d),newestReport:s,automatic:!u,usingPreviousPeriod:!u&&!!d&&d.id!==s?.id}}var J=e=>typeof e==`number`?e.toLocaleString(`zh-CN`,{maximumFractionDigits:2}):`—`;function ae({metrics:n,products:r,projects:o,ready:s,onOpen:c,onNav:l,onAssign:u,demo:d,projectActivity:f}){let[p,m]=(0,j.useState)(``),[h,_]=(0,j.useState)(``),{sales:v,report:y,shop:b,itemBooks:S,newestReport:C,automatic:w,usingPreviousPeriod:T}=(0,j.useMemo)(()=>q(n,h),[n,h]),E=S.filter(e=>e.complete),O=E.filter(e=>e.profit>0),k=E.filter(e=>e.profit<0),A=E.filter(e=>e.profit===0),M=n?.incubation||[],N=M.filter(e=>e.success),P=f?.running,I=[{id:`sales`,label:`店铺销售额`,value:y?J(y.total):`暂无记录`,unit:y?`元`:``,note:y?`${y.shopIds?.length||1} 家店铺 · ${y.start} — ${y.end}`:`先归档全店销售数据`,Icon:a},{id:`profit`,label:`店铺利润`,value:b?.complete?J(b.profit):`缺成本资料`,unit:b?.complete?`元`:``,note:`已列成本口径经营结余 · 点击核对`,Icon:D},{id:`links`,label:`盈利 / 亏损链接`,value:E.length?`${O.length} / ${k.length}`:`尚未核算`,unit:E.length?`个`:``,note:`${E.length} 个有核算结果 · ${A.length} 个持平`,Icon:g},{id:`incubation`,label:`孵化晋级记录`,value:M.length?`${N.length} / ${M.length}`:`尚无记录`,unit:M.length?`个`:``,note:`已记录晋级 / 累计纳入 · 不代表成功率`,Icon:t},{id:`tasks`,label:`正在推进的任务`,value:s&&P!==void 0?P:`—`,unit:`个`,note:f?`${f.complete} 个项目已完成 · 任务看板进行中`:`正在读取项目任务`,Icon:e}],ee=I.map(e=>!s&&e.id!==`tasks`?{...e,value:`读取中`,unit:``,note:`正在读取经营资料`}:e);function L(e){if(e===`tasks`){l(`projects`);return}m(p===e?``:e)}let R=e=>d||e.aggregated?`data:application/json;charset=utf-8,`+encodeURIComponent(JSON.stringify(e,null,2)):`/api/workbench/`+e.project+`/file/`+(e.artifactId||e.id);return(0,F.jsxs)(F.Fragment,{children:[v.length>1&&(0,F.jsxs)(`div`,{className:`gb-period`,children:[(0,F.jsxs)(`label`,{children:[`销售与核算周期`,(0,F.jsxs)(`select`,{"aria-label":`销售与核算周期`,value:w?``:y?.id||``,onChange:e=>_(e.target.value),children:[(0,F.jsx)(`option`,{value:``,children:`自动选择 · 优先完整核算`}),v.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[e.scopeLabel||e.projectName,` · `,e.start,` ~ `,e.end,` · `,e.financeComplete?`成本齐全`:`成本待补齐`]},e.id))]})]}),T&&(0,F.jsxs)(`p`,{role:`status`,children:[`最新销售归档(`,C.start,` — `,C.end,`)尚未完成全部店铺的同期核算,当前展示最近完整核算周期(`,y.start,` — `,y.end,`)。`]})]}),(0,F.jsx)(ie,{group:`cockpit.kpis`,className:`gc-kpis`,children:ee.map(e=>(0,F.jsx)(`div`,{"data-layout-label":e.label,children:(0,F.jsxs)(`button`,{className:`gc-kpi gc-kpi-`+e.id+` `+(p===e.id?`is-open`:``),onClick:()=>L(e.id),"aria-expanded":p===e.id,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`gc-kpi-icon`,children:(0,F.jsx)(e.Icon,{size:21})}),(0,F.jsx)(`span`,{children:e.label}),(0,F.jsx)(i,{size:13})]}),(0,F.jsxs)(`strong`,{className:String(e.value).length>9?`gc-long-value`:``,children:[e.value,(0,F.jsx)(`small`,{children:e.unit})]}),(0,F.jsx)(`p`,{children:e.note})]},e.id)},e.id))}),p&&(0,F.jsxs)(`section`,{className:`gb-detail`,"aria-label":`经营指标明细`,children:[(0,F.jsxs)(`header`,{children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`small`,{children:d?`演示数据 · 不代表真实经营结果`:`归档数据 · 以原件日期和来源为准`}),(0,F.jsxs)(`h2`,{children:[I.find(e=>e.id===p)?.label,` · 明细与下一步`]})]}),(0,F.jsx)(`button`,{"aria-label":`关闭指标明细`,onClick:()=>m(``),children:(0,F.jsx)(x,{size:18})})]}),p===`sales`&&(0,F.jsxs)(F.Fragment,{children:[y?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{children:y.basis}),(0,F.jsxs)(`p`,{children:[`统计范围:`,y.scopeLabel,` · `,y.count,` 个链接 · `,y.identity,`。`,y.mode===`unverified`?`来源未完成独立核验。`:``]}),(0,F.jsx)(`div`,{className:`gb-table`,children:(0,F.jsxs)(`table`,{children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`商品 / 分类`}),(0,F.jsx)(`th`,{children:`支付销售额`}),(0,F.jsx)(`th`,{children:`链接数`}),(0,F.jsx)(`th`,{children:`下一步`})]})}),(0,F.jsx)(`tbody`,{children:y.breakdown.map(e=>(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{children:e.name}),(0,F.jsxs)(`td`,{children:[`¥ `,J(e.sales)]}),(0,F.jsx)(`td`,{children:e.count}),(0,F.jsx)(`td`,{children:(0,F.jsx)(`button`,{onClick:()=>e.itemId?c(e.project,{tab:`monitor`,itemId:e.itemId}):c(y.project,{tab:`data`}),children:e.itemId?`看商品表现`:`核对来源数据`})})]},e.name))})]})}),(0,F.jsx)(`p`,{className:`gb-next`,children:`下一步:先看销售贡献高的商品,再核对退款和成本,决定继续推广还是调整商品。`}),(0,F.jsx)(`a`,{href:R(y),download:d?`模拟销售账本.json`:void 0,children:`查看原始记录`})]}):(0,F.jsx)(`p`,{children:`当前没有全店销售记录。先到数据中心归档同一店铺、同一统计窗口的数据。`}),(0,F.jsx)(`button`,{onClick:()=>l(`data`),children:`进入数据中心`})]}),p===`profit`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{children:`计算:支付销售额 − 同支付订单退款 − 货品、履约、平台、广告、税费、其他费用 − 固定费用分摊。结果是已列成本口径经营结余。`}),b?.complete?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`gb-costs`,children:[Object.entries(b.amounts).map(([e,t])=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{children:e===`gross`?`支付销售额`:te[e]}),(0,F.jsxs)(`b`,{children:[`¥ `,J(t)]})]},e)),(0,F.jsxs)(`div`,{className:`gb-profit`,children:[(0,F.jsx)(`span`,{children:`经营结余`}),(0,F.jsxs)(`b`,{children:[`¥ `,J(b.profit)]})]})]}),(0,F.jsx)(`a`,{href:R(b),download:d?`模拟利润账本.json`:void 0,children:`查看核算原件`})]}):(0,F.jsxs)(`div`,{className:`gb-gap`,children:[(0,F.jsx)(`b`,{children:`当前所选周期缺少完整店铺成本账本,不能计算利润。`}),(0,F.jsx)(`p`,{children:`需要补齐:货品、运费、平台、广告、税费、其他费用、固定费用分摊,以及同支付订单退款。明确没有发生的费用填0,未知项留空。`})]}),(0,F.jsx)(`p`,{className:`gb-next`,children:`下一步:核对金额和凭证;若亏损,先查看费用占比与亏损商品,再进入商品优化评估原因。`}),(0,F.jsx)(`button`,{onClick:()=>c(b?.project||y?.project||o[0]?.id,{tab:`finance`}),disabled:!o.length,children:`打开经营核算`})]}),p===`links`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{children:`按同周期、完整成本账本判断:结余大于0为盈利,小于0为亏损,等于0为持平;缺成本的商品不计入盈亏。当前仅统计有账本的范围。`}),(0,F.jsx)(`div`,{className:`gb-table`,children:(0,F.jsxs)(`table`,{children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`商品`}),(0,F.jsx)(`th`,{children:`销售额`}),(0,F.jsx)(`th`,{children:`经营结余`}),(0,F.jsx)(`th`,{children:`状态`}),(0,F.jsx)(`th`,{children:`下一步`})]})}),(0,F.jsx)(`tbody`,{children:S.map(e=>(0,F.jsxs)(`tr`,{children:[(0,F.jsxs)(`td`,{children:[e.projectName,(0,F.jsx)(`small`,{children:e.scope.id})]}),(0,F.jsxs)(`td`,{children:[`¥ `,J(e.gross)]}),(0,F.jsx)(`td`,{children:e.complete?`¥ `+J(e.profit):`费用不全`}),(0,F.jsx)(`td`,{children:(0,F.jsx)(`span`,{className:e.profit<0?`gb-loss`:`gb-win`,children:e.complete?e.profit>0?`盈利`:e.profit<0?`亏损`:`持平`:`待核算`})}),(0,F.jsx)(`td`,{children:(0,F.jsx)(`button`,{onClick:()=>c(e.project,{tab:e.complete?`optimization`:`finance`,itemId:e.scope.id}),children:e.complete?`查看并优化`:`补齐费用`})})]},e.id))})]})}),!S.length&&(0,F.jsx)(`p`,{children:`当前所选周期没有商品成本账本,不能仅凭销售额判定盈亏。`}),(0,F.jsx)(`button`,{disabled:!o.length,onClick:()=>c(y?.project||o[0]?.id,{tab:`finance`}),children:`补充商品成本账本`})]}),p===`incubation`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{children:`这里只统计已保存的运营晋级记录与累计纳入数量,不计算经营成功率。未晋级可能仍在观察,不代表失败;每条记录需要核对标准、证据和观察时间,不能推断可复制收益。`}),(0,F.jsxs)(`div`,{className:`gb-inc-summary`,children:[(0,F.jsxs)(`b`,{children:[N.length,(0,F.jsx)(`small`,{children:`达标晋级`})]}),(0,F.jsx)(`span`,{children:`/`}),(0,F.jsxs)(`b`,{children:[M.length,(0,F.jsx)(`small`,{children:`纳入孵化`})]})]}),(0,F.jsx)(`div`,{className:`gb-table`,children:(0,F.jsxs)(`table`,{children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`商品`}),(0,F.jsx)(`th`,{children:`加入时间`}),(0,F.jsx)(`th`,{children:`结果`}),(0,F.jsx)(`th`,{children:`老师标准与依据`}),(0,F.jsx)(`th`,{children:`下一步`})]})}),(0,F.jsx)(`tbody`,{children:M.map(e=>(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{children:e.itemId}),(0,F.jsx)(`td`,{children:e.started.slice(0,10)}),(0,F.jsx)(`td`,{children:e.success?`达标晋级`:`继续观察`}),(0,F.jsxs)(`td`,{className:`gb-wrap`,children:[e.standard||`待记录老师标准`,(0,F.jsx)(`small`,{children:e.evidence||`尚无达标证据`})]}),(0,F.jsx)(`td`,{children:(0,F.jsx)(`button`,{onClick:()=>{let t=r.find(t=>t.itemId===e.itemId&&t.project===e.project);t?u(t):c(e.project,{tab:`data`})},children:e.success?`查看运营分组`:`核对并晋级`})})]},e.key))})]})}),!M.length&&(0,F.jsx)(`p`,{children:`还没有新品进入孵化的记录,暂不能评价。`}),(0,F.jsx)(`p`,{className:`gb-next`,children:`下一步:先把新品加入“新品测试”;达标后选择下一运营分组,填写老师标准与达标依据。单纯换组不计为已记录达标晋级。`}),(0,F.jsx)(`button`,{disabled:!r.length,onClick:()=>u(r.find(e=>e.tier===`unassigned`)||r[0],`test`),children:`登记新品,开始孵化`})]})]})]})}var oe=e=>Math.abs(e)>=1e4?(e/1e4).toFixed(1)+`万`:Y(e),Y=e=>typeof e==`number`?e.toLocaleString(`zh-CN`,{maximumFractionDigits:2}):`—`,se={scale:`#35dcca`,incubate:`#9880ff`,test:`#438bff`,unassigned:`var(--omni-muted,#91a9bd)`},X={scale:`重点推广`,incubate:`持续孵化`,test:`新品测试`,unassigned:`待分组`},Z=[{id:`business`,label:`经营分析`,note:`查看商品经营趋势、销售构成和运营分组。`},{id:`projects`,label:`项目总览`,note:`全局看进度,卡片看状态,进入节点主流程继续推进。`},{id:`tasks`,label:`待办与任务`,note:`集中查看运营任务、巡店提醒和需要你处理的事项。`},{id:`history`,label:`复盘动态`,note:`回看项目阶段与历史记录,核对过程和依据。`}],ce={done:`已确认`,review:`待确认`,attention:`需处理`,todo:`未开始`,stopped:`已停止`};function Q({title:e,sub:t,children:n}){return(0,F.jsxs)(`div`,{className:`gc-panel-head`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h2`,{children:[(0,F.jsx)(`span`,{}),` `,e]}),(0,F.jsx)(`small`,{children:t})]}),n]})}function le({series:e,days:t,onOpen:n}){let[r,o]=(0,j.useState)(null),s=e?.points||[],c=Date.parse(s.at(-1)?.date)-(t-1)*864e5,l=s.filter(e=>Date.parse(e.date)>=c),u=l.filter(e=>e.value!==null).map(e=>e.value);if(!u.length)return(0,F.jsxs)(`div`,{className:`gc-chart-empty`,children:[(0,F.jsx)(a,{size:38}),(0,F.jsx)(`b`,{children:`这段时间还没有可用数据`}),(0,F.jsx)(`span`,{children:`进入商品监控,查看数据来源与日期`}),(0,F.jsxs)(`button`,{onClick:n,children:[`查看商品监控 `,(0,F.jsx)(i,{size:13})]})]});let d=Math.min(0,...u),f=Math.max(1,...u)-d,p=e=>54+(Date.parse(e.date)-c)/(Math.max(1,t-1)*864e5)*690,m=e=>220-(e-d)/f*180,h=null,g=[];return l.forEach(e=>{if(e.value===null){h=null;return}h&&Date.parse(e.date)-Date.parse(h.date)===864e5&&g.push((0,F.jsx)(`line`,{x1:p(h),y1:m(h.value),x2:p(e),y2:m(e.value)},e.date)),h=e}),(0,F.jsxs)(`div`,{className:`gc-chart`,children:[(0,F.jsxs)(`div`,{className:`gc-chart-reading`,children:[(0,F.jsxs)(`strong`,{children:[Y(r?.value??l.at(-1)?.value),(0,F.jsx)(`small`,{children:e.unit})]}),(0,F.jsxs)(`span`,{children:[r?.date||l.at(-1)?.date,` · `,e.name]}),(0,F.jsx)(`i`,{children:`柱与线均为同一指标`})]}),(0,F.jsxs)(`svg`,{viewBox:`0 0 780 255`,role:`img`,"aria-label":`${e.name},最近${t}天归档趋势,缺失不补零`,children:[(0,F.jsx)(`defs`,{children:(0,F.jsxs)(`linearGradient`,{id:`gc-bar`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,F.jsx)(`stop`,{stopColor:`var(--omni-chart-primary,#5ec9ff)`}),(0,F.jsx)(`stop`,{offset:`1`,stopColor:`var(--omni-chart-primary,#2857d6)`,stopOpacity:`.3`})]})}),[0,.25,.5,.75,1].map(e=>(0,F.jsxs)(`g`,{children:[(0,F.jsx)(`line`,{className:`gc-gridline`,x1:`54`,x2:`750`,y1:m(d+f*e),y2:m(d+f*e)}),(0,F.jsx)(`text`,{x:`42`,y:m(d+f*e)+4,textAnchor:`end`,children:oe(d+f*e)})]},e)),l.map(n=>n.value===null?null:(0,F.jsxs)(`g`,{onMouseEnter:()=>o(n),onMouseLeave:()=>o(null),children:[(0,F.jsx)(`rect`,{x:p(n)-Math.min(8,230/t),y:Math.min(m(0),m(n.value)),width:Math.min(16,460/t),height:Math.max(1,Math.abs(m(0)-m(n.value))),rx:`2`,fill:`url(#gc-bar)`}),(0,F.jsx)(`circle`,{cx:p(n),cy:m(n.value),r:`3`,fill:`var(--omni-chart-primary,#6ceeff)`}),(0,F.jsxs)(`title`,{children:[n.date,`:`,Y(n.value),` `,e.unit]})]},n.date)),(0,F.jsx)(`g`,{className:`gc-line`,children:g}),[0,.25,.5,.75,1].map(e=>(0,F.jsx)(`text`,{x:54+690*e,y:`247`,textAnchor:`middle`,children:new Date(c+(t-1)*864e5*e).toISOString().slice(5,10)},e))]})]})}function $(e){return(0,F.jsx)(ne,{scope:e.layoutScope,onDirty:e.onDirty,children:(0,F.jsx)(ue,{...e})})}function ue({products:e,projects:t,catalog:n,ready:r,onAction:a,onAssign:o,onOpen:l,onNav:u,onTier:d,onCreate:p,onExecute:h,metrics:g,demo:_,projectActivity:v,projectPreview:y,onRefreshProjects:b}){let[x,S]=T(`workbench.cockpit.tab`,`business`),C=Z.find(e=>e.id===x)||Z[0],w=(0,j.useRef)(null);function E(e){let t=Z.findIndex(e=>e.id===C.id),n=e.key===`ArrowRight`?(t+1)%Z.length:e.key===`ArrowLeft`?(t+Z.length-1)%Z.length:e.key===`Home`?0:e.key===`End`?Z.length-1:-1;n<0||(e.preventDefault(),S(Z[n].id),(w.current?.querySelectorAll(`[role=tab]`)[n])?.focus())}let[D,O]=T(`workbench.productKey`,``),[k,M]=T(`workbench.metric`,``),[N,P]=T(`workbench.days`,30),[I,ee]=T(`workbench.timelineDays`,14),[te,L]=(0,j.useState)(null),R=e.find(e=>e.key===D)||e.find(e=>e.demoCurrent)||e[0],z=R?.series.find(e=>e.key===k)||R?.series.find(e=>[`paid`,`payAmt`,`sales`,`gmv`].includes(e.metric))||R?.series.find(e=>e.metric===`buyers`)||R?.series[0],B=v?.running??0,ne=v?.pending??0,V=e.filter(e=>f(e)),H=Object.keys(X).map(t=>({id:t,name:X[t],count:e.filter(e=>e.tier===t).length})),U=0,W=H.map(t=>{let n={...t,offset:U,length:e.length?t.count/e.length*314.16:0};return U+=n.length,n}),G=t.filter(e=>e.replay?.some(e=>Number.isFinite(Date.parse(e.at)))).sort((e,t)=>String(t.updated).localeCompare(String(e.updated))),K=Math.max(0,...G.flatMap(e=>e.replay.map(e=>Date.parse(e.at)).filter(Number.isFinite))),q=K-(I-1)*864e5,J=[{label:`待选择运营分组`,items:e.filter(e=>e.tier===`unassigned`),color:`#8097b8`},{label:`数据需更新`,items:e.filter(e=>e.work?.needsUpdate),color:`#f3ba66`},{label:`任务需检查`,items:e.filter(e=>e.work?.problems?.length),color:`#f581a7`},{label:`近期运行中`,items:e.filter(e=>e.work?.active?.length),color:`#3ddad7`}],Y=g?.sales?.[0],$=(Y?.breakdown||[]).filter(e=>typeof e.sales==`number`).slice().sort((e,t)=>t.sales-e.sales).slice(0,8),ue=$.length>0&&$.every(e=>e.itemId),me=Math.max(1,...$.map(e=>e.sales));return(0,F.jsxs)(`div`,{className:`gc`,children:[(0,F.jsx)(re,{enabled:[`business`,`projects`].includes(C.id),groups:[`cockpit.kpis`,...C.id===`projects`?[`projects.modules`,`projects.stats`,`projects.cards`]:[`cockpit.business`]]}),(0,F.jsx)(ae,{metrics:g,products:e,projects:t,ready:r,onOpen:l,onNav:u,onAssign:o,demo:_,projectActivity:v}),(0,F.jsxs)(`div`,{className:`gc-tabs-heading`,children:[(0,F.jsx)(`div`,{role:`tablist`,"aria-label":`工作台分类`,className:`gc-tabs`,"data-layout-control":!0,ref:w,onKeyDown:E,children:Z.map(e=>(0,F.jsx)(`button`,{role:`tab`,id:`gc-tab-`+e.id,"aria-controls":`gc-panel-`+e.id,"aria-selected":C.id===e.id,tabIndex:C.id===e.id?0:-1,onClick:()=>S(e.id),children:e.label},e.id))}),C.id===`projects`&&(0,F.jsxs)(`div`,{className:`pb-heading-actions`,children:[(0,F.jsxs)(`button`,{className:`pb-all-projects`,onClick:()=>u(`projects`),children:[`查看全部项目 `,(0,F.jsx)(i,{size:14})]}),(0,F.jsx)(`button`,{className:`pb-create`,onClick:p,children:`+ 新建项目`})]})]}),(0,F.jsx)(`p`,{className:`gc-tab-description`,children:C.note}),(0,F.jsxs)(`div`,{role:`tabpanel`,id:`gc-panel-`+C.id,"aria-labelledby":`gc-tab-`+C.id,tabIndex:0,className:`gc-tab-panel gc-tab-`+C.id,children:[C.id===`projects`&&(0,F.jsx)(c,{previewData:y,onRefresh:b,onExecute:h,projects:t,ready:r,onOpen:l,onCreate:p,showHeading:!1,previewLimit:8,onAllProjects:()=>u(`projects`)}),C.id===`tasks`&&(0,F.jsx)(`div`,{className:`gc-quick-tiers`,"aria-label":`运营策略任务速览`,children:[`test`,`incubate`,`scale`].map(t=>{let n=e.filter(e=>e.tier===t),r=n.filter(e=>e.work?.active?.length),c=n.filter(e=>f(e)),l=n.find(e=>e.demoCurrent)||r[0]||n[0];return(0,F.jsxs)(`section`,{style:{"--tier":se[t]},children:[(0,F.jsxs)(`header`,{children:[(0,F.jsx)(`b`,{children:X[t]}),(0,F.jsxs)(`span`,{children:[n.length,`个商品 · `,r.length,`个运行中`]}),(0,F.jsx)(`button`,{onClick:()=>d(t),"aria-label":`查看`+X[t]+`全部商品`,children:(0,F.jsx)(s,{size:14})})]}),(0,F.jsxs)(`button`,{className:`gc-quick-line`,disabled:!l,onClick:()=>a(l,`work`),children:[(0,F.jsx)(`em`,{children:`正在做`}),(0,F.jsxs)(`span`,{children:[l?l.demoCurrent||m(l):`等待商品加入`,l&&(0,F.jsx)(`small`,{children:l.projectName})]})]}),(0,F.jsxs)(`button`,{className:`gc-quick-line`,onClick:()=>l?a(l,`data`):o(null,t),children:[(0,F.jsx)(`em`,{children:`下一步`}),(0,F.jsx)(`span`,{children:l?.demoNext||(t===`test`?`核对点击和加购,选出潜力款`:t===`incubate`?`核对转化与成本,确认是否赚钱`:`检查推广效果,优化计划`)}),(0,F.jsx)(s,{size:12})]}),(0,F.jsxs)(`button`,{className:`gc-quick-alert `+(c.length?`has-issues`:``),onClick:()=>c.length?a(c[0],`work`):d(t),children:[c.length?`需要你处理 `+c.length+` 项 · `+f(c[0]):`暂无待处理提醒`,(0,F.jsx)(i,{size:12})]})]},t)})}),(0,F.jsxs)(ie,{group:`cockpit.`+C.id,className:`gc-main-grid`,children:[C.id===`business`&&(0,F.jsxs)(`section`,{"data-layout-label":`商品经营趋势`,className:`gc-panel gc-sales`,children:[(0,F.jsx)(Q,{title:`商品经营趋势`,sub:`按商品查看归档数据,保留真实波动`,children:(0,F.jsx)(`div`,{className:`gc-toggle`,children:[7,30].map(e=>(0,F.jsxs)(`button`,{"aria-pressed":N===e,onClick:()=>P(e),children:[e,`天`]},e))})}),(0,F.jsxs)(`div`,{className:`gc-selects`,children:[(0,F.jsx)(`select`,{"aria-label":`驾驶舱商品`,value:R?.key||``,onChange:e=>{O(e.target.value),M(``)},children:e.map(e=>(0,F.jsxs)(`option`,{value:e.key,children:[e.title||e.projectName,` · `,e.shopName||e.itemId]},e.key))}),(0,F.jsx)(`select`,{"aria-label":`驾驶舱趋势指标`,value:z?.key||``,onChange:e=>M(e.target.value),children:R?.series.map(e=>(0,F.jsx)(`option`,{value:e.key,children:e.name},e.key))}),(0,F.jsxs)(`button`,{disabled:!R,onClick:()=>a(R,`data`),children:[`明细 `,(0,F.jsx)(s,{size:12})]})]}),(0,F.jsx)(le,{series:z,days:N,onOpen:()=>R?a(R,`monitor`):u(`projects`)},R?.key+`|`+z?.key+`|`+N),(0,F.jsx)(`p`,{className:`gc-footnote`,children:`单商品数据,不等于全店销售额 · 缺失日期不连线 · 来源见归档详情`})]},`sales`),C.id===`business`&&(0,F.jsxs)(`section`,{"data-layout-label":`商品运营分组`,className:`gc-panel gc-structure`,children:[(0,F.jsx)(Q,{title:`商品运营分组`,sub:`点击分类,查看商品和下一步`}),(0,F.jsxs)(`div`,{className:`gc-ring`,children:[(0,F.jsxs)(`svg`,{viewBox:`0 0 160 160`,role:`img`,"aria-label":H.map(e=>e.name+e.count+`个`).join(`,`),children:[(0,F.jsx)(`circle`,{cx:`80`,cy:`80`,r:`62`,fill:`none`,stroke:`var(--omni-chart-track,#1e355b)`,strokeWidth:`1`,strokeDasharray:`2 4`}),(0,F.jsx)(`circle`,{cx:`80`,cy:`80`,r:`50`,fill:`none`,stroke:`var(--omni-chart-track,#152849)`,strokeWidth:`18`}),W.filter(e=>e.count>0).map(e=>(0,F.jsx)(`circle`,{cx:`80`,cy:`80`,r:`50`,fill:`none`,stroke:se[e.id],strokeWidth:`18`,strokeDasharray:`${e.length} ${314.16-e.length}`,strokeDashoffset:-e.offset,transform:`rotate(-90 80 80)`},e.id)),(0,F.jsx)(`text`,{x:`80`,y:`80`,textAnchor:`middle`,className:`gc-ring-number`,children:r?e.length:`—`}),(0,F.jsx)(`text`,{x:`80`,y:`98`,textAnchor:`middle`,children:`商品观察对象`})]}),(0,F.jsx)(`div`,{className:`gc-ring-legend`,children:H.map(t=>(0,F.jsxs)(`button`,{onClick:()=>d(t.id),children:[(0,F.jsx)(`i`,{style:{background:se[t.id]}}),(0,F.jsx)(`span`,{children:t.name}),(0,F.jsx)(`b`,{children:t.count}),(0,F.jsxs)(`small`,{children:[e.length?Math.round(t.count/e.length*100):0,`%`]}),(0,F.jsx)(s,{size:12})]},t.id))})]}),(0,F.jsx)(`p`,{className:`gc-footnote`,children:`同一商品在不同项目中分别记录;人工策略分组以保存记录为准,不代表全店经营梯队。`})]},`structure`),C.id===`business`&&(0,F.jsxs)(`section`,{"data-layout-label":`销售构成`,className:`gc-panel gc-ranking`,children:[(0,F.jsx)(Q,{title:ue?`商品销售排行`:`销售构成`,sub:Y?Y.start+` — `+Y.end+` · 同一份销售账本`:`按同一统计期的销售账本排名`}),(0,F.jsx)(`div`,{className:`gc-rank-list`,children:$.map((e,t)=>(0,F.jsxs)(`button`,{onClick:()=>l(e.project||Y.project,{tab:e.itemId?`monitor`:`data`,itemId:e.itemId}),children:[(0,F.jsx)(`i`,{children:t+1}),(0,F.jsxs)(`span`,{title:e.name||e.itemId,children:[e.name||e.itemId,(0,F.jsx)(`small`,{children:e.itemId||e.count+`个商品`})]}),(0,F.jsx)(`div`,{children:(0,F.jsx)(`b`,{style:{width:Math.max(2,e.sales/me*100)+`%`}})}),(0,F.jsxs)(`strong`,{children:[`¥`,oe(e.sales)]})]},e.project+`|`+(e.itemId||e.name)))}),!$.length&&(0,F.jsxs)(`p`,{className:`gc-no-data`,children:[`还没有同期商品销售明细。`,(0,F.jsx)(`button`,{onClick:()=>u(`data`),children:`查看已有资料`})]}),(0,F.jsx)(`p`,{className:`gc-footnote`,children:ue?`点击商品核对明细 · 销售排名不代表盈利排名`:`原件按品类汇总,点击查看归档;不是单品排名`})]},`ranking`),C.id===`tasks`&&(0,F.jsxs)(`section`,{"data-layout-label":`巡店检查`,className:`gc-panel gc-inspect`,children:[(0,F.jsx)(Q,{title:`巡店检查`,sub:`基于归档与任务状态 · 点击查看待办`,children:(0,F.jsx)(A,{size:17})}),(0,F.jsx)(`div`,{className:`gc-checks`,children:J.map(t=>(0,F.jsxs)(`button`,{disabled:!t.items.length,onClick:()=>t.label===`待选择运营分组`?o(t.items[0]):a(t.items[0],`work`),children:[(0,F.jsx)(`span`,{children:t.label}),(0,F.jsx)(`div`,{children:(0,F.jsx)(`i`,{style:{width:`${e.length?t.items.length/e.length*100:0}%`,background:t.color}})}),(0,F.jsx)(`b`,{children:r?t.items.length:`—`}),(0,F.jsx)(s,{size:12})]},t.label))}),(0,F.jsx)(`p`,{className:`gc-footnote`,children:`同一商品可有多项提醒,数量不可相加;点击先处理一项。`}),(0,F.jsxs)(`div`,{className:`gc-archive`,children:[(0,F.jsx)(de,{count:n.length}),(0,F.jsxs)(`button`,{onClick:()=>u(`data`),children:[`查看来源 `,(0,F.jsx)(i,{size:12})]})]})]},`inspect`),C.id===`history`&&(0,F.jsxs)(`section`,{"data-layout-label":`项目阶段记录`,className:`gc-panel gc-matrix`,children:[(0,F.jsx)(Q,{title:`项目阶段记录`,sub:`节点流程与历史六步记录分别保留,点击核对对应阶段`,children:(0,F.jsxs)(`button`,{onClick:()=>u(`projects`),children:[`全部项目 `,(0,F.jsx)(i,{size:12})]})}),(0,F.jsx)(`div`,{className:`gc-state-legend`,children:Object.entries(ce).map(([e,t])=>(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`i`,{className:e}),t]},e))}),(0,F.jsxs)(`div`,{className:`gc-matrix-scroll`,children:[t.slice(0,8).map(e=>(0,F.jsxs)(`div`,{className:`gc-matrix-row`,children:[(0,F.jsxs)(`button`,{className:`gc-project-name`,title:e.name,onClick:()=>l(e.id,{tab:`overview`}),children:[e.name,(0,F.jsxs)(`small`,{children:[e.done,`/`,e.total,` 阶段已确认`]})]}),(0,F.jsx)(`div`,{children:e.route.map((t,n)=>(0,F.jsx)(`button`,{className:`gc-cell `+t.state,"aria-label":`${e.name}:${t.name},${ce[t.state]}`,title:`${t.name} · ${ce[t.state]}`,onClick:()=>l(e.id,t.target),children:String(n+1).padStart(2,`0`)},t.id))})]},e.id)),!t.length&&(0,F.jsx)(`p`,{className:`gc-no-data`,children:`当前范围还没有项目。`})]})]},`matrix`),C.id===`history`&&(0,F.jsxs)(`section`,{"data-layout-label":`项目历史时间轴`,className:`gc-panel gc-history`,children:[(0,F.jsx)(Q,{title:`项目历史时间轴`,sub:_?`模拟历史记录;每天的记录合并为一个色块`:`按真实归档时间显示;每天的记录合并为一个色块`,children:(0,F.jsx)(`div`,{className:`gc-toggle`,children:[14,30].map(e=>(0,F.jsxs)(`button`,{"aria-pressed":I===e,onClick:()=>ee(e),children:[e,`天`]},e))})}),K>0?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`gc-time-header`,children:[(0,F.jsx)(`span`,{children:`项目 / 点击查看记录`}),(0,F.jsx)(`div`,{children:[0,.25,.5,.75,1].map(e=>(0,F.jsx)(`span`,{children:new Date(q+(K-q)*e).toISOString().slice(5,10)},e))})]}),(0,F.jsx)(`div`,{className:`gc-time-scroll`,children:G.filter(e=>e.replay.some(e=>Date.parse(e.at)>=q)).slice(0,7).map(e=>(0,F.jsxs)(`div`,{className:`gc-time-row`,children:[(0,F.jsx)(`button`,{title:e.name,onClick:()=>L({project:e,events:e.replay}),children:e.name}),(0,F.jsx)(`div`,{children:fe(e.replay.filter(e=>Date.parse(e.at)>=q)).map(t=>(0,F.jsx)(`button`,{className:`gc-event `+(t.events.some(e=>/失败|停止/.test(e.state))?`bad`:t.events.some(e=>/确认|完成/.test(e.state))?`done`:`saved`),style:{left:`${(Date.parse(t.events[0].at)-q)/(K-q)*100}%`},title:`${t.date} · ${t.events.length} 条记录`,"aria-label":`${e.name}:${t.date},${t.events.length}条记录`,onClick:()=>L({project:e,events:t.events,date:t.date}),children:t.events.length},t.date))})]},e.id))}),(0,F.jsxs)(`p`,{className:`gc-footnote`,children:[`最近有记录的日期窗口 · 每个项目最多展示最近120条记录 · 点击色块展开当天记录,不代表运行时长;`,_?`演示操作会追加记录。`:`完整回放在项目执行页。`]})]}):(0,F.jsx)(`p`,{className:`gc-no-data`,children:`暂无可回放的历史记录。`})]},`history`),C.id===`tasks`&&(0,F.jsxs)(`section`,{"data-layout-label":`需要你处理`,className:`gc-panel gc-todo`,children:[(0,F.jsx)(Q,{title:`需要你处理`,sub:`先做这一件,再继续下一步`,children:(0,F.jsxs)(`span`,{className:`gc-badge`,children:[V.length,` 项`]})}),(0,F.jsxs)(`div`,{className:`gc-todo-list`,children:[V.map((e,t)=>(0,F.jsxs)(`button`,{onClick:()=>e.tier===`unassigned`?o(e):a(e,`work`),children:[(0,F.jsx)(`span`,{className:`gc-todo-num`,children:String(t+1).padStart(2,`0`)}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`b`,{children:f(e)}),(0,F.jsxs)(`span`,{children:[e.title||e.projectName,` · `,e.shopName||e.itemId]}),(0,F.jsx)(`small`,{children:m(e)})]}),(0,F.jsx)(s,{size:15})]},e.key)),!V.length&&(0,F.jsx)(`p`,{className:`gc-no-data`,children:r?`当前没有商品待办。`:`正在读取…`}),(0,F.jsx)(`h3`,{className:`gc-next-label`,children:`接下来可以做`}),t.slice(0,5).map(e=>(0,F.jsxs)(`button`,{onClick:()=>l(e.id,{tab:`overview`}),children:[(0,F.jsx)(`span`,{className:`gc-next-dot`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`b`,{children:e.name}),(0,F.jsx)(`span`,{children:`查看项目节点与下一步`})]}),(0,F.jsx)(s,{size:13})]},`next-`+e.id))]})]},`todo`)]})]}),te&&(0,F.jsx)(pe,{...te,onClose:()=>L(null),onOpen:l}),(0,F.jsxs)(`div`,{className:`gc-status-strip`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`i`,{}),` `,_?`教学模拟`:`归档数据`,` · `,e.length,` 个商品`]}),(0,F.jsxs)(`span`,{children:[t.length,` 个项目 · `,v?.started??0,` 个已开展 · `,v?.complete??0,` 个项目已完成`]}),(0,F.jsxs)(`span`,{children:[B,` 项推进中 · `,ne,` 项待开始`]}),(0,F.jsxs)(`button`,{onClick:()=>u(`products`),children:[`展开运营工作清单 `,(0,F.jsx)(i,{size:13})]})]})]})}function de({count:e}){return(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{children:e}),` 份归档资料可追溯`]})}function fe(e){let t=new Map;for(let n of e){let e=new Date(Date.parse(n.at)+8*36e5).toISOString().slice(0,10);t.set(e,[...t.get(e)||[],n])}return[...t].map(([e,t])=>({date:e,events:t}))}function pe({project:e,events:t,date:n,onClose:r,onOpen:i}){let a=(0,j.useRef)(null);return(0,j.useEffect)(()=>{a.current?.showModal()},[]),(0,F.jsxs)(`dialog`,{className:`ta-dialog gc-history-dialog`,ref:a,onClose:r,"aria-labelledby":`gc-history-title`,children:[(0,F.jsxs)(`div`,{className:`ta-dialog-head`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`small`,{children:e.name}),(0,F.jsxs)(`h2`,{id:`gc-history-title`,children:[n||`项目历史`,` · `,t.length,` 条记录`]})]}),(0,F.jsx)(`button`,{"aria-label":`关闭历史记录`,onClick:r,children:`×`})]}),(0,F.jsx)(`p`,{children:`按发生时间排列。展开记录,查看当时做了什么。`}),(0,F.jsx)(`div`,{className:`gc-records`,children:t.map((t,n)=>(0,F.jsxs)(`details`,{children:[(0,F.jsxs)(`summary`,{children:[(0,F.jsx)(`span`,{children:new Date(t.at).toLocaleString(`zh-CN`,{timeZone:`Asia/Shanghai`})}),(0,F.jsx)(`b`,{children:t.name}),(0,F.jsx)(`em`,{children:t.state})]}),(0,F.jsx)(`p`,{children:t.detail||`此记录没有保存详细说明,可进入对应阶段核对原始资料。`}),(0,F.jsx)(`button`,{onClick:()=>{r(),i(e.id,e.route.find(e=>e.id===t.routeId)?.target||{tab:`data`})},children:`进入对应阶段 / 资料`})]},n))})]})}function me(){let e=w(),[t,n]=T(`workbench.loadedData`,{growth:null,projects:null,activity:null}),[r,i]=(0,j.useState)(!0),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,d]=(0,j.useState)(0),f=e.archiveScope||`real`,[m,g]=(0,j.useState)(null),[v,y]=(0,j.useState)(null);(0,j.useEffect)(()=>{let t=new AbortController;return ee(e.api,e=>n(t=>({...t,...e})),t.signal).then(()=>{t.signal.aborted||o(``)}).catch(e=>{t.signal.aborted||o(e instanceof Error?e.message:`经营资料读取失败`)}).finally(()=>{t.signal.aborted||i(!1)}),()=>t.abort()},[e.api,l,n]);let b=e=>f===`stored-demo`?e.mode===`simulated`:e.mode!==`simulated`,x=t.growth?.products.filter(b)||[],S=t.growth?.catalog.filter(b)||[],C=t.projects?.filter(e=>f===`stored-demo`?e.simulated:!e.simulated)||[],D=t.projects&&t.activity?t.activity.items.filter(e=>C.some(t=>t.id===e.id)):null,O=D?{running:D.reduce((e,t)=>e+t.activeTasks,0),pending:D.reduce((e,t)=>e+t.pendingTasks,0),started:D.filter(e=>e.started>0).length,complete:D.filter(e=>e.status===`complete`).length}:null,k=(0,j.useMemo)(()=>{let e=e=>f===`stored-demo`?e.mode===`simulated`:e.mode!==`simulated`;return{sales:t.growth?.metrics?.sales?.filter(e)||[],finance:t.growth?.metrics?.finance?.filter(e)||[],incubation:t.growth?.metrics?.incubation?.filter(e)||[]}},[t.growth,f]),A=(0,j.useCallback)(()=>{i(!0),d(e=>e+1)},[]);u(C.some(e=>e.execution?.state===`running`),A);function M(t,n){n===`work`?y(t):n===`data`?e.onProductGroup(`all`,t,f):e.onOpen(t.project,{tab:n,itemId:t.itemId})}return(0,F.jsx)(`div`,{className:`workbench-module`,children:(0,F.jsx)(`div`,{className:`gw`,children:(0,F.jsxs)(`div`,{className:`gw-body`,children:[(0,F.jsxs)(`header`,{className:`gw-header`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`small`,{children:`工作台 / 经营总览`}),(0,F.jsx)(`h1`,{children:`电商运营作战台`})]}),(0,F.jsxs)(`div`,{className:`gw-header-actions`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`i`,{className:`gw-dot`}),`归档数据 · 非实时`]}),(0,F.jsxs)(`button`,{disabled:r,onClick:A,children:[(0,F.jsx)(_,{size:14}),r?`读取中`:`刷新数据`]})]})]}),(0,F.jsx)(`div`,{className:`gw-scope`,children:(0,F.jsx)(`span`,{children:t.growth?`${new Date(t.growth.updatedAt).toLocaleString(`zh-CN`)} 读取归档`:`正在读取归档…`})}),a&&(0,F.jsxs)(`p`,{role:`alert`,className:`gw-message`,children:[a,` `,(0,F.jsx)(`button`,{onClick:A,children:`重试`})]}),s&&(0,F.jsx)(`p`,{role:`status`,className:`gw-message`,children:s}),(0,F.jsx)($,{layoutScope:e.layoutScope,onDirty:e.onDirty,onCreate:e.onCreate,products:x,projects:C,catalog:S,metrics:k,projectActivity:O,projectPreview:t.activity,onRefreshProjects:A,ready:!!t.growth,demo:!1,onOpen:e.onOpen,onNav:e.onModule,onTier:t=>e.onProductGroup(t,void 0,f),onAction:M,onAssign:(e,t)=>g({product:e,suggestedTier:t})}),m&&(0,F.jsx)(p,{...m,products:x,onDirty:e.onDirty,onBusy:e.onBusy,onClose:()=>g(null),onSave:async(t,n,r,i)=>{await E(e.api,t,n,r,i),c(`分组已保存,正在更新看板。`),A()}}),v&&(0,F.jsx)(h,{product:v,onOpen:e.onOpen,onClose:()=>y(null)})]})})})}function he({section:e}){let t=w();return e===`tasks`||e===`records`?(0,F.jsx)(I,{mode:e,api:t.api,onOpen:t.onOpen},e):(0,F.jsx)(me,{})}export{he as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as e,x as t}from"./index-
|
|
1
|
+
import{v as e,x as t}from"./index-Dfy2jMWq.js";import{n}from"./workspace-view-state-BuK4-c0r.js";import"./public-Csb687JC.js";import{t as r}from"./api-SsFxK3hw.js";var i=t(e(),1),a={category:`类目`,shop:`店铺`,product:`商品`};function o(e){let[t,a]=n(`market.favorites.collection`,null),[o,s]=(0,i.useState)(``),[c,l]=(0,i.useState)(``),[u,d]=(0,i.useState)(!0),[f,p]=(0,i.useState)(null),[m,h]=(0,i.useState)(0),[g,_]=(0,i.useState)(``),[v,y]=(0,i.useState)({kind:e,count:24}),b=(0,i.useRef)(!1),x=(0,i.useRef)(new Set),S=(0,i.useCallback)(()=>h(e=>e+1),[]),C=(0,i.useCallback)(()=>{b.current=!0,S()},[S]),w=(0,i.useCallback)(t=>y(n=>n.kind===e&&n.count===t?n:{kind:e,count:t}),[e]),T=(0,i.useMemo)(()=>(t?.entries||[]).filter(t=>t.kind===e),[t,e]),E=v.kind===e?v.count:24;(0,i.useEffect)(()=>(window.addEventListener(`omni:market-favorites-changed`,S),()=>window.removeEventListener(`omni:market-favorites-changed`,S)),[S]),(0,i.useEffect)(()=>{let e=new AbortController;return Promise.resolve().then(async()=>{if(!e.signal.aborted){d(!0),s(``),l(``);try{let t=await r.favorites(e.signal);if(t.contractVersion!==1||!Array.isArray(t.entries))throw Error(`收藏数据契约版本不兼容`);e.signal.aborted||(x.current.clear(),b.current&&(t.entries=t.entries.map(e=>({...e,needsRefresh:!0}))),b.current=!1,a(t))}catch(t){e.signal.aborted||(t&&typeof t==`object`&&`status`in t&&[401,403].includes(Number(t.status))&&a(null),s(t instanceof Error?t.message:`收藏读取失败`))}finally{e.signal.aborted||d(!1)}}}),()=>e.abort()},[m,a]),(0,i.useEffect)(()=>{let t=T.slice(0,E).filter(e=>e.needsRefresh&&!x.current.has(e.kind+`:`+e.key)).slice(0,6);if(!t.length)return;let n=new AbortController;return Promise.resolve().then(async()=>{if(!n.signal.aborted){p(e);try{let e=await r.refreshFavorites(t.map(e=>({kind:e.kind,key:e.key})),n.signal);if(n.signal.aborted)return;t.forEach(e=>x.current.add(e.kind+`:`+e.key));let i=new Map(e.entries.map(e=>[e.kind+`:`+e.key,e]));a(e=>e&&{...e,entries:e.entries.map(e=>i.get(e.kind+`:`+e.key)||e)}),e.failed.length&&l(`部分收藏暂时无法更新,已保存的资料仍可使用。`)}catch(e){if(!n.signal.aborted){t.forEach(e=>x.current.add(e.kind+`:`+e.key));let n=e&&typeof e==`object`&&`status`in e?e.status:void 0;n===401||n===403?(a(null),s(`访问授权已变化,请重新检查收藏。`)):l(`资料更新暂未完成,可稍后点击刷新收藏。`)}}finally{n.signal.aborted||p(t=>t===e?null:t)}}}),()=>{n.abort(),p(t=>t===e?null:t)}},[T,e,E,a]);async function D(e,t,n){_(e+`:`+t),s(``);try{return await r.favorite(e,t,n),S(),!0}catch(e){return s(e instanceof Error?e.message:`收藏操作失败`),!1}finally{_(``)}}function O(t){let n=T.find(e=>e.key===t);return{kind:e,key:t,category:n?.snapshot.category,record:n?.snapshot.record,categoryPath:n?.snapshot.categoryPath}}return{collection:t,items:T,error:o,syncError:c,loading:u&&!t,syncing:f===e,busy:g,refresh:C,onVisibleCount:w,save:D,resolve:O}}var s={home:`_home_176h4_1`,top:`_top_176h4_2`,panel:`_panel_176h4_6`,row:`_row_176h4_7`,empty:`_empty_176h4_9`,recordInfo:`_recordInfo_176h4_10`,recordText:`_recordText_176h4_10`,metadata:`_metadata_176h4_10`,thumbnail:`_thumbnail_176h4_10`,actions:`_actions_176h4_11`,tabs:`_tabs_176h4_11`,adder:`_adder_176h4_15`,picker:`_picker_176h4_17`,pickRow:`_pickRow_176h4_18`};export{a as n,o as r,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./index-
|
|
1
|
+
import{h as e}from"./index-Dfy2jMWq.js";var t=e(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as e,x as t}from"./index-
|
|
1
|
+
import{v as e,x as t}from"./index-Dfy2jMWq.js";import{Bt as n,Ct as r,Ht as i,Lt as a,N as o,Ot as s,S as c,Ut as l,Vt as u,bt as d,kt as f,m as p,s as m,y as h}from"./CartesianChart-aa0EJ6w3.js";var g=t(e());function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_.apply(null,arguments)}var v=e=>{var{cx:t,cy:n,r:i,className:a}=e,o=l(`recharts-dot`,a);return f(t)&&f(n)&&f(i)?g.createElement(`circle`,_({},u(e),r(e),{className:o,cx:t,cy:n,r:i})):null},y=[`points`];function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?b(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function S(e,t,n){return(t=C(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function C(e){var t=w(e,`string`);return typeof t==`symbol`?t:t+``}function w(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function T(){return T=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},T.apply(null,arguments)}function E(e,t){if(e==null)return{};var n,r,i=D(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function D(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function O(e){var{option:t,dotProps:n,className:r}=e;if((0,g.isValidElement)(t))return(0,g.cloneElement)(t,n);if(typeof t==`function`)return t(n);var i=l(r,typeof t==`boolean`?``:t.className),a=n??{},{points:o}=a,s=E(a,y);return g.createElement(v,T({},s,{className:i}))}function k(e,t){return e==null?!1:t?!0:e.length===1}function A(e){var{points:t,dot:r,className:i,dotClassName:s,dataKey:c,baseProps:l,needClip:u,clipPathId:d,zIndex:f=o.scatter}=e;if(!k(t,r))return null;var m=p(r),_=n(r),v=t.map((e,n)=>{var i=x(x(x({r:3},l),_),{},{index:n,cx:e.x??void 0,cy:e.y??void 0,dataKey:c,value:e.value,payload:e.payload,points:t});return g.createElement(O,{key:`dot-${n}`,option:r,dotProps:i,className:s})}),y={};return u&&d!=null&&(y.clipPath=`url(#clipPath-${m?``:`dots-`}${d})`),g.createElement(h,{zIndex:f},g.createElement(a,T({className:i},y),v))}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function M(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?j(Object(n),!0).forEach(function(t){N(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function N(e,t,n){return(t=P(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e){var t=F(e,`string`);return typeof t==`symbol`?t:t+``}function F(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var I=e=>{var{point:t,childIndex:n,mainColor:o,activeDot:s,dataKey:c,clipPath:l}=e;if(s===!1||t.x==null||t.y==null)return null;var u=M(M(M({},{index:n,dataKey:c,cx:t.x,cy:t.y,r:4,fill:o??`none`,strokeWidth:2,stroke:`#fff`,payload:t.payload,value:t.value}),i(s)),r(s)),d=(0,g.isValidElement)(s)?(0,g.cloneElement)(s,u):typeof s==`function`?s(u):g.createElement(v,u);return g.createElement(a,{className:`recharts-active-dot`,clipPath:l},d)};function L(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:l=o.activeDot}=e,u=d(c),f=m();if(t==null||f==null)return null;var p=t.find(e=>f.includes(e.payload));return s(p)?null:g.createElement(h,{zIndex:l},g.createElement(I,{point:p,childIndex:Number(u),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}function R(e){var t=i(e),n=3,r=2;if(t!=null){var{r:a,strokeWidth:o}=t,s=Number(a),c=Number(o);return(Number.isNaN(s)||s<0)&&(s=n),(Number.isNaN(c)||c<0)&&(c=r),{r:s,strokeWidth:c}}return{r:n,strokeWidth:r}}export{L as n,A as r,R as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./index-
|
|
1
|
+
import{h as e}from"./index-Dfy2jMWq.js";var t=e(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]);export{t};
|