feat: implement scenario-driven sales SOP platform

This commit is contained in:
Eric 1549169735@qq.com
2026-08-06 21:37:29 +08:00
parent 254469ab89
commit de5345607a
84 changed files with 7132 additions and 2 deletions

View File

@@ -0,0 +1 @@
import{F as e,a as t}from"./client-CO11mUW5.js";var n={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z`}}]},name:`arrow-right`,theme:`outlined`};function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i(e,t,n[t])})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(i,a){var o=r({},i,a.attrs);return e(t,r({},o,{icon:n}),null)};a.displayName=`ArrowRightOutlined`,a.inheritAttrs=!1;var o={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z`}}]},name:`appstore`,theme:`outlined`};function s(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){c(e,t,n[t])})}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(n,r){var i=s({},n,r.attrs);return e(t,s({},i,{icon:o}),null)};l.displayName=`AppstoreOutlined`,l.inheritAttrs=!1;export{a as n,l as t};

View File

@@ -0,0 +1 @@
import{F as e,a as t}from"./client-CO11mUW5.js";var n={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z`}}]},name:`arrow-left`,theme:`outlined`};function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i(e,t,n[t])})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(i,a){var o=r({},i,a.attrs);return e(t,r({},o,{icon:n}),null)};a.displayName=`ArrowLeftOutlined`,a.inheritAttrs=!1;export{a as t};

View File

@@ -0,0 +1 @@
import{F as e,a as t}from"./client-CO11mUW5.js";var n={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-260 72h96v209.9L621.5 312 572 347.4V136zm220 752H232V136h280v296.9c0 3.3 1 6.6 3 9.3a15.9 15.9 0 0022.3 3.7l83.8-59.9 81.4 59.4c2.7 2 6 3.1 9.4 3.1 8.8 0 16-7.2 16-16V136h64v752z`}}]},name:`book`,theme:`outlined`};function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i(e,t,n[t])})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(i,a){var o=r({},i,a.attrs);return e(t,r({},o,{icon:n}),null)};a.displayName=`BookOutlined`,a.inheritAttrs=!1;export{a as t};

View File

@@ -0,0 +1 @@
import{Bt as e,F as t,I as n,O as r,P as i,Q as a,Tt as o,Y as s,i as c,j as l,lt as u,r as d,t as f,tt as p,vt as m}from"./client-CO11mUW5.js";import{t as h}from"./PlusOutlined-5Urx-Evx.js";import{n as g,t as _}from"./AppstoreOutlined-BOx6VBGQ.js";import{t as v}from"./PlayCircleOutlined-C2UGH7h6.js";import{h as y}from"./useApi-CROJJdhE-BlzMTLF9.js";var b={class:`page-shell`},x={class:`page-heading`},S={class:`page-actions`},C={class:`metric-strip surface`},w={class:`metric`},T={class:`metric-icon green`},E={class:`metric`},D={class:`metric-icon coral`},O={class:`metric`},k={class:`metric-icon amber`},A={class:`metric`},j={class:`completion`},M={class:`work-grid`},N={class:`surface action-panel`},P=d(n({__name:`DashboardView`,setup(n){let d=y(),P=m(!0),F=m({scenarios:0,published_sops:0,runs:0,completed_runs:0});return s(async()=>{try{F.value=await f.get(`/dashboard/summary`)}finally{P.value=!1}}),(n,s)=>{let f=p(`a-button`),m=p(`a-skeleton`);return a(),l(`div`,b,[r(`div`,x,[s[5]||=r(`div`,null,[r(`h1`,null,`今天从经验开始`),r(`p`,null,`查看知识沉淀和一线执行的最新状态。`)],-1),r(`div`,S,[t(f,{type:`primary`,onClick:s[0]||=e=>o(d).push(`/scenarios`)},{default:u(()=>[t(o(h)),s[4]||=i(`创建场景`,-1)]),_:1})])]),t(m,{loading:P.value,active:``},{default:u(()=>[r(`section`,C,[r(`div`,w,[r(`span`,T,[t(o(_))]),r(`div`,null,[r(`b`,null,e(F.value.scenarios),1),s[6]||=r(`small`,null,`可用场景`,-1)])]),r(`div`,E,[r(`span`,D,[t(o(c))]),r(`div`,null,[r(`b`,null,e(F.value.published_sops),1),s[7]||=r(`small`,null,`已发布 SOP`,-1)])]),r(`div`,O,[r(`span`,k,[t(o(v))]),r(`div`,null,[r(`b`,null,e(F.value.runs),1),s[8]||=r(`small`,null,`累计执行`,-1)])]),r(`div`,A,[r(`span`,j,e(F.value.runs?Math.round(F.value.completed_runs/F.value.runs*100):0)+`%`,1),r(`div`,null,[r(`b`,null,e(F.value.completed_runs),1),s[9]||=r(`small`,null,`完成执行`,-1)])])])]),_:1},8,[`loading`]),r(`section`,M,[r(`div`,N,[s[13]||=r(`div`,{class:`panel-kicker`},`常用入口`,-1),r(`button`,{onClick:s[1]||=e=>o(d).push(`/scenarios`)},[s[10]||=r(`span`,null,[i(`配置新的业务场景`),r(`small`,null,`定义字段、目标和触发条件`)],-1),t(o(g))]),r(`button`,{onClick:s[2]||=e=>o(d).push(`/execute`)},[s[11]||=r(`span`,null,[i(`开始执行已发布 SOP`),r(`small`,null,`根据客户回答逐步推进`)],-1),t(o(g))]),r(`button`,{onClick:s[3]||=e=>o(d).push(`/knowledge`)},[s[12]||=r(`span`,null,[i(`维护审核知识卡`),r(`small`,null,`统一口径与风险提示`)],-1),t(o(g))])]),s[14]||=r(`div`,{class:`surface doctrine-panel`},[r(`div`,{class:`panel-kicker`},`平台原则`),r(`blockquote`,null,`一句好话术不应只被收藏,它应该知道何时出现、下一步去哪,以及是否真的有效。`),r(`div`,{class:`flow-note`},[r(`span`,null,`创建`),r(`i`),r(`span`,null,`发布`),r(`i`),r(`span`,null,`执行`),r(`i`),r(`span`,null,`复盘`)])],-1)])])}}}),[[`__scopeId`,`data-v-233c2a06`]]);export{P as default};

View File

@@ -0,0 +1 @@
.metric-strip[data-v-233c2a06]{grid-template-columns:repeat(4,1fr);display:grid;overflow:hidden}.metric[data-v-233c2a06]{border-right:1px solid var(--line);align-items:center;gap:16px;min-height:116px;padding:22px;display:flex}.metric[data-v-233c2a06]:last-child{border-right:0}.metric-icon[data-v-233c2a06],.completion[data-v-233c2a06]{border-radius:5px;place-items:center;width:42px;height:42px;font-size:19px;display:grid}.metric-icon.green[data-v-233c2a06]{color:#16775b;background:#e5f3ee}.metric-icon.coral[data-v-233c2a06]{color:#c4573f;background:#faece7}.metric-icon.amber[data-v-233c2a06]{color:#a86e1e;background:#f8efdf}.completion[data-v-233c2a06]{color:#202825;background:#e8ecea;font-size:12px;font-weight:800}.metric div[data-v-233c2a06]{flex-direction:column;display:flex}.metric b[data-v-233c2a06]{font-family:Noto Serif SC,serif;font-size:28px;line-height:1}.metric small[data-v-233c2a06]{color:var(--muted);margin-top:8px}.work-grid[data-v-233c2a06]{grid-template-columns:1.05fr .95fr;gap:18px;margin-top:18px;display:grid}.action-panel[data-v-233c2a06],.doctrine-panel[data-v-233c2a06]{padding:22px}.panel-kicker[data-v-233c2a06]{color:#7c8883;text-transform:uppercase;margin-bottom:14px;font-size:11px;font-weight:700}.action-panel button[data-v-233c2a06]{width:100%;color:var(--ink);text-align:left;border:0;border-bottom:1px solid var(--line);cursor:pointer;background:0 0;justify-content:space-between;align-items:center;padding:15px 0;display:flex}.action-panel button[data-v-233c2a06]:last-child{border-bottom:0}.action-panel button[data-v-233c2a06]:hover{color:var(--green)}.action-panel button span[data-v-233c2a06]{flex-direction:column;font-weight:650;display:flex}.action-panel button small[data-v-233c2a06]{color:var(--muted);margin-top:4px;font-weight:400}.doctrine-panel[data-v-233c2a06]{color:#fff;background:#202825;border-color:#202825}.doctrine-panel .panel-kicker[data-v-233c2a06]{color:#89a099}blockquote[data-v-233c2a06]{margin:30px 0 42px;font-family:Noto Serif SC,serif;font-size:22px;line-height:1.65}.flow-note[data-v-233c2a06]{color:#9cafaa;align-items:center;font-size:12px;display:flex}.flow-note i[data-v-233c2a06]{background:#4a5a54;flex:1;height:1px;margin:0 10px}@media (width<=900px){.metric-strip[data-v-233c2a06]{grid-template-columns:repeat(2,1fr)}.metric[data-v-233c2a06]:nth-child(2){border-right:0}.metric[data-v-233c2a06]:nth-child(-n+2){border-bottom:1px solid var(--line)}.work-grid[data-v-233c2a06]{grid-template-columns:1fr}}@media (width<=520px){.metric[data-v-233c2a06]{min-height:100px;padding:16px}.metric b[data-v-233c2a06]{font-size:24px}.metric-icon[data-v-233c2a06],.completion[data-v-233c2a06]{display:none}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
.execution-shell[data-v-6a3af49b]{max-width:1220px}.sop-catalog[data-v-6a3af49b]{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;display:grid}.sop-entry[data-v-6a3af49b]{text-align:left;cursor:pointer;grid-template-columns:40px 1fr 42px;align-items:start;gap:14px;min-height:150px;padding:22px;display:grid}.sop-entry[data-v-6a3af49b]:hover{border-color:#9ac8b8;box-shadow:0 8px 24px #20282512}.entry-seq[data-v-6a3af49b]{color:#8c9893;font-family:monospace;font-size:12px}.sop-entry small[data-v-6a3af49b]{color:var(--green);font-weight:650}.sop-entry h2[data-v-6a3af49b]{margin:8px 0 7px;font-family:Noto Serif SC,serif;font-size:20px}.sop-entry p[data-v-6a3af49b]{color:var(--muted);margin:0;line-height:1.6}.play[data-v-6a3af49b]{color:#fff;background:#202825;border-radius:4px;place-items:center;width:38px;height:38px;font-size:18px;display:grid}.run-workspace[data-v-6a3af49b]{grid-template-columns:270px minmax(0,1fr);gap:18px;display:grid}.run-context[data-v-6a3af49b]{color:#fff;background:#202825;border-radius:6px;align-self:start;padding:24px;position:sticky;top:86px}.run-label[data-v-6a3af49b]{color:#72c9ab;font-size:11px;font-weight:700}.run-context h2[data-v-6a3af49b]{margin:12px 0 8px;font-family:Noto Serif SC,serif}.run-context>p[data-v-6a3af49b]{color:#aebdb7;margin:0 0 28px;line-height:1.6}.context-meta[data-v-6a3af49b]{border-top:1px solid #3a4742;justify-content:space-between;align-items:center;padding:13px 0;display:flex}.context-meta span[data-v-6a3af49b]{color:#9eada7;font-size:12px}.privacy-note[data-v-6a3af49b]{color:#889b93;gap:8px;margin-top:28px;font-size:11px;display:flex}.conversation[data-v-6a3af49b]{min-height:590px;padding:30px 34px}.conversation-progress[data-v-6a3af49b]{color:#66736d;align-items:center;gap:8px;font-size:12px;display:flex}.conversation-progress span[data-v-6a3af49b]{background:#d08736;border-radius:50%;width:8px;height:8px;box-shadow:0 0 0 4px #faefe1}.conversation-progress span.done[data-v-6a3af49b]{background:var(--green);box-shadow:0 0 0 4px #e4f1ec}.node-content[data-v-6a3af49b]{padding:44px 0 26px}.node-content small[data-v-6a3af49b]{color:var(--green);font-size:10px;font-weight:800}.node-content h1[data-v-6a3af49b]{margin:8px 0 22px;font-family:Noto Serif SC,serif;font-size:28px}.node-content blockquote[data-v-6a3af49b]{color:#29342f;border-left:3px solid var(--green);background:#f2f6f4;margin:0;padding:18px 20px;font-size:17px;line-height:1.8}.answer-form[data-v-6a3af49b]{max-width:680px}.choice-group[data-v-6a3af49b]{flex-wrap:wrap;display:flex}.run-actions[data-v-6a3af49b]{border-top:1px solid var(--line);color:var(--muted);justify-content:space-between;align-items:center;gap:16px;margin:24px -34px -30px;padding:18px 34px;font-size:12px;display:flex}.completed-state[data-v-6a3af49b]{text-align:center;padding:40px 0}.completed-state>span[data-v-6a3af49b]{color:var(--green);font-size:50px}.completed-state h3[data-v-6a3af49b]{margin:14px 0 8px;font-family:Noto Serif SC,serif;font-size:24px}.completed-state p[data-v-6a3af49b]{color:var(--muted);margin:0 0 24px}@media (width<=800px){.sop-catalog[data-v-6a3af49b],.run-workspace[data-v-6a3af49b]{grid-template-columns:1fr}.run-context[data-v-6a3af49b]{position:static}.conversation[data-v-6a3af49b]{padding:22px}.run-actions[data-v-6a3af49b]{margin:24px -22px -22px;padding:16px 22px}.run-actions span[data-v-6a3af49b]{display:none}}

View File

@@ -0,0 +1 @@
import{A as e,Bt as t,D as n,F as r,I as i,O as a,P as o,Q as s,S as c,Tt as l,Y as u,_t as d,et as f,j as p,k as m,lt as h,n as g,r as _,t as v,tt as y,vt as b}from"./client-CO11mUW5.js";import{a as x}from"./config-provider-kwhtQ-D4.js";import{n as S,t as C}from"./DeleteOutlined-Dsl9pMnk.js";import{t as w}from"./PlusOutlined-5Urx-Evx.js";import{t as T}from"./BookOutlined-CNUY9qCc.js";var E={class:`page-shell`},D={class:`page-heading`},O={key:0,class:`knowledge-grid`},k={key:0,class:`risk-note`},A=_(i({__name:`KnowledgeView`,setup(i){let _=b(!1),A=b(!1),j=b([]),M=b([]),N=d({scenario_id:void 0,title:``,content:``,forbidden:``,risk_note:``}),P=n(()=>M.value.map(e=>({value:e.id,label:e.name})));async function F(){_.value=!0;try{let[e,t]=await Promise.all([v.get(`/knowledge-cards`),v.get(`/scenarios`)]);j.value=e.items,M.value=t.items}catch(e){x.error(g(e))}finally{_.value=!1}}async function I(){try{await v.post(`/knowledge-cards`,{scenario_id:N.scenario_id,title:N.title,content:{standard_copy:N.content,forbidden_copy:N.forbidden,risk_note:N.risk_note}}),x.success(`知识卡已发布`),A.value=!1,Object.assign(N,{scenario_id:void 0,title:``,content:``,forbidden:``,risk_note:``}),await F()}catch(e){x.error(g(e))}}function L(e){S.confirm({title:`归档“${e.title}”?`,okType:`danger`,async onOk(){await v.delete(`/knowledge-cards/${e.id}`),await F()}})}function R(e,t){return e.content?.[t]||``}return u(F),(n,i)=>{let u=y(`a-button`),d=y(`a-tag`),g=y(`a-empty`),v=y(`a-spin`),b=y(`a-select`),x=y(`a-form-item`),S=y(`a-input`),F=y(`a-textarea`),z=y(`a-form`),B=y(`a-drawer`);return s(),p(`div`,E,[a(`div`,D,[i[8]||=a(`div`,null,[a(`h1`,null,`知识卡`),a(`p`,null,`沉淀经过审核的标准表达、禁用语和风险提醒。`)],-1),r(u,{type:`primary`,onClick:i[0]||=e=>A.value=!0},{default:h(()=>[r(l(w)),i[7]||=o(`新建知识卡`,-1)]),_:1})]),r(v,{spinning:_.value},{default:h(()=>[j.value.length?(s(),p(`div`,O,[(s(!0),p(c,null,f(j.value,n=>(s(),p(`article`,{key:n.id,class:`knowledge-card surface`},[a(`header`,null,[a(`span`,null,[r(l(T))]),r(d,{color:`green`},{default:h(()=>[...i[9]||=[o(`已发布`,-1)]]),_:1})]),a(`h2`,null,t(n.title),1),a(`p`,null,t(R(n,`standard_copy`)||`暂无标准话术`),1),R(n,`risk_note`)?(s(),p(`div`,k,t(R(n,`risk_note`)),1)):e(``,!0),a(`footer`,null,[a(`span`,null,t(M.value.find(e=>e.id===n.scenario_id)?.name||`未分类场景`),1),r(u,{type:`text`,danger:``,"aria-label":`归档知识卡`,onClick:e=>L(n)},{default:h(()=>[r(l(C))]),_:1},8,[`onClick`])])]))),128))])):(s(),m(g,{key:1,description:`还没有知识卡`}))]),_:1},8,[`spinning`]),r(B,{open:A.value,"onUpdate:open":i[6]||=e=>A.value=e,title:`新建知识卡`,width:`520`},{default:h(()=>[r(z,{layout:`vertical`,model:N,onFinish:I},{default:h(()=>[r(x,{label:`所属场景`,name:`scenario_id`,rules:[{required:!0,message:`请选择场景`}]},{default:h(()=>[r(b,{value:N.scenario_id,"onUpdate:value":i[1]||=e=>N.scenario_id=e,options:P.value},null,8,[`value`,`options`])]),_:1}),r(x,{label:`标题`,name:`title`,rules:[{required:!0,message:`请输入标题`}]},{default:h(()=>[r(S,{value:N.title,"onUpdate:value":i[2]||=e=>N.title=e},null,8,[`value`])]),_:1}),r(x,{label:`标准话术`,name:`content`,rules:[{required:!0,message:`请输入标准话术`}]},{default:h(()=>[r(F,{value:N.content,"onUpdate:value":i[3]||=e=>N.content=e,rows:5},null,8,[`value`])]),_:1}),r(x,{label:`禁用表达`},{default:h(()=>[r(F,{value:N.forbidden,"onUpdate:value":i[4]||=e=>N.forbidden=e,rows:3},null,8,[`value`])]),_:1}),r(x,{label:`风险提醒`},{default:h(()=>[r(F,{value:N.risk_note,"onUpdate:value":i[5]||=e=>N.risk_note=e,rows:3},null,8,[`value`])]),_:1}),r(u,{type:`primary`,"html-type":`submit`,block:``},{default:h(()=>[...i[10]||=[o(`发布知识卡`,-1)]]),_:1})]),_:1},8,[`model`])]),_:1},8,[`open`])])}}}),[[`__scopeId`,`data-v-fc5e74e6`]]);export{A as default};

View File

@@ -0,0 +1 @@
.knowledge-grid[data-v-fc5e74e6]{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;display:grid}.knowledge-card[data-v-fc5e74e6]{flex-direction:column;min-height:250px;padding:20px;display:flex}.knowledge-card header[data-v-fc5e74e6]{justify-content:space-between;display:flex}.knowledge-card header>span[data-v-fc5e74e6]{width:36px;height:36px;color:var(--green);background:#e8f3ef;border-radius:4px;place-items:center;display:grid}.knowledge-card h2[data-v-fc5e74e6]{margin:20px 0 10px;font-family:Noto Serif SC,serif;font-size:19px}.knowledge-card>p[data-v-fc5e74e6]{color:#4f5c56;margin:0;line-height:1.7}.risk-note[data-v-fc5e74e6]{color:#8b5b16;background:#fbf3e5;border-left:2px solid #c68a37;margin-top:14px;padding:9px 11px;font-size:12px}.knowledge-card footer[data-v-fc5e74e6]{color:var(--muted);justify-content:space-between;align-items:center;margin-top:auto;padding-top:18px;font-size:12px;display:flex}@media (width<=1050px){.knowledge-grid[data-v-fc5e74e6]{grid-template-columns:repeat(2,1fr)}}@media (width<=650px){.knowledge-grid[data-v-fc5e74e6]{grid-template-columns:1fr}}

View File

@@ -0,0 +1 @@
.login-page[data-v-265399d7]{background:#f8faf9;grid-template-columns:minmax(420px,1.05fr) minmax(420px,.95fr);min-height:100vh;display:grid}.identity-panel[data-v-265399d7]{color:#fff;background:#202825;flex-direction:column;min-height:640px;padding:42px 54px;display:flex;position:relative;overflow:hidden}.identity-grid[data-v-265399d7]{opacity:.12;background-image:linear-gradient(#b7c4be 1px,#0000 1px),linear-gradient(90deg,#b7c4be 1px,#0000 1px);background-size:44px 44px;position:absolute;inset:0}.brand-lockup[data-v-265399d7]{align-items:center;gap:12px;font-family:Noto Serif SC,serif;font-size:18px;font-weight:700;display:flex;position:relative}.brand-symbol[data-v-265399d7]{border:1px solid #ffffff59;border-radius:5px;grid-template-columns:repeat(3,1fr);align-items:end;gap:3px;width:34px;height:34px;padding:6px;display:grid}.brand-symbol i[data-v-265399d7]{background:#6cc7a8;height:8px;display:block}.brand-symbol i[data-v-265399d7]:nth-child(2){height:15px}.brand-symbol i[data-v-265399d7]:nth-child(3){background:#ed8e6a;height:22px}.identity-copy[data-v-265399d7]{max-width:600px;margin:auto 0;position:relative}.eyebrow[data-v-265399d7]{font-size:12px;font-weight:700;color:#86d3b8!important}.identity-copy h1[data-v-265399d7]{letter-spacing:0;margin:20px 0 24px;font-family:Noto Serif SC,Songti SC,serif;font-size:clamp(38px,4.2vw,64px);line-height:1.2}.identity-copy p[data-v-265399d7]{color:#bdc8c3;max-width:510px;font-size:16px;line-height:1.8}.signal-line[data-v-265399d7]{color:#91a29b;align-items:center;gap:12px;font-size:12px;display:flex;position:relative}.signal-line b[data-v-265399d7]{background:#52615b;width:70px;height:1px}.login-panel[data-v-265399d7]{place-items:center;padding:40px;display:grid}.login-form-wrap[data-v-265399d7]{width:min(100%,390px)}.login-form-wrap h2[data-v-265399d7]{color:#202825;letter-spacing:0;margin:0;font-family:Noto Serif SC,serif;font-size:28px}.login-form-wrap>p[data-v-265399d7]{color:#728079;margin:8px 0 30px}.login-form-wrap[data-v-265399d7] .ant-form-item-label label{color:#46514c;font-weight:600}.login-form-wrap[data-v-265399d7] .ant-input-affix-wrapper{padding:10px 12px}.login-form-wrap[data-v-265399d7] .ant-btn-lg{height:44px;margin-top:8px}.login-note[data-v-265399d7]{color:#8a9691;align-items:center;gap:8px;margin-top:20px;font-size:12px;display:flex}.login-note span[data-v-265399d7]{background:#d5644a;border-radius:50%;width:7px;height:7px}.mobile-brand[data-v-265399d7]{display:none}@media (width<=860px){.login-page[data-v-265399d7]{grid-template-columns:1fr}.identity-panel[data-v-265399d7]{display:none}.login-panel[data-v-265399d7]{min-height:100vh;padding:28px}.mobile-brand[data-v-265399d7]{color:#16775b;margin-bottom:48px;font-family:Noto Serif SC,serif;font-weight:700;display:block}}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
import{F as e,a as t}from"./client-CO11mUW5.js";var n={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z`}},{tag:`path`,attrs:{d:`M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z`}}]},name:`play-circle`,theme:`outlined`};function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i(e,t,n[t])})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(i,a){var o=r({},i,a.attrs);return e(t,r({},o,{icon:n}),null)};a.displayName=`PlayCircleOutlined`,a.inheritAttrs=!1;export{a as t};

View File

@@ -0,0 +1 @@
import{F as e,a as t}from"./client-CO11mUW5.js";var n={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z`}},{tag:`path`,attrs:{d:`M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z`}}]},name:`plus`,theme:`outlined`};function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i(e,t,n[t])})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(i,a){var o=r({},i,a.attrs);return e(t,r({},o,{icon:n}),null)};a.displayName=`PlusOutlined`,a.inheritAttrs=!1;export{a as t};

View File

@@ -0,0 +1 @@
code[data-v-4d911d56]{color:#17654f;background:#eef5f2;border-radius:3px;padding:2px 5px}

View File

@@ -0,0 +1 @@
import{A as e,Bt as t,F as n,I as r,O as i,P as a,Q as o,S as s,Y as c,j as l,k as u,lt as d,n as f,r as p,t as m,tt as h,vt as g}from"./client-CO11mUW5.js";import{a as _}from"./config-provider-kwhtQ-D4.js";var v={class:`page-shell`},y={class:`surface`},b={key:0},x=p(r({__name:`RunHistoryView`,setup(r){let p=g(!1),x=g([]);async function S(){p.value=!0;try{x.value=(await m.get(`/runs`)).items}catch(e){_.error(f(e))}finally{p.value=!1}}function C(e){return e===`completed`?`已完成`:`进行中`}return c(S),(r,c)=>{let f=h(`a-tag`),m=h(`a-table`);return o(),l(`div`,v,[c[1]||=i(`div`,{class:`page-heading`},[i(`div`,null,[i(`h1`,null,`执行记录`),i(`p`,null,`查看 SOP 的实际使用情况和执行结果。`)])],-1),i(`section`,y,[n(m,{"row-key":`id`,loading:p.value,"data-source":x.value,pagination:{pageSize:20},columns:[{title:`执行编号`,dataIndex:`id`,width:130},{title:`SOP`,dataIndex:`sop_name`},{title:`状态`,dataIndex:`status`,width:110},{title:`结果`,dataIndex:`result`,width:120},{title:`开始时间`,dataIndex:`started_at`,width:190},{title:`完成时间`,dataIndex:`completed_at`,width:190}],scroll:{x:900}},{bodyCell:d(({column:n,record:r})=>[n.dataIndex===`id`?(o(),l(`code`,b,`RUN-`+t(String(r.id).padStart(5,`0`)),1)):n.dataIndex===`status`?(o(),u(f,{key:1,color:r.status===`completed`?`green`:`orange`},{default:d(()=>[a(t(C(r.status)),1)]),_:2},1032,[`color`])):n.dataIndex===`result`?(o(),l(s,{key:2},[a(t(r.result||`-`),1)],64)):n.dataIndex===`started_at`||n.dataIndex===`completed_at`?(o(),l(s,{key:3},[a(t(r[n.dataIndex]?new Date(r[n.dataIndex]).toLocaleString(`zh-CN`):`-`),1)],64)):e(``,!0)]),emptyText:d(()=>[...c[0]||=[i(`div`,{class:`empty-copy`},`还没有执行记录。发布 SOP 后即可开始执行。`,-1)]]),_:1},8,[`loading`,`data-source`])])])}}}),[[`__scopeId`,`data-v-4d911d56`]]);export{x as default};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
.editor-page[data-v-06435891]{background:#eef1ef;min-height:calc(100vh - 62px)}.editor-header[data-v-06435891]{border-bottom:1px solid var(--line);z-index:10;background:#fff;justify-content:space-between;align-items:center;gap:16px;min-height:66px;padding:10px 24px;display:flex;position:sticky;top:62px}.editor-title[data-v-06435891]{align-items:center;gap:8px;display:flex}.editor-title>div[data-v-06435891]{flex-direction:column;display:flex}.editor-title b[data-v-06435891]{font-size:15px}.editor-title span[data-v-06435891]{color:var(--muted);margin-top:3px;font-size:11px}.editor-workbench[data-v-06435891]{grid-template-columns:280px minmax(0,1fr);gap:16px;max-width:1500px;margin:0 auto;padding:18px;display:grid}.node-rail[data-v-06435891]{align-self:start;position:sticky;top:146px;overflow:hidden}.rail-title[data-v-06435891]{border-bottom:1px solid var(--line);justify-content:space-between;align-items:center;height:50px;padding:0 14px;font-weight:650;display:flex}.node-list[data-v-06435891]{padding:8px}.node-list button[data-v-06435891]{text-align:left;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:4px;grid-template-columns:34px 1fr auto;align-items:center;gap:9px;width:100%;min-height:58px;padding:7px 8px;display:grid}.node-list button[data-v-06435891]:hover{background:#f5f8f6}.node-list button.active[data-v-06435891]{background:#edf6f2;border-color:#b9d8cc}.node-index[data-v-06435891]{color:#88958f;font-family:monospace;font-size:11px}.node-meta[data-v-06435891]{flex-direction:column;min-width:0;display:flex}.node-meta b[data-v-06435891]{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.node-meta small[data-v-06435891]{color:var(--muted);margin-top:3px;font-size:11px}.node-move[data-v-06435891]{color:#87938e;gap:4px;display:flex}.node-move[data-v-06435891]>:hover{color:var(--green)}.node-editor[data-v-06435891]{align-self:start;min-height:600px;padding:24px}.node-editor-head[data-v-06435891]{border-bottom:1px solid var(--line);justify-content:space-between;align-items:flex-start;padding-bottom:18px;display:flex}.node-editor-head h2[data-v-06435891]{margin:6px 0 0;font-family:Noto Serif SC,serif;font-size:22px}.node-type-mark[data-v-06435891]{color:var(--green);font-size:10px;font-weight:750}.property-form[data-v-06435891]{padding-top:22px}.property-grid[data-v-06435891]{grid-template-columns:1fr 1fr;gap:16px;display:grid}.transition-head[data-v-06435891]{border-top:1px solid var(--line);justify-content:space-between;margin:8px -24px 0;padding:18px 24px 10px;display:flex}.transition-head>div[data-v-06435891]{flex-direction:column;display:flex}.transition-head span[data-v-06435891]{color:var(--muted);margin-top:4px;font-size:11px}.transition-row[data-v-06435891]{border-bottom:1px solid #edf0ee;grid-template-columns:20px minmax(120px,1fr) auto 36px;align-items:center;gap:10px;min-height:48px;display:grid}.route-line[data-v-06435891]{background:var(--green);width:16px;height:1px}.route-target[data-v-06435891]{font-weight:600}.route-empty[data-v-06435891]{color:var(--muted);padding:20px 0;font-size:12px}.edge-builder[data-v-06435891]{grid-template-columns:1.1fr 1fr 120px 1fr auto;gap:8px;padding-top:16px;display:grid}.editor-empty[data-v-06435891]{place-items:center;min-height:400px;display:grid}@media (width<=1050px){.edge-builder[data-v-06435891]{grid-template-columns:1fr 1fr}.editor-workbench[data-v-06435891]{grid-template-columns:230px minmax(0,1fr)}}@media (width<=760px){.editor-header[data-v-06435891]{flex-direction:column;align-items:flex-start;padding:12px;top:62px}.editor-workbench[data-v-06435891]{grid-template-columns:1fr;padding:10px}.node-rail[data-v-06435891]{position:static}.property-grid[data-v-06435891],.edge-builder[data-v-06435891]{grid-template-columns:1fr}.node-editor[data-v-06435891]{padding:16px}.transition-head[data-v-06435891]{margin:8px -16px 0;padding:16px}}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
.back-link[data-v-a1877f4c]{color:var(--muted);margin:-4px 0 12px -14px}.detail-heading[data-v-a1877f4c]{color:#fff;background:#202825;border-radius:6px;justify-content:space-between;align-items:flex-end;gap:24px;min-height:150px;padding:28px;display:flex}.detail-heading h1[data-v-a1877f4c]{letter-spacing:0;margin:10px 0 8px;font-family:Noto Serif SC,serif;font-size:28px}.detail-heading p[data-v-a1877f4c]{color:#b8c4bf;max-width:720px;margin:0}.heading-tags[data-v-a1877f4c]{color:#a8b6b0;align-items:center;gap:10px;font-size:12px;display:flex}.scenario-code[data-v-a1877f4c]{color:#70817a;align-self:flex-start;font-size:12px}.detail-tabs[data-v-a1877f4c]{margin-top:18px}.toolbar>div[data-v-a1877f4c]{align-items:baseline;gap:12px;display:flex}.toolbar-note[data-v-a1877f4c]{color:var(--muted);font-size:12px}.field-grid[data-v-a1877f4c]{grid-template-columns:1fr 1fr;gap:14px;display:grid}code[data-v-a1877f4c]{color:#17654f;background:#eef5f2;border-radius:3px;padding:2px 5px}.sop-list button[data-v-a1877f4c]{text-align:left;border:0;border-bottom:1px solid var(--line);cursor:pointer;background:#fff;grid-template-columns:42px 1fr auto 100px;align-items:center;gap:14px;width:100%;min-height:74px;padding:12px 18px;display:grid}.sop-list button[data-v-a1877f4c]:hover{background:#f8faf9}.sop-icon[data-v-a1877f4c]{width:38px;height:38px;color:var(--green);background:#e8f3ef;border-radius:4px;place-items:center;display:grid}.sop-copy[data-v-a1877f4c]{flex-direction:column;min-width:0;display:flex}.sop-copy small[data-v-a1877f4c]{color:var(--muted);text-overflow:ellipsis;white-space:nowrap;margin-top:4px;overflow:hidden}.sop-date[data-v-a1877f4c]{color:var(--muted);text-align:right;font-size:12px}.empty-state[data-v-a1877f4c]{color:#82908a;text-align:center;padding:64px 20px}.empty-state>span[data-v-a1877f4c]{font-size:32px}.empty-state p[data-v-a1877f4c]{margin:12px 0 0}@media (width<=650px){.detail-heading[data-v-a1877f4c]{flex-direction:column;align-items:flex-start}.scenario-code[data-v-a1877f4c]{display:none}.field-grid[data-v-a1877f4c]{grid-template-columns:1fr;gap:0}.sop-list button[data-v-a1877f4c]{grid-template-columns:36px 1fr auto}.sop-date[data-v-a1877f4c]{display:none}}

View File

@@ -0,0 +1 @@
.scenario-name[data-v-3965a2e5]{cursor:pointer;flex-direction:column;max-width:460px;display:flex}.scenario-name b[data-v-3965a2e5]{font-size:14px}.scenario-name small[data-v-3965a2e5]{color:var(--muted);text-overflow:ellipsis;white-space:nowrap;margin-top:4px;overflow:hidden}.form-grid[data-v-3965a2e5]{grid-template-columns:1fr 1fr;gap:14px;display:grid}[data-v-3965a2e5] .ant-table-row{cursor:pointer}@media (width<=600px){.form-grid[data-v-3965a2e5]{grid-template-columns:1fr;gap:0}}

View File

@@ -0,0 +1 @@
import{A as e,Bt as t,F as n,I as r,O as i,P as a,Q as o,S as s,Tt as c,Y as l,_t as u,j as d,k as f,lt as p,n as m,r as h,t as g,tt as _,vt as v}from"./client-CO11mUW5.js";import{a as y}from"./config-provider-kwhtQ-D4.js";import{t as b}from"./SearchOutlined-DRcWUFRC.js";import{t as x}from"./PlusOutlined-5Urx-Evx.js";import{h as S}from"./useApi-CROJJdhE-BlzMTLF9.js";var C={class:`page-shell`},w={class:`page-heading`},T={class:`surface`},E={class:`toolbar`},D={class:`muted`},O={key:0,class:`scenario-name`},k={class:`form-grid`},A=h(r({__name:`ScenariosView`,setup(r){let h=S(),A=v(!1),j=v(!1),M=v(``),N=v([]),P=u({name:``,industry:``,role_name:``,goal:``,trigger_text:``,visibility:`tenant`}),F=[{title:`场景名称`,dataIndex:`name`,key:`name`},{title:`行业`,dataIndex:`industry`,key:`industry`,width:140},{title:`适用角色`,dataIndex:`role_name`,key:`role_name`,width:160},{title:`状态`,dataIndex:`status`,key:`status`,width:110},{title:`更新时间`,dataIndex:`updated_at`,key:`updated_at`,width:180},{title:``,key:`action`,width:80}];async function I(){A.value=!0;try{N.value=(await g.get(`/scenarios`,{params:{keyword:M.value}})).items}finally{A.value=!1}}async function L(){try{let e=await g.post(`/scenarios`,P);y.success(`场景已创建`),j.value=!1,h.push(`/scenarios/${e.id}`)}catch(e){y.error(m(e))}}function R(e){return{draft:`草稿`,active:`使用中`,archived:`已归档`}[e]||e}return l(I),(r,l)=>{let u=_(`a-button`),m=_(`a-input`),g=_(`a-tag`),v=_(`a-table`),y=_(`a-form-item`),S=_(`a-textarea`),z=_(`a-radio`),B=_(`a-radio-group`),V=_(`a-form`),H=_(`a-drawer`);return o(),d(`div`,C,[i(`div`,w,[l[10]||=i(`div`,null,[i(`h1`,null,`场景与 SOP`),i(`p`,null,`从业务触发点开始,定义信息字段与可执行话术流程。`)],-1),n(u,{type:`primary`,onClick:l[0]||=e=>j.value=!0},{default:p(()=>[n(c(x)),l[9]||=a(`新建场景`,-1)]),_:1})]),i(`section`,T,[i(`div`,E,[n(m,{value:M.value,"onUpdate:value":l[1]||=e=>M.value=e,"allow-clear":``,placeholder:`搜索名称或行业`,style:{width:`280px`},onPressEnter:I},{prefix:p(()=>[n(c(b))]),_:1},8,[`value`]),i(`span`,D,``+t(N.value.length)+` 个场景`,1)]),n(v,{columns:F,"data-source":N.value,loading:A.value,"row-key":`id`,pagination:!1,scroll:{x:800},"custom-row":e=>({onClick:()=>c(h).push(`/scenarios/${e.id}`)})},{bodyCell:p(({column:n,record:r})=>[n.key===`name`?(o(),d(`div`,O,[i(`b`,null,t(r.name),1),i(`small`,null,t(r.goal),1)])):n.key===`status`?(o(),f(g,{key:1,color:r.status===`active`?`green`:`default`},{default:p(()=>[a(t(R(r.status)),1)]),_:2},1032,[`color`])):n.key===`updated_at`?(o(),d(s,{key:2},[a(t(new Date(r.updated_at).toLocaleString(`zh-CN`)),1)],64)):n.key===`action`?(o(),f(u,{key:3,type:`link`,size:`small`},{default:p(()=>[...l[11]||=[a(`配置`,-1)]]),_:1})):e(``,!0)]),emptyText:p(()=>[...l[12]||=[i(`div`,{class:`empty-copy`},`还没有业务场景。创建第一个场景后,就可以配置字段和 SOP。`,-1)]]),_:1},8,[`data-source`,`loading`,`custom-row`])]),n(H,{open:j.value,"onUpdate:open":l[8]||=e=>j.value=e,title:`创建业务场景`,width:`520`,"destroy-on-close":!0},{default:p(()=>[n(V,{layout:`vertical`,model:P},{default:p(()=>[n(y,{label:`场景名称`,name:`name`,rules:[{required:!0,message:`请输入场景名称`}]},{default:p(()=>[n(m,{value:P.name,"onUpdate:value":l[2]||=e=>P.name=e,placeholder:`例如:宠物医生问诊问药`},null,8,[`value`])]),_:1}),i(`div`,k,[n(y,{label:`所属行业`,name:`industry`,rules:[{required:!0,message:`请输入行业`}]},{default:p(()=>[n(m,{value:P.industry,"onUpdate:value":l[3]||=e=>P.industry=e,placeholder:`宠物医疗`},null,8,[`value`])]),_:1}),n(y,{label:`适用角色`,name:`role_name`,rules:[{required:!0,message:`请输入角色`}]},{default:p(()=>[n(m,{value:P.role_name,"onUpdate:value":l[4]||=e=>P.role_name=e,placeholder:`医生、客服`},null,8,[`value`])]),_:1})]),n(y,{label:`执行目标`,name:`goal`,rules:[{required:!0,message:`请输入执行目标`}]},{default:p(()=>[n(S,{value:P.goal,"onUpdate:value":l[5]||=e=>P.goal=e,rows:3,placeholder:`这个场景最终要推动什么结果`},null,8,[`value`])]),_:1}),n(y,{label:`触发条件`,name:`trigger_text`,rules:[{required:!0,message:`请输入触发条件`}]},{default:p(()=>[n(S,{value:P.trigger_text,"onUpdate:value":l[6]||=e=>P.trigger_text=e,rows:3,placeholder:`什么时候进入这个场景`},null,8,[`value`])]),_:1}),n(y,{label:`可见范围`},{default:p(()=>[n(B,{value:P.visibility,"onUpdate:value":l[7]||=e=>P.visibility=e},{default:p(()=>[n(z,{value:`tenant`},{default:p(()=>[...l[13]||=[a(`全企业`,-1)]]),_:1}),n(z,{value:`team`},{default:p(()=>[...l[14]||=[a(`团队`,-1)]]),_:1}),n(z,{value:`private`},{default:p(()=>[...l[15]||=[a(`仅自己`,-1)]]),_:1})]),_:1},8,[`value`])]),_:1}),n(u,{type:`primary`,block:``,onClick:L},{default:p(()=>[...l[16]||=[a(`创建并继续配置`,-1)]]),_:1})]),_:1},8,[`model`])]),_:1},8,[`open`])])}}}),[[`__scopeId`,`data-v-3965a2e5`]]);export{A as default};

View File

@@ -0,0 +1 @@
import{F as e,a as t}from"./client-CO11mUW5.js";var n={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z`}}]},name:`search`,theme:`outlined`};function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i(e,t,n[t])})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(i,a){var o=r({},i,a.attrs);return e(t,r({},o,{icon:n}),null)};a.displayName=`SearchOutlined`,a.inheritAttrs=!1;export{a as t};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

327
codes/web/dist/assets/index-DL8F6dio.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
import{V as e}from"./client-CO11mUW5.js";function t(e){return typeof e==`object`||`displayName`in e||`props`in e||`__vccOpts`in e}function n(e){return e.__esModule||e[Symbol.toStringTag]===`Module`||e.default&&t(e.default)}var r=Object.assign;function i(e,t){let n={};for(let r in t){let i=t[r];n[r]=o(i)?i.map(e):e(i)}return n}var a=()=>{},o=Array.isArray;function s(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}var c=Symbol(``);function l(e,t){return r(Error(),{type:e,[c]:!0},t)}function u(e,t){return e instanceof Error&&c in e&&(t==null||!!(e.type&t))}var d=Symbol(``),f=Symbol(``),p=Symbol(``),m=Symbol(``),h=Symbol(``);function g(){return e(p)}function _(t){return e(m)}export{n as a,d as c,m as d,p as f,f as g,g as h,o as i,s as l,_ as m,r as n,u as o,h as p,l as r,t as s,i as t,a as u};

25
codes/web/dist/index.html vendored Normal file
View File

@@ -0,0 +1,25 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#202825" />
<title>销冠 SOP 平台</title>
<script type="module" crossorigin src="/assets/index-DL8F6dio.js"></script>
<link rel="modulepreload" crossorigin href="/assets/client-CO11mUW5.js">
<link rel="modulepreload" crossorigin href="/assets/config-provider-kwhtQ-D4.js">
<link rel="modulepreload" crossorigin href="/assets/auth-D7KJ41TQ.js">
<link rel="modulepreload" crossorigin href="/assets/DeleteOutlined-Dsl9pMnk.js">
<link rel="modulepreload" crossorigin href="/assets/SearchOutlined-DRcWUFRC.js">
<link rel="modulepreload" crossorigin href="/assets/PlusOutlined-5Urx-Evx.js">
<link rel="modulepreload" crossorigin href="/assets/ArrowLeftOutlined-m6YdiMlD.js">
<link rel="modulepreload" crossorigin href="/assets/AppstoreOutlined-BOx6VBGQ.js">
<link rel="modulepreload" crossorigin href="/assets/BookOutlined-CNUY9qCc.js">
<link rel="modulepreload" crossorigin href="/assets/PlayCircleOutlined-C2UGH7h6.js">
<link rel="modulepreload" crossorigin href="/assets/useApi-CROJJdhE-BlzMTLF9.js">
<link rel="stylesheet" crossorigin href="/assets/index-BM4AsfIr.css">
</head>
<body>
<div id="app"></div>
</body>
</html>

13
codes/web/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#202825" />
<title>销冠 SOP 平台</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

2291
codes/web/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

27
codes/web/package.json Normal file
View File

@@ -0,0 +1,27 @@
{
"name": "iqudo-top1-web",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview"
},
"dependencies": {
"@ant-design/icons-vue": "7.0.1",
"ant-design-vue": "4.2.6",
"axios": "1.19.0",
"dayjs": "1.11.21",
"pinia": "4.0.2",
"vue": "3.5.41",
"vue-router": "5.2.0"
},
"devDependencies": {
"@types/node": "26.1.2",
"@vitejs/plugin-vue": "6.0.8",
"typescript": "5.9.3",
"vite": "8.2.0",
"vue-tsc": "3.3.9"
}
}

3
codes/web/src/App.vue Normal file
View File

@@ -0,0 +1,3 @@
<template>
<router-view />
</template>

View File

@@ -0,0 +1,46 @@
import axios, { type AxiosRequestConfig } from 'axios'
interface Envelope<T> { code: string; message: string; data: T }
const client = axios.create({ baseURL: '/api/v1', timeout: 15000 })
client.interceptors.request.use((config) => {
const token = localStorage.getItem('access_token')
if (token) config.headers.Authorization = `Bearer ${token}`
return config
})
client.interceptors.response.use(
(response) => response,
(error) => {
if (error.response?.status === 401 && !error.config?.url?.includes('/auth/login')) {
localStorage.removeItem('access_token')
localStorage.removeItem('refresh_token')
if (window.location.pathname !== '/login') window.location.href = '/login'
}
return Promise.reject(error)
},
)
export const api = {
async get<T>(url: string, config?: AxiosRequestConfig): Promise<T> {
const response = await client.get<Envelope<T>>(url, config)
return response.data.data
},
async post<T>(url: string, data?: unknown): Promise<T> {
const response = await client.post<Envelope<T>>(url, data)
return response.data.data
},
async put<T>(url: string, data?: unknown): Promise<T> {
const response = await client.put<Envelope<T>>(url, data)
return response.data.data
},
async delete<T>(url: string): Promise<T> {
const response = await client.delete<Envelope<T>>(url)
return response.data.data
},
}
export function apiMessage(error: any): string {
return error?.response?.data?.message || error?.message || '操作失败,请稍后重试'
}

1
codes/web/src/env.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@@ -0,0 +1,121 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
import {
AppstoreOutlined,
BookOutlined,
DashboardOutlined,
HistoryOutlined,
LogoutOutlined,
MenuFoldOutlined,
MenuUnfoldOutlined,
PlayCircleOutlined,
} from '@ant-design/icons-vue'
const collapsed = ref(false)
const route = useRoute()
const router = useRouter()
const auth = useAuthStore()
const selectedKeys = computed(() => {
if (route.path.startsWith('/scenarios') || route.path.startsWith('/sops')) return ['scenarios']
if (route.path.startsWith('/execute')) return ['execute']
if (route.path.startsWith('/runs')) return ['runs']
if (route.path.startsWith('/knowledge')) return ['knowledge']
return ['dashboard']
})
const titles: Record<string, string> = {
dashboard: '工作台', scenarios: '场景与 SOP', execute: '执行话术', runs: '执行记录', knowledge: '知识卡',
}
const pageTitle = computed(() => titles[selectedKeys.value[0]] || '销冠 SOP')
onMounted(() => auth.loadUser().catch(() => auth.logout()))
function navigate({ key }: { key: string }) {
const target: Record<string, string> = { dashboard: '/', scenarios: '/scenarios', execute: '/execute', runs: '/runs', knowledge: '/knowledge' }
router.push(target[key])
}
function logout() {
auth.logout()
router.push('/login')
}
</script>
<template>
<a-layout class="app-frame">
<a-layout-sider v-model:collapsed="collapsed" :trigger="null" collapsible :width="224" class="side-panel">
<div class="brand" :class="{ compact: collapsed }">
<div class="brand-mark"><span></span><span></span><span></span></div>
<div v-if="!collapsed" class="brand-copy">
<strong>销冠 SOP</strong>
<small>经验执行系统</small>
</div>
</div>
<a-menu mode="inline" theme="dark" :selected-keys="selectedKeys" @click="navigate">
<a-menu-item key="dashboard"><DashboardOutlined /><span>工作台</span></a-menu-item>
<a-menu-item key="scenarios"><AppstoreOutlined /><span>场景与 SOP</span></a-menu-item>
<a-menu-item key="execute"><PlayCircleOutlined /><span>执行话术</span></a-menu-item>
<a-menu-item key="runs"><HistoryOutlined /><span>执行记录</span></a-menu-item>
<a-menu-item key="knowledge"><BookOutlined /><span>知识卡</span></a-menu-item>
</a-menu>
<div class="sider-foot" :class="{ compact: collapsed }">
<span class="online-dot"></span>
<span v-if="!collapsed">服务运行正常</span>
</div>
</a-layout-sider>
<a-layout>
<a-layout-header class="topbar">
<a-button type="text" class="collapse-button" :aria-label="collapsed ? '展开导航' : '收起导航'" @click="collapsed = !collapsed">
<MenuUnfoldOutlined v-if="collapsed" /><MenuFoldOutlined v-else />
</a-button>
<div class="topbar-title">{{ pageTitle }}</div>
<a-dropdown placement="bottomRight">
<button class="user-button">
<span class="avatar">{{ (auth.user?.display_name || '管').slice(0, 1) }}</span>
<span class="user-copy">
<strong>{{ auth.user?.display_name || '平台管理员' }}</strong>
<small>{{ auth.user?.role_code === 'admin' ? '企业管理员' : auth.user?.role_code }}</small>
</span>
</button>
<template #overlay>
<a-menu><a-menu-item key="logout" @click="logout"><LogoutOutlined /> 退出登录</a-menu-item></a-menu>
</template>
</a-dropdown>
</a-layout-header>
<a-layout-content class="content-area"><router-view /></a-layout-content>
</a-layout>
</a-layout>
</template>
<style scoped>
.app-frame { min-height: 100vh; }
.side-panel { position: sticky; top: 0; height: 100vh; background: #202825 !important; overflow: hidden; }
.brand { height: 78px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,.09); }
.brand.compact { padding: 0; justify-content: center; }
.brand-mark { width: 32px; height: 32px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 3px; padding: 5px; border: 1px solid rgba(255,255,255,.22); border-radius: 5px; }
.brand-mark span { background: #66c8a6; border-radius: 1px 1px 0 0; }
.brand-mark span:nth-child(1) { height: 8px; }.brand-mark span:nth-child(2) { height: 14px; }.brand-mark span:nth-child(3) { height: 20px; background: #f0a07d; }
.brand-copy { min-width: 0; color: white; display: flex; flex-direction: column; }
.brand-copy strong { font-family: "Noto Serif SC", serif; font-size: 16px; letter-spacing: 0; }
.brand-copy small { color: #a7b7b0; font-size: 11px; margin-top: 2px; }
.side-panel :deep(.ant-menu-dark) { background: transparent; padding: 12px 9px; }
.side-panel :deep(.ant-menu-item) { height: 42px; margin: 5px 0; border-radius: 4px; color: #b9c4c0; }
.side-panel :deep(.ant-menu-item-selected) { background: #166b53 !important; color: white; }
.sider-foot { position: absolute; bottom: 0; left: 0; right: 0; height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 20px; color: #91a29b; font-size: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sider-foot.compact { justify-content: center; padding: 0; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #67caa8; box-shadow: 0 0 0 3px rgba(103,202,168,.12); }
.topbar { height: 62px; padding: 0 22px; display: flex; align-items: center; gap: 12px; line-height: normal; background: rgba(255,255,255,.94); border-bottom: 1px solid #dce2df; position: sticky; top: 0; z-index: 20; }
.collapse-button { width: 36px; height: 36px; }
.topbar-title { flex: 1; color: #52605a; font-size: 14px; }
.user-button { display: flex; align-items: center; gap: 9px; border: 0; padding: 6px 8px; background: transparent; cursor: pointer; border-radius: 5px; }
.user-button:hover { background: #f1f4f2; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 4px; background: #e5f2ed; color: #126248; font-weight: 700; }
.user-copy { display: flex; flex-direction: column; text-align: left; }
.user-copy strong { font-size: 13px; }.user-copy small { color: #7c8883; font-size: 11px; margin-top: 2px; }
.content-area { min-width: 0; background: #f4f6f5; }
@media (max-width: 760px) { .side-panel { display: none; }.user-copy { display: none; }.topbar { padding: 0 12px; } }
</style>

9
codes/web/src/main.ts Normal file
View File

@@ -0,0 +1,9 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/reset.css'
import './styles/main.css'
import App from './App.vue'
import router from './router'
createApp(App).use(createPinia()).use(router).use(Antd).mount('#app')

View File

@@ -0,0 +1,29 @@
import { createRouter, createWebHistory } from 'vue-router'
import AppLayout from '@/layouts/AppLayout.vue'
const router = createRouter({
history: createWebHistory(),
routes: [
{ path: '/login', component: () => import('@/views/LoginView.vue'), meta: { public: true } },
{
path: '/',
component: AppLayout,
children: [
{ path: '', name: 'dashboard', component: () => import('@/views/DashboardView.vue') },
{ path: 'scenarios', name: 'scenarios', component: () => import('@/views/ScenariosView.vue') },
{ path: 'scenarios/:id', name: 'scenario-detail', component: () => import('@/views/ScenarioDetailView.vue') },
{ path: 'sops/:id', name: 'sop-editor', component: () => import('@/views/SOPEditorView.vue') },
{ path: 'execute', name: 'execute', component: () => import('@/views/ExecuteView.vue') },
{ path: 'runs', name: 'runs', component: () => import('@/views/RunHistoryView.vue') },
{ path: 'knowledge', name: 'knowledge', component: () => import('@/views/KnowledgeView.vue') },
],
},
],
})
router.beforeEach((to) => {
if (!to.meta.public && !localStorage.getItem('access_token')) return '/login'
if (to.path === '/login' && localStorage.getItem('access_token')) return '/'
})
export default router

View File

@@ -0,0 +1,34 @@
import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
import { api } from '@/api/client'
import type { User } from '@/types'
interface LoginResult { access_token: string; refresh_token: string; expires_at: string; user: User }
export const useAuthStore = defineStore('auth', () => {
const user = ref<User | null>(null)
const token = ref(localStorage.getItem('access_token') || '')
const authenticated = computed(() => Boolean(token.value))
async function login(username: string, password: string) {
const result = await api.post<LoginResult>('/auth/login', { username, password })
token.value = result.access_token
user.value = result.user
localStorage.setItem('access_token', result.access_token)
localStorage.setItem('refresh_token', result.refresh_token)
}
async function loadUser() {
if (!token.value) return
user.value = await api.get<User>('/auth/me')
}
function logout() {
token.value = ''
user.value = null
localStorage.removeItem('access_token')
localStorage.removeItem('refresh_token')
}
return { user, token, authenticated, login, loadUser, logout }
})

View File

@@ -0,0 +1,48 @@
:root {
color: #202825;
background: #f4f6f5;
font-family: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", sans-serif;
font-synthesis: none;
text-rendering: optimizeLegibility;
--ink: #202825;
--muted: #69746f;
--line: #dce2df;
--surface: #ffffff;
--canvas: #f4f6f5;
--green: #16775b;
--green-dark: #0f5843;
--coral: #d5644a;
--amber: #b97a20;
}
* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body { min-width: 320px; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
.page-shell { max-width: 1440px; margin: 0 auto; padding: 24px 28px 40px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { margin: 0; font-family: "Noto Serif SC", "Songti SC", serif; font-size: 26px; line-height: 1.3; font-weight: 700; letter-spacing: 0; }
.page-heading p { margin: 6px 0 0; color: var(--muted); line-height: 1.6; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.muted { color: var(--muted); }
.empty-copy { max-width: 360px; margin: 0 auto; color: var(--muted); line-height: 1.7; text-align: center; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 7px; background: var(--green); }
.ant-btn { border-radius: 5px; box-shadow: none; }
.ant-btn-primary { background: var(--green); }
.ant-btn-primary:hover { background: var(--green-dark) !important; }
.ant-table-wrapper .ant-table { border-radius: 0 0 6px 6px; }
.ant-table-wrapper .ant-table-thead > tr > th { color: #52605a; font-size: 12px; font-weight: 650; background: #f7f9f8; }
.ant-tag { border-radius: 3px; }
.ant-modal-content, .ant-drawer-content { border-radius: 6px !important; }
.ant-card { border-radius: 6px; }
.ant-input, .ant-input-number, .ant-select-selector, .ant-input-affix-wrapper { border-radius: 4px !important; }
@media (max-width: 760px) {
.page-shell { padding: 18px 14px 28px; }
.page-heading { flex-direction: column; }
.page-actions { width: 100%; }
.page-heading h1 { font-size: 23px; }
}

View File

@@ -0,0 +1,10 @@
export interface BaseEntity { id: number; created_at: string; updated_at: string }
export interface User { user_id: number; tenant_id: number; role_code: string; username: string; display_name: string }
export interface Scenario extends BaseEntity { tenant_id: number; name: string; industry: string; role_name: string; goal: string; trigger_text: string; visibility: string; status: string; created_by: number }
export interface ScenarioField extends BaseEntity { scenario_id: number; field_key: string; field_name: string; field_type: string; required: boolean; options: unknown[]; validation: Record<string, unknown>; sort_order: number }
export interface SOP extends BaseEntity { scenario_id: number; name: string; description: string; status: string }
export interface SOPVersion extends BaseEntity { sop_id: number; version: number; status: string; start_node_key: string; published_at?: string }
export interface SOPNode extends BaseEntity { node_key: string; type: string; title: string; content: string; config: Record<string, any>; position_x: number; position_y: number }
export interface SOPEdge extends BaseEntity { source_node_key: string; target_node_key: string; condition: Record<string, any>; priority: number }
export interface SOPRun extends BaseEntity { sop_id: number; sop_version_id: number; current_node_key: string; status: string; answers: Record<string, any>; result: string; started_at: string; completed_at?: string; sop_name?: string }
export interface KnowledgeCard extends BaseEntity { scenario_id: number; title: string; status: string; content?: Record<string, any> }

View File

@@ -0,0 +1,64 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { ArrowRightOutlined, AppstoreOutlined, CheckCircleOutlined, PlayCircleOutlined, PlusOutlined } from '@ant-design/icons-vue'
import { api } from '@/api/client'
const router = useRouter()
const loading = ref(true)
const summary = ref({ scenarios: 0, published_sops: 0, runs: 0, completed_runs: 0 })
onMounted(async () => {
try { summary.value = await api.get('/dashboard/summary') } finally { loading.value = false }
})
</script>
<template>
<div class="page-shell">
<div class="page-heading">
<div><h1>今天从经验开始</h1><p>查看知识沉淀和一线执行的最新状态</p></div>
<div class="page-actions"><a-button type="primary" @click="router.push('/scenarios')"><PlusOutlined />创建场景</a-button></div>
</div>
<a-skeleton :loading="loading" active>
<section class="metric-strip surface">
<div class="metric"><span class="metric-icon green"><AppstoreOutlined /></span><div><b>{{ summary.scenarios }}</b><small>可用场景</small></div></div>
<div class="metric"><span class="metric-icon coral"><CheckCircleOutlined /></span><div><b>{{ summary.published_sops }}</b><small>已发布 SOP</small></div></div>
<div class="metric"><span class="metric-icon amber"><PlayCircleOutlined /></span><div><b>{{ summary.runs }}</b><small>累计执行</small></div></div>
<div class="metric"><span class="completion">{{ summary.runs ? Math.round(summary.completed_runs / summary.runs * 100) : 0 }}%</span><div><b>{{ summary.completed_runs }}</b><small>完成执行</small></div></div>
</section>
</a-skeleton>
<section class="work-grid">
<div class="surface action-panel">
<div class="panel-kicker">常用入口</div>
<button @click="router.push('/scenarios')"><span>配置新的业务场景<small>定义字段目标和触发条件</small></span><ArrowRightOutlined /></button>
<button @click="router.push('/execute')"><span>开始执行已发布 SOP<small>根据客户回答逐步推进</small></span><ArrowRightOutlined /></button>
<button @click="router.push('/knowledge')"><span>维护审核知识卡<small>统一口径与风险提示</small></span><ArrowRightOutlined /></button>
</div>
<div class="surface doctrine-panel">
<div class="panel-kicker">平台原则</div>
<blockquote>一句好话术不应只被收藏它应该知道何时出现下一步去哪以及是否真的有效</blockquote>
<div class="flow-note"><span>创建</span><i></i><span>发布</span><i></i><span>执行</span><i></i><span>复盘</span></div>
</div>
</section>
</div>
</template>
<style scoped>
.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; }
.metric { min-height: 116px; display: flex; align-items: center; gap: 16px; padding: 22px; border-right: 1px solid var(--line); }.metric:last-child { border-right: 0; }
.metric-icon, .completion { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 5px; font-size: 19px; }.metric-icon.green { background: #e5f3ee; color: #16775b; }.metric-icon.coral { background: #faece7; color: #c4573f; }.metric-icon.amber { background: #f8efdf; color: #a86e1e; }
.completion { color: #202825; background: #e8ecea; font-size: 12px; font-weight: 800; }
.metric div { display: flex; flex-direction: column; }.metric b { font-family: "Noto Serif SC", serif; font-size: 28px; line-height: 1; }.metric small { margin-top: 8px; color: var(--muted); }
.work-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; margin-top: 18px; }
.action-panel, .doctrine-panel { padding: 22px; }
.panel-kicker { margin-bottom: 14px; color: #7c8883; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.action-panel button { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 15px 0; color: var(--ink); text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }.action-panel button:last-child { border-bottom: 0; }.action-panel button:hover { color: var(--green); }
.action-panel button span { display: flex; flex-direction: column; font-weight: 650; }.action-panel button small { margin-top: 4px; color: var(--muted); font-weight: 400; }
.doctrine-panel { background: #202825; border-color: #202825; color: white; }.doctrine-panel .panel-kicker { color: #89a099; }
blockquote { margin: 30px 0 42px; font-family: "Noto Serif SC", serif; font-size: 22px; line-height: 1.65; }
.flow-note { display: flex; align-items: center; color: #9cafaa; font-size: 12px; }.flow-note i { flex: 1; height: 1px; margin: 0 10px; background: #4a5a54; }
@media (max-width: 900px) { .metric-strip { grid-template-columns: repeat(2,1fr); }.metric:nth-child(2) { border-right: 0; }.metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }.work-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .metric { min-height: 100px; padding: 16px; }.metric b { font-size: 24px; }.metric-icon, .completion { display: none; } }
</style>

View File

@@ -0,0 +1,65 @@
<script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue'
import { CheckCircleOutlined, PlayCircleOutlined, SafetyCertificateOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { api, apiMessage } from '@/api/client'
import type { ScenarioField, SOPNode, SOPRun } from '@/types'
interface PublishedSOP { id:number; name:string; description:string; scenario_id:number; scenario_name:string; version:number }
interface RunView { run:SOPRun; node:SOPNode; fields:ScenarioField[] }
const loading=ref(true);const sops=ref<PublishedSOP[]>([]);const active=ref<RunView|null>(null);const answers=reactive<Record<string,any>>({});const submitting=ref(false)
const currentConfig=computed(()=>active.value?.node.config||{})
const currentFields=computed(()=>{if(!active.value)return[];const node=active.value.node;if(node.type==='question'||node.type==='choice')return active.value.fields.filter(f=>f.field_key===currentConfig.value.field_key);if(node.type==='form')return active.value.fields.filter(f=>(currentConfig.value.field_keys||[]).includes(f.field_key));return[]})
async function load(){loading.value=true;try{sops.value=(await api.get<{items:PublishedSOP[]}>('/published-sops')).items}catch(error){message.error(apiMessage(error))}finally{loading.value=false}}
async function start(sopID:number){try{active.value=await api.post<RunView>('/runs',{sop_id:sopID});Object.keys(answers).forEach(k=>delete answers[k])}catch(error){message.error(apiMessage(error))}}
async function next(){if(!active.value)return;submitting.value=true;try{active.value=await api.post<RunView>(`/runs/${active.value.run.id}/answer`,{answers:{...answers}});Object.keys(answers).forEach(k=>delete answers[k])}catch(error){message.error(apiMessage(error))}finally{submitting.value=false}}
function inputFor(field:ScenarioField){return field.field_type}
function reset(){active.value=null;load()}
onMounted(load)
</script>
<template>
<div class="page-shell execution-shell">
<div class="page-heading"><div><h1>执行话术</h1><p>选择已发布 SOP系统会根据客户回答给出下一步</p></div></div>
<a-spin :spinning="loading">
<div v-if="!active" class="sop-catalog">
<button v-for="item in sops" :key="item.id" class="sop-entry surface" @click="start(item.id)"><span class="entry-seq">{{ String(item.id).padStart(2,'0') }}</span><div><small>{{ item.scenario_name }} · V{{ item.version }}</small><h2>{{ item.name }}</h2><p>{{ item.description || '按标准步骤执行这套话术流程。' }}</p></div><span class="play"><PlayCircleOutlined /></span></button>
<a-empty v-if="!sops.length" description="还没有已发布的 SOP" />
</div>
<div v-else class="run-workspace">
<aside class="run-context">
<span class="run-label">RUN-{{ String(active.run.id).padStart(5,'0') }}</span>
<h2>执行进行中</h2><p>客户回答会自动保存在当前执行记录中</p>
<div class="context-meta"><span>当前节点</span><b>{{ active.node.title }}</b></div><div class="context-meta"><span>已采集字段</span><b>{{ Object.keys(active.run.answers || {}).length }}</b></div>
<div class="privacy-note"><SafetyCertificateOutlined /><span>敏感信息请遵循企业数据规范</span></div>
</aside>
<main class="conversation surface">
<div class="conversation-progress"><span :class="{done:active.run.status==='completed'}"></span><b>{{ active.run.status==='completed'?'流程已完成':'正在执行' }}</b></div>
<div class="node-content"><small>{{ active.node.type.toUpperCase() }}</small><h1>{{ active.node.title }}</h1><blockquote v-if="active.node.content">{{ active.node.content }}</blockquote></div>
<div v-if="active.run.status==='completed'" class="completed-state"><CheckCircleOutlined /><h3>{{ active.node.type==='escalate'?'已转交处理':'本次执行已完成' }}</h3><p>{{ active.node.content }}</p><a-button type="primary" @click="reset">执行另一套 SOP</a-button></div>
<template v-else>
<a-form layout="vertical" class="answer-form">
<a-form-item v-for="field in currentFields" :key="field.id" :label="field.field_name" :required="field.required">
<a-input v-if="inputFor(field)==='text'" v-model:value="answers[field.field_key]" />
<a-textarea v-else-if="inputFor(field)==='textarea'" v-model:value="answers[field.field_key]" :rows="3" />
<a-input-number v-else-if="inputFor(field)==='number'" v-model:value="answers[field.field_key]" style="width:100%" />
<a-radio-group v-else-if="inputFor(field)==='boolean'" v-model:value="answers[field.field_key]"><a-radio :value="true">是</a-radio><a-radio :value="false"></a-radio></a-radio-group>
<a-select v-else-if="inputFor(field)==='select'" v-model:value="answers[field.field_key]" :options="(field.options||[]).map(value=>({value,label:value}))" />
<a-select v-else-if="inputFor(field)==='multiselect'" v-model:value="answers[field.field_key]" mode="multiple" :options="(field.options||[]).map(value=>({value,label:value}))" />
<a-date-picker v-else-if="inputFor(field)==='date'" v-model:value="answers[field.field_key]" style="width:100%" />
<a-input v-else v-model:value="answers[field.field_key]" />
</a-form-item>
<a-form-item v-if="active.node.type==='choice'&&currentFields.length===0"><a-radio-group v-model:value="answers[currentConfig.field_key]" class="choice-group"><a-radio-button v-for="option in currentConfig.options||[]" :key="option" :value="option">{{ option }}</a-radio-button></a-radio-group></a-form-item>
</a-form>
<div class="run-actions"><span>{{ currentFields.length ? '填写后继续下一步' : '确认当前话术已完成' }}</span><a-button type="primary" size="large" :loading="submitting" @click="next">继续下一步</a-button></div>
</template>
</main>
</div>
</a-spin>
</div>
</template>
<style scoped>
.execution-shell{max-width:1220px}.sop-catalog{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.sop-entry{min-height:150px;display:grid;grid-template-columns:40px 1fr 42px;align-items:start;gap:14px;padding:22px;text-align:left;cursor:pointer}.sop-entry:hover{border-color:#9ac8b8;box-shadow:0 8px 24px rgba(32,40,37,.07)}.entry-seq{color:#8c9893;font-family:monospace;font-size:12px}.sop-entry small{color:var(--green);font-weight:650}.sop-entry h2{margin:8px 0 7px;font-family:"Noto Serif SC",serif;font-size:20px}.sop-entry p{margin:0;color:var(--muted);line-height:1.6}.play{width:38px;height:38px;display:grid;place-items:center;color:white;background:#202825;border-radius:4px;font-size:18px}.run-workspace{display:grid;grid-template-columns:270px minmax(0,1fr);gap:18px}.run-context{align-self:start;padding:24px;color:white;background:#202825;border-radius:6px;position:sticky;top:86px}.run-label{color:#72c9ab;font-size:11px;font-weight:700}.run-context h2{margin:12px 0 8px;font-family:"Noto Serif SC",serif}.run-context>p{margin:0 0 28px;color:#aebdb7;line-height:1.6}.context-meta{display:flex;align-items:center;justify-content:space-between;padding:13px 0;border-top:1px solid #3a4742}.context-meta span{color:#9eada7;font-size:12px}.privacy-note{display:flex;gap:8px;margin-top:28px;color:#889b93;font-size:11px}.conversation{min-height:590px;padding:30px 34px}.conversation-progress{display:flex;align-items:center;gap:8px;color:#66736d;font-size:12px}.conversation-progress span{width:8px;height:8px;border-radius:50%;background:#d08736;box-shadow:0 0 0 4px #faefe1}.conversation-progress span.done{background:var(--green);box-shadow:0 0 0 4px #e4f1ec}.node-content{padding:44px 0 26px}.node-content small{color:var(--green);font-size:10px;font-weight:800}.node-content h1{margin:8px 0 22px;font-family:"Noto Serif SC",serif;font-size:28px}.node-content blockquote{margin:0;padding:18px 20px;color:#29342f;background:#f2f6f4;border-left:3px solid var(--green);font-size:17px;line-height:1.8}.answer-form{max-width:680px}.choice-group{display:flex;flex-wrap:wrap}.run-actions{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:24px -34px -30px;padding:18px 34px;border-top:1px solid var(--line);color:var(--muted);font-size:12px}.completed-state{padding:40px 0;text-align:center}.completed-state>span{color:var(--green);font-size:50px}.completed-state h3{margin:14px 0 8px;font-family:"Noto Serif SC",serif;font-size:24px}.completed-state p{margin:0 0 24px;color:var(--muted)}
@media(max-width:800px){.sop-catalog{grid-template-columns:1fr}.run-workspace{grid-template-columns:1fr}.run-context{position:static}.conversation{padding:22px}.run-actions{margin:24px -22px -22px;padding:16px 22px}.run-actions span{display:none}}
</style>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue'
import { BookOutlined, DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue'
import { message, Modal } from 'ant-design-vue'
import { api, apiMessage } from '@/api/client'
import type { KnowledgeCard, Scenario } from '@/types'
const loading=ref(false);const open=ref(false);const items=ref<KnowledgeCard[]>([]);const scenarios=ref<Scenario[]>([])
const form=reactive({scenario_id:undefined as number|undefined,title:'',content:'',forbidden:'',risk_note:''})
const scenarioOptions=computed(()=>scenarios.value.map(s=>({value:s.id,label:s.name})))
async function load(){loading.value=true;try{const [cards,sceneData]=await Promise.all([api.get<{items:KnowledgeCard[]}>('/knowledge-cards'),api.get<{items:Scenario[]}>('/scenarios')]);items.value=cards.items;scenarios.value=sceneData.items}catch(error){message.error(apiMessage(error))}finally{loading.value=false}}
async function create(){try{await api.post('/knowledge-cards',{scenario_id:form.scenario_id,title:form.title,content:{standard_copy:form.content,forbidden_copy:form.forbidden,risk_note:form.risk_note}});message.success('知识卡已发布');open.value=false;Object.assign(form,{scenario_id:undefined,title:'',content:'',forbidden:'',risk_note:''});await load()}catch(error){message.error(apiMessage(error))}}
function remove(item:KnowledgeCard){Modal.confirm({title:`归档“${item.title}”?`,okType:'danger',async onOk(){await api.delete(`/knowledge-cards/${item.id}`);await load()}})}
function contentOf(item:KnowledgeCard,key:string){return item.content?.[key]||''}
onMounted(load)
</script>
<template><div class="page-shell"><div class="page-heading"><div><h1>知识卡</h1><p>沉淀经过审核的标准表达禁用语和风险提醒</p></div><a-button type="primary" @click="open=true"><PlusOutlined />新建知识卡</a-button></div><a-spin :spinning="loading"><div v-if="items.length" class="knowledge-grid"><article v-for="item in items" :key="item.id" class="knowledge-card surface"><header><span><BookOutlined /></span><a-tag color="green">已发布</a-tag></header><h2>{{ item.title }}</h2><p>{{ contentOf(item,'standard_copy')||'暂无标准话术' }}</p><div v-if="contentOf(item,'risk_note')" class="risk-note">{{ contentOf(item,'risk_note') }}</div><footer><span>{{ scenarios.find(s=>s.id===item.scenario_id)?.name||'未分类场景' }}</span><a-button type="text" danger aria-label="归档知识卡" @click="remove(item)"><DeleteOutlined /></a-button></footer></article></div><a-empty v-else description="还没有知识卡" /></a-spin><a-drawer v-model:open="open" title="新建知识卡" width="520"><a-form layout="vertical" :model="form" @finish="create"><a-form-item label="所属场景" name="scenario_id" :rules="[{required:true,message:'请选择场景'}]"><a-select v-model:value="form.scenario_id" :options="scenarioOptions" /></a-form-item><a-form-item label="标题" name="title" :rules="[{required:true,message:'请输入标题'}]"><a-input v-model:value="form.title" /></a-form-item><a-form-item label="标准话术" name="content" :rules="[{required:true,message:'请输入标准话术'}]"><a-textarea v-model:value="form.content" :rows="5" /></a-form-item><a-form-item label="禁用表达"><a-textarea v-model:value="form.forbidden" :rows="3" /></a-form-item><a-form-item label="风险提醒"><a-textarea v-model:value="form.risk_note" :rows="3" /></a-form-item><a-button type="primary" html-type="submit" block>发布知识卡</a-button></a-form></a-drawer></div></template>
<style scoped>.knowledge-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.knowledge-card{min-height:250px;padding:20px;display:flex;flex-direction:column}.knowledge-card header{display:flex;justify-content:space-between}.knowledge-card header>span{width:36px;height:36px;display:grid;place-items:center;color:var(--green);background:#e8f3ef;border-radius:4px}.knowledge-card h2{margin:20px 0 10px;font-family:"Noto Serif SC",serif;font-size:19px}.knowledge-card>p{margin:0;color:#4f5c56;line-height:1.7}.risk-note{margin-top:14px;padding:9px 11px;color:#8b5b16;background:#fbf3e5;border-left:2px solid #c68a37;font-size:12px}.knowledge-card footer{display:flex;align-items:center;justify-content:space-between;margin-top:auto;padding-top:18px;color:var(--muted);font-size:12px}@media(max-width:1050px){.knowledge-grid{grid-template-columns:repeat(2,1fr)}}@media(max-width:650px){.knowledge-grid{grid-template-columns:1fr}}</style>

View File

@@ -0,0 +1,86 @@
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { LockOutlined, UserOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { apiMessage } from '@/api/client'
import { useAuthStore } from '@/stores/auth'
const router = useRouter()
const auth = useAuthStore()
const loading = ref(false)
const form = reactive({ username: 'admin', password: 'admin123' })
async function submit() {
loading.value = true
try {
await auth.login(form.username, form.password)
await router.push('/')
} catch (error) {
message.error(apiMessage(error))
} finally {
loading.value = false
}
}
</script>
<template>
<main class="login-page">
<section class="identity-panel">
<div class="identity-grid"></div>
<div class="brand-lockup">
<div class="brand-symbol"><i></i><i></i><i></i></div>
<span>销冠 SOP</span>
</div>
<div class="identity-copy">
<p class="eyebrow">SALES PRACTICE SYSTEM</p>
<h1>把经验变成<br />每天可执行的步骤</h1>
<p>场景配置话术编排版本发布与一线执行在同一个工作台完成</p>
</div>
<div class="signal-line"><span>01</span><b></b><span>结构化经验</span></div>
</section>
<section class="login-panel">
<div class="login-form-wrap">
<div class="mobile-brand">销冠 SOP</div>
<h2>登录工作台</h2>
<p>使用企业账号进入经验执行系统</p>
<a-form layout="vertical" :model="form" @finish="submit">
<a-form-item label="用户名" name="username" :rules="[{ required: true, message: '请输入用户名' }]">
<a-input v-model:value="form.username" size="large" autocomplete="username"><template #prefix><UserOutlined /></template></a-input>
</a-form-item>
<a-form-item label="密码" name="password" :rules="[{ required: true, message: '请输入密码' }]">
<a-input-password v-model:value="form.password" size="large" autocomplete="current-password"><template #prefix><LockOutlined /></template></a-input-password>
</a-form-item>
<a-button type="primary" html-type="submit" size="large" block :loading="loading">进入平台</a-button>
</a-form>
<div class="login-note"><span></span>本地开发账号已预填</div>
</div>
</section>
</main>
</template>
<style scoped>
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(420px, .95fr); background: #f8faf9; }
.identity-panel { position: relative; overflow: hidden; min-height: 640px; padding: 42px 54px; display: flex; flex-direction: column; color: white; background: #202825; }
.identity-grid { position: absolute; inset: 0; opacity: .12; background-image: linear-gradient(#b7c4be 1px, transparent 1px), linear-gradient(90deg, #b7c4be 1px, transparent 1px); background-size: 44px 44px; }
.brand-lockup { position: relative; display: flex; align-items: center; gap: 12px; font-family: "Noto Serif SC", serif; font-size: 18px; font-weight: 700; }
.brand-symbol { width: 34px; height: 34px; display: grid; grid-template-columns: repeat(3,1fr); align-items: end; gap: 3px; padding: 6px; border: 1px solid rgba(255,255,255,.35); border-radius: 5px; }
.brand-symbol i { display: block; height: 8px; background: #6cc7a8; }.brand-symbol i:nth-child(2) { height: 15px; }.brand-symbol i:nth-child(3) { height: 22px; background: #ed8e6a; }
.identity-copy { position: relative; margin: auto 0; max-width: 600px; }
.eyebrow { color: #86d3b8 !important; font-size: 12px; font-weight: 700; }
.identity-copy h1 { margin: 20px 0 24px; font-family: "Noto Serif SC", "Songti SC", serif; font-size: clamp(38px, 4.2vw, 64px); line-height: 1.2; letter-spacing: 0; }
.identity-copy p { max-width: 510px; color: #bdc8c3; font-size: 16px; line-height: 1.8; }
.signal-line { position: relative; display: flex; align-items: center; gap: 12px; color: #91a29b; font-size: 12px; }
.signal-line b { width: 70px; height: 1px; background: #52615b; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-form-wrap { width: min(100%, 390px); }
.login-form-wrap h2 { margin: 0; color: #202825; font-family: "Noto Serif SC", serif; font-size: 28px; letter-spacing: 0; }
.login-form-wrap > p { margin: 8px 0 30px; color: #728079; }
.login-form-wrap :deep(.ant-form-item-label label) { color: #46514c; font-weight: 600; }
.login-form-wrap :deep(.ant-input-affix-wrapper) { padding: 10px 12px; }
.login-form-wrap :deep(.ant-btn-lg) { height: 44px; margin-top: 8px; }
.login-note { display: flex; align-items: center; gap: 8px; margin-top: 20px; color: #8a9691; font-size: 12px; }
.login-note span { width: 7px; height: 7px; border-radius: 50%; background: #d5644a; }
.mobile-brand { display: none; }
@media (max-width: 860px) { .login-page { grid-template-columns: 1fr; }.identity-panel { display: none; }.login-panel { min-height: 100vh; padding: 28px; }.mobile-brand { display: block; margin-bottom: 48px; color: #16775b; font-family: "Noto Serif SC", serif; font-weight: 700; } }
</style>

View File

@@ -0,0 +1,12 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { api, apiMessage } from '@/api/client'
import { message } from 'ant-design-vue'
import type { SOPRun } from '@/types'
const loading=ref(false);const items=ref<SOPRun[]>([])
async function load(){loading.value=true;try{items.value=(await api.get<{items:SOPRun[]}>('/runs')).items}catch(error){message.error(apiMessage(error))}finally{loading.value=false}}
function statusText(v:string){return v==='completed'?'已完成':'进行中'}
onMounted(load)
</script>
<template><div class="page-shell"><div class="page-heading"><div><h1>执行记录</h1><p>查看 SOP 的实际使用情况和执行结果</p></div></div><section class="surface"><a-table row-key="id" :loading="loading" :data-source="items" :pagination="{pageSize:20}" :columns="[{title:'执行编号',dataIndex:'id',width:130},{title:'SOP',dataIndex:'sop_name'},{title:'状态',dataIndex:'status',width:110},{title:'结果',dataIndex:'result',width:120},{title:'开始时间',dataIndex:'started_at',width:190},{title:'完成时间',dataIndex:'completed_at',width:190}]" :scroll="{x:900}"><template #bodyCell="{column,record}"><template v-if="column.dataIndex==='id'"><code>RUN-{{ String(record.id).padStart(5,'0') }}</code></template><template v-else-if="column.dataIndex==='status'"><a-tag :color="record.status==='completed'?'green':'orange'">{{ statusText(record.status) }}</a-tag></template><template v-else-if="column.dataIndex==='result'">{{ record.result||'-' }}</template><template v-else-if="column.dataIndex==='started_at'||column.dataIndex==='completed_at'">{{ record[column.dataIndex]?new Date(record[column.dataIndex]).toLocaleString('zh-CN'):'-' }}</template></template><template #emptyText><div class="empty-copy">还没有执行记录发布 SOP 后即可开始执行</div></template></a-table></section></div></template>
<style scoped>code{padding:2px 5px;color:#17654f;background:#eef5f2;border-radius:3px}</style>

View File

@@ -0,0 +1,83 @@
<script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ArrowDownOutlined, ArrowLeftOutlined, ArrowUpOutlined, DeleteOutlined, PlusOutlined, SaveOutlined, SendOutlined } from '@ant-design/icons-vue'
import { message, Modal } from 'ant-design-vue'
import { api, apiMessage } from '@/api/client'
import type { SOP, SOPEdge, SOPNode, SOPVersion } from '@/types'
const route = useRoute(); const router = useRouter(); const id = Number(route.params.id)
const loading = ref(true); const saving = ref(false)
const sop = ref<SOP | null>(null); const version = ref<SOPVersion | null>(null)
const nodes = ref<SOPNode[]>([]); const edges = ref<SOPEdge[]>([]); const selectedKey = ref('')
const selected = computed(() => nodes.value.find(n => n.node_key === selectedKey.value))
const editable = computed(() => version.value?.status === 'draft')
const reviewing = computed(() => version.value?.status === 'reviewing')
const nodeTypes = [{value:'message',label:'标准话术'},{value:'question',label:'单项提问'},{value:'choice',label:'选择判断'},{value:'condition',label:'条件节点'},{value:'knowledge',label:'知识卡'},{value:'escalate',label:'转人工/转诊'},{value:'finish',label:'结束'}]
const edgeDraft = reactive({ target_node_key: '', field: '', operator: 'equals', value: '' })
async function load() {
loading.value = true
try {
const data = await api.get<{ sop:SOP; version:SOPVersion; nodes:SOPNode[]; edges:SOPEdge[] }>(`/sops/${id}`)
sop.value=data.sop; version.value=data.version; nodes.value=data.nodes.map(n=>({...n,config:n.config||{}})); edges.value=data.edges.map(e=>({...e,condition:e.condition||{}})); selectedKey.value ||= nodes.value[0]?.node_key || ''
} catch(error) { message.error(apiMessage(error)) } finally { loading.value=false }
}
function addNode() {
const key=`node_${Date.now()}`; nodes.value.push({ id:0,created_at:'',updated_at:'',node_key:key,type:'message',title:'新步骤',content:'',config:{},position_x:0,position_y:nodes.value.length*120 }); selectedKey.value=key
}
function removeNode(node:SOPNode) {
if (['start'].includes(node.type)) return message.warning('开始节点不能删除')
Modal.confirm({title:`删除“${node.title}”?`,content:'与该节点关联的转移条件也会删除。',okType:'danger',onOk(){nodes.value=nodes.value.filter(n=>n.node_key!==node.node_key);edges.value=edges.value.filter(e=>e.source_node_key!==node.node_key&&e.target_node_key!==node.node_key);selectedKey.value=nodes.value[0]?.node_key||''}})
}
function move(index:number,delta:number){const target=index+delta;if(target<0||target>=nodes.value.length)return;const copy=[...nodes.value];[copy[index],copy[target]]=[copy[target],copy[index]];copy.forEach((n,i)=>n.position_y=i*120);nodes.value=copy}
function outgoing(key:string){return edges.value.filter(e=>e.source_node_key===key)}
function addEdge(){if(!selected.value||!edgeDraft.target_node_key)return;const condition=edgeDraft.field?{field:edgeDraft.field,operator:edgeDraft.operator,value:parseValue(edgeDraft.value)}:{};edges.value.push({id:0,created_at:'',updated_at:'',source_node_key:selected.value.node_key,target_node_key:edgeDraft.target_node_key,condition,priority:outgoing(selected.value.node_key).length});Object.assign(edgeDraft,{target_node_key:'',field:'',operator:'equals',value:''})}
function removeEdge(edge:SOPEdge){edges.value=edges.value.filter(e=>e!==edge)}
function parseValue(value:string){if(value==='true')return true;if(value==='false')return false;if(value!==''&&!Number.isNaN(Number(value)))return Number(value);return value}
function conditionText(condition:Record<string,any>){if(!condition||!condition.field)return '默认路径';const names:Record<string,string>={equals:'等于',not_equals:'不等于',contains:'包含',greater_than:'大于',less_than:'小于',exists:'已填写',not_exists:'未填写'};return `${condition.field} ${names[condition.operator]||condition.operator} ${condition.value ?? ''}`}
async function save(){saving.value=true;try{await api.put(`/sops/${id}/draft`,{start_node_key:version.value?.start_node_key||'start',nodes:nodes.value.map(({node_key,type,title,content,config,position_x,position_y})=>({node_key,type,title,content,config,position_x,position_y})),edges:edges.value.map(({source_node_key,target_node_key,condition,priority})=>({source_node_key,target_node_key,condition,priority}))});message.success('草稿已保存');await load()}catch(error){message.error(apiMessage(error))}finally{saving.value=false}}
async function validate(){try{const data=await api.post<{valid:boolean;problems:string[]}>(`/sops/${id}/validate`);data.valid?message.success('流程校验通过'):Modal.warning({title:'流程还不能发布',content:data.problems.join('')})}catch(error){message.error(apiMessage(error))}}
async function submitReview(){try{await save();await api.post(`/sops/${id}/submit-review`);message.success('SOP 已提交审核');await load()}catch(error){message.error(apiMessage(error))}}
async function publish(){try{if(editable.value) await save();await api.post(`/sops/${id}/publish`);message.success('SOP 已发布');await load()}catch(error){message.error(apiMessage(error))}}
async function offline(){try{await api.post(`/sops/${id}/offline`);message.success('SOP 已下线');await load()}catch(error){message.error(apiMessage(error))}}
async function createVersion(){try{await api.post(`/sops/${id}/versions`);message.success('已创建新草稿版本');await load()}catch(error){message.error(apiMessage(error))}}
onMounted(load)
</script>
<template>
<div class="editor-page">
<header class="editor-header">
<div class="editor-title"><a-button type="text" aria-label="返回场景" @click="router.push(`/scenarios/${sop?.scenario_id}`)"><ArrowLeftOutlined /></a-button><div><b>{{ sop?.name || 'SOP 编辑器' }}</b><span>版本 {{ version?.version }} · {{ editable ? '草稿' : (reviewing ? '审核中' : (version?.status === 'offline' ? '已下线' : '已发布')) }}</span></div></div>
<div class="page-actions"><a-button @click="validate">校验流程</a-button><a-button v-if="editable" :loading="saving" @click="save"><SaveOutlined />保存</a-button><a-button v-if="editable" @click="submitReview"><SendOutlined />提交审核</a-button><a-button v-if="editable||reviewing" type="primary" @click="publish"><SendOutlined />发布</a-button><a-button v-if="version?.status === 'published'" danger @click="offline">下线</a-button><a-button v-if="!editable&&version?.status !== 'reviewing'&&version?.status !== 'published'" type="primary" @click="createVersion"><PlusOutlined />创建新版本</a-button><a-button v-if="version?.status === 'published'" type="primary" @click="createVersion"><PlusOutlined />创建新版本</a-button></div>
</header>
<a-spin :spinning="loading">
<main class="editor-workbench">
<aside class="node-rail surface">
<div class="rail-title"><span>流程节点</span><a-button v-if="editable" type="text" aria-label="添加节点" @click="addNode"><PlusOutlined /></a-button></div>
<div class="node-list">
<button v-for="(node,index) in nodes" :key="node.node_key" :class="{active:selectedKey===node.node_key}" @click="selectedKey=node.node_key"><span class="node-index">{{ String(index+1).padStart(2,'0') }}</span><span class="node-meta"><b>{{ node.title }}</b><small>{{ nodeTypes.find(t=>t.value===node.type)?.label || node.type }}</small></span><span v-if="editable&&node.type!=='start'" class="node-move"><ArrowUpOutlined @click.stop="move(index,-1)"/><ArrowDownOutlined @click.stop="move(index,1)"/></span></button>
</div>
</aside>
<section v-if="selected" class="node-editor surface">
<div class="node-editor-head"><div><span class="node-type-mark">{{ selected.type.toUpperCase() }}</span><h2>{{ selected.title }}</h2></div><a-button v-if="editable&&selected.type!=='start'" danger type="text" @click="removeNode(selected)"><DeleteOutlined />删除</a-button></div>
<a-form layout="vertical" class="property-form">
<div class="property-grid"><a-form-item label="节点名称"><a-input v-model:value="selected.title" :disabled="!editable" /></a-form-item><a-form-item label="节点类型"><a-select v-model:value="selected.type" :disabled="!editable||selected.type==='start'" :options="nodeTypes" /></a-form-item></div>
<a-form-item label="标准话术 / 操作提示"><a-textarea v-model:value="selected.content" :disabled="!editable" :rows="5" placeholder="执行到此节点时展示给一线人员的内容" /></a-form-item>
<template v-if="['question','choice'].includes(selected.type)"><div class="property-grid"><a-form-item label="写入字段标识"><a-input v-model:value="selected.config.field_key" :disabled="!editable" placeholder="例如 pet_weight" /></a-form-item><a-form-item label="是否必填"><a-switch v-model:checked="selected.config.required" :disabled="!editable" /></a-form-item></div></template>
<a-form-item v-if="selected.type==='choice'" label="可选项(每行一个)"><a-textarea :value="(selected.config.options||[]).join('\n')" :disabled="!editable" :rows="4" @change="selected.config.options=($event.target as HTMLTextAreaElement).value.split('\n').filter(Boolean)" /></a-form-item>
</a-form>
<div class="transition-head"><div><b>下一步路径</b><span>按优先级匹配默认路径建议放最后</span></div></div>
<div class="transition-list"><div v-for="edge in outgoing(selectedKey)" :key="`${edge.source_node_key}-${edge.target_node_key}-${edge.priority}`" class="transition-row"><span class="route-line"></span><span class="route-target">{{ nodes.find(n=>n.node_key===edge.target_node_key)?.title || edge.target_node_key }}</span><a-tag>{{ conditionText(edge.condition) }}</a-tag><a-button v-if="editable" type="text" danger aria-label="删除路径" @click="removeEdge(edge)"><DeleteOutlined /></a-button></div><div v-if="!outgoing(selectedKey).length" class="route-empty">还没有下一步路径</div></div>
<div v-if="editable&&!['finish','escalate'].includes(selected.type)" class="edge-builder"><a-select v-model:value="edgeDraft.target_node_key" placeholder="目标节点" :options="nodes.filter(n=>n.node_key!==selectedKey).map(n=>({value:n.node_key,label:n.title}))" /><a-input v-model:value="edgeDraft.field" placeholder="条件字段(留空为默认)" /><a-select v-model:value="edgeDraft.operator" :options="[{value:'equals',label:'等于'},{value:'not_equals',label:'不等于'},{value:'contains',label:'包含'},{value:'greater_than',label:'大于'},{value:'less_than',label:'小于'},{value:'exists',label:'已填写'}]" /><a-input v-model:value="edgeDraft.value" placeholder="条件值" /><a-button @click="addEdge"><PlusOutlined />添加路径</a-button></div>
</section>
<a-empty v-else description="请选择一个节点" class="surface editor-empty" />
</main>
</a-spin>
</div>
</template>
<style scoped>
.editor-page { min-height: calc(100vh - 62px); background: #eef1ef; }.editor-header { min-height: 66px; display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 24px;background:white;border-bottom:1px solid var(--line);position:sticky;top:62px;z-index:10 }.editor-title{display:flex;align-items:center;gap:8px}.editor-title>div{display:flex;flex-direction:column}.editor-title b{font-size:15px}.editor-title span{margin-top:3px;color:var(--muted);font-size:11px}.editor-workbench{display:grid;grid-template-columns:280px minmax(0,1fr);gap:16px;max-width:1500px;margin:0 auto;padding:18px}.node-rail{align-self:start;overflow:hidden;position:sticky;top:146px}.rail-title{height:50px;display:flex;align-items:center;justify-content:space-between;padding:0 14px;border-bottom:1px solid var(--line);font-weight:650}.node-list{padding:8px}.node-list button{width:100%;min-height:58px;display:grid;grid-template-columns:34px 1fr auto;align-items:center;gap:9px;padding:7px 8px;text-align:left;background:transparent;border:1px solid transparent;border-radius:4px;cursor:pointer}.node-list button:hover{background:#f5f8f6}.node-list button.active{background:#edf6f2;border-color:#b9d8cc}.node-index{color:#88958f;font-family:monospace;font-size:11px}.node-meta{min-width:0;display:flex;flex-direction:column}.node-meta b{overflow:hidden;font-size:13px;text-overflow:ellipsis;white-space:nowrap}.node-meta small{margin-top:3px;color:var(--muted);font-size:11px}.node-move{display:flex;gap:4px;color:#87938e}.node-move>*:hover{color:var(--green)}.node-editor{align-self:start;min-height:600px;padding:24px}.node-editor-head{display:flex;align-items:flex-start;justify-content:space-between;padding-bottom:18px;border-bottom:1px solid var(--line)}.node-editor-head h2{margin:6px 0 0;font-family:"Noto Serif SC",serif;font-size:22px}.node-type-mark{color:var(--green);font-size:10px;font-weight:750}.property-form{padding-top:22px}.property-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.transition-head{display:flex;justify-content:space-between;margin:8px -24px 0;padding:18px 24px 10px;border-top:1px solid var(--line)}.transition-head>div{display:flex;flex-direction:column}.transition-head span{margin-top:4px;color:var(--muted);font-size:11px}.transition-row{min-height:48px;display:grid;grid-template-columns:20px minmax(120px,1fr) auto 36px;align-items:center;gap:10px;border-bottom:1px solid #edf0ee}.route-line{width:16px;height:1px;background:var(--green)}.route-target{font-weight:600}.route-empty{padding:20px 0;color:var(--muted);font-size:12px}.edge-builder{display:grid;grid-template-columns:1.1fr 1fr 120px 1fr auto;gap:8px;padding-top:16px}.editor-empty{min-height:400px;display:grid;place-items:center}
@media(max-width:1050px){.edge-builder{grid-template-columns:1fr 1fr}.editor-workbench{grid-template-columns:230px minmax(0,1fr)}}@media(max-width:760px){.editor-header{top:62px;align-items:flex-start;flex-direction:column;padding:12px}.editor-workbench{grid-template-columns:1fr;padding:10px}.node-rail{position:static}.property-grid,.edge-builder{grid-template-columns:1fr}.node-editor{padding:16px}.transition-head{margin:8px -16px 0;padding:16px}}
</style>

View File

@@ -0,0 +1,99 @@
<script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ArrowLeftOutlined, BranchesOutlined, DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue'
import { message, Modal } from 'ant-design-vue'
import { api, apiMessage } from '@/api/client'
import type { Scenario, ScenarioField, SOP } from '@/types'
const route = useRoute()
const router = useRouter()
const scenarioId = Number(route.params.id)
const loading = ref(true)
const scenario = ref<Scenario | null>(null)
const fields = ref<ScenarioField[]>([])
const sops = ref<SOP[]>([])
const fieldOpen = ref(false)
const sopOpen = ref(false)
const fieldForm = reactive({ field_key: '', field_name: '', field_type: 'text', required: false, options_text: '', sort_order: 0 })
const sopForm = reactive({ name: '', description: '' })
const statusColor = computed(() => scenario.value?.status === 'active' ? 'green' : 'default')
async function load() {
loading.value = true
try {
const data = await api.get<{ scenario: Scenario; fields: ScenarioField[]; sops: SOP[] }>(`/scenarios/${scenarioId}`)
scenario.value = data.scenario; fields.value = data.fields; sops.value = data.sops
} catch (error) { message.error(apiMessage(error)) } finally { loading.value = false }
}
async function createField() {
try {
const options = fieldForm.options_text.split('\n').map(v => v.trim()).filter(Boolean)
await api.post(`/scenarios/${scenarioId}/fields`, { ...fieldForm, options, validation: {}, sort_order: fields.value.length })
message.success('字段已添加'); fieldOpen.value = false
Object.assign(fieldForm, { field_key: '', field_name: '', field_type: 'text', required: false, options_text: '', sort_order: 0 }); await load()
} catch (error) { message.error(apiMessage(error)) }
}
async function deleteField(field: ScenarioField) {
Modal.confirm({ title: `删除字段“${field.field_name}”?`, content: '已经使用该字段的 SOP 节点可能需要重新配置。', okType: 'danger', async onOk() { await api.delete(`/scenario-fields/${field.id}`); await load() } })
}
async function createSOP() {
try {
const data = await api.post<{ sop: SOP }>(`/scenarios/${scenarioId}/sops`, sopForm)
message.success('SOP 草稿已创建'); sopOpen.value = false; router.push(`/sops/${data.sop.id}`)
} catch (error) { message.error(apiMessage(error)) }
}
function statusText(value: string) { return ({ draft: '草稿', published: '已发布' } as Record<string,string>)[value] || value }
onMounted(load)
</script>
<template>
<div class="page-shell">
<a-button type="link" class="back-link" @click="router.push('/scenarios')"><ArrowLeftOutlined />返回场景列表</a-button>
<a-skeleton :loading="loading" active>
<div v-if="scenario" class="detail-heading">
<div><div class="heading-tags"><a-tag :color="statusColor">{{ scenario.status === 'active' ? '使用中' : '草稿' }}</a-tag><span>{{ scenario.industry }}</span><span>{{ scenario.role_name }}</span></div><h1>{{ scenario.name }}</h1><p>{{ scenario.goal }}</p></div>
<div class="scenario-code">SCN-{{ String(scenario.id).padStart(4, '0') }}</div>
</div>
<a-tabs default-active-key="fields" class="detail-tabs">
<a-tab-pane key="fields" tab="场景字段">
<section class="surface">
<div class="toolbar"><div><b>采集字段</b><span class="toolbar-note">执行过程中收集的信息</span></div><a-button type="primary" @click="fieldOpen = true"><PlusOutlined />添加字段</a-button></div>
<a-table :data-source="fields" row-key="id" :pagination="false" :columns="[{title:'字段名称',dataIndex:'field_name'},{title:'字段标识',dataIndex:'field_key'},{title:'类型',dataIndex:'field_type',width:130},{title:'必填',dataIndex:'required',width:90},{title:'',key:'action',width:70}]">
<template #bodyCell="{ column, record }"><template v-if="column.dataIndex === 'field_key'"><code>{{ record.field_key }}</code></template><template v-else-if="column.dataIndex === 'required'"><a-tag :color="record.required ? 'orange' : 'default'">{{ record.required ? '必填' : '选填' }}</a-tag></template><template v-else-if="column.key === 'action'"><a-button type="text" danger aria-label="删除字段" @click="deleteField(record)"><DeleteOutlined /></a-button></template></template>
<template #emptyText><div class="empty-copy">还没有字段先添加执行过程中需要收集的客户信息</div></template>
</a-table>
</section>
</a-tab-pane>
<a-tab-pane key="sops" tab="SOP 流程">
<section class="surface">
<div class="toolbar"><div><b>话术流程</b><span class="toolbar-note">一个场景可以包含多套 SOP</span></div><a-button type="primary" @click="sopOpen = true"><PlusOutlined />创建 SOP</a-button></div>
<div v-if="sops.length" class="sop-list">
<button v-for="item in sops" :key="item.id" @click="router.push(`/sops/${item.id}`)"><span class="sop-icon"><BranchesOutlined /></span><span class="sop-copy"><b>{{ item.name }}</b><small>{{ item.description || '暂无说明' }}</small></span><a-tag :color="item.status === 'published' ? 'green' : 'default'">{{ statusText(item.status) }}</a-tag><span class="sop-date">{{ new Date(item.updated_at).toLocaleDateString('zh-CN') }}</span></button>
</div>
<div v-else class="empty-state"><BranchesOutlined /><p>还没有 SOP创建一套流程将经验变成连续动作</p></div>
</section>
</a-tab-pane>
</a-tabs>
</a-skeleton>
<a-modal v-model:open="fieldOpen" title="添加场景字段" ok-text="添加字段" @ok="createField">
<a-form layout="vertical" :model="fieldForm">
<div class="field-grid"><a-form-item label="字段名称"><a-input v-model:value="fieldForm.field_name" placeholder="宠物体重" /></a-form-item><a-form-item label="字段标识"><a-input v-model:value="fieldForm.field_key" placeholder="pet_weight" /></a-form-item></div>
<a-form-item label="字段类型"><a-select v-model:value="fieldForm.field_type" :options="[{value:'text',label:'单行文本'},{value:'textarea',label:'多行文本'},{value:'number',label:'数字'},{value:'boolean',label:'是/否'},{value:'select',label:'单选'},{value:'multiselect',label:'多选'},{value:'date',label:'日期'}]" /></a-form-item>
<a-form-item v-if="['select','multiselect'].includes(fieldForm.field_type)" label="选项(每行一个)"><a-textarea v-model:value="fieldForm.options_text" :rows="4" /></a-form-item>
<a-checkbox v-model:checked="fieldForm.required">执行时必须填写</a-checkbox>
</a-form>
</a-modal>
<a-modal v-model:open="sopOpen" title="创建 SOP 草稿" ok-text="创建并编排" @ok="createSOP">
<a-form layout="vertical" :model="sopForm"><a-form-item label="SOP 名称"><a-input v-model:value="sopForm.name" placeholder="问诊问药标准流程" /></a-form-item><a-form-item label="说明"><a-textarea v-model:value="sopForm.description" :rows="4" placeholder="这套流程适用于什么情况" /></a-form-item></a-form>
</a-modal>
</div>
</template>
<style scoped>
.back-link { margin: -4px 0 12px -14px; color: var(--muted); }.detail-heading { min-height: 150px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 28px; color: white; background: #202825; border-radius: 6px; }.detail-heading h1 { margin: 10px 0 8px; font-family: "Noto Serif SC",serif; font-size: 28px; letter-spacing: 0; }.detail-heading p { max-width: 720px; margin: 0; color: #b8c4bf; }.heading-tags { display: flex; align-items: center; gap: 10px; color: #a8b6b0; font-size: 12px; }.scenario-code { align-self: flex-start; color: #70817a; font-size: 12px; }.detail-tabs { margin-top: 18px; }.toolbar > div { display: flex; align-items: baseline; gap: 12px; }.toolbar-note { color: var(--muted); font-size: 12px; }.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }code { padding: 2px 5px; color: #17654f; background: #eef5f2; border-radius: 3px; }
.sop-list button { width: 100%; min-height: 74px; display: grid; grid-template-columns: 42px 1fr auto 100px; align-items: center; gap: 14px; padding: 12px 18px; text-align: left; background: white; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }.sop-list button:hover { background: #f8faf9; }.sop-icon { width: 38px; height: 38px; display: grid; place-items: center; color: var(--green); background: #e8f3ef; border-radius: 4px; }.sop-copy { min-width: 0; display: flex; flex-direction: column; }.sop-copy small { overflow: hidden; margin-top: 4px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }.sop-date { color: var(--muted); font-size: 12px; text-align: right; }.empty-state { padding: 64px 20px; color: #82908a; text-align: center; }.empty-state > span { font-size: 32px; }.empty-state p { margin: 12px 0 0; }
@media (max-width: 650px) { .detail-heading { align-items: flex-start; flex-direction: column; }.scenario-code { display:none; }.field-grid { grid-template-columns: 1fr; gap: 0; }.sop-list button { grid-template-columns: 36px 1fr auto; }.sop-date { display:none; } }
</style>

View File

@@ -0,0 +1,77 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { PlusOutlined, SearchOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { api, apiMessage } from '@/api/client'
import type { Scenario } from '@/types'
const router = useRouter()
const loading = ref(false)
const open = ref(false)
const keyword = ref('')
const items = ref<Scenario[]>([])
const form = reactive({ name: '', industry: '', role_name: '', goal: '', trigger_text: '', visibility: 'tenant' })
const columns = [
{ title: '场景名称', dataIndex: 'name', key: 'name' }, { title: '行业', dataIndex: 'industry', key: 'industry', width: 140 },
{ title: '适用角色', dataIndex: 'role_name', key: 'role_name', width: 160 }, { title: '状态', dataIndex: 'status', key: 'status', width: 110 },
{ title: '更新时间', dataIndex: 'updated_at', key: 'updated_at', width: 180 }, { title: '', key: 'action', width: 80 },
]
async function load() {
loading.value = true
try { items.value = (await api.get<{ items: Scenario[] }>('/scenarios', { params: { keyword: keyword.value } })).items } finally { loading.value = false }
}
async function create() {
try {
const item = await api.post<Scenario>('/scenarios', form)
message.success('场景已创建')
open.value = false
router.push(`/scenarios/${item.id}`)
} catch (error) { message.error(apiMessage(error)) }
}
function statusText(value: string) { return ({ draft: '草稿', active: '使用中', archived: '已归档' } as Record<string,string>)[value] || value }
onMounted(load)
</script>
<template>
<div class="page-shell">
<div class="page-heading">
<div><h1>场景与 SOP</h1><p>从业务触发点开始定义信息字段与可执行话术流程</p></div>
<a-button type="primary" @click="open = true"><PlusOutlined />新建场景</a-button>
</div>
<section class="surface">
<div class="toolbar">
<a-input v-model:value="keyword" allow-clear placeholder="搜索名称或行业" style="width: 280px" @press-enter="load"><template #prefix><SearchOutlined /></template></a-input>
<span class="muted"> {{ items.length }} 个场景</span>
</div>
<a-table :columns="columns" :data-source="items" :loading="loading" row-key="id" :pagination="false" :scroll="{ x: 800 }" :custom-row="(record: Scenario) => ({ onClick: () => router.push(`/scenarios/${record.id}`) })">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'name'"><div class="scenario-name"><b>{{ record.name }}</b><small>{{ record.goal }}</small></div></template>
<template v-else-if="column.key === 'status'"><a-tag :color="record.status === 'active' ? 'green' : 'default'">{{ statusText(record.status) }}</a-tag></template>
<template v-else-if="column.key === 'updated_at'">{{ new Date(record.updated_at).toLocaleString('zh-CN') }}</template>
<template v-else-if="column.key === 'action'"><a-button type="link" size="small">配置</a-button></template>
</template>
<template #emptyText><div class="empty-copy">还没有业务场景。创建第一个场景后,就可以配置字段和 SOP。</div></template>
</a-table>
</section>
<a-drawer v-model:open="open" title="创建业务场景" width="520" :destroy-on-close="true">
<a-form layout="vertical" :model="form">
<a-form-item label="场景名称" name="name" :rules="[{ required: true, message: '请输入场景名称' }]"><a-input v-model:value="form.name" placeholder="例如宠物医生问诊问药" /></a-form-item>
<div class="form-grid"><a-form-item label="所属行业" name="industry" :rules="[{ required: true, message: '请输入行业' }]"><a-input v-model:value="form.industry" placeholder="宠物医疗" /></a-form-item><a-form-item label="适用角色" name="role_name" :rules="[{ required: true, message: '请输入角色' }]"><a-input v-model:value="form.role_name" placeholder="医生客服" /></a-form-item></div>
<a-form-item label="执行目标" name="goal" :rules="[{ required: true, message: '请输入执行目标' }]"><a-textarea v-model:value="form.goal" :rows="3" placeholder="这个场景最终要推动什么结果" /></a-form-item>
<a-form-item label="触发条件" name="trigger_text" :rules="[{ required: true, message: '请输入触发条件' }]"><a-textarea v-model:value="form.trigger_text" :rows="3" placeholder="什么时候进入这个场景" /></a-form-item>
<a-form-item label="可见范围"><a-radio-group v-model:value="form.visibility"><a-radio value="tenant">全企业</a-radio><a-radio value="team">团队</a-radio><a-radio value="private">仅自己</a-radio></a-radio-group></a-form-item>
<a-button type="primary" block @click="create">创建并继续配置</a-button>
</a-form>
</a-drawer>
</div>
</template>
<style scoped>
.scenario-name { max-width: 460px; display: flex; flex-direction: column; cursor: pointer; }.scenario-name b { font-size: 14px; }.scenario-name small { overflow: hidden; margin-top: 4px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
:deep(.ant-table-row) { cursor: pointer; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; gap: 0; } }
</style>

19
codes/web/tsconfig.json Normal file
View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ES2022",
"useDefineForClassFields": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"jsx": "preserve",
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"baseUrl": ".",
"paths": { "@/*": ["src/*"] },
"types": ["vite/client", "node"]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue", "vite.config.ts"]
}

19
codes/web/vite.config.ts Normal file
View File

@@ -0,0 +1,19 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
},
server: {
host: '127.0.0.1',
port: 5173,
proxy: { '/api': 'http://127.0.0.1:8080' },
},
build: {
outDir: 'dist',
sourcemap: false,
},
})