flex-mcp 1.1.5 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{d as $e,u as Se,r as m,p as le,A as De,c as y,b as a,f as o,w as n,g as l,B as $,k as q,C as Ie,D as ce,o as w,h,N as Ce,j as W,E as ze,n as I,G as ye,H as Ae,I as Te,J as X,K as Ve,L as _e,m as te,F as fe,s as me,t as K,M as He,O as Ue,x as Ne,y as xe,P as Oe,Q as je,R as Le,S as Ee,U as Pe,V as ge,W as Je,X as qe,Y as Fe,Z as Be,_ as We,v as Ke,a as Ye,q as Ge,z as Qe,i as Xe}from"./index-Ku_MdnLs.js";import{g as Ze,p as et,_ as tt,u as Re,I as at,C as st,M as lt}from"./InitScriptEditor-CJfq5ewu.js";import{_ as Me}from"./_plugin-vue_export-helper-DlAUqK2U.js";const nt={class:"variables-manager"},ot={class:"variables-toolbar"},rt={class:"variables-table-container"},it={class:"modal-form-wrapper"},ut=$e({__name:"VariablesManager",props:{config:{}},emits:["update"],setup(ne,{emit:_}){const f=ne,p=_,A=Se(),c=m(!1),E=m(!1),z=m(null),O=m(),R=m(""),U={pageSize:10,showSizePicker:!0,pageSizes:[10,20,50]},G=C=>({style:"cursor: pointer; transition: all 0.2s ease;",onMouseenter:u=>{u.currentTarget.style.backgroundColor="rgba(99, 102, 241, 0.04)"},onMouseleave:u=>{u.currentTarget.style.backgroundColor=""}}),H=[{title:"变量名",key:"name",width:100,render(C){return I("strong",C.name)}},{title:"值",key:"value",width:500,render(C){if(C.isSecret)return I(ye,{type:"info",depth:3,italic:!0},{default:()=>"****** (敏感信息)"});const u=String(C.value).split(`
1
+ import{d as $e,u as Se,r as m,p as le,A as De,c as y,b as a,f as o,w as n,g as l,B as $,k as q,C as Ie,D as ce,o as w,h,N as Ce,j as W,E as ze,n as I,G as ye,H as Ae,I as Te,J as X,K as Ve,L as _e,m as te,F as fe,s as me,t as K,M as He,O as Ue,x as Ne,y as xe,P as Oe,Q as je,R as Le,S as Ee,U as Pe,V as ge,W as Je,X as qe,Y as Fe,Z as Be,_ as We,v as Ke,a as Ye,q as Ge,z as Qe,i as Xe}from"./index-DAOSS2K-.js";import{g as Ze,p as et,_ as tt,u as Re,I as at,C as st,M as lt}from"./InitScriptEditor-DzzTB5Qk.js";import{_ as Me}from"./_plugin-vue_export-helper-DlAUqK2U.js";const nt={class:"variables-manager"},ot={class:"variables-toolbar"},rt={class:"variables-table-container"},it={class:"modal-form-wrapper"},ut=$e({__name:"VariablesManager",props:{config:{}},emits:["update"],setup(ne,{emit:_}){const f=ne,p=_,A=Se(),c=m(!1),E=m(!1),z=m(null),O=m(),R=m(""),U={pageSize:10,showSizePicker:!0,pageSizes:[10,20,50]},G=C=>({style:"cursor: pointer; transition: all 0.2s ease;",onMouseenter:u=>{u.currentTarget.style.backgroundColor="rgba(99, 102, 241, 0.04)"},onMouseleave:u=>{u.currentTarget.style.backgroundColor=""}}),H=[{title:"变量名",key:"name",width:100,render(C){return I("strong",C.name)}},{title:"值",key:"value",width:500,render(C){if(C.isSecret)return I(ye,{type:"info",depth:3,italic:!0},{default:()=>"****** (敏感信息)"});const u=String(C.value).split(`
2
2
  `).map((b,Q,oe)=>{const ae=[I("span",{class:"value-line"},b)];return Q<oe.length-1&&ae.push(I("br")),ae}).flat();return I("div",{class:"variable-value-cell"},u)}},{title:"描述",key:"description",width:300,render(C){return I(ye,{depth:3},{default:()=>C.description||"-"})}},{title:"操作",key:"actions",width:150,render(C){return I(Ae,{size:"small"},{default:()=>[I($,{size:"small",onClick:()=>V(C)},{default:()=>"编辑"}),I($,{size:"small",type:"error",onClick:()=>P(C.id)},{default:()=>"删除"})]})}}],B=le(()=>{if(!R.value)return f.config.variables;const C=R.value.toLowerCase();return f.config.variables.filter(u=>{var b;return u.name.toLowerCase().includes(C)||((b=u.description)==null?void 0:b.toLowerCase().includes(C))})}),x=m({name:"",value:"",description:"",isSecret:!1}),L={name:{required:!0,message:"请输入变量名",trigger:"blur"},value:{required:!0,message:"请输入变量值",trigger:"blur"}};function V(C){z.value=C,x.value={name:C.name,value:C.value,description:C.description||"",isSecret:C.isSecret||!1},c.value=!0}function P(C){const u=f.config.variables.filter(b=>b.id!==C);p("update",{variables:u})}async function ve(){var C,u;try{await((C=O.value)==null?void 0:C.validate()),E.value=!0;const b={id:((u=z.value)==null?void 0:u.id)||Ze(),name:x.value.name,value:x.value.value,description:x.value.description||void 0,isSecret:x.value.isSecret},Q=[...f.config.variables],oe=Q.findIndex(ae=>ae.id===b.id);oe!==-1?Q[oe]=b:Q.push(b),p("update",{variables:Q}),c.value=!1,J()}catch(b){A.error(b.message)}finally{E.value=!1}}function J(){z.value=null,x.value={name:"",value:"",description:"",isSecret:!1}}return De(()=>c.value,C=>{C||J()}),(C,u)=>(w(),y("div",nt,[a("div",ot,[o(l($),{type:"primary",size:"large",class:"add-variable-btn",onClick:u[0]||(u[0]=b=>c.value=!0)},{icon:n(()=>[...u[8]||(u[8]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[u[9]||(u[9]=h(" 添加变量 ",-1))]),_:1}),o(l(q),{value:R.value,"onUpdate:value":u[1]||(u[1]=b=>R.value=b),placeholder:"搜索变量名或描述...",size:"large",clearable:"",class:"search-input"},{prefix:n(()=>[...u[10]||(u[10]=[a("svg",{class:"search-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),a("div",rt,[o(l(Ie),{columns:H,data:B.value,pagination:U,"row-props":G,class:"modern-table"},null,8,["data"])]),o(l(ce),{show:c.value,"onUpdate:show":u[7]||(u[7]=b=>c.value=b),preset:"dialog",title:z.value?"编辑变量":"添加变量",class:"variable-edit-modal",style:{maxHeight:"90vh"}},{action:n(()=>[o(l($),{onClick:u[6]||(u[6]=b=>c.value=!1)},{default:n(()=>[...u[12]||(u[12]=[h("取消",-1)])]),_:1}),o(l($),{type:"primary",loading:E.value,onClick:ve},{default:n(()=>[...u[13]||(u[13]=[h("保存",-1)])]),_:1},8,["loading"])]),default:n(()=>[a("div",it,[o(l(Ce),{ref_key:"formRef",ref:O,model:x.value,rules:L},{default:n(()=>[o(l(W),{path:"name",label:"变量名"},{default:n(()=>[o(l(q),{value:x.value.name,"onUpdate:value":u[2]||(u[2]=b=>x.value.name=b),placeholder:"例如: API_KEY"},null,8,["value"])]),_:1}),o(l(W),{path:"value",label:"值"},{default:n(()=>[o(l(q),{value:x.value.value,"onUpdate:value":u[3]||(u[3]=b=>x.value.value=b),type:x.value.isSecret?"password":"textarea",rows:x.value.isSecret?void 0:3,placeholder:"变量值"},null,8,["value","type","rows"])]),_:1}),o(l(W),{path:"description",label:"描述"},{default:n(()=>[o(l(q),{value:x.value.description,"onUpdate:value":u[4]||(u[4]=b=>x.value.description=b),type:"textarea",rows:2,placeholder:"可选"},null,8,["value"])]),_:1}),o(l(W),{path:"isSecret",label:"敏感信息"},{default:n(()=>[o(l(ze),{checked:x.value.isSecret,"onUpdate:checked":u[5]||(u[5]=b=>x.value.isSecret=b)},{default:n(()=>[...u[11]||(u[11]=[h("标记为敏感信息(导出时使用占位符)",-1)])]),_:1},8,["checked"])]),_:1})]),_:1},8,["model"])])]),_:1},8,["show","title"])]))}}),dt=Me(ut,[["__scopeId","data-v-f50b6ccd"]]),ct={class:"prompts-manager"},vt={class:"prompts-toolbar"},pt={class:"prompts-table-container"},ft={class:"modal-header"},mt={class:"modal-title"},gt={class:"modal-subtitle"},wt={class:"modal-content-wrapper"},ht={class:"tab-pane-content"},bt={class:"form-section"},kt={class:"form-grid-2"},yt={class:"form-section"},xt={class:"section-header"},Ct={class:"parameters-list"},$t={class:"parameter-header"},St={class:"parameter-index"},Dt={class:"parameter-fields"},Mt={key:0,class:"empty-parameters"},_t={class:"tab-pane-content"},zt={style:{display:"flex","align-items":"center",gap:"8px"}},Tt={viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:"18px",height:"18px"}},Ut={class:"messages-section"},Nt={class:"message-header"},jt={class:"save-status-indicator"},It=["title"],Bt={key:0,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},At={key:1,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Vt={key:0,class:"monaco-wrapper"},Et={key:0,class:"empty-messages"},Rt={class:"modal-footer"},Ht={class:"test-content"},Ot={class:"test-messages"},Lt={class:"test-message-header"},Pt={class:"test-message-content"},Jt={key:0,class:"test-message-empty"},qt=$e({__name:"PromptsManager",setup(ne){const _=Se(),f=m(!1),p=m(!1),A=m(!1),c=m(!1),E=m(!1),z=m(null),O=m(),R=m(""),U=m([]),G=m("content"),H=m(!1),B=m(-1),x=m(new Map),L=m(!1),V=[{label:"用户",value:"user"},{label:"助手",value:"assistant"}],P={pageSize:10,showSizePicker:!0,pageSizes:[10,20,50]},ve=d=>({style:"cursor: pointer; transition: all 0.2s ease;",onMouseenter:t=>{t.currentTarget.style.backgroundColor="rgba(99, 102, 241, 0.04)"},onMouseleave:t=>{t.currentTarget.style.backgroundColor=""}}),J=[{title:"名称",key:"name",width:200,render(d){return I("strong",d.name)}},{title:"描述",key:"description",render(d){return I(ye,{depth:3},{default:()=>d.description||"-"})}},{title:"参数数量",key:"arguments",width:120,render(d){return I(ye,{depth:3},{default:()=>{var t;return`${((t=d.arguments)==null?void 0:t.length)||0} 个`}})}},{title:"消息数量",key:"messages",width:120,render(d){return I(ye,{depth:3},{default:()=>{var t;return`${((t=d.messages)==null?void 0:t.length)||0} 条`}})}},{title:"操作",key:"actions",width:200,render(d){return I(Ae,{size:"small"},{default:()=>[I($,{size:"small",onClick:()=>ue(d)},{default:()=>"编辑"}),I($,{size:"small",type:"info",onClick:()=>r(d)},{default:()=>"测试"}),I($,{size:"small",type:"error",onClick:()=>we(d.id)},{default:()=>"删除"})]})}}],C=le(()=>{if(!R.value)return U.value;const d=R.value.toLowerCase();return U.value.filter(t=>{var e;return t.name.toLowerCase().includes(d)||((e=t.description)==null?void 0:e.toLowerCase().includes(d))})}),u=m({name:"",description:"",arguments:[],messages:[]}),b=m({arguments:{}}),Q=le(()=>!p.value||!u.value.messages||u.value.messages.length===0?[]:u.value.messages.filter(t=>t.content.text).map(t=>({...t,content:{...t.content,text:et(t.content.text,b.value.arguments)}}))),oe={name:{required:!0,message:"请输入提示词名称",trigger:"blur"},messages:{required:!0,validator:(d,t)=>!t||t.length===0?new Error("至少需要一条消息"):!0,trigger:"blur"}};function ae(d){return x.value.get(d)||!1}function se(d){x.value.set(d,!0)}function ie(d){H.value&&B.value===d?(H.value=!1,B.value=-1):(H.value=!0,B.value=d)}async function Z(){var d,t;try{E.value=!0;const e=await X.get("/prompts");e.data.success&&(U.value=e.data.data)}catch(e){_.error(((t=(d=e.response)==null?void 0:d.data)==null?void 0:t.error)||"加载提示词失败")}finally{E.value=!1}}function pe(){z.value=null,T(),f.value=!0,G.value="content"}function ue(d){z.value=d,u.value={name:d.name,description:d.description||"",arguments:d.arguments?[...d.arguments]:[],messages:d.messages&&d.messages.length>0?[...d.messages]:[{role:"user",content:{type:"text",text:""}}]},x.value.clear(),f.value=!0,G.value="content"}async function we(d){var t,e;try{await X.delete(`/prompts/${d}`),_.success("删除成功"),await Z()}catch(s){_.error(((e=(t=s.response)==null?void 0:t.data)==null?void 0:e.error)||"删除失败")}}function he(){u.value.arguments.push({name:"",description:"",required:!1})}function re(d){u.value.arguments.splice(d,1)}function be(){u.value.messages.push({role:"user",content:{type:"text",text:""}}),se(u.value.messages.length-1)}function de(d){u.value.messages.splice(d,1),x.value.delete(d),B.value===d?(H.value=!1,B.value=-1):B.value>d&&B.value--}async function ke(){var d,t,e;try{await((d=O.value)==null?void 0:d.validate()),A.value=!0;const s={name:u.value.name,description:u.value.description||void 0,arguments:u.value.arguments.filter(i=>i.name),messages:u.value.messages.filter(i=>i.content.text)};z.value?(await X.put(`/prompts/${z.value.id}`,s),_.success("更新成功")):(await X.post("/prompts",s),_.success("创建成功")),x.value.clear(),f.value=!1,await Z(),T()}catch(s){_.error(((e=(t=s.response)==null?void 0:t.data)==null?void 0:e.error)||"保存失败")}finally{A.value=!1}}async function g(){var d,t,e;try{await((d=O.value)==null?void 0:d.validate()),c.value=!0;const s=u.value.arguments.filter(i=>i.name);b.value.arguments=s.reduce((i,j)=>(i[j.name]=b.value.arguments[j.name]||"",i),{}),p.value=!0}catch(s){_.error(((e=(t=s.response)==null?void 0:t.data)==null?void 0:e.error)||"测试失败")}finally{c.value=!1}}async function r(d){z.value=d,u.value={name:d.name,description:d.description||"",arguments:d.arguments?[...d.arguments]:[],messages:d.messages?[...d.messages]:[]};const t=u.value.arguments.filter(e=>e.name);b.value.arguments=t.reduce((e,s)=>(e[s.name]="",e),{}),await g()}function T(){z.value=null,u.value={name:"",description:"",arguments:[],messages:[{role:"user",content:{type:"text",text:`# 提示词模板
3
3
 
4
4
  ## 变量替换
@@ -27,4 +27,4 @@ import{d as $e,u as Se,r as m,p as le,A as De,c as y,b as a,f as o,w as n,g as l
27
27
  ${M}${N}`)}if(v.length>0){const M=v.slice(0,10).join(`
28
28
  `),N=v.length>10?`
29
29
  ... 还有 ${v.length-10} 个错误`:"";f.error(`数据校验失败:
30
- ${M}${N}`);return}z.value=!0,x.value=!0,L.value=`正在导入 ${i.length} 条数据...`;try{const M=i.map(D=>{const k={};return p.tableDefinition.columns.forEach(Y=>{const F=D[Y.name];let ee=F;if(F!=null&&F!=="")switch(Y.type){case"number":ee=typeof F=="string"?Number(F):F;break;case"boolean":ee=typeof F=="boolean"?F:!!F;break;case"date":typeof F=="string"&&(ee=new Date(F).toISOString());break;case"json":if(typeof F=="string")try{ee=JSON.parse(F)}catch{ee=F}break}else if(Y.defaultValue!==void 0)ee=Y.defaultValue;else if(Y.nullable)ee=null;else switch(Y.type){case"string":ee="";break;case"number":ee=0;break;case"boolean":ee=!1;break;case"date":ee=new Date().toISOString();break;case"json":ee={};break}k[Y.name]=ee}),{rowData:k}}),N=await X.put(`/tables/data/${p.tableId}/batch`,{rows:M});N.data.success?(de(),await b(),A("saved"),R.value=!1,f.success(`成功导入 ${i.length} 条数据`)):f.error("导入失败:"+(N.data.error||"未知错误"))}catch(M){f.error("导入失败: "+(((s=(e=M.response)==null?void 0:e.data)==null?void 0:s.error)||M.message))}finally{z.value=!1,x.value=!1}}catch(i){f.error("文件读取失败: "+(i.message||"未知错误"))}}async function T(t){var s;const e=(s=t.fileList[0])==null?void 0:s.file;if(e)try{const i=await e.text();await r(i)}catch(i){f.error("文件读取失败: "+(i.message||"未知错误"))}}async function d(){if(!B.value.trim()){f.warning("请输入 JSON 数据");return}await r(B.value.trim()),B.value=""}return(t,e)=>(w(),y("div",Wt,[a("div",Kt,[a("div",Yt,[o(l($),{size:"large",onClick:e[0]||(e[0]=s=>U.value=!U.value),type:U.value?"warning":"success",ghost:""},{icon:n(()=>[U.value?(w(),y("svg",Gt,[...e[6]||(e[6]=[a("path",{d:"M19 11H5a2 2 0 00-2 2v7a2 2 0 002 2h14a2 2 0 002-2v-7a2 2 0 00-2-2zM7 11V7a5 5 0 0110 0v4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(w(),y("svg",Qt,[...e[7]||(e[7]=[a("path",{d:"M19 11H5a2 2 0 00-2 2v7a2 2 0 002 2h14a2 2 0 002-2v-7a2 2 0 00-2-2zM7 11V7a5 5 0 0110 0v4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),a("path",{d:"M12 15v2M9 17h6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),default:n(()=>[h(" "+K(U.value?"解锁编辑":"锁定编辑"),1)]),_:1},8,["type"]),o(l($),{type:"primary",size:"large",onClick:Q,disabled:!ne.tableDefinition||U.value},{icon:n(()=>[...e[8]||(e[8]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[e[9]||(e[9]=h(" 添加行 ",-1))]),_:1},8,["disabled"]),o(l($),{size:"large",onClick:oe,disabled:E.value.length===0||U.value,type:"error",ghost:""},{icon:n(()=>[...e[10]||(e[10]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[h(" 删除选中 ("+K(E.value.length)+") ",1)]),_:1},8,["disabled"]),o(l($),{size:"large",onClick:g,disabled:!ne.tableDefinition||c.value.length===0},{icon:n(()=>[...e[11]||(e[11]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[e[12]||(e[12]=h(" 导出 JSON ",-1))]),_:1},8,["disabled"]),o(l($),{size:"large",onClick:e[1]||(e[1]=s=>R.value=!0),disabled:!ne.tableDefinition},{icon:n(()=>[...e[13]||(e[13]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[e[14]||(e[14]=h(" 导入 JSON ",-1))]),_:1},8,["disabled"])]),a("div",Xt,[a("div",Zt,[O.value?(w(),y("div",{key:0,class:Ne(["save-success-indicator",{flash:O.value}])},null,2)):te("",!0)]),o(l(je),{type:"info",size:"large"},{default:n(()=>[h(" 共 "+K(c.value.length)+" 行(编辑即保存) ",1)]),_:1})])]),ne.tableDefinition?(w(),y("div",ea,[a("div",ta,[o(l(Ie),{columns:P.value,data:c.value,pagination:V.value,"row-key":s=>s.id||`new-${c.value.indexOf(s)}`,"row-props":J,"max-height":600,"scroll-x":ve.value,bordered:!0,"single-line":!1,"onUpdate:checkedRowKeys":ae,class:"editable-data-table excel-table"},null,8,["columns","data","pagination","row-key","scroll-x"])],512)])):(w(),y("div",aa,[o(l(ge),{description:"请先创建或选择表定义"})])),o(l(ce),{show:R.value,"onUpdate:show":e[4]||(e[4]=s=>R.value=s),preset:"card",bordered:!1,class:"import-modal",style:{width:"90vw",maxWidth:"600px"}},{header:n(()=>[...e[15]||(e[15]=[a("div",{class:"modal-header"},[a("div",{class:"modal-icon"},[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])]),a("div",null,[a("h3",{class:"modal-title"},"导入表数据"),a("p",{class:"modal-subtitle"},"从 JSON 文件导入表数据")])],-1)])]),default:n(()=>[a("div",sa,[o(l(Ve),{"default-value":"file",type:"line"},{default:n(()=>[o(l(_e),{name:"file",tab:"文件上传"},{default:n(()=>[o(l(Je),{"file-list":[],accept:".json",max:1,onChange:T},{default:n(()=>[o(l(qe),null,{default:n(()=>[...e[16]||(e[16]=[a("div",{class:"upload-area"},[a("svg",{class:"upload-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4m17-7l-5-5m0 0L7 8m9-5v12",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),a("p",{class:"upload-text"},"点击或拖拽 JSON 文件到此处"),a("p",{class:"upload-hint"},"支持导入表数据")],-1)])]),_:1})]),_:1})]),_:1}),o(l(_e),{name:"text",tab:"直接编辑/粘贴"},{default:n(()=>[a("div",la,[o(l(q),{value:B.value,"onUpdate:value":e[2]||(e[2]=s=>B.value=s),type:"textarea",placeholder:"请粘贴或输入 JSON 数据(数组格式)...",rows:15,class:"json-textarea"},null,8,["value"]),a("div",na,[o(l($),{onClick:d,type:"primary",disabled:!B.value.trim()},{default:n(()=>[...e[17]||(e[17]=[h(" 导入 ",-1)])]),_:1},8,["disabled"]),o(l($),{onClick:e[3]||(e[3]=s=>B.value="")},{default:n(()=>[...e[18]||(e[18]=[h(" 清空 ",-1)])]),_:1})])])]),_:1})]),_:1})])]),_:1},8,["show"]),o(l(ce),{show:x.value,"onUpdate:show":e[5]||(e[5]=s=>x.value=s),"mask-closable":!1,"close-on-esc":!1,"auto-focus":!1,preset:"dialog",closable:!1,"show-icon":!1,style:{width:"400px"}},{default:n(()=>[a("div",oa,[o(l(Fe),{size:"large"},{description:n(()=>[a("div",ra,K(L.value),1)]),_:1})])]),_:1},8,["show"])]))}}),ua=Me(ia,[["__scopeId","data-v-da42254c"]]),da={class:"tables-page"},ca={class:"tables-toolbar"},va={class:"toolbar-left"},pa={class:"table-select-with-icon"},fa={class:"toolbar-right"},ma={class:"toolbar-switch"},ga={class:"explore-config-panel"},wa={class:"explore-config-list"},ha={key:0,class:"empty-tables-hint"},ba={class:"explore-config-item-info"},ka={class:"table-name"},ya={key:0,class:"table-description"},xa={key:0,class:"tables-table-container"},Ca={key:1,class:"no-table-selected"},$a={class:"columns-section"},Sa={class:"columns-header"},Da={class:"columns-list"},Ma={class:"column-index"},_a={key:0,class:"empty-columns"},za={class:"form-actions"},Ta={class:"modal-header"},Ua={class:"modal-subtitle"},Na={class:"column-descriptions-section"},ja={class:"column-description-label"},Ia={class:"column-name-label"},Ba={key:0,class:"empty-columns-hint"},Aa={class:"form-actions"},Va=$e({__name:"Tables",setup(ne){const _=Se(),f=Re(),p=m([]),A=m(null),c=m(null),E=m(!1),z=m(!1),O=m(!1),R=m(!1),U=m(!1),G=m(!1),H=m(!1),B=m(null),x=m(""),L=m({}),V=m(!0),P=m({}),ve=[{label:"字符串",value:"string"},{label:"数字",value:"number"},{label:"布尔值",value:"boolean"},{label:"日期",value:"date"},{label:"JSON",value:"json"}],J=m({name:"",description:"",columns:[]}),C={name:{required:!0,message:"表名不能为空",trigger:"blur"}},u=le(()=>p.value.map(g=>({label:g.name,value:g.id,description:g.description})));function b(g){if(g){const r=p.value.find(T=>T.id===g);r&&pe(r)}else A.value=null,c.value=null}const Q=le({get:()=>E.value,set:g=>{E.value=g}});Te(async()=>{await Z(),await oe()});async function oe(){try{if(await f.fetchConfig(),f.currentConfig){const g=f.currentConfig;V.value=g.enableExploreTable!==!1}}catch(g){console.error("加载配置失败:",g)}}async function ae(g){H.value=!0;try{await f.updateConfig({enableExploreTable:g}),_.success(g?"已允许 AI 探索数据表":"已禁止 AI 探索数据表")}catch(r){_.error("更新配置失败: "+(r.message||"未知错误")),V.value=!g}finally{H.value=!1}}function se(g){return g.allowExplore!==!1}async function ie(g,r){var T,d;P.value[g]=!0;try{const t=p.value.find(s=>s.id===g);if(!t){_.error("表不存在");return}(await X.put(`/tables/definitions/${g}`,{allowExplore:r})).data.success&&(t.allowExplore=r,_.success(r?`已允许 AI 探索表「${t.name}」`:`已禁止 AI 探索表「${t.name}」`),c.value&&c.value.id===g&&(c.value.allowExplore=r))}catch(t){_.error("更新失败: "+(((d=(T=t.response)==null?void 0:T.data)==null?void 0:d.error)||t.message))}finally{P.value[g]=!1}}async function Z(){var g,r;try{const T=await X.get("/tables/definitions");T.data.success&&(p.value=T.data.data,p.value.length>0&&!A.value&&pe(p.value[0]))}catch(T){_.error("加载表列表失败: "+(((r=(g=T.response)==null?void 0:g.data)==null?void 0:r.error)||T.message))}}function pe(g){A.value=g.id,c.value=g}function ue(){J.value.columns.push({name:"",type:"string",nullable:!0,description:""})}function we(g){J.value.columns.splice(g,1)}async function he(){B.value&&await B.value.validate(async g=>{var r,T;if(!g){if(J.value.columns.length===0){_.warning("至少需要定义一个列");return}U.value=!0;try{const d=await X.post("/tables/definitions",J.value);d.data.success&&(_.success("表创建成功"),E.value=!1,J.value={name:"",description:"",columns:[]},await Z(),pe(d.data.data))}catch(d){_.error("保存失败: "+(((T=(r=d.response)==null?void 0:r.data)==null?void 0:T.error)||d.message))}finally{U.value=!1}}})}async function re(){var g,r;if(c.value){R.value=!0;try{(await X.delete(`/tables/definitions/${c.value.id}`)).data.success&&(_.success("表删除成功"),A.value=null,c.value=null,O.value=!1,await Z())}catch(T){_.error("删除失败: "+(((r=(g=T.response)==null?void 0:g.data)==null?void 0:r.error)||T.message))}finally{R.value=!1}}}function be(){}De(z,g=>{g&&c.value&&(x.value=c.value.description||"",L.value={},c.value.columns&&c.value.columns.forEach(r=>{L.value[r.name]=r.description||""}))});function de(g){switch(g){case"string":return"info";case"number":return"success";case"boolean":return"warning";case"date":return"default";case"json":return"error";default:return"default"}}async function ke(){var g,r;if(!c.value||!A.value){_.error("请先选择一个表");return}G.value=!0;try{const T=c.value.columns.map(t=>({...t,description:L.value[t.name]||void 0})),d=await X.put(`/tables/definitions/${A.value}`,{description:x.value||null,columns:T});d.data.success&&(_.success("表声明和字段声明更新成功"),z.value=!1,c.value&&(c.value.description=d.data.data.description,c.value.columns=d.data.data.columns),await Z())}catch(T){_.error("更新失败: "+(((r=(g=T.response)==null?void 0:g.data)==null?void 0:r.error)||T.message))}finally{G.value=!1}}return(g,r)=>{var d,t;const T=Ke("n-tag");return w(),y("div",da,[a("div",ca,[a("div",va,[a("div",pa,[o(l(Ue),{value:A.value,"onUpdate:value":[r[0]||(r[0]=e=>A.value=e),b],options:u.value,placeholder:"选择表...",size:"large",clearable:"",filterable:"",class:"table-select"},{empty:n(()=>[o(l(ge),{description:"暂无表",size:"small"})]),_:1},8,["value","options"]),(d=c.value)!=null&&d.description?(w(),xe(l(Ee),{key:0,trigger:"hover",placement:"top"},{trigger:n(()=>[...r[14]||(r[14]=[a("div",{class:"table-info-icon"},[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)])]),default:n(()=>[h(" "+K(c.value.description),1)]),_:1})):te("",!0)])]),a("div",fa,[a("div",ma,[o(l(Be),{value:V.value,"onUpdate:value":[r[1]||(r[1]=e=>V.value=e),ae],size:"medium",loading:H.value},{checked:n(()=>[...r[15]||(r[15]=[h("允许 AI 探索数据表",-1)])]),unchecked:n(()=>[...r[16]||(r[16]=[h("禁止 AI 探索数据表",-1)])]),_:1},8,["value","loading"]),o(l(We),{trigger:"hover",placement:"bottom-end",style:{width:"400px",maxHeight:"500px"}},{trigger:n(()=>[...r[17]||(r[17]=[a("div",{class:"explore-config-icon",title:"配置表探索权限"},[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94L14.4 2.81c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z",fill:"currentColor"})])],-1)])]),default:n(()=>[a("div",ga,[r[18]||(r[18]=a("div",{class:"explore-config-header"},[a("h4",null,"配置表探索权限"),a("p",{class:"explore-config-hint"},"控制哪些表允许被 AI 探索(默认为允许)")],-1)),a("div",wa,[p.value.length===0?(w(),y("div",ha,[o(l(ge),{description:"暂无表",size:"small"})])):te("",!0),(w(!0),y(fe,null,me(p.value,e=>(w(),y("div",{key:e.id,class:"explore-config-item"},[a("div",ba,[a("span",ka,K(e.name),1),e.description?(w(),y("span",ya,K(e.description),1)):te("",!0)]),o(l(Be),{value:se(e),"onUpdate:value":s=>ie(e.id,s),size:"small",loading:P.value[e.id]},null,8,["value","onUpdate:value","loading"])]))),128))])])]),_:1})]),c.value?(w(),xe(l($),{key:0,size:"large",ghost:"",onClick:r[2]||(r[2]=e=>z.value=!0),class:"edit-table-btn"},{icon:n(()=>[...r[19]||(r[19]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[r[20]||(r[20]=h(" 编辑表声明 ",-1))]),_:1})):te("",!0),c.value?(w(),xe(l($),{key:1,type:"error",size:"large",ghost:"",onClick:r[3]||(r[3]=e=>O.value=!0),class:"delete-table-btn"},{icon:n(()=>[...r[21]||(r[21]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[r[22]||(r[22]=h(" 删除表 ",-1))]),_:1})):te("",!0),o(l($),{type:"primary",size:"large",onClick:r[4]||(r[4]=e=>E.value=!0),class:"create-table-btn"},{icon:n(()=>[...r[23]||(r[23]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[r[24]||(r[24]=h(" 创建新表 ",-1))]),_:1})])]),c.value?(w(),y("div",xa,[o(ua,{"table-definition":c.value,"table-id":A.value,onSaved:be},null,8,["table-definition","table-id"])])):(w(),y("div",Ca,[o(l(ge),{description:"请选择一个表进行编辑"})])),o(l(ce),{show:O.value,"onUpdate:show":r[5]||(r[5]=e=>O.value=e),preset:"dialog",type:"warning",title:"确认删除",content:`确定要删除表「${(t=c.value)==null?void 0:t.name}」吗?此操作将同时删除表中的所有数据,且不可恢复。`,"positive-text":"确认删除","negative-text":"取消","positive-button-props":{type:"error"},loading:R.value,onPositiveClick:re,onNegativeClick:r[6]||(r[6]=e=>O.value=!1)},null,8,["show","content","loading"]),o(l(ce),{show:Q.value,"onUpdate:show":r[10]||(r[10]=e=>Q.value=e),preset:"card",bordered:!1,class:"table-definition-modal",style:{width:"90vw",maxWidth:"800px"}},{header:n(()=>[...r[25]||(r[25]=[a("div",{class:"modal-header"},[a("div",{class:"modal-icon"},[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M3 3h18v18H3V3zm2 2v14h14V5H5zm2 2h10v2H7V7zm0 4h10v2H7v-2zm0 4h7v2H7v-2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])]),a("div",null,[a("h3",{class:"modal-title"}," 创建新表 "),a("p",{class:"modal-subtitle"}," 定义表的结构和列类型(创建后不可修改) ")])],-1)])]),default:n(()=>[o(l(Ce),{ref_key:"tableFormRef",ref:B,model:J.value,rules:C,class:"table-form"},{default:n(()=>[o(l(W),{path:"name",label:"表名"},{default:n(()=>[o(l(q),{value:J.value.name,"onUpdate:value":r[7]||(r[7]=e=>J.value.name=e),placeholder:"例如: users, products",size:"large"},null,8,["value"])]),_:1}),o(l(W),{path:"description",label:"描述"},{default:n(()=>[o(l(q),{value:J.value.description,"onUpdate:value":r[8]||(r[8]=e=>J.value.description=e),placeholder:"表的用途说明",size:"large",type:"textarea",rows:2},null,8,["value"])]),_:1}),o(l(W),{label:"列定义"},{default:n(()=>[a("div",$a,[a("div",Sa,[r[28]||(r[28]=a("span",null,null,-1)),o(l($),{dashed:"",onClick:ue,size:"medium"},{icon:n(()=>[...r[26]||(r[26]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[r[27]||(r[27]=h(" 添加列 ",-1))]),_:1})]),a("div",Da,[(w(!0),y(fe,null,me(J.value.columns,(e,s)=>(w(),y("div",{key:s,class:"column-row"},[a("span",Ma,"#"+K(s+1),1),o(l(W),{path:`columns[${s}].name`,"show-label":!1,rule:{required:!0,message:"必填",trigger:"blur"},class:"column-field-name"},{default:n(()=>[o(l(q),{value:e.name,"onUpdate:value":i=>e.name=i,placeholder:"列名"},null,8,["value","onUpdate:value"])]),_:2},1032,["path"]),o(l(W),{path:`columns[${s}].type`,"show-label":!1,rule:{required:!0,message:"必填",trigger:"change"},class:"column-field-type"},{default:n(()=>[o(l(Ue),{value:e.type,"onUpdate:value":i=>e.type=i,options:ve},null,8,["value","onUpdate:value"])]),_:2},1032,["path"]),o(l(ze),{checked:!e.nullable,"onUpdate:checked":i=>e.nullable=!i,class:"column-field-nullable"},{default:n(()=>[...r[29]||(r[29]=[h("必要",-1)])]),_:1},8,["checked","onUpdate:checked"]),o(l(W),{path:`columns[${s}].description`,"show-label":!1,class:"column-field-description"},{default:n(()=>[o(l(q),{value:e.description,"onUpdate:value":i=>e.description=i,placeholder:"列说明(可选)"},null,8,["value","onUpdate:value"])]),_:2},1032,["path"]),o(l($),{type:"error",text:"",size:"small",onClick:i=>we(s),class:"column-delete-btn"},{default:n(()=>[...r[30]||(r[30]=[h(" 删除 ",-1)])]),_:1},8,["onClick"])]))),128)),J.value.columns.length===0?(w(),y("div",_a,[o(l(ge),{description:"暂无列,点击上方添加列按钮添加",size:"small"})])):te("",!0)])])]),_:1}),a("div",za,[o(l($),{size:"large",onClick:r[9]||(r[9]=e=>Q.value=!1)},{default:n(()=>[...r[31]||(r[31]=[h(" 取消 ",-1)])]),_:1}),o(l($),{type:"primary",size:"large",loading:U.value,onClick:he},{default:n(()=>[...r[32]||(r[32]=[h(" 保存 ",-1)])]),_:1},8,["loading"])])]),_:1},8,["model"])]),_:1},8,["show"]),o(l(ce),{show:z.value,"onUpdate:show":r[13]||(r[13]=e=>z.value=e),preset:"card",bordered:!1,class:"edit-table-description-modal",style:{width:"90vw",maxWidth:"600px"}},{header:n(()=>{var e;return[a("div",Ta,[r[34]||(r[34]=a("div",{class:"modal-icon"},[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),a("div",null,[r[33]||(r[33]=a("h3",{class:"modal-title"}," 编辑表声明 ",-1)),a("p",Ua," 编辑表「"+K((e=c.value)==null?void 0:e.name)+"」的描述信息 ",1)])])]}),default:n(()=>[o(l(Ce),{ref:"editTableFormRef",class:"edit-table-form"},{default:n(()=>[o(l(W),{label:"表声明"},{default:n(()=>[o(l(q),{value:x.value,"onUpdate:value":r[11]||(r[11]=e=>x.value=e),placeholder:"表的用途说明",size:"large",type:"textarea",rows:4},null,8,["value"])]),_:1}),o(l(W),{label:"字段声明"},{default:n(()=>{var e,s;return[a("div",Na,[(w(!0),y(fe,null,me(((e=c.value)==null?void 0:e.columns)||[],i=>(w(),y("div",{key:i.name,class:"column-description-row"},[a("div",ja,[a("span",Ia,K(i.name),1),o(T,{size:"tiny",type:de(i.type),style:{"margin-left":"8px"}},{default:n(()=>[h(K(i.type),1)]),_:2},1032,["type"])]),o(l(q),{value:L.value[i.name],"onUpdate:value":j=>L.value[i.name]=j,placeholder:`${i.name} 字段的说明(可选)`,size:"medium",clearable:""},null,8,["value","onUpdate:value","placeholder"])]))),128)),!((s=c.value)!=null&&s.columns)||c.value.columns.length===0?(w(),y("div",Ba,[o(l(ge),{description:"当前表没有字段",size:"small"})])):te("",!0)])]}),_:1}),a("div",Aa,[o(l($),{size:"large",onClick:r[12]||(r[12]=e=>z.value=!1)},{default:n(()=>[...r[35]||(r[35]=[h(" 取消 ",-1)])]),_:1}),o(l($),{type:"primary",size:"large",loading:G.value,onClick:ke},{default:n(()=>[...r[36]||(r[36]=[h(" 保存 ",-1)])]),_:1},8,["loading"])])]),_:1},512)]),_:1},8,["show"])])}}}),Ea=Me(Va,[["__scopeId","data-v-bf1554c4"]]),Ra={class:"dashboard-container"},Ha={style:{position:"absolute",width:"0",height:"0"}},Oa={key:0,class:"loading-state"},La={key:1,class:"dashboard-content"},Pa=$e({__name:"Dashboard",setup(ne){const _=Se(),f=Re(),p=Ye(),A=Ge(),c=Xe(),E=m(A.query.section||"components"),z=le(()=>f.currentConfig),O=le(()=>f.loading),R=le(()=>{var V;return((V=p.user)==null?void 0:V.role)==="admin"}),U=["variables","tables"],G={components:lt,tools:st,variables:dt,init:at,tables:Ea,prompts:Ft},H=le(()=>G[E.value]);async function B(){try{await f.fetchConfig()}catch(V){_.error(V.message)}}async function x(V){if(z.value)try{await f.updateConfig(V),_.success("更新成功")}catch(P){_.error(P.message)}}function L(V){return R.value&&U.includes(V)?(_.warning("超级管理员不允许访问此功能"),c.replace({name:"UserDashboard",query:{section:"components"}}),E.value="components",!0):!1}return De(()=>A.query.section,V=>{if(!V)return;const P=V;L(P)||(E.value=P)},{immediate:!0}),Te(()=>{const V=A.query.section;L(V),B()}),(V,P)=>(w(),y("div",Ra,[(w(),y("svg",Ha,[...P[0]||(P[0]=[a("defs",null,[a("linearGradient",{id:"loading-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%"},[a("stop",{offset:"0%","stop-color":"#6366f1"}),a("stop",{offset:"50%","stop-color":"#8b5cf6"}),a("stop",{offset:"100%","stop-color":"#ec4899"})])],-1)])])),O.value&&!z.value?(w(),y("div",Oa,[...P[1]||(P[1]=[a("div",{class:"loading-spinner"},[a("svg",{class:"spinner",viewBox:"0 0 50 50"},[a("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"4"})])],-1),a("p",{class:"loading-text"},"加载配置中...",-1)])])):z.value?(w(),y("div",La,[(w(),xe(Qe(H.value),{config:z.value,onUpdate:x},null,40,["config"]))])):te("",!0)]))}}),Wa=Me(Pa,[["__scopeId","data-v-5f9aa991"]]);export{Wa as default};
30
+ ${M}${N}`);return}z.value=!0,x.value=!0,L.value=`正在导入 ${i.length} 条数据...`;try{const M=i.map(D=>{const k={};return p.tableDefinition.columns.forEach(Y=>{const F=D[Y.name];let ee=F;if(F!=null&&F!=="")switch(Y.type){case"number":ee=typeof F=="string"?Number(F):F;break;case"boolean":ee=typeof F=="boolean"?F:!!F;break;case"date":typeof F=="string"&&(ee=new Date(F).toISOString());break;case"json":if(typeof F=="string")try{ee=JSON.parse(F)}catch{ee=F}break}else if(Y.defaultValue!==void 0)ee=Y.defaultValue;else if(Y.nullable)ee=null;else switch(Y.type){case"string":ee="";break;case"number":ee=0;break;case"boolean":ee=!1;break;case"date":ee=new Date().toISOString();break;case"json":ee={};break}k[Y.name]=ee}),{rowData:k}}),N=await X.put(`/tables/data/${p.tableId}/batch`,{rows:M});N.data.success?(de(),await b(),A("saved"),R.value=!1,f.success(`成功导入 ${i.length} 条数据`)):f.error("导入失败:"+(N.data.error||"未知错误"))}catch(M){f.error("导入失败: "+(((s=(e=M.response)==null?void 0:e.data)==null?void 0:s.error)||M.message))}finally{z.value=!1,x.value=!1}}catch(i){f.error("文件读取失败: "+(i.message||"未知错误"))}}async function T(t){var s;const e=(s=t.fileList[0])==null?void 0:s.file;if(e)try{const i=await e.text();await r(i)}catch(i){f.error("文件读取失败: "+(i.message||"未知错误"))}}async function d(){if(!B.value.trim()){f.warning("请输入 JSON 数据");return}await r(B.value.trim()),B.value=""}return(t,e)=>(w(),y("div",Wt,[a("div",Kt,[a("div",Yt,[o(l($),{size:"large",onClick:e[0]||(e[0]=s=>U.value=!U.value),type:U.value?"warning":"success",ghost:""},{icon:n(()=>[U.value?(w(),y("svg",Gt,[...e[6]||(e[6]=[a("path",{d:"M19 11H5a2 2 0 00-2 2v7a2 2 0 002 2h14a2 2 0 002-2v-7a2 2 0 00-2-2zM7 11V7a5 5 0 0110 0v4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(w(),y("svg",Qt,[...e[7]||(e[7]=[a("path",{d:"M19 11H5a2 2 0 00-2 2v7a2 2 0 002 2h14a2 2 0 002-2v-7a2 2 0 00-2-2zM7 11V7a5 5 0 0110 0v4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),a("path",{d:"M12 15v2M9 17h6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),default:n(()=>[h(" "+K(U.value?"解锁编辑":"锁定编辑"),1)]),_:1},8,["type"]),o(l($),{type:"primary",size:"large",onClick:Q,disabled:!ne.tableDefinition||U.value},{icon:n(()=>[...e[8]||(e[8]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[e[9]||(e[9]=h(" 添加行 ",-1))]),_:1},8,["disabled"]),o(l($),{size:"large",onClick:oe,disabled:E.value.length===0||U.value,type:"error",ghost:""},{icon:n(()=>[...e[10]||(e[10]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[h(" 删除选中 ("+K(E.value.length)+") ",1)]),_:1},8,["disabled"]),o(l($),{size:"large",onClick:g,disabled:!ne.tableDefinition||c.value.length===0},{icon:n(()=>[...e[11]||(e[11]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[e[12]||(e[12]=h(" 导出 JSON ",-1))]),_:1},8,["disabled"]),o(l($),{size:"large",onClick:e[1]||(e[1]=s=>R.value=!0),disabled:!ne.tableDefinition},{icon:n(()=>[...e[13]||(e[13]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[e[14]||(e[14]=h(" 导入 JSON ",-1))]),_:1},8,["disabled"])]),a("div",Xt,[a("div",Zt,[O.value?(w(),y("div",{key:0,class:Ne(["save-success-indicator",{flash:O.value}])},null,2)):te("",!0)]),o(l(je),{type:"info",size:"large"},{default:n(()=>[h(" 共 "+K(c.value.length)+" 行(编辑即保存) ",1)]),_:1})])]),ne.tableDefinition?(w(),y("div",ea,[a("div",ta,[o(l(Ie),{columns:P.value,data:c.value,pagination:V.value,"row-key":s=>s.id||`new-${c.value.indexOf(s)}`,"row-props":J,"max-height":600,"scroll-x":ve.value,bordered:!0,"single-line":!1,"onUpdate:checkedRowKeys":ae,class:"editable-data-table excel-table"},null,8,["columns","data","pagination","row-key","scroll-x"])],512)])):(w(),y("div",aa,[o(l(ge),{description:"请先创建或选择表定义"})])),o(l(ce),{show:R.value,"onUpdate:show":e[4]||(e[4]=s=>R.value=s),preset:"card",bordered:!1,class:"import-modal",style:{width:"90vw",maxWidth:"600px"}},{header:n(()=>[...e[15]||(e[15]=[a("div",{class:"modal-header"},[a("div",{class:"modal-icon"},[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])]),a("div",null,[a("h3",{class:"modal-title"},"导入表数据"),a("p",{class:"modal-subtitle"},"从 JSON 文件导入表数据")])],-1)])]),default:n(()=>[a("div",sa,[o(l(Ve),{"default-value":"file",type:"line"},{default:n(()=>[o(l(_e),{name:"file",tab:"文件上传"},{default:n(()=>[o(l(Je),{"file-list":[],accept:".json",max:1,onChange:T},{default:n(()=>[o(l(qe),null,{default:n(()=>[...e[16]||(e[16]=[a("div",{class:"upload-area"},[a("svg",{class:"upload-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4m17-7l-5-5m0 0L7 8m9-5v12",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),a("p",{class:"upload-text"},"点击或拖拽 JSON 文件到此处"),a("p",{class:"upload-hint"},"支持导入表数据")],-1)])]),_:1})]),_:1})]),_:1}),o(l(_e),{name:"text",tab:"直接编辑/粘贴"},{default:n(()=>[a("div",la,[o(l(q),{value:B.value,"onUpdate:value":e[2]||(e[2]=s=>B.value=s),type:"textarea",placeholder:"请粘贴或输入 JSON 数据(数组格式)...",rows:15,class:"json-textarea"},null,8,["value"]),a("div",na,[o(l($),{onClick:d,type:"primary",disabled:!B.value.trim()},{default:n(()=>[...e[17]||(e[17]=[h(" 导入 ",-1)])]),_:1},8,["disabled"]),o(l($),{onClick:e[3]||(e[3]=s=>B.value="")},{default:n(()=>[...e[18]||(e[18]=[h(" 清空 ",-1)])]),_:1})])])]),_:1})]),_:1})])]),_:1},8,["show"]),o(l(ce),{show:x.value,"onUpdate:show":e[5]||(e[5]=s=>x.value=s),"mask-closable":!1,"close-on-esc":!1,"auto-focus":!1,preset:"dialog",closable:!1,"show-icon":!1,style:{width:"400px"}},{default:n(()=>[a("div",oa,[o(l(Fe),{size:"large"},{description:n(()=>[a("div",ra,K(L.value),1)]),_:1})])]),_:1},8,["show"])]))}}),ua=Me(ia,[["__scopeId","data-v-da42254c"]]),da={class:"tables-page"},ca={class:"tables-toolbar"},va={class:"toolbar-left"},pa={class:"table-select-with-icon"},fa={class:"toolbar-right"},ma={class:"toolbar-switch"},ga={class:"explore-config-panel"},wa={class:"explore-config-list"},ha={key:0,class:"empty-tables-hint"},ba={class:"explore-config-item-info"},ka={class:"table-name"},ya={key:0,class:"table-description"},xa={key:0,class:"tables-table-container"},Ca={key:1,class:"no-table-selected"},$a={class:"columns-section"},Sa={class:"columns-header"},Da={class:"columns-list"},Ma={class:"column-index"},_a={key:0,class:"empty-columns"},za={class:"form-actions"},Ta={class:"modal-header"},Ua={class:"modal-subtitle"},Na={class:"column-descriptions-section"},ja={class:"column-description-label"},Ia={class:"column-name-label"},Ba={key:0,class:"empty-columns-hint"},Aa={class:"form-actions"},Va=$e({__name:"Tables",setup(ne){const _=Se(),f=Re(),p=m([]),A=m(null),c=m(null),E=m(!1),z=m(!1),O=m(!1),R=m(!1),U=m(!1),G=m(!1),H=m(!1),B=m(null),x=m(""),L=m({}),V=m(!0),P=m({}),ve=[{label:"字符串",value:"string"},{label:"数字",value:"number"},{label:"布尔值",value:"boolean"},{label:"日期",value:"date"},{label:"JSON",value:"json"}],J=m({name:"",description:"",columns:[]}),C={name:{required:!0,message:"表名不能为空",trigger:"blur"}},u=le(()=>p.value.map(g=>({label:g.name,value:g.id,description:g.description})));function b(g){if(g){const r=p.value.find(T=>T.id===g);r&&pe(r)}else A.value=null,c.value=null}const Q=le({get:()=>E.value,set:g=>{E.value=g}});Te(async()=>{await Z(),await oe()});async function oe(){try{if(await f.fetchConfig(),f.currentConfig){const g=f.currentConfig;V.value=g.enableExploreTable!==!1}}catch(g){console.error("加载配置失败:",g)}}async function ae(g){H.value=!0;try{await f.updateConfig({enableExploreTable:g}),_.success(g?"已允许 AI 探索数据表":"已禁止 AI 探索数据表")}catch(r){_.error("更新配置失败: "+(r.message||"未知错误")),V.value=!g}finally{H.value=!1}}function se(g){return g.allowExplore!==!1}async function ie(g,r){var T,d;P.value[g]=!0;try{const t=p.value.find(s=>s.id===g);if(!t){_.error("表不存在");return}(await X.put(`/tables/definitions/${g}`,{allowExplore:r})).data.success&&(t.allowExplore=r,_.success(r?`已允许 AI 探索表「${t.name}」`:`已禁止 AI 探索表「${t.name}」`),c.value&&c.value.id===g&&(c.value.allowExplore=r))}catch(t){_.error("更新失败: "+(((d=(T=t.response)==null?void 0:T.data)==null?void 0:d.error)||t.message))}finally{P.value[g]=!1}}async function Z(){var g,r;try{const T=await X.get("/tables/definitions");T.data.success&&(p.value=T.data.data,p.value.length>0&&!A.value&&pe(p.value[0]))}catch(T){_.error("加载表列表失败: "+(((r=(g=T.response)==null?void 0:g.data)==null?void 0:r.error)||T.message))}}function pe(g){A.value=g.id,c.value=g}function ue(){J.value.columns.push({name:"",type:"string",nullable:!0,description:""})}function we(g){J.value.columns.splice(g,1)}async function he(){B.value&&await B.value.validate(async g=>{var r,T;if(!g){if(J.value.columns.length===0){_.warning("至少需要定义一个列");return}U.value=!0;try{const d=await X.post("/tables/definitions",J.value);d.data.success&&(_.success("表创建成功"),E.value=!1,J.value={name:"",description:"",columns:[]},await Z(),pe(d.data.data))}catch(d){_.error("保存失败: "+(((T=(r=d.response)==null?void 0:r.data)==null?void 0:T.error)||d.message))}finally{U.value=!1}}})}async function re(){var g,r;if(c.value){R.value=!0;try{(await X.delete(`/tables/definitions/${c.value.id}`)).data.success&&(_.success("表删除成功"),A.value=null,c.value=null,O.value=!1,await Z())}catch(T){_.error("删除失败: "+(((r=(g=T.response)==null?void 0:g.data)==null?void 0:r.error)||T.message))}finally{R.value=!1}}}function be(){}De(z,g=>{g&&c.value&&(x.value=c.value.description||"",L.value={},c.value.columns&&c.value.columns.forEach(r=>{L.value[r.name]=r.description||""}))});function de(g){switch(g){case"string":return"info";case"number":return"success";case"boolean":return"warning";case"date":return"default";case"json":return"error";default:return"default"}}async function ke(){var g,r;if(!c.value||!A.value){_.error("请先选择一个表");return}G.value=!0;try{const T=c.value.columns.map(t=>({...t,description:L.value[t.name]||void 0})),d=await X.put(`/tables/definitions/${A.value}`,{description:x.value||null,columns:T});d.data.success&&(_.success("表声明和字段声明更新成功"),z.value=!1,c.value&&(c.value.description=d.data.data.description,c.value.columns=d.data.data.columns),await Z())}catch(T){_.error("更新失败: "+(((r=(g=T.response)==null?void 0:g.data)==null?void 0:r.error)||T.message))}finally{G.value=!1}}return(g,r)=>{var d,t;const T=Ke("n-tag");return w(),y("div",da,[a("div",ca,[a("div",va,[a("div",pa,[o(l(Ue),{value:A.value,"onUpdate:value":[r[0]||(r[0]=e=>A.value=e),b],options:u.value,placeholder:"选择表...",size:"large",clearable:"",filterable:"",class:"table-select"},{empty:n(()=>[o(l(ge),{description:"暂无表",size:"small"})]),_:1},8,["value","options"]),(d=c.value)!=null&&d.description?(w(),xe(l(Ee),{key:0,trigger:"hover",placement:"top"},{trigger:n(()=>[...r[14]||(r[14]=[a("div",{class:"table-info-icon"},[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)])]),default:n(()=>[h(" "+K(c.value.description),1)]),_:1})):te("",!0)])]),a("div",fa,[a("div",ma,[o(l(Be),{value:V.value,"onUpdate:value":[r[1]||(r[1]=e=>V.value=e),ae],size:"medium",loading:H.value},{checked:n(()=>[...r[15]||(r[15]=[h("允许 AI 探索数据表",-1)])]),unchecked:n(()=>[...r[16]||(r[16]=[h("禁止 AI 探索数据表",-1)])]),_:1},8,["value","loading"]),o(l(We),{trigger:"hover",placement:"bottom-end",style:{width:"400px",maxHeight:"500px"}},{trigger:n(()=>[...r[17]||(r[17]=[a("div",{class:"explore-config-icon",title:"配置表探索权限"},[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94L14.4 2.81c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z",fill:"currentColor"})])],-1)])]),default:n(()=>[a("div",ga,[r[18]||(r[18]=a("div",{class:"explore-config-header"},[a("h4",null,"配置表探索权限"),a("p",{class:"explore-config-hint"},"控制哪些表允许被 AI 探索(默认为允许)")],-1)),a("div",wa,[p.value.length===0?(w(),y("div",ha,[o(l(ge),{description:"暂无表",size:"small"})])):te("",!0),(w(!0),y(fe,null,me(p.value,e=>(w(),y("div",{key:e.id,class:"explore-config-item"},[a("div",ba,[a("span",ka,K(e.name),1),e.description?(w(),y("span",ya,K(e.description),1)):te("",!0)]),o(l(Be),{value:se(e),"onUpdate:value":s=>ie(e.id,s),size:"small",loading:P.value[e.id]},null,8,["value","onUpdate:value","loading"])]))),128))])])]),_:1})]),c.value?(w(),xe(l($),{key:0,size:"large",ghost:"",onClick:r[2]||(r[2]=e=>z.value=!0),class:"edit-table-btn"},{icon:n(()=>[...r[19]||(r[19]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[r[20]||(r[20]=h(" 编辑表声明 ",-1))]),_:1})):te("",!0),c.value?(w(),xe(l($),{key:1,type:"error",size:"large",ghost:"",onClick:r[3]||(r[3]=e=>O.value=!0),class:"delete-table-btn"},{icon:n(()=>[...r[21]||(r[21]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[r[22]||(r[22]=h(" 删除表 ",-1))]),_:1})):te("",!0),o(l($),{type:"primary",size:"large",onClick:r[4]||(r[4]=e=>E.value=!0),class:"create-table-btn"},{icon:n(()=>[...r[23]||(r[23]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[r[24]||(r[24]=h(" 创建新表 ",-1))]),_:1})])]),c.value?(w(),y("div",xa,[o(ua,{"table-definition":c.value,"table-id":A.value,onSaved:be},null,8,["table-definition","table-id"])])):(w(),y("div",Ca,[o(l(ge),{description:"请选择一个表进行编辑"})])),o(l(ce),{show:O.value,"onUpdate:show":r[5]||(r[5]=e=>O.value=e),preset:"dialog",type:"warning",title:"确认删除",content:`确定要删除表「${(t=c.value)==null?void 0:t.name}」吗?此操作将同时删除表中的所有数据,且不可恢复。`,"positive-text":"确认删除","negative-text":"取消","positive-button-props":{type:"error"},loading:R.value,onPositiveClick:re,onNegativeClick:r[6]||(r[6]=e=>O.value=!1)},null,8,["show","content","loading"]),o(l(ce),{show:Q.value,"onUpdate:show":r[10]||(r[10]=e=>Q.value=e),preset:"card",bordered:!1,class:"table-definition-modal",style:{width:"90vw",maxWidth:"800px"}},{header:n(()=>[...r[25]||(r[25]=[a("div",{class:"modal-header"},[a("div",{class:"modal-icon"},[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M3 3h18v18H3V3zm2 2v14h14V5H5zm2 2h10v2H7V7zm0 4h10v2H7v-2zm0 4h7v2H7v-2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])]),a("div",null,[a("h3",{class:"modal-title"}," 创建新表 "),a("p",{class:"modal-subtitle"}," 定义表的结构和列类型(创建后不可修改) ")])],-1)])]),default:n(()=>[o(l(Ce),{ref_key:"tableFormRef",ref:B,model:J.value,rules:C,class:"table-form"},{default:n(()=>[o(l(W),{path:"name",label:"表名"},{default:n(()=>[o(l(q),{value:J.value.name,"onUpdate:value":r[7]||(r[7]=e=>J.value.name=e),placeholder:"例如: users, products",size:"large"},null,8,["value"])]),_:1}),o(l(W),{path:"description",label:"描述"},{default:n(()=>[o(l(q),{value:J.value.description,"onUpdate:value":r[8]||(r[8]=e=>J.value.description=e),placeholder:"表的用途说明",size:"large",type:"textarea",rows:2},null,8,["value"])]),_:1}),o(l(W),{label:"列定义"},{default:n(()=>[a("div",$a,[a("div",Sa,[r[28]||(r[28]=a("span",null,null,-1)),o(l($),{dashed:"",onClick:ue,size:"medium"},{icon:n(()=>[...r[26]||(r[26]=[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:n(()=>[r[27]||(r[27]=h(" 添加列 ",-1))]),_:1})]),a("div",Da,[(w(!0),y(fe,null,me(J.value.columns,(e,s)=>(w(),y("div",{key:s,class:"column-row"},[a("span",Ma,"#"+K(s+1),1),o(l(W),{path:`columns[${s}].name`,"show-label":!1,rule:{required:!0,message:"必填",trigger:"blur"},class:"column-field-name"},{default:n(()=>[o(l(q),{value:e.name,"onUpdate:value":i=>e.name=i,placeholder:"列名"},null,8,["value","onUpdate:value"])]),_:2},1032,["path"]),o(l(W),{path:`columns[${s}].type`,"show-label":!1,rule:{required:!0,message:"必填",trigger:"change"},class:"column-field-type"},{default:n(()=>[o(l(Ue),{value:e.type,"onUpdate:value":i=>e.type=i,options:ve},null,8,["value","onUpdate:value"])]),_:2},1032,["path"]),o(l(ze),{checked:!e.nullable,"onUpdate:checked":i=>e.nullable=!i,class:"column-field-nullable"},{default:n(()=>[...r[29]||(r[29]=[h("必要",-1)])]),_:1},8,["checked","onUpdate:checked"]),o(l(W),{path:`columns[${s}].description`,"show-label":!1,class:"column-field-description"},{default:n(()=>[o(l(q),{value:e.description,"onUpdate:value":i=>e.description=i,placeholder:"列说明(可选)"},null,8,["value","onUpdate:value"])]),_:2},1032,["path"]),o(l($),{type:"error",text:"",size:"small",onClick:i=>we(s),class:"column-delete-btn"},{default:n(()=>[...r[30]||(r[30]=[h(" 删除 ",-1)])]),_:1},8,["onClick"])]))),128)),J.value.columns.length===0?(w(),y("div",_a,[o(l(ge),{description:"暂无列,点击上方添加列按钮添加",size:"small"})])):te("",!0)])])]),_:1}),a("div",za,[o(l($),{size:"large",onClick:r[9]||(r[9]=e=>Q.value=!1)},{default:n(()=>[...r[31]||(r[31]=[h(" 取消 ",-1)])]),_:1}),o(l($),{type:"primary",size:"large",loading:U.value,onClick:he},{default:n(()=>[...r[32]||(r[32]=[h(" 保存 ",-1)])]),_:1},8,["loading"])])]),_:1},8,["model"])]),_:1},8,["show"]),o(l(ce),{show:z.value,"onUpdate:show":r[13]||(r[13]=e=>z.value=e),preset:"card",bordered:!1,class:"edit-table-description-modal",style:{width:"90vw",maxWidth:"600px"}},{header:n(()=>{var e;return[a("div",Ta,[r[34]||(r[34]=a("div",{class:"modal-icon"},[a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),a("div",null,[r[33]||(r[33]=a("h3",{class:"modal-title"}," 编辑表声明 ",-1)),a("p",Ua," 编辑表「"+K((e=c.value)==null?void 0:e.name)+"」的描述信息 ",1)])])]}),default:n(()=>[o(l(Ce),{ref:"editTableFormRef",class:"edit-table-form"},{default:n(()=>[o(l(W),{label:"表声明"},{default:n(()=>[o(l(q),{value:x.value,"onUpdate:value":r[11]||(r[11]=e=>x.value=e),placeholder:"表的用途说明",size:"large",type:"textarea",rows:4},null,8,["value"])]),_:1}),o(l(W),{label:"字段声明"},{default:n(()=>{var e,s;return[a("div",Na,[(w(!0),y(fe,null,me(((e=c.value)==null?void 0:e.columns)||[],i=>(w(),y("div",{key:i.name,class:"column-description-row"},[a("div",ja,[a("span",Ia,K(i.name),1),o(T,{size:"tiny",type:de(i.type),style:{"margin-left":"8px"}},{default:n(()=>[h(K(i.type),1)]),_:2},1032,["type"])]),o(l(q),{value:L.value[i.name],"onUpdate:value":j=>L.value[i.name]=j,placeholder:`${i.name} 字段的说明(可选)`,size:"medium",clearable:""},null,8,["value","onUpdate:value","placeholder"])]))),128)),!((s=c.value)!=null&&s.columns)||c.value.columns.length===0?(w(),y("div",Ba,[o(l(ge),{description:"当前表没有字段",size:"small"})])):te("",!0)])]}),_:1}),a("div",Aa,[o(l($),{size:"large",onClick:r[12]||(r[12]=e=>z.value=!1)},{default:n(()=>[...r[35]||(r[35]=[h(" 取消 ",-1)])]),_:1}),o(l($),{type:"primary",size:"large",loading:G.value,onClick:ke},{default:n(()=>[...r[36]||(r[36]=[h(" 保存 ",-1)])]),_:1},8,["loading"])])]),_:1},512)]),_:1},8,["show"])])}}}),Ea=Me(Va,[["__scopeId","data-v-c01436bb"]]),Ra={class:"dashboard-container"},Ha={style:{position:"absolute",width:"0",height:"0"}},Oa={key:0,class:"loading-state"},La={key:1,class:"dashboard-content"},Pa=$e({__name:"Dashboard",setup(ne){const _=Se(),f=Re(),p=Ye(),A=Ge(),c=Xe(),E=m(A.query.section||"components"),z=le(()=>f.currentConfig),O=le(()=>f.loading),R=le(()=>{var V;return((V=p.user)==null?void 0:V.role)==="admin"}),U=["variables","tables"],G={components:lt,tools:st,variables:dt,init:at,tables:Ea,prompts:Ft},H=le(()=>G[E.value]);async function B(){try{await f.fetchConfig()}catch(V){_.error(V.message)}}async function x(V){if(z.value)try{await f.updateConfig(V),_.success("更新成功")}catch(P){_.error(P.message)}}function L(V){return R.value&&U.includes(V)?(_.warning("超级管理员不允许访问此功能"),c.replace({name:"UserDashboard",query:{section:"components"}}),E.value="components",!0):!1}return De(()=>A.query.section,V=>{if(!V)return;const P=V;L(P)||(E.value=P)},{immediate:!0}),Te(()=>{const V=A.query.section;L(V),B()}),(V,P)=>(w(),y("div",Ra,[(w(),y("svg",Ha,[...P[0]||(P[0]=[a("defs",null,[a("linearGradient",{id:"loading-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%"},[a("stop",{offset:"0%","stop-color":"#6366f1"}),a("stop",{offset:"50%","stop-color":"#8b5cf6"}),a("stop",{offset:"100%","stop-color":"#ec4899"})])],-1)])])),O.value&&!z.value?(w(),y("div",Oa,[...P[1]||(P[1]=[a("div",{class:"loading-spinner"},[a("svg",{class:"spinner",viewBox:"0 0 50 50"},[a("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"4"})])],-1),a("p",{class:"loading-text"},"加载配置中...",-1)])])):z.value?(w(),y("div",La,[(w(),xe(Qe(H.value),{config:z.value,onUpdate:x},null,40,["config"]))])):te("",!0)]))}}),Wa=Me(Pa,[["__scopeId","data-v-5f9aa991"]]);export{Wa as default};
@@ -1,4 +1,4 @@
1
- import{a1 as co,r as N,J as de,d as xt,I as Ut,U as po,A as Ce,c as R,o as _,u as Jt,p as Pe,m as ue,f as g,b as o,w as u,g as p,B as q,a2 as go,e as Xt,D as bt,h as E,F as ht,s as yt,y as _e,t as X,Q as st,Z as mo,a3 as vo,K as eo,L as rt,a4 as It,a5 as fo,a6 as Bt,a7 as Rt,N as to,j as ce,k as we,O as oo,a8 as Ot,M as Ve,x as Ee,E as no,a9 as Me,S as ho,aa as yo,l as vt,ab as wo,Y as bo,R as Le,C as At,ac as _t,n as ve,G as Vt,_ as Lt,ad as ko,H as xo}from"./index-Ku_MdnLs.js";import{_ as Ft}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Or=co("config",()=>{const t=N(null),l=N(!1);async function s(){var P,M;l.value=!0;try{const L=await de.get("/configs/me");return t.value=L.data.data,t.value}catch(L){throw new Error(((M=(P=L.response)==null?void 0:P.data)==null?void 0:M.error)||"Failed to fetch config")}finally{l.value=!1}}async function i(P){var M,L;l.value=!0;try{const V=await de.get(`/configs/user/${P}`);return t.value=V.data.data,t.value}catch(V){throw new Error(((L=(M=V.response)==null?void 0:M.data)==null?void 0:L.error)||"Failed to fetch user config")}finally{l.value=!1}}async function d(P){var M,L;l.value=!0;try{const V=await de.put("/configs/me",P);return t.value=V.data.data,t.value}catch(V){throw new Error(((L=(M=V.response)==null?void 0:M.data)==null?void 0:L.error)||"Failed to update config")}finally{l.value=!1}}async function w(P,M){var L,V;l.value=!0;try{const B=await de.put(`/configs/user/${P}`,M);return t.value=B.data.data,t.value}catch(B){throw new Error(((V=(L=B.response)==null?void 0:L.data)==null?void 0:V.error)||"Failed to update user config")}finally{l.value=!1}}function j(P){const M={...P,variables:P.variables.map(L=>({...L,value:L.isSecret?`{{${L.name}}}`:L.value}))};return JSON.stringify(M,null,2)}function T(P){try{const M=JSON.parse(P);if(!M.name||!Array.isArray(M.components)||!Array.isArray(M.customTools))throw new Error("Invalid config format");return M}catch(M){throw new Error(`Failed to parse config: ${M.message}`)}}return{currentConfig:t,loading:l,fetchConfig:s,fetchUserConfig:i,updateConfig:d,updateUserConfig:w,exportConfig:j,importConfig:T}});function ot(){if(typeof globalThis<"u"&&"crypto"in globalThis){const t=globalThis.crypto;if(t&&typeof t.randomUUID=="function")return t.randomUUID()}return`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}function qt(t){return t==null?!1:typeof t=="boolean"?t:typeof t=="string"?t.trim()!=="":typeof t=="number"?t!==0:Array.isArray(t)?t.length>0:typeof t=="object"?Object.keys(t).length>0:!!t}function Co(t,l){let s=t;const i=/\{\{#if\s+(\w+)\}\}([\s\S]*?)(?:\{\{else\}\}([\s\S]*?))?\{\{\/if\}\}/g;s=s.replace(i,(w,j,T,P)=>{const M=l[j];return qt(M)?T||"":P||""});const d=/\{\{#ifnot\s+(\w+)\}\}([\s\S]*?)(?:\{\{else\}\}([\s\S]*?))?\{\{\/ifnot\}\}/g;return s=s.replace(d,(w,j,T,P)=>{const M=l[j];return qt(M)?P||"":T||""}),s}function To(t,l){return t.replace(/\{\{(\w+)\}\}/g,(s,i)=>{const d=l[i];return d!=null?String(d):s})}function Ar(t,l){let s=Co(t,l);return s=To(s,l),s}function Ht(t,l){(l==null||l>t.length)&&(l=t.length);for(var s=0,i=Array(l);s<l;s++)i[s]=t[s];return i}function So(t){if(Array.isArray(t))return t}function $o(t,l,s){return(l=Do(l))in t?Object.defineProperty(t,l,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[l]=s,t}function Po(t,l){var s=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(s!=null){var i,d,w,j,T=[],P=!0,M=!1;try{if(w=(s=s.call(t)).next,l!==0)for(;!(P=(i=w.call(s)).done)&&(T.push(i.value),T.length!==l);P=!0);}catch(L){M=!0,d=L}finally{try{if(!P&&s.return!=null&&(j=s.return(),Object(j)!==j))return}finally{if(M)throw d}}return T}}function jo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{a1 as co,r as N,J as de,d as xt,I as Ut,U as po,A as Ce,c as R,o as _,u as Jt,p as Pe,m as ue,f as g,b as o,w as u,g as p,B as q,a2 as go,e as Xt,D as bt,h as E,F as ht,s as yt,y as _e,t as X,Q as st,Z as mo,a3 as vo,K as eo,L as rt,a4 as It,a5 as fo,a6 as Bt,a7 as Rt,N as to,j as ce,k as we,O as oo,a8 as Ot,M as Ve,x as Ee,E as no,a9 as Me,S as ho,aa as yo,l as vt,ab as wo,Y as bo,R as Le,C as At,ac as _t,n as ve,G as Vt,_ as Lt,ad as ko,H as xo}from"./index-DAOSS2K-.js";import{_ as Ft}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Or=co("config",()=>{const t=N(null),l=N(!1);async function s(){var P,M;l.value=!0;try{const L=await de.get("/configs/me");return t.value=L.data.data,t.value}catch(L){throw new Error(((M=(P=L.response)==null?void 0:P.data)==null?void 0:M.error)||"Failed to fetch config")}finally{l.value=!1}}async function i(P){var M,L;l.value=!0;try{const V=await de.get(`/configs/user/${P}`);return t.value=V.data.data,t.value}catch(V){throw new Error(((L=(M=V.response)==null?void 0:M.data)==null?void 0:L.error)||"Failed to fetch user config")}finally{l.value=!1}}async function d(P){var M,L;l.value=!0;try{const V=await de.put("/configs/me",P);return t.value=V.data.data,t.value}catch(V){throw new Error(((L=(M=V.response)==null?void 0:M.data)==null?void 0:L.error)||"Failed to update config")}finally{l.value=!1}}async function w(P,M){var L,V;l.value=!0;try{const B=await de.put(`/configs/user/${P}`,M);return t.value=B.data.data,t.value}catch(B){throw new Error(((V=(L=B.response)==null?void 0:L.data)==null?void 0:V.error)||"Failed to update user config")}finally{l.value=!1}}function j(P){const M={...P,variables:P.variables.map(L=>({...L,value:L.isSecret?`{{${L.name}}}`:L.value}))};return JSON.stringify(M,null,2)}function T(P){try{const M=JSON.parse(P);if(!M.name||!Array.isArray(M.components)||!Array.isArray(M.customTools))throw new Error("Invalid config format");return M}catch(M){throw new Error(`Failed to parse config: ${M.message}`)}}return{currentConfig:t,loading:l,fetchConfig:s,fetchUserConfig:i,updateConfig:d,updateUserConfig:w,exportConfig:j,importConfig:T}});function ot(){if(typeof globalThis<"u"&&"crypto"in globalThis){const t=globalThis.crypto;if(t&&typeof t.randomUUID=="function")return t.randomUUID()}return`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}function qt(t){return t==null?!1:typeof t=="boolean"?t:typeof t=="string"?t.trim()!=="":typeof t=="number"?t!==0:Array.isArray(t)?t.length>0:typeof t=="object"?Object.keys(t).length>0:!!t}function Co(t,l){let s=t;const i=/\{\{#if\s+(\w+)\}\}([\s\S]*?)(?:\{\{else\}\}([\s\S]*?))?\{\{\/if\}\}/g;s=s.replace(i,(w,j,T,P)=>{const M=l[j];return qt(M)?T||"":P||""});const d=/\{\{#ifnot\s+(\w+)\}\}([\s\S]*?)(?:\{\{else\}\}([\s\S]*?))?\{\{\/ifnot\}\}/g;return s=s.replace(d,(w,j,T,P)=>{const M=l[j];return qt(M)?P||"":T||""}),s}function To(t,l){return t.replace(/\{\{(\w+)\}\}/g,(s,i)=>{const d=l[i];return d!=null?String(d):s})}function Ar(t,l){let s=Co(t,l);return s=To(s,l),s}function Ht(t,l){(l==null||l>t.length)&&(l=t.length);for(var s=0,i=Array(l);s<l;s++)i[s]=t[s];return i}function So(t){if(Array.isArray(t))return t}function $o(t,l,s){return(l=Do(l))in t?Object.defineProperty(t,l,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[l]=s,t}function Po(t,l){var s=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(s!=null){var i,d,w,j,T=[],P=!0,M=!1;try{if(w=(s=s.call(t)).next,l!==0)for(;!(P=(i=w.call(s)).done)&&(T.push(i.value),T.length!==l);P=!0);}catch(L){M=!0,d=L}finally{try{if(!P&&s.return!=null&&(j=s.return(),Object(j)!==j))return}finally{if(M)throw d}}return T}}function jo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kt(t,l){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);l&&(i=i.filter(function(d){return Object.getOwnPropertyDescriptor(t,d).enumerable})),s.push.apply(s,i)}return s}function Gt(t){for(var l=1;l<arguments.length;l++){var s=arguments[l]!=null?arguments[l]:{};l%2?Kt(Object(s),!0).forEach(function(i){$o(t,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Kt(Object(s)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(s,i))})}return t}function No(t,l){if(t==null)return{};var s,i,d=Oo(t,l);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(t);for(i=0;i<w.length;i++)s=w[i],l.indexOf(s)===-1&&{}.propertyIsEnumerable.call(t,s)&&(d[s]=t[s])}return d}function Oo(t,l){if(t==null)return{};var s={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(l.indexOf(i)!==-1)continue;s[i]=t[i]}return s}function Ao(t,l){return So(t)||Po(t,l)||zo(t,l)||jo()}function Mo(t,l){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var i=s.call(t,l);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(t)}function Do(t){var l=Mo(t,"string");return typeof l=="symbol"?l:l+""}function zo(t,l){if(t){if(typeof t=="string")return Ht(t,l);var s={}.toString.call(t).slice(8,-1);return s==="Object"&&t.constructor&&(s=t.constructor.name),s==="Map"||s==="Set"?Array.from(t):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?Ht(t,l):void 0}}function _o(t,l,s){return l in t?Object.defineProperty(t,l,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[l]=s,t}function Wt(t,l){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);l&&(i=i.filter(function(d){return Object.getOwnPropertyDescriptor(t,d).enumerable})),s.push.apply(s,i)}return s}function Zt(t){for(var l=1;l<arguments.length;l++){var s=arguments[l]!=null?arguments[l]:{};l%2?Wt(Object(s),!0).forEach(function(i){_o(t,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Wt(Object(s)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(s,i))})}return t}function Eo(){for(var t=arguments.length,l=new Array(t),s=0;s<t;s++)l[s]=arguments[s];return function(i){return l.reduceRight(function(d,w){return w(d)},i)}}function nt(t){return function l(){for(var s=this,i=arguments.length,d=new Array(i),w=0;w<i;w++)d[w]=arguments[w];return d.length>=t.length?t.apply(this,d):function(){for(var j=arguments.length,T=new Array(j),P=0;P<j;P++)T[P]=arguments[P];return l.apply(s,[].concat(d,T))}}}function kt(t){return{}.toString.call(t).includes("Object")}function Uo(t){return!Object.keys(t).length}function lt(t){return typeof t=="function"}function Jo(t,l){return Object.prototype.hasOwnProperty.call(t,l)}function Fo(t,l){return kt(l)||Je("changeType"),Object.keys(l).some(function(s){return!Jo(t,s)})&&Je("changeField"),l}function Io(t){lt(t)||Je("selectorType")}function Bo(t){lt(t)||kt(t)||Je("handlerType"),kt(t)&&Object.values(t).some(function(l){return!lt(l)})&&Je("handlersType")}function Ro(t){t||Je("initialIsRequired"),kt(t)||Je("initialType"),Uo(t)&&Je("initialContent")}function Vo(t,l){throw new Error(t[l]||t.default)}var Lo={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Je=nt(Vo)(Lo),ft={changes:Fo,selector:Io,handler:Bo,initial:Ro};function qo(t){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ft.initial(t),ft.handler(l);var s={current:t},i=nt(Go)(s,l),d=nt(Ko)(s),w=nt(ft.changes)(t),j=nt(Ho)(s);function T(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(L){return L};return ft.selector(M),M(s.current)}function P(M){Eo(i,d,w,j)(M)}return[T,P]}function Ho(t,l){return lt(l)?l(t.current):l}function Ko(t,l){return t.current=Zt(Zt({},t.current),l),l}function Go(t,l,s){return lt(l)?l(t.current):Object.keys(s).forEach(function(i){var d;return(d=l[i])===null||d===void 0?void 0:d.call(l,t.current[i])}),s}var Wo={create:qo},Zo={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Yo(t){return function l(){for(var s=this,i=arguments.length,d=new Array(i),w=0;w<i;w++)d[w]=arguments[w];return d.length>=t.length?t.apply(this,d):function(){for(var j=arguments.length,T=new Array(j),P=0;P<j;P++)T[P]=arguments[P];return l.apply(s,[].concat(d,T))}}}function Qo(t){return{}.toString.call(t).includes("Object")}function Xo(t){return t||Yt("configIsRequired"),Qo(t)||Yt("configType"),t.urls?(en(),{paths:{vs:t.urls.monacoBase}}):t}function en(){console.warn(so.deprecation)}function tn(t,l){throw new Error(t[l]||t.default)}var so={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
3
  You are using deprecated way of configuration.
4
4
 
@@ -573,7 +573,7 @@ export default async function(args: ToolArgs, context: Context) {
573
573
  ## 约束
574
574
 
575
575
  - 只能使用 args 和 context 参数中的 API`;await navigator.clipboard.writeText(e),d.success("提示词已复制到剪贴板!")}catch(v){console.error("Failed to copy prompt:",v),d.error("复制失败,请手动复制")}}function et(){T.value=null,L.value="schema",V.value=!1,ee.value=!1,K.value="{}",U.value=null,I.value=!1;const v=D(null);S.value={name:"",description:"",serverScript:v||We,parameters:[]},W.value=""}return Ut(()=>{te(),Oe()}),Ce(()=>s.config.components,()=>{te()},{deep:!0}),Ce(()=>L.value,v=>{v==="implementation"&&Le(()=>{Ae.value++})}),Ce(()=>S.value.parameters,()=>{Le(()=>{Ae.value++})},{deep:!0,immediate:!1}),Ce(()=>[S.value.name,S.value.description],()=>{Le(()=>{Ae.value++})},{immediate:!1}),Ce(()=>ee.value,v=>{var a;if(v){const f=((a=T.value)==null?void 0:a.id)||null,Z=xe(f);Z?K.value=Z:K.value=ut()}}),Ce(()=>s.config.customTools,()=>{te()},{deep:!0}),Ce(()=>w.value,v=>{if(v){if(!T.value){const a=D(null);a&&(S.value.serverScript=a)}}else et()}),(v,a)=>(_(),R("div",As,[o("div",Ms,[g(p(q),{type:"primary",size:"large",class:"add-tool-btn",onClick:a[0]||(a[0]=f=>w.value=!0)},{icon:u(()=>[...a[13]||(a[13]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:u(()=>[a[14]||(a[14]=E(" 添加工具 ",-1))]),_:1}),g(p(we),{value:M.value,"onUpdate:value":a[1]||(a[1]=f=>M.value=f),placeholder:"搜索工具名称或描述...",size:"large",clearable:"",class:"search-input"},{prefix:u(()=>[...a[15]||(a[15]=[o("svg",{class:"search-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),o("div",Ds,[g(p(At),{columns:r,data:H.value,pagination:qe,"row-props":Te,class:"modern-table"},null,8,["data"])]),g(p(bt),{show:w.value,"onUpdate:show":a[9]||(a[9]=f=>w.value=f),preset:"card",bordered:!1,class:"tool-edit-modal",style:{width:"90vw",maxWidth:"1400px",height:"90vh",maxHeight:"90vh"}},{header:u(()=>[o("div",zs,[a[16]||(a[16]=o("div",{class:"modal-icon"},[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),o("div",null,[o("h3",_s,X(T.value?"编辑自定义工具":"创建自定义工具"),1),o("p",Es,X(T.value?"修改工具的 Schema 和实现代码":"定义工具的 Schema 并编写实现逻辑"),1)])])]),footer:u(()=>[o("div",er,[g(p(q),{size:"large",onClick:a[8]||(a[8]=f=>w.value=!1)},{default:u(()=>[...a[36]||(a[36]=[E("取消",-1)])]),_:1}),g(p(q),{type:"primary",size:"large",loading:j.value,onClick:St},{default:u(()=>[E(X(T.value?"保存修改":"创建工具"),1)]),_:1},8,["loading"])])]),default:u(()=>[o("div",Us,[g(p(to),{ref_key:"formRef",ref:P,model:S.value,rules:Ie,class:"tool-form"},{default:u(()=>[g(p(eo),{value:L.value,"onUpdate:value":a[7]||(a[7]=f=>L.value=f),type:"line",animated:"",size:"large",class:"tool-config-tabs"},{default:u(()=>[g(p(rt),{name:"schema",tab:"Schema 声明"},{default:u(()=>[o("div",Js,[g(p(Ve),{type:"info",bordered:!1,class:"schema-tip"},{icon:u(()=>[...a[17]||(a[17]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:u(()=>[a[18]||(a[18]=E(' 在 Schema 声明中定义的参数会自动生成类型定义,在"工具实现"标签页的脚本编辑器中可以使用类型提示 ',-1))]),_:1}),o("div",Fs,[a[21]||(a[21]=o("h4",{class:"section-title"},"基础信息",-1)),o("div",Is,[g(p(ce),{path:"name"},{label:u(()=>[...a[19]||(a[19]=[o("div",{class:"form-label"},[o("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),o("span",null,"工具名称")],-1)])]),default:u(()=>[g(p(we),{value:S.value.name,"onUpdate:value":a[2]||(a[2]=f=>S.value.name=f),placeholder:"例如: my-custom-tool",size:"large"},null,8,["value"])]),_:1}),g(p(ce),{path:"description"},{label:u(()=>[...a[20]||(a[20]=[o("div",{class:"form-label"},[o("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),o("span",null,"工具描述")],-1)])]),default:u(()=>[g(p(we),{value:S.value.description,"onUpdate:value":a[3]||(a[3]=f=>S.value.description=f),placeholder:"简要描述工具的功能",size:"large"},null,8,["value"])]),_:1})])]),o("div",Bs,[o("div",Rs,[a[24]||(a[24]=o("h4",{class:"section-title"},"参数定义",-1)),g(p(q),{dashed:"",onClick:a[4]||(a[4]=f=>S.value.parameters.push(Tt())),size:"medium"},{icon:u(()=>[...a[22]||(a[22]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:u(()=>[a[23]||(a[23]=E(" 添加参数 ",-1))]),_:1})]),o("div",Vs,[(_(!0),R(ht,null,yt(S.value.parameters,(f,Z)=>(_(),R("div",{key:Z,class:"parameter-card"},[o("div",Ls,[o("span",qs,"#"+X(Z+1),1),g(p(q),{type:"error",text:"",size:"small",onClick:re=>S.value.parameters.splice(Z,1)},{icon:u(()=>[...a[25]||(a[25]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:u(()=>[a[26]||(a[26]=E(" 删除 ",-1))]),_:1},8,["onClick"])]),o("div",Hs,[g(p(ce),{label:"必填",class:"required-field"},{default:u(()=>[g(p(no),{checked:f.required,"onUpdate:checked":re=>f.required=re},null,8,["checked","onUpdate:checked"])]),_:2},1024),g(p(ce),{label:"参数名",path:`parameters[${Z}].name`,rule:{required:!0,message:"必填",trigger:"blur"}},{default:u(()=>[g(p(we),{value:f.name,"onUpdate:value":re=>f.name=re,placeholder:"参数名"},null,8,["value","onUpdate:value"])]),_:2},1032,["path"]),g(p(ce),{label:"类型"},{default:u(()=>[g(p(oo),{value:f.type,"onUpdate:value":re=>f.type=re,options:Fe},null,8,["value","onUpdate:value"])]),_:2},1024),g(p(ce),{label:"描述"},{default:u(()=>[g(p(we),{value:f.description,"onUpdate:value":re=>f.description=re,placeholder:"参数描述"},null,8,["value","onUpdate:value"])]),_:2},1024)])]))),128)),S.value.parameters.length===0?(_(),R("div",Ks,[...a[27]||(a[27]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"2"}),o("path",{d:"M12 16v-4m0-4h.01",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})],-1),o("p",null,"暂无参数,点击上方按钮添加参数",-1)])])):ue("",!0)])])])]),_:1}),g(p(rt),{name:"implementation",tab:"工具实现"},{default:u(()=>[o("div",Gs,[o("div",{class:Ee(["editor-container",{fullscreen:V.value}])},[o("div",Ws,[o("div",{class:Ee(["status-dot",{unsaved:x.value,saved:!x.value}]),title:x.value?"未保存":"已保存"},null,10,Zs)]),g(p(q),{type:"default",size:"small",class:"fullscreen-btn",onClick:mt},{icon:u(()=>[V.value?(_(),R("svg",Qs,[...a[29]||(a[29]=[o("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(_(),R("svg",Ys,[...a[28]||(a[28]=[o("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),default:u(()=>[E(" "+X(V.value?"退出全屏":"全屏"),1)]),_:1}),o("div",Xs,[g(at,{modelValue:S.value.serverScript,"onUpdate:modelValue":a[5]||(a[5]=f=>S.value.serverScript=f),language:"typescript",options:{minimap:{enabled:!0},fontSize:14,lineHeight:22,padding:{top:16,bottom:16},scrollBeyondLastLine:!1,automaticLayout:!0},"extra-libs":He.value,onSave:Qe,onChange:$t,style:_t(J.value)},null,8,["modelValue","extra-libs","style"])])],2),o("div",{class:Ee(["editor-actions",{"fullscreen-actions":V.value}])},[g(p(q),{type:"default",size:"small",class:"copy-prompt-btn",onClick:Ge},{icon:u(()=>[...a[30]||(a[30]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M8 5.00069C7.01165 5.00069 6.49359 5.00069 6.09202 5.21967C5.71569 5.42393 5.42413 5.71549 5.21987 6.09182C5 6.49339 5 7.01145 5 7.99979V15.9998C5 16.9881 5 17.5062 5.21987 17.9078C5.42413 18.2841 5.71569 18.5757 6.09202 18.7799C6.49359 18.9998 7.01165 18.9998 8 18.9998H16C16.9883 18.9998 17.5064 18.9998 17.908 18.7799C18.2843 18.5757 18.5759 18.2841 18.7801 17.9078C19 17.5062 19 16.9881 19 15.9998V7.99979C19 7.01145 19 6.49339 18.7801 6.09182C18.5759 5.71549 18.2843 5.42393 17.908 5.21967C17.5064 5.00069 16.9883 5.00069 16 5.00069H8Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),o("path",{d:"M9 3.00069C9 2.4484 9 2.17226 9.08579 1.94418C9.18885 1.67761 9.37764 1.38893 9.58579 1.18378C9.79094 0.975636 10.0796 0.786849 10.3462 0.683785C10.5743 0.598 10.8504 0.598 11.4027 0.598H14.5973C15.1496 0.598 15.4257 0.598 15.6538 0.683785C15.9204 0.786849 16.2091 0.975636 16.4142 1.18378C16.6224 1.38893 16.8111 1.67761 16.9142 1.94418C17 2.17226 17 2.4484 17 3.00069V4.00069C17 4.55297 16.5523 5.00069 16 5.00069H8C7.44772 5.00069 7 4.55297 7 4.00069V3.00069C7 2.4484 7 2.17226 7.08579 1.94418C7.18885 1.67761 7.37764 1.38893 7.58579 1.18378C7.79094 0.975636 8.07963 0.786849 8.34621 0.683785C8.57428 0.598 8.85043 0.598 9.40272 0.598H12.5973C13.1496 0.598 13.4257 0.598 13.6538 0.683785C13.9204 0.786849 14.2091 0.975636 14.4142 1.18378C14.6224 1.38893 14.8111 1.67761 14.9142 1.94418C15 2.17226 15 2.4484 15 3.00069",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:u(()=>[a[31]||(a[31]=E(" 复制提示词到大模型生成 ",-1))]),_:1}),g(p(q),{type:"primary",size:"small",class:"save-btn",disabled:!x.value,onClick:Qe},{icon:u(()=>[...a[32]||(a[32]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M5 13l4 4L19 7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:u(()=>[a[33]||(a[33]=E(" 保存 (Ctrl+S) ",-1))]),_:1},8,["disabled"]),g(p(q),{type:"info",size:"small",class:"test-btn",loading:B.value,onClick:a[6]||(a[6]=f=>ee.value=!0)},{icon:u(()=>[...a[34]||(a[34]=[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("polygon",{points:"5 3 19 12 5 21 5 3",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:u(()=>[a[35]||(a[35]=E(" 测试执行 ",-1))]),_:1},8,["loading"])],2)])]),_:1})]),_:1},8,["value"])]),_:1},8,["model"])])]),_:1},8,["show"]),g(p(bt),{show:ee.value,"onUpdate:show":a[12]||(a[12]=f=>ee.value=f),preset:"card",bordered:!1,class:"test-args-modal",style:_t({width:I.value?"800px":"600px"}),title:"测试执行参数"},{header:u(()=>[...a[37]||(a[37]=[o("div",{class:"modal-header"},[o("div",{class:"modal-icon"},[o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("polygon",{points:"5 3 19 12 5 21 5 3",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])]),o("div",null,[o("h3",{class:"modal-title"},"输入测试参数"),o("p",{class:"modal-subtitle"},'请输入 JSON 格式的参数(例如:{"param1": "value1", "param2": 123})')])],-1)])]),footer:u(()=>[o("div",yr,[g(p(q),{size:"large",onClick:gt},{default:u(()=>[...a[48]||(a[48]=[E("取消",-1)])]),_:1}),g(p(q),{type:"primary",size:"large",loading:B.value,onClick:Pt},{default:u(()=>[...a[49]||(a[49]=[E(" 执行测试 ",-1)])]),_:1},8,["loading"])])]),default:u(()=>[o("div",tr,[S.value.parameters&&S.value.parameters.length>0?(_(),R("div",or,[o("div",nr,[a[38]||(a[38]=o("span",{class:"parameters-title"},"参数定义",-1)),o("span",sr,X(S.value.parameters.length)+" 个参数",1)]),g(p(At),{columns:je,data:S.value.parameters.filter(f=>f.name&&f.name.trim()),pagination:!1,size:"small",bordered:"",class:"test-args-table"},null,8,["data"])])):ue("",!0),o("div",rr,[o("div",ar,[a[41]||(a[41]=o("span",{class:"test-args-input-title"},"测试参数 (JSON)",-1)),g(p(q),{size:"small",type:"default",onClick:pt},{icon:u(()=>[(_(),R("svg",lr,[...a[39]||(a[39]=[o("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),o("path",{d:"M21 3v5h-5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),o("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),o("path",{d:"M3 21v-5h5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),default:u(()=>[a[40]||(a[40]=E(" 重置 ",-1))]),_:1})]),g(p(we),{value:K.value,"onUpdate:value":a[10]||(a[10]=f=>K.value=f),type:"textarea",placeholder:'{"param1": "value1", "param2": 123}',rows:8,autosize:{minRows:8,maxRows:12},class:"test-args-input"},null,8,["value"])]),I.value&&U.value?(_(),R("div",ir,[o("div",ur,[o("div",cr,[(_(),R("svg",dr,[...a[42]||(a[42]=[o("path",{d:"M9 11l3 3L22 4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),o("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])),a[43]||(a[43]=o("span",null,"测试结果",-1))]),o("div",pr,[g(p(q),{size:"small",text:"",onClick:Ke},{icon:u(()=>[(_(),R("svg",gr,[...a[44]||(a[44]=[o("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),o("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),default:u(()=>[a[45]||(a[45]=E(" 复制 ",-1))]),_:1}),g(p(q),{size:"small",text:"",onClick:a[11]||(a[11]=f=>I.value=!1)},{icon:u(()=>[(_(),R("svg",mr,[...a[46]||(a[46]=[o("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),_:1})])]),o("div",vr,[o("pre",fr,[o("code",hr,X(be(U.value)),1),a[47]||(a[47]=E(`
576
- `,-1))])])])):ue("",!0)])]),_:1},8,["show","style"])]))}}),Dr=Ft(wr,[["__scopeId","data-v-789b5d4c"]]),br={class:"init-script-editor"},kr={class:"save-status-indicator"},xr=["title"],Cr={key:0,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Tr={key:1,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Sr={class:"monaco-wrapper"},$r={class:"editor-actions"},Ze=`/**
576
+ `,-1))])])])):ue("",!0)])]),_:1},8,["show","style"])]))}}),Dr=Ft(wr,[["__scopeId","data-v-6b73ec28"]]),br={class:"init-script-editor"},kr={class:"save-status-indicator"},xr=["title"],Cr={key:0,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Tr={key:1,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Sr={class:"monaco-wrapper"},$r={class:"editor-actions"},Ze=`/**
577
577
  * MCP 初始化脚本
578
578
  * 在 MCP 客户端连接时执行,用于环境检查、数据预加载等操作
579
579
  */
@@ -1 +1 @@
1
- import{d as C,a as x,p as y,q as L,c as n,b as e,e as M,f as i,w as r,g as b,B,F as j,s as z,v as V,o as s,x as A,m as I,y as v,z as u,t as _,n as a,T as S,i as G}from"./index-Ku_MdnLs.js";import{_ as H}from"./_plugin-vue_export-helper-DlAUqK2U.js";const N={class:"app-shell"},F={class:"app-header"},R={class:"app-header__container"},U={class:"app-header__right"},q={class:"app-body"},D={class:"app-sidebar"},P={class:"sidebar-nav"},T=["onClick"],Z={class:"nav-item__icon admin-nav-icon"},E={class:"nav-item__content"},O={class:"nav-item__label"},$={class:"nav-item__description"},J={key:0,class:"nav-item__indicator admin-indicator"},K={class:"app-content"},Q={class:"content-wrapper"},W=C({__name:"Layout",setup(X){const d=G(),h=L(),m=x(),l=y(()=>h.name),k=[{label:"用户管理",key:"AdminUsers",icon:()=>a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),description:"管理系统用户和权限"},{label:"配置管理",key:"AdminConfigs",icon:()=>a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),description:"管理用户的 MCP 配置"}];function g(c){d.push({name:c})}function w(){m.adminLogout(),d.push("/admin/login")}return(c,t)=>{const f=V("router-view");return s(),n("div",N,[e("header",F,[e("div",R,[t[2]||(t[2]=M('<div class="app-header__left" data-v-012e7336><div class="app-logo" data-v-012e7336><div class="logo-icon admin-theme" data-v-012e7336><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-012e7336><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#admin-gradient1)" data-v-012e7336></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#admin-gradient2)" data-v-012e7336></path><defs data-v-012e7336><linearGradient id="admin-gradient1" x1="2" y1="2" x2="22" y2="12" data-v-012e7336><stop offset="0%" stop-color="#dc2626" data-v-012e7336></stop><stop offset="100%" stop-color="#ea580c" data-v-012e7336></stop></linearGradient><linearGradient id="admin-gradient2" x1="2" y1="12" x2="22" y2="22" data-v-012e7336><stop offset="0%" stop-color="#ea580c" data-v-012e7336></stop><stop offset="100%" stop-color="#f59e0b" data-v-012e7336></stop></linearGradient></defs></svg></div><div class="logo-text" data-v-012e7336><div class="logo-title admin-title" data-v-012e7336>Flex MCP Admin</div><div class="logo-subtitle" data-v-012e7336>管理员控制台</div></div></div></div>',1)),e("div",U,[t[1]||(t[1]=e("div",{class:"admin-badge"},[e("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),e("span",null,"管理员")],-1)),i(b(B),{class:"logout-btn",quaternary:"",circle:"",onClick:w},{icon:r(()=>[...t[0]||(t[0]=[e("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M9 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M16 17L21 12L16 7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M21 12H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1})])])]),e("div",q,[e("aside",D,[e("nav",P,[(s(),n(j,null,z(k,o=>e("div",{key:o.key,class:A(["nav-item",{"nav-item--active":l.value===o.key}]),onClick:p=>g(o.key)},[e("div",Z,[(s(),v(u(o.icon)))]),e("div",E,[e("div",O,_(o.label),1),e("div",$,_(o.description),1)]),l.value===o.key?(s(),n("div",J)):I("",!0)],10,T)),64))])]),e("main",K,[e("div",Q,[i(f,null,{default:r(({Component:o,route:p})=>[i(S,{name:"page-fade",mode:"out-in"},{default:r(()=>[(s(),v(u(o),{key:p.path}))]),_:2},1024)]),_:1})])])])])}}}),se=H(W,[["__scopeId","data-v-012e7336"]]);export{se as default};
1
+ import{d as C,a as x,p as y,q as L,c as n,b as e,e as M,f as i,w as r,g as b,B,F as j,s as z,v as V,o as s,x as A,m as I,y as v,z as u,t as _,n as a,T as S,i as G}from"./index-DAOSS2K-.js";import{_ as H}from"./_plugin-vue_export-helper-DlAUqK2U.js";const N={class:"app-shell"},F={class:"app-header"},R={class:"app-header__container"},U={class:"app-header__right"},q={class:"app-body"},D={class:"app-sidebar"},P={class:"sidebar-nav"},T=["onClick"],Z={class:"nav-item__icon admin-nav-icon"},E={class:"nav-item__content"},O={class:"nav-item__label"},$={class:"nav-item__description"},J={key:0,class:"nav-item__indicator admin-indicator"},K={class:"app-content"},Q={class:"content-wrapper"},W=C({__name:"Layout",setup(X){const d=G(),h=L(),m=x(),l=y(()=>h.name),k=[{label:"用户管理",key:"AdminUsers",icon:()=>a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),description:"管理系统用户和权限"},{label:"配置管理",key:"AdminConfigs",icon:()=>a("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),description:"管理用户的 MCP 配置"}];function g(c){d.push({name:c})}function w(){m.adminLogout(),d.push("/admin/login")}return(c,t)=>{const f=V("router-view");return s(),n("div",N,[e("header",F,[e("div",R,[t[2]||(t[2]=M('<div class="app-header__left" data-v-012e7336><div class="app-logo" data-v-012e7336><div class="logo-icon admin-theme" data-v-012e7336><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-012e7336><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#admin-gradient1)" data-v-012e7336></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#admin-gradient2)" data-v-012e7336></path><defs data-v-012e7336><linearGradient id="admin-gradient1" x1="2" y1="2" x2="22" y2="12" data-v-012e7336><stop offset="0%" stop-color="#dc2626" data-v-012e7336></stop><stop offset="100%" stop-color="#ea580c" data-v-012e7336></stop></linearGradient><linearGradient id="admin-gradient2" x1="2" y1="12" x2="22" y2="22" data-v-012e7336><stop offset="0%" stop-color="#ea580c" data-v-012e7336></stop><stop offset="100%" stop-color="#f59e0b" data-v-012e7336></stop></linearGradient></defs></svg></div><div class="logo-text" data-v-012e7336><div class="logo-title admin-title" data-v-012e7336>Flex MCP Admin</div><div class="logo-subtitle" data-v-012e7336>管理员控制台</div></div></div></div>',1)),e("div",U,[t[1]||(t[1]=e("div",{class:"admin-badge"},[e("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),e("span",null,"管理员")],-1)),i(b(B),{class:"logout-btn",quaternary:"",circle:"",onClick:w},{icon:r(()=>[...t[0]||(t[0]=[e("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M9 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M16 17L21 12L16 7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M21 12H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1})])])]),e("div",q,[e("aside",D,[e("nav",P,[(s(),n(j,null,z(k,o=>e("div",{key:o.key,class:A(["nav-item",{"nav-item--active":l.value===o.key}]),onClick:p=>g(o.key)},[e("div",Z,[(s(),v(u(o.icon)))]),e("div",E,[e("div",O,_(o.label),1),e("div",$,_(o.description),1)]),l.value===o.key?(s(),n("div",J)):I("",!0)],10,T)),64))])]),e("main",K,[e("div",Q,[i(f,null,{default:r(({Component:o,route:p})=>[i(S,{name:"page-fade",mode:"out-in"},{default:r(()=>[(s(),v(u(o),{key:p.path}))]),_:2},1024)]),_:1})])])])])}}}),se=H(W,[["__scopeId","data-v-012e7336"]]);export{se as default};
@@ -1 +1 @@
1
- import{n as o,d as M,a as B,p as _,q as L,c as i,b as e,e as V,f as p,t as u,g as m,w as h,B as H,F as j,s as z,v as I,o as r,x as A,m as F,y as g,z as f,T as P,i as S}from"./index-Ku_MdnLs.js";import{_ as q}from"./_plugin-vue_export-helper-DlAUqK2U.js";const D=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"}),o("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"}),o("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"}),o("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"})]),G=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),N=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M4 7h3m13 0h-3m-2 4l-2 5l-2-5m9-4l-3 8l-3-8m-6 11h3m0 0h3m-3 0V10",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),T=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("polyline",{points:"16 18 22 12 16 6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),o("polyline",{points:"8 6 2 12 8 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),R=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M3 3h18v18H3V3zm2 2v14h14V5H5zm2 2h10v2H7V7zm0 4h10v2H7v-2zm0 4h7v2H7v-2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),O=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),o("path",{d:"M14 2v6h6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),o("path",{d:"M16 13H8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),o("path",{d:"M16 17H8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),o("path",{d:"M10 9H8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})]),C=[{label:"MCP 组件",key:"section-components",icon:D,description:"管理 MCP 服务组件"},{label:"自定义工具",key:"section-tools",icon:G,description:"创建和编辑工具"},{label:"变量管理",key:"section-variables",icon:N,description:"配置环境变量",hideForAdmin:!0},{label:"初始化脚本",key:"section-init",icon:T,description:"编写启动脚本"},{label:"数据管理",key:"section-tables",icon:R,description:"创建和管理数据表",hideForAdmin:!0},{label:"提示词管理",key:"section-prompts",icon:O,description:"创建和管理提示词模板"}],U={class:"app-shell"},Z={class:"app-header"},$={class:"app-header__container"},E={class:"app-header__right"},W={class:"user-info"},J={class:"user-email"},K={class:"app-body"},Q={class:"app-sidebar"},X={class:"sidebar-nav"},Y=["onClick"],ee={class:"nav-item__icon"},oe={class:"nav-item__content"},te={class:"nav-item__label"},se={class:"nav-item__description"},ne={key:0,class:"nav-item__indicator"},re={class:"app-content"},ie={class:"content-wrapper"},ae=M({__name:"Layout",setup(le){const a=S(),l=L(),c=B(),v=_(()=>l.name==="UserDashboard"?`section-${l.query.section||"components"}`:l.name),x=_(()=>{var t;return((t=c.user)==null?void 0:t.role)==="admin"?C.filter(d=>!d.hideForAdmin):C});function y(n){if(n.startsWith("section-")){const t=n.replace("section-","");a.push({name:"UserDashboard",query:{section:t}});return}a.push({name:n})}function b(){c.userLogout(),a.push("/user/login")}return(n,t)=>{var k;const d=I("router-view");return r(),i("div",U,[e("header",Z,[e("div",$,[t[2]||(t[2]=V('<div class="app-header__left" data-v-ae7e6c80><div class="app-logo" data-v-ae7e6c80><div class="logo-icon" data-v-ae7e6c80><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-ae7e6c80><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#gradient1)" data-v-ae7e6c80></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#gradient2)" data-v-ae7e6c80></path><defs data-v-ae7e6c80><linearGradient id="gradient1" x1="2" y1="2" x2="22" y2="12" data-v-ae7e6c80><stop offset="0%" stop-color="#6366f1" data-v-ae7e6c80></stop><stop offset="100%" stop-color="#8b5cf6" data-v-ae7e6c80></stop></linearGradient><linearGradient id="gradient2" x1="2" y1="12" x2="22" y2="22" data-v-ae7e6c80><stop offset="0%" stop-color="#8b5cf6" data-v-ae7e6c80></stop><stop offset="100%" stop-color="#ec4899" data-v-ae7e6c80></stop></linearGradient></defs></svg></div><div class="logo-text" data-v-ae7e6c80><div class="logo-title" data-v-ae7e6c80>Flex MCP</div><div class="logo-subtitle" data-v-ae7e6c80>MCP 服务运营平台</div></div></div></div>',1)),e("div",E,[e("div",W,[t[0]||(t[0]=e("div",{class:"user-avatar"},[e("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("circle",{cx:"12",cy:"8",r:"4",fill:"currentColor",opacity:"0.3"}),e("path",{d:"M6 21C6 17.686 8.686 15 12 15C15.314 15 18 17.686 18 21",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})])],-1)),e("span",J,u(((k=m(c).user)==null?void 0:k.email)||"用户"),1)]),p(m(H),{class:"logout-btn",quaternary:"",circle:"",onClick:b},{icon:h(()=>[...t[1]||(t[1]=[e("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M9 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M16 17L21 12L16 7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M21 12H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1})])])]),e("div",K,[e("aside",Q,[e("nav",X,[(r(!0),i(j,null,z(x.value,s=>(r(),i("div",{key:s.key,class:A(["nav-item",{"nav-item--active":v.value===s.key}]),onClick:w=>y(s.key)},[e("div",ee,[(r(),g(f(s.icon)))]),e("div",oe,[e("div",te,u(s.label),1),e("div",se,u(s.description),1)]),v.value===s.key?(r(),i("div",ne)):F("",!0)],10,Y))),128))])]),e("main",re,[e("div",ie,[p(d,null,{default:h(({Component:s,route:w})=>[p(P,{name:"page-fade",mode:"out-in"},{default:h(()=>[(r(),g(f(s),{key:w.path}))]),_:2},1024)]),_:1})])])])])}}}),pe=q(ae,[["__scopeId","data-v-ae7e6c80"]]);export{pe as default};
1
+ import{n as o,d as M,a as B,p as _,q as L,c as i,b as e,e as V,f as p,t as u,g as m,w as h,B as H,F as j,s as z,v as I,o as r,x as A,m as F,y as g,z as f,T as P,i as S}from"./index-DAOSS2K-.js";import{_ as q}from"./_plugin-vue_export-helper-DlAUqK2U.js";const D=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"}),o("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"}),o("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"}),o("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1",stroke:"currentColor","stroke-width":"2",fill:"none"})]),G=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),N=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M4 7h3m13 0h-3m-2 4l-2 5l-2-5m9-4l-3 8l-3-8m-6 11h3m0 0h3m-3 0V10",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),T=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("polyline",{points:"16 18 22 12 16 6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),o("polyline",{points:"8 6 2 12 8 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),R=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M3 3h18v18H3V3zm2 2v14h14V5H5zm2 2h10v2H7V7zm0 4h10v2H7v-2zm0 4h7v2H7v-2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),O=()=>o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),o("path",{d:"M14 2v6h6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),o("path",{d:"M16 13H8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),o("path",{d:"M16 17H8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),o("path",{d:"M10 9H8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})]),C=[{label:"MCP 组件",key:"section-components",icon:D,description:"管理 MCP 服务组件"},{label:"自定义工具",key:"section-tools",icon:G,description:"创建和编辑工具"},{label:"变量管理",key:"section-variables",icon:N,description:"配置环境变量",hideForAdmin:!0},{label:"初始化脚本",key:"section-init",icon:T,description:"编写启动脚本"},{label:"数据管理",key:"section-tables",icon:R,description:"创建和管理数据表",hideForAdmin:!0},{label:"提示词管理",key:"section-prompts",icon:O,description:"创建和管理提示词模板"}],U={class:"app-shell"},Z={class:"app-header"},$={class:"app-header__container"},E={class:"app-header__right"},W={class:"user-info"},J={class:"user-email"},K={class:"app-body"},Q={class:"app-sidebar"},X={class:"sidebar-nav"},Y=["onClick"],ee={class:"nav-item__icon"},oe={class:"nav-item__content"},te={class:"nav-item__label"},se={class:"nav-item__description"},ne={key:0,class:"nav-item__indicator"},re={class:"app-content"},ie={class:"content-wrapper"},ae=M({__name:"Layout",setup(le){const a=S(),l=L(),c=B(),v=_(()=>l.name==="UserDashboard"?`section-${l.query.section||"components"}`:l.name),x=_(()=>{var t;return((t=c.user)==null?void 0:t.role)==="admin"?C.filter(d=>!d.hideForAdmin):C});function y(n){if(n.startsWith("section-")){const t=n.replace("section-","");a.push({name:"UserDashboard",query:{section:t}});return}a.push({name:n})}function b(){c.userLogout(),a.push("/user/login")}return(n,t)=>{var k;const d=I("router-view");return r(),i("div",U,[e("header",Z,[e("div",$,[t[2]||(t[2]=V('<div class="app-header__left" data-v-ae7e6c80><div class="app-logo" data-v-ae7e6c80><div class="logo-icon" data-v-ae7e6c80><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-ae7e6c80><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#gradient1)" data-v-ae7e6c80></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#gradient2)" data-v-ae7e6c80></path><defs data-v-ae7e6c80><linearGradient id="gradient1" x1="2" y1="2" x2="22" y2="12" data-v-ae7e6c80><stop offset="0%" stop-color="#6366f1" data-v-ae7e6c80></stop><stop offset="100%" stop-color="#8b5cf6" data-v-ae7e6c80></stop></linearGradient><linearGradient id="gradient2" x1="2" y1="12" x2="22" y2="22" data-v-ae7e6c80><stop offset="0%" stop-color="#8b5cf6" data-v-ae7e6c80></stop><stop offset="100%" stop-color="#ec4899" data-v-ae7e6c80></stop></linearGradient></defs></svg></div><div class="logo-text" data-v-ae7e6c80><div class="logo-title" data-v-ae7e6c80>Flex MCP</div><div class="logo-subtitle" data-v-ae7e6c80>MCP 服务运营平台</div></div></div></div>',1)),e("div",E,[e("div",W,[t[0]||(t[0]=e("div",{class:"user-avatar"},[e("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("circle",{cx:"12",cy:"8",r:"4",fill:"currentColor",opacity:"0.3"}),e("path",{d:"M6 21C6 17.686 8.686 15 12 15C15.314 15 18 17.686 18 21",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})])],-1)),e("span",J,u(((k=m(c).user)==null?void 0:k.email)||"用户"),1)]),p(m(H),{class:"logout-btn",quaternary:"",circle:"",onClick:b},{icon:h(()=>[...t[1]||(t[1]=[e("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M9 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V5C3 4.46957 3.21071 3.96086 3.58579 3.58579C3.96086 3.21071 4.46957 3 5 3H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M16 17L21 12L16 7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M21 12H9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1})])])]),e("div",K,[e("aside",Q,[e("nav",X,[(r(!0),i(j,null,z(x.value,s=>(r(),i("div",{key:s.key,class:A(["nav-item",{"nav-item--active":v.value===s.key}]),onClick:w=>y(s.key)},[e("div",ee,[(r(),g(f(s.icon)))]),e("div",oe,[e("div",te,u(s.label),1),e("div",se,u(s.description),1)]),v.value===s.key?(r(),i("div",ne)):F("",!0)],10,Y))),128))])]),e("main",re,[e("div",ie,[p(d,null,{default:h(({Component:s,route:w})=>[p(P,{name:"page-fade",mode:"out-in"},{default:h(()=>[(r(),g(f(s),{key:w.path}))]),_:2},1024)]),_:1})])])])])}}}),pe=q(ae,[["__scopeId","data-v-ae7e6c80"]]);export{pe as default};
@@ -1 +1 @@
1
- import{d as C,u as M,a as B,r as v,c as u,b as e,e as L,f as d,w as t,g as r,N as V,h as w,o as f,i as j,j as g,k as m,l as h,B as K,m as z}from"./index-Ku_MdnLs.js";import{_ as N}from"./_plugin-vue_export-helper-DlAUqK2U.js";const I={class:"auth-bg"},P={class:"login-container"},A={class:"form-section"},H={class:"form-card"},_={key:0,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},G=C({__name:"Login",setup(F){const b=j(),p=M(),k=B(),c=v(),l=v(!1),s=v({email:"",apiKey:""}),x={email:{required:!0,message:"请输入邮箱地址",trigger:"blur"},apiKey:{required:!0,message:"请输入 API Key",trigger:"blur"}};async function n(){var i,a,o;try{await((i=c.value)==null?void 0:i.validate()),l.value=!0,await k.loginUser(s.value.email,s.value.apiKey),p.success("登录成功"),b.push("/user/dashboard")}catch(y){p.error(((o=(a=y.response)==null?void 0:a.data)==null?void 0:o.error)||"登录失败,请检查您的凭据")}finally{l.value=!1}}return(i,a)=>(f(),u("div",I,[a[11]||(a[11]=e("div",{class:"floating-shapes"},[e("div",{class:"shape shape-1"}),e("div",{class:"shape shape-2"}),e("div",{class:"shape shape-3"})],-1)),e("div",P,[a[10]||(a[10]=L('<div class="brand-section" data-v-d6d8ce7b><div class="brand-content" data-v-d6d8ce7b><div class="brand-logo" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#logo-gradient1)" data-v-d6d8ce7b></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#logo-gradient2)" data-v-d6d8ce7b></path><defs data-v-d6d8ce7b><linearGradient id="logo-gradient1" x1="2" y1="2" x2="22" y2="12" data-v-d6d8ce7b><stop offset="0%" stop-color="#6366f1" data-v-d6d8ce7b></stop><stop offset="100%" stop-color="#8b5cf6" data-v-d6d8ce7b></stop></linearGradient><linearGradient id="logo-gradient2" x1="2" y1="12" x2="22" y2="22" data-v-d6d8ce7b><stop offset="0%" stop-color="#8b5cf6" data-v-d6d8ce7b></stop><stop offset="100%" stop-color="#ec4899" data-v-d6d8ce7b></stop></linearGradient></defs></svg></div><h1 class="brand-title" data-v-d6d8ce7b>Flex MCP</h1><p class="brand-subtitle" data-v-d6d8ce7b>MCP 服务运营平台</p><div class="brand-features" data-v-d6d8ce7b><div class="feature-item" data-v-d6d8ce7b><div class="feature-icon" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d6d8ce7b></path></svg></div><span data-v-d6d8ce7b>统一管理 MCP 组件</span></div><div class="feature-item" data-v-d6d8ce7b><div class="feature-icon" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M13 10V3L4 14h7v7l9-11h-7z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d6d8ce7b></path></svg></div><span data-v-d6d8ce7b>快速创建自定义工具</span></div><div class="feature-item" data-v-d6d8ce7b><div class="feature-icon" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d6d8ce7b></path></svg></div><span data-v-d6d8ce7b>安全的 API 密钥管理</span></div></div></div></div>',1)),e("div",A,[e("div",H,[a[8]||(a[8]=e("div",{class:"form-header"},[e("h2",{class:"form-title"},"欢迎回来"),e("p",{class:"form-description"},"使用您的账户凭据登录系统")],-1)),d(r(V),{ref_key:"formRef",ref:c,model:s.value,rules:x,size:"large"},{default:t(()=>[d(r(g),{path:"email"},{label:t(()=>[...a[2]||(a[2]=[e("div",{class:"input-label"},[e("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),e("span",null,"邮箱地址")],-1)])]),default:t(()=>[d(r(m),{value:s.value.email,"onUpdate:value":a[0]||(a[0]=o=>s.value.email=o),placeholder:"your@email.com",class:"modern-input",onKeyup:h(n,["enter"])},{prefix:t(()=>[...a[3]||(a[3]=[e("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),d(r(g),{path:"apiKey"},{label:t(()=>[...a[4]||(a[4]=[e("div",{class:"input-label"},[e("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),e("span",null,"API 密钥")],-1)])]),default:t(()=>[d(r(m),{value:s.value.apiKey,"onUpdate:value":a[1]||(a[1]=o=>s.value.apiKey=o),type:"password",placeholder:"输入您的 API Key",class:"modern-input","show-password-on":"click",onKeyup:h(n,["enter"])},{prefix:t(()=>[...a[5]||(a[5]=[e("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M7 11V7a5 5 0 0110 0v4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),d(r(K),{type:"primary",size:"large",block:"",loading:l.value,class:"login-button",onClick:n},{icon:t(()=>[l.value?z("",!0):(f(),u("svg",_,[...a[6]||(a[6]=[e("path",{d:"M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),default:t(()=>[a[7]||(a[7]=w(" 登录系统 ",-1))]),_:1},8,["loading"])]),_:1},8,["model"]),a[9]||(a[9]=e("div",{class:"form-footer"},[e("p",{class:"help-text"},[e("svg",{class:"help-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),w(" 首次使用?请联系管理员获取账户信息 ")])],-1))])])])]))}}),U=N(G,[["__scopeId","data-v-d6d8ce7b"]]);export{U as default};
1
+ import{d as C,u as M,a as B,r as v,c as u,b as e,e as L,f as d,w as t,g as r,N as V,h as w,o as f,i as j,j as g,k as m,l as h,B as K,m as z}from"./index-DAOSS2K-.js";import{_ as N}from"./_plugin-vue_export-helper-DlAUqK2U.js";const I={class:"auth-bg"},P={class:"login-container"},A={class:"form-section"},H={class:"form-card"},_={key:0,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},G=C({__name:"Login",setup(F){const b=j(),p=M(),k=B(),c=v(),l=v(!1),s=v({email:"",apiKey:""}),x={email:{required:!0,message:"请输入邮箱地址",trigger:"blur"},apiKey:{required:!0,message:"请输入 API Key",trigger:"blur"}};async function n(){var i,a,o;try{await((i=c.value)==null?void 0:i.validate()),l.value=!0,await k.loginUser(s.value.email,s.value.apiKey),p.success("登录成功"),b.push("/user/dashboard")}catch(y){p.error(((o=(a=y.response)==null?void 0:a.data)==null?void 0:o.error)||"登录失败,请检查您的凭据")}finally{l.value=!1}}return(i,a)=>(f(),u("div",I,[a[11]||(a[11]=e("div",{class:"floating-shapes"},[e("div",{class:"shape shape-1"}),e("div",{class:"shape shape-2"}),e("div",{class:"shape shape-3"})],-1)),e("div",P,[a[10]||(a[10]=L('<div class="brand-section" data-v-d6d8ce7b><div class="brand-content" data-v-d6d8ce7b><div class="brand-logo" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#logo-gradient1)" data-v-d6d8ce7b></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#logo-gradient2)" data-v-d6d8ce7b></path><defs data-v-d6d8ce7b><linearGradient id="logo-gradient1" x1="2" y1="2" x2="22" y2="12" data-v-d6d8ce7b><stop offset="0%" stop-color="#6366f1" data-v-d6d8ce7b></stop><stop offset="100%" stop-color="#8b5cf6" data-v-d6d8ce7b></stop></linearGradient><linearGradient id="logo-gradient2" x1="2" y1="12" x2="22" y2="22" data-v-d6d8ce7b><stop offset="0%" stop-color="#8b5cf6" data-v-d6d8ce7b></stop><stop offset="100%" stop-color="#ec4899" data-v-d6d8ce7b></stop></linearGradient></defs></svg></div><h1 class="brand-title" data-v-d6d8ce7b>Flex MCP</h1><p class="brand-subtitle" data-v-d6d8ce7b>MCP 服务运营平台</p><div class="brand-features" data-v-d6d8ce7b><div class="feature-item" data-v-d6d8ce7b><div class="feature-icon" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d6d8ce7b></path></svg></div><span data-v-d6d8ce7b>统一管理 MCP 组件</span></div><div class="feature-item" data-v-d6d8ce7b><div class="feature-icon" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M13 10V3L4 14h7v7l9-11h-7z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d6d8ce7b></path></svg></div><span data-v-d6d8ce7b>快速创建自定义工具</span></div><div class="feature-item" data-v-d6d8ce7b><div class="feature-icon" data-v-d6d8ce7b><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d6d8ce7b><path d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-d6d8ce7b></path></svg></div><span data-v-d6d8ce7b>安全的 API 密钥管理</span></div></div></div></div>',1)),e("div",A,[e("div",H,[a[8]||(a[8]=e("div",{class:"form-header"},[e("h2",{class:"form-title"},"欢迎回来"),e("p",{class:"form-description"},"使用您的账户凭据登录系统")],-1)),d(r(V),{ref_key:"formRef",ref:c,model:s.value,rules:x,size:"large"},{default:t(()=>[d(r(g),{path:"email"},{label:t(()=>[...a[2]||(a[2]=[e("div",{class:"input-label"},[e("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),e("span",null,"邮箱地址")],-1)])]),default:t(()=>[d(r(m),{value:s.value.email,"onUpdate:value":a[0]||(a[0]=o=>s.value.email=o),placeholder:"your@email.com",class:"modern-input",onKeyup:h(n,["enter"])},{prefix:t(()=>[...a[3]||(a[3]=[e("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),d(r(g),{path:"apiKey"},{label:t(()=>[...a[4]||(a[4]=[e("div",{class:"input-label"},[e("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),e("span",null,"API 密钥")],-1)])]),default:t(()=>[d(r(m),{value:s.value.apiKey,"onUpdate:value":a[1]||(a[1]=o=>s.value.apiKey=o),type:"password",placeholder:"输入您的 API Key",class:"modern-input","show-password-on":"click",onKeyup:h(n,["enter"])},{prefix:t(()=>[...a[5]||(a[5]=[e("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M7 11V7a5 5 0 0110 0v4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),d(r(K),{type:"primary",size:"large",block:"",loading:l.value,class:"login-button",onClick:n},{icon:t(()=>[l.value?z("",!0):(f(),u("svg",_,[...a[6]||(a[6]=[e("path",{d:"M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),default:t(()=>[a[7]||(a[7]=w(" 登录系统 ",-1))]),_:1},8,["loading"])]),_:1},8,["model"]),a[9]||(a[9]=e("div",{class:"form-footer"},[e("p",{class:"help-text"},[e("svg",{class:"help-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("path",{d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),w(" 首次使用?请联系管理员获取账户信息 ")])],-1))])])])]))}}),U=N(G,[["__scopeId","data-v-d6d8ce7b"]]);export{U as default};
@@ -1 +1 @@
1
- import{d as C,u as B,a as z,r as v,c,b as a,e as w,f as r,w as t,g as n,N as j,h as f,o as g,j as m,k as h,l as k,B as L,m as N,i as V}from"./index-Ku_MdnLs.js";import{_ as A}from"./_plugin-vue_export-helper-DlAUqK2U.js";const _={class:"auth-bg admin-theme"},H={class:"login-container"},G={class:"form-section"},F={class:"form-card"},I={key:0,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},K=C({__name:"Login",setup(R){const x=V(),p=B(),b=z(),u=v(),l=v(!1),s=v({username:"",password:""}),M={username:{required:!0,message:"请输入管理员用户名",trigger:"blur"},password:{required:!0,message:"请输入管理员密码",trigger:"blur"}};async function d(){var i,e,o;try{await((i=u.value)==null?void 0:i.validate()),l.value=!0,await b.loginAdmin(s.value.username,s.value.password),p.success("登录成功"),x.push("/admin/users")}catch(y){p.error(((o=(e=y.response)==null?void 0:e.data)==null?void 0:o.error)||"登录失败,请检查您的凭据")}finally{l.value=!1}}return(i,e)=>(g(),c("div",_,[e[11]||(e[11]=a("div",{class:"floating-shapes"},[a("div",{class:"shape shape-1"}),a("div",{class:"shape shape-2"}),a("div",{class:"shape shape-3"})],-1)),a("div",H,[e[10]||(e[10]=w('<div class="brand-section admin-gradient" data-v-332e576e><div class="brand-content" data-v-332e576e><div class="brand-logo" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#admin-logo-gradient1)" data-v-332e576e></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#admin-logo-gradient2)" data-v-332e576e></path><defs data-v-332e576e><linearGradient id="admin-logo-gradient1" x1="2" y1="2" x2="22" y2="12" data-v-332e576e><stop offset="0%" stop-color="#ffffff" data-v-332e576e></stop><stop offset="100%" stop-color="#fef3c7" data-v-332e576e></stop></linearGradient><linearGradient id="admin-logo-gradient2" x1="2" y1="12" x2="22" y2="22" data-v-332e576e><stop offset="0%" stop-color="#fef3c7" data-v-332e576e></stop><stop offset="100%" stop-color="#ffffff" data-v-332e576e></stop></linearGradient></defs></svg></div><h1 class="brand-title" data-v-332e576e>Flex MCP Admin</h1><p class="brand-subtitle" data-v-332e576e>超级管理员控制台</p><div class="brand-features" data-v-332e576e><div class="feature-item" data-v-332e576e><div class="feature-icon" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg></div><span data-v-332e576e>全面的用户管理</span></div><div class="feature-item" data-v-332e576e><div class="feature-icon" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path><path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg></div><span data-v-332e576e>灵活的配置管理</span></div><div class="feature-item" data-v-332e576e><div class="feature-icon" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg></div><span data-v-332e576e>强大的权限控制</span></div></div></div></div>',1)),a("div",G,[a("div",F,[e[8]||(e[8]=w('<div class="form-header" data-v-332e576e><div class="admin-badge" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg><span data-v-332e576e>管理员登录</span></div><h2 class="form-title" data-v-332e576e>系统管理后台</h2><p class="form-description" data-v-332e576e>使用管理员凭据访问控制面板</p></div>',1)),r(n(j),{ref_key:"formRef",ref:u,model:s.value,rules:M,size:"large"},{default:t(()=>[r(n(m),{path:"username"},{label:t(()=>[...e[2]||(e[2]=[a("div",{class:"input-label"},[a("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),a("span",null,"管理员账号")],-1)])]),default:t(()=>[r(n(h),{value:s.value.username,"onUpdate:value":e[0]||(e[0]=o=>s.value.username=o),placeholder:"输入管理员用户名",class:"modern-input",onKeyup:k(d,["enter"])},{prefix:t(()=>[...e[3]||(e[3]=[a("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),r(n(m),{path:"password"},{label:t(()=>[...e[4]||(e[4]=[a("div",{class:"input-label"},[a("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),a("span",null,"管理员密码")],-1)])]),default:t(()=>[r(n(h),{value:s.value.password,"onUpdate:value":e[1]||(e[1]=o=>s.value.password=o),type:"password",placeholder:"输入管理员密码",class:"modern-input","show-password-on":"click",onKeyup:k(d,["enter"])},{prefix:t(()=>[...e[5]||(e[5]=[a("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M7 11V7a5 5 0 0110 0v4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),r(n(L),{type:"primary",size:"large",block:"",loading:l.value,class:"login-button admin-login-btn",onClick:d},{icon:t(()=>[l.value?N("",!0):(g(),c("svg",I,[...e[6]||(e[6]=[a("path",{d:"M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),default:t(()=>[e[7]||(e[7]=f(" 进入管理后台 ",-1))]),_:1},8,["loading"])]),_:1},8,["model"]),e[9]||(e[9]=a("div",{class:"form-footer"},[a("p",{class:"help-text"},[a("svg",{class:"help-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),f(" 仅限授权管理员访问,未经授权的访问将被记录 ")])],-1))])])])]))}}),U=A(K,[["__scopeId","data-v-332e576e"]]);export{U as default};
1
+ import{d as C,u as B,a as z,r as v,c,b as a,e as w,f as r,w as t,g as n,N as j,h as f,o as g,j as m,k as h,l as k,B as L,m as N,i as V}from"./index-DAOSS2K-.js";import{_ as A}from"./_plugin-vue_export-helper-DlAUqK2U.js";const _={class:"auth-bg admin-theme"},H={class:"login-container"},G={class:"form-section"},F={class:"form-card"},I={key:0,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},K=C({__name:"Login",setup(R){const x=V(),p=B(),b=z(),u=v(),l=v(!1),s=v({username:"",password:""}),M={username:{required:!0,message:"请输入管理员用户名",trigger:"blur"},password:{required:!0,message:"请输入管理员密码",trigger:"blur"}};async function d(){var i,e,o;try{await((i=u.value)==null?void 0:i.validate()),l.value=!0,await b.loginAdmin(s.value.username,s.value.password),p.success("登录成功"),x.push("/admin/users")}catch(y){p.error(((o=(e=y.response)==null?void 0:e.data)==null?void 0:o.error)||"登录失败,请检查您的凭据")}finally{l.value=!1}}return(i,e)=>(g(),c("div",_,[e[11]||(e[11]=a("div",{class:"floating-shapes"},[a("div",{class:"shape shape-1"}),a("div",{class:"shape shape-2"}),a("div",{class:"shape shape-3"})],-1)),a("div",H,[e[10]||(e[10]=w('<div class="brand-section admin-gradient" data-v-332e576e><div class="brand-content" data-v-332e576e><div class="brand-logo" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#admin-logo-gradient1)" data-v-332e576e></path><path d="M2 17L12 22L22 17V12L12 17L2 12V17Z" fill="url(#admin-logo-gradient2)" data-v-332e576e></path><defs data-v-332e576e><linearGradient id="admin-logo-gradient1" x1="2" y1="2" x2="22" y2="12" data-v-332e576e><stop offset="0%" stop-color="#ffffff" data-v-332e576e></stop><stop offset="100%" stop-color="#fef3c7" data-v-332e576e></stop></linearGradient><linearGradient id="admin-logo-gradient2" x1="2" y1="12" x2="22" y2="22" data-v-332e576e><stop offset="0%" stop-color="#fef3c7" data-v-332e576e></stop><stop offset="100%" stop-color="#ffffff" data-v-332e576e></stop></linearGradient></defs></svg></div><h1 class="brand-title" data-v-332e576e>Flex MCP Admin</h1><p class="brand-subtitle" data-v-332e576e>超级管理员控制台</p><div class="brand-features" data-v-332e576e><div class="feature-item" data-v-332e576e><div class="feature-icon" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg></div><span data-v-332e576e>全面的用户管理</span></div><div class="feature-item" data-v-332e576e><div class="feature-icon" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path><path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg></div><span data-v-332e576e>灵活的配置管理</span></div><div class="feature-item" data-v-332e576e><div class="feature-icon" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg></div><span data-v-332e576e>强大的权限控制</span></div></div></div></div>',1)),a("div",G,[a("div",F,[e[8]||(e[8]=w('<div class="form-header" data-v-332e576e><div class="admin-badge" data-v-332e576e><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-332e576e><path d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-332e576e></path></svg><span data-v-332e576e>管理员登录</span></div><h2 class="form-title" data-v-332e576e>系统管理后台</h2><p class="form-description" data-v-332e576e>使用管理员凭据访问控制面板</p></div>',1)),r(n(j),{ref_key:"formRef",ref:u,model:s.value,rules:M,size:"large"},{default:t(()=>[r(n(m),{path:"username"},{label:t(()=>[...e[2]||(e[2]=[a("div",{class:"input-label"},[a("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),a("span",null,"管理员账号")],-1)])]),default:t(()=>[r(n(h),{value:s.value.username,"onUpdate:value":e[0]||(e[0]=o=>s.value.username=o),placeholder:"输入管理员用户名",class:"modern-input",onKeyup:k(d,["enter"])},{prefix:t(()=>[...e[3]||(e[3]=[a("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),r(n(m),{path:"password"},{label:t(()=>[...e[4]||(e[4]=[a("div",{class:"input-label"},[a("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),a("span",null,"管理员密码")],-1)])]),default:t(()=>[r(n(h),{value:s.value.password,"onUpdate:value":e[1]||(e[1]=o=>s.value.password=o),type:"password",placeholder:"输入管理员密码",class:"modern-input","show-password-on":"click",onKeyup:k(d,["enter"])},{prefix:t(()=>[...e[5]||(e[5]=[a("svg",{class:"input-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M7 11V7a5 5 0 0110 0v4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1},8,["value"])]),_:1}),r(n(L),{type:"primary",size:"large",block:"",loading:l.value,class:"login-button admin-login-btn",onClick:d},{icon:t(()=>[l.value?N("",!0):(g(),c("svg",I,[...e[6]||(e[6]=[a("path",{d:"M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),default:t(()=>[e[7]||(e[7]=f(" 进入管理后台 ",-1))]),_:1},8,["loading"])]),_:1},8,["model"]),e[9]||(e[9]=a("div",{class:"form-footer"},[a("p",{class:"help-text"},[a("svg",{class:"help-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),f(" 仅限授权管理员访问,未经授权的访问将被记录 ")])],-1))])])])]))}}),U=A(K,[["__scopeId","data-v-332e576e"]]);export{U as default};
@@ -1 +1 @@
1
- import{d as D,u as V,$ as L,r as n,I as O,c as J,b as s,f as a,w as o,g as r,B as p,C as q,D as C,J as y,o as E,h as v,N as F,j as M,k as z,O as R,M as G,a0 as Q,n as B,Q as W}from"./index-Ku_MdnLs.js";import{_ as X}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Y={class:"users-page"},Z={class:"page-header"},_={class:"users-card"},ee={class:"modal-footer"},se={class:"apikey-section"},oe={class:"mcp-config-section"},le=D({__name:"Users",setup(te){const d=V(),N=L(),m=n(!1),f=n(!1),c=n(!1),w=n(!1),g=n(""),h=n(""),b=n([]),x=n(),i=n({email:"",role:"user"}),j={pageSize:10,showSizePicker:!0,pageSizes:[10,20,50]},A=t=>({style:"cursor: pointer; transition: all 0.2s ease;",onMouseenter:e=>{e.currentTarget.style.backgroundColor="rgba(99, 102, 241, 0.04)"},onMouseleave:e=>{e.currentTarget.style.backgroundColor=""}}),$=[{label:"普通用户",value:"user"},{label:"管理员",value:"admin"}],P={email:{required:!0,message:"请输入邮箱地址",trigger:"blur"},role:{required:!0,message:"请选择用户角色",trigger:"change"}},U=[{title:"邮箱",key:"email",ellipsis:{tooltip:!0}},{title:"角色",key:"role",width:120,render(t){return B(W,{type:t.role==="admin"?"error":"info",round:!0},{default:()=>t.role==="admin"?"管理员":"普通用户"})}},{title:"创建时间",key:"createdAt",width:180},{title:"操作",key:"actions",width:100,render(t){return B(p,{type:"error",size:"small",secondary:!0,onClick:()=>T(t)},{default:()=>"删除"})}}];async function k(){m.value=!0;try{const t=await y.get("/users");b.value=t.data.data}catch{d.error("加载用户列表失败")}finally{m.value=!1}}async function I(){var t,e,l;try{await((t=x.value)==null?void 0:t.validate()),f.value=!0;const u=await y.post("/users",i.value);u.data.data&&u.data.data.apiKey?(g.value=u.data.data.apiKey,h.value=i.value.email,w.value=!0):d.success("创建成功"),c.value=!1,i.value={email:"",role:"user"},await k()}catch(u){d.error(((l=(e=u.response)==null?void 0:e.data)==null?void 0:l.error)||"创建失败")}finally{f.value=!1}}function T(t){N.warning({title:"确认删除",content:`确定要删除用户 ${t.email} 吗?此操作不可恢复。`,positiveText:"删除",negativeText:"取消",onPositiveClick:async()=>{var e,l;try{await y.delete(`/users/${t.id}`),d.success("删除成功"),await k()}catch(u){d.error(((l=(e=u.response)==null?void 0:e.data)==null?void 0:l.error)||"删除失败")}}})}function H(){navigator.clipboard.writeText(g.value),d.success("已复制到剪贴板")}function K(){const t=window.location.hostname,l=["5173","5174"].includes(window.location.port)?"3000":window.location.port,S={mcpServers:{"flex-mcp":{url:`${`${window.location.protocol}//${t}${l?`:${l}`:""}`}/mcp/sse`,headers:{email:h.value,apiKey:g.value}}}};navigator.clipboard.writeText(JSON.stringify(S,null,2)),d.success("MCP 配置已复制到剪贴板")}return O(()=>{k()}),(t,e)=>(E(),J("div",Y,[s("div",Z,[e[9]||(e[9]=s("div",null,[s("h1",{class:"page-title"},"用户管理"),s("p",{class:"page-description"},"创建和管理系统用户,分配权限和 API 密钥")],-1)),a(r(p),{type:"primary",size:"large",class:"create-btn",onClick:e[0]||(e[0]=l=>c.value=!0)},{icon:o(()=>[...e[7]||(e[7]=[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:o(()=>[e[8]||(e[8]=v(" 创建用户 ",-1))]),_:1})]),s("div",_,[a(r(q),{columns:U,data:b.value,loading:m.value,pagination:j,"row-props":A,class:"modern-table"},null,8,["data","loading"])]),a(r(C),{show:c.value,"onUpdate:show":e[4]||(e[4]=l=>c.value=l),preset:"card",title:"创建新用户",class:"create-modal",bordered:!1,size:"huge"},{header:o(()=>[...e[10]||(e[10]=[s("div",{class:"modal-header"},[s("div",{class:"modal-icon"},[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])]),s("div",null,[s("h3",{class:"modal-title"},"创建新用户"),s("p",{class:"modal-subtitle"},"为新用户设置邮箱和角色权限")])],-1)])]),footer:o(()=>[s("div",ee,[a(r(p),{size:"large",onClick:e[3]||(e[3]=l=>c.value=!1)},{default:o(()=>[...e[13]||(e[13]=[v("取消",-1)])]),_:1}),a(r(p),{type:"primary",size:"large",loading:f.value,class:"submit-btn",onClick:I},{icon:o(()=>[...e[14]||(e[14]=[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M5 13l4 4L19 7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:o(()=>[e[15]||(e[15]=v(" 创建用户 ",-1))]),_:1},8,["loading"])])]),default:o(()=>[a(r(F),{ref_key:"formRef",ref:x,model:i.value,rules:P,size:"large"},{default:o(()=>[a(r(M),{path:"email"},{label:o(()=>[...e[11]||(e[11]=[s("div",{class:"form-label"},[s("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),s("span",null,"用户邮箱")],-1)])]),default:o(()=>[a(r(z),{value:i.value.email,"onUpdate:value":e[1]||(e[1]=l=>i.value.email=l),placeholder:"user@example.com","input-props":{type:"email"}},null,8,["value"])]),_:1}),a(r(M),{path:"role"},{label:o(()=>[...e[12]||(e[12]=[s("div",{class:"form-label"},[s("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),s("span",null,"用户角色")],-1)])]),default:o(()=>[a(r(R),{value:i.value.role,"onUpdate:value":e[2]||(e[2]=l=>i.value.role=l),options:$,placeholder:"选择用户角色"},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["show"]),a(r(C),{show:w.value,"onUpdate:show":e[6]||(e[6]=l=>w.value=l),preset:"card",title:"用户创建成功",closable:!1,"mask-closable":!1,class:"apikey-modal",bordered:!1,size:"huge"},{header:o(()=>[...e[16]||(e[16]=[s("div",{class:"success-header"},[s("div",{class:"success-icon"},[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])]),s("div",null,[s("h3",{class:"success-title"},"用户创建成功!"),s("p",{class:"success-subtitle"},"请妥善保管以下信息")])],-1)])]),footer:o(()=>[a(r(p),{type:"primary",size:"large",block:"",class:"confirm-btn",onClick:e[5]||(e[5]=l=>w.value=!1)},{default:o(()=>[...e[25]||(e[25]=[v(" 我已保存,关闭窗口 ",-1)])]),_:1})]),default:o(()=>[a(r(G),{type:"warning",class:"warning-alert"},{icon:o(()=>[...e[17]||(e[17]=[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:o(()=>[e[18]||(e[18]=s("div",{class:"warning-content"},[s("strong",null,"重要提示"),s("p",null,"API Key 只会显示一次,请立即复制并妥善保存!丢失后需要重新创建用户。")],-1))]),_:1}),s("div",se,[e[21]||(e[21]=s("div",{class:"section-label"},[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),s("span",null,"API 密钥")],-1)),a(r(Q),{class:"apikey-input-group"},{default:o(()=>[a(r(z),{value:g.value,readonly:"",placeholder:"API Key",size:"large",class:"apikey-input"},null,8,["value"]),a(r(p),{type:"primary",size:"large",class:"copy-btn",onClick:H},{icon:o(()=>[...e[19]||(e[19]=[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:o(()=>[e[20]||(e[20]=v(" 复制 ",-1))]),_:1})]),_:1})]),s("div",oe,[e[24]||(e[24]=s("div",{class:"section-label"},[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),s("span",null,"MCP 配置 (用于 Cursor / Claude)")],-1)),a(r(p),{type:"primary",size:"large",block:"",class:"copy-config-btn",onClick:K},{icon:o(()=>[...e[22]||(e[22]=[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:o(()=>[e[23]||(e[23]=v(" 复制 MCP 配置 JSON ",-1))]),_:1})])]),_:1},8,["show"])]))}}),ne=X(le,[["__scopeId","data-v-8c8c351d"]]);export{ne as default};
1
+ import{d as D,u as V,$ as L,r as n,I as O,c as J,b as s,f as a,w as o,g as r,B as p,C as q,D as C,J as y,o as E,h as v,N as F,j as M,k as z,O as R,M as G,a0 as Q,n as B,Q as W}from"./index-DAOSS2K-.js";import{_ as X}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Y={class:"users-page"},Z={class:"page-header"},_={class:"users-card"},ee={class:"modal-footer"},se={class:"apikey-section"},oe={class:"mcp-config-section"},le=D({__name:"Users",setup(te){const d=V(),N=L(),m=n(!1),f=n(!1),c=n(!1),w=n(!1),g=n(""),h=n(""),b=n([]),x=n(),i=n({email:"",role:"user"}),j={pageSize:10,showSizePicker:!0,pageSizes:[10,20,50]},A=t=>({style:"cursor: pointer; transition: all 0.2s ease;",onMouseenter:e=>{e.currentTarget.style.backgroundColor="rgba(99, 102, 241, 0.04)"},onMouseleave:e=>{e.currentTarget.style.backgroundColor=""}}),$=[{label:"普通用户",value:"user"},{label:"管理员",value:"admin"}],P={email:{required:!0,message:"请输入邮箱地址",trigger:"blur"},role:{required:!0,message:"请选择用户角色",trigger:"change"}},U=[{title:"邮箱",key:"email",ellipsis:{tooltip:!0}},{title:"角色",key:"role",width:120,render(t){return B(W,{type:t.role==="admin"?"error":"info",round:!0},{default:()=>t.role==="admin"?"管理员":"普通用户"})}},{title:"创建时间",key:"createdAt",width:180},{title:"操作",key:"actions",width:100,render(t){return B(p,{type:"error",size:"small",secondary:!0,onClick:()=>T(t)},{default:()=>"删除"})}}];async function k(){m.value=!0;try{const t=await y.get("/users");b.value=t.data.data}catch{d.error("加载用户列表失败")}finally{m.value=!1}}async function I(){var t,e,l;try{await((t=x.value)==null?void 0:t.validate()),f.value=!0;const u=await y.post("/users",i.value);u.data.data&&u.data.data.apiKey?(g.value=u.data.data.apiKey,h.value=i.value.email,w.value=!0):d.success("创建成功"),c.value=!1,i.value={email:"",role:"user"},await k()}catch(u){d.error(((l=(e=u.response)==null?void 0:e.data)==null?void 0:l.error)||"创建失败")}finally{f.value=!1}}function T(t){N.warning({title:"确认删除",content:`确定要删除用户 ${t.email} 吗?此操作不可恢复。`,positiveText:"删除",negativeText:"取消",onPositiveClick:async()=>{var e,l;try{await y.delete(`/users/${t.id}`),d.success("删除成功"),await k()}catch(u){d.error(((l=(e=u.response)==null?void 0:e.data)==null?void 0:l.error)||"删除失败")}}})}function H(){navigator.clipboard.writeText(g.value),d.success("已复制到剪贴板")}function K(){const t=window.location.hostname,l=["5173","5174"].includes(window.location.port)?"3000":window.location.port,S={mcpServers:{"flex-mcp":{url:`${`${window.location.protocol}//${t}${l?`:${l}`:""}`}/mcp/sse`,headers:{email:h.value,apiKey:g.value}}}};navigator.clipboard.writeText(JSON.stringify(S,null,2)),d.success("MCP 配置已复制到剪贴板")}return O(()=>{k()}),(t,e)=>(E(),J("div",Y,[s("div",Z,[e[9]||(e[9]=s("div",null,[s("h1",{class:"page-title"},"用户管理"),s("p",{class:"page-description"},"创建和管理系统用户,分配权限和 API 密钥")],-1)),a(r(p),{type:"primary",size:"large",class:"create-btn",onClick:e[0]||(e[0]=l=>c.value=!0)},{icon:o(()=>[...e[7]||(e[7]=[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M12 4v16m8-8H4",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:o(()=>[e[8]||(e[8]=v(" 创建用户 ",-1))]),_:1})]),s("div",_,[a(r(q),{columns:U,data:b.value,loading:m.value,pagination:j,"row-props":A,class:"modern-table"},null,8,["data","loading"])]),a(r(C),{show:c.value,"onUpdate:show":e[4]||(e[4]=l=>c.value=l),preset:"card",title:"创建新用户",class:"create-modal",bordered:!1,size:"huge"},{header:o(()=>[...e[10]||(e[10]=[s("div",{class:"modal-header"},[s("div",{class:"modal-icon"},[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])]),s("div",null,[s("h3",{class:"modal-title"},"创建新用户"),s("p",{class:"modal-subtitle"},"为新用户设置邮箱和角色权限")])],-1)])]),footer:o(()=>[s("div",ee,[a(r(p),{size:"large",onClick:e[3]||(e[3]=l=>c.value=!1)},{default:o(()=>[...e[13]||(e[13]=[v("取消",-1)])]),_:1}),a(r(p),{type:"primary",size:"large",loading:f.value,class:"submit-btn",onClick:I},{icon:o(()=>[...e[14]||(e[14]=[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M5 13l4 4L19 7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:o(()=>[e[15]||(e[15]=v(" 创建用户 ",-1))]),_:1},8,["loading"])])]),default:o(()=>[a(r(F),{ref_key:"formRef",ref:x,model:i.value,rules:P,size:"large"},{default:o(()=>[a(r(M),{path:"email"},{label:o(()=>[...e[11]||(e[11]=[s("div",{class:"form-label"},[s("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),s("span",null,"用户邮箱")],-1)])]),default:o(()=>[a(r(z),{value:i.value.email,"onUpdate:value":e[1]||(e[1]=l=>i.value.email=l),placeholder:"user@example.com","input-props":{type:"email"}},null,8,["value"])]),_:1}),a(r(M),{path:"role"},{label:o(()=>[...e[12]||(e[12]=[s("div",{class:"form-label"},[s("svg",{class:"label-icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),s("span",null,"用户角色")],-1)])]),default:o(()=>[a(r(R),{value:i.value.role,"onUpdate:value":e[2]||(e[2]=l=>i.value.role=l),options:$,placeholder:"选择用户角色"},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["show"]),a(r(C),{show:w.value,"onUpdate:show":e[6]||(e[6]=l=>w.value=l),preset:"card",title:"用户创建成功",closable:!1,"mask-closable":!1,class:"apikey-modal",bordered:!1,size:"huge"},{header:o(()=>[...e[16]||(e[16]=[s("div",{class:"success-header"},[s("div",{class:"success-icon"},[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])]),s("div",null,[s("h3",{class:"success-title"},"用户创建成功!"),s("p",{class:"success-subtitle"},"请妥善保管以下信息")])],-1)])]),footer:o(()=>[a(r(p),{type:"primary",size:"large",block:"",class:"confirm-btn",onClick:e[5]||(e[5]=l=>w.value=!1)},{default:o(()=>[...e[25]||(e[25]=[v(" 我已保存,关闭窗口 ",-1)])]),_:1})]),default:o(()=>[a(r(G),{type:"warning",class:"warning-alert"},{icon:o(()=>[...e[17]||(e[17]=[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:o(()=>[e[18]||(e[18]=s("div",{class:"warning-content"},[s("strong",null,"重要提示"),s("p",null,"API Key 只会显示一次,请立即复制并妥善保存!丢失后需要重新创建用户。")],-1))]),_:1}),s("div",se,[e[21]||(e[21]=s("div",{class:"section-label"},[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),s("span",null,"API 密钥")],-1)),a(r(Q),{class:"apikey-input-group"},{default:o(()=>[a(r(z),{value:g.value,readonly:"",placeholder:"API Key",size:"large",class:"apikey-input"},null,8,["value"]),a(r(p),{type:"primary",size:"large",class:"copy-btn",onClick:H},{icon:o(()=>[...e[19]||(e[19]=[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:o(()=>[e[20]||(e[20]=v(" 复制 ",-1))]),_:1})]),_:1})]),s("div",oe,[e[24]||(e[24]=s("div",{class:"section-label"},[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]),s("span",null,"MCP 配置 (用于 Cursor / Claude)")],-1)),a(r(p),{type:"primary",size:"large",block:"",class:"copy-config-btn",onClick:K},{icon:o(()=>[...e[22]||(e[22]=[s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),default:o(()=>[e[23]||(e[23]=v(" 复制 MCP 配置 JSON ",-1))]),_:1})])]),_:1},8,["show"])]))}}),ne=X(le,[["__scopeId","data-v-8c8c351d"]]);export{ne as default};