| 1 |
- import{_ as de,R as re,a as $,b as O,c as me,d as ie}from"./authheader.vue_vue_type_script_setup_true_lang-1549e361.js";import{m as pe,a8 as ce,r,x as d,ah as fe,C as k,D as _e,v as t,u as a,F as n,E as ve,L as ye,N as Ve,H as N,W as ge,Z as be,I as ke,G as E,i as Ie,aj as he,aa as Ne,_ as Ue}from"./index-1bac2251.js";const xe={class:"container"},M="/api/v1/llm/upload",we=pe({__name:"index",setup(Ce){const j=ce();let U=r(),x=r(),_=r(!1),I=r([]),G=r(!0),H=r(["权限管理","资源"]);const w={value:"key",label:"value"};let C=r([{key:"3",value:"目录"},{key:"0",value:"菜单"},{key:"1",value:"按钮"}]),e=r({component:"",createTime:"",description:"",icon:"",menuId:"",menuName:"",menuType:"",orderNum:"0",parentId:"",parentName:"",children:[],path:"",perms:"",status:"",syesourcetype:"",target:"",updateTime:""}),V=r(!1),L=r(""),T=r("IconLock");const W=u=>{u&&(e.value.parentId=u.menuId,e.value.parentName=u.menuName),e.value.component="",e.value.createTime="",e.value.description="",e.value.icon="",e.value.menuId="",e.value.menuName="",e.value.menuType="",e.value.orderNum="0",e.value.path="",e.value.perms="",e.value.status="",e.value.syesourcetype="",_.value=!0},Z=r([]),R=r([]),h=r([]),D=j.hrefUrl,q=u=>{Z.value=u},S=u=>{h.value=u;const l=u.map(f=>D+f);R.value=l},J=async u=>{u?_.value=!0:(e.value.icon=h.value[0]||"",await ie({...e.value}).then(l=>{b()}))},K=async u=>{x.value.validate(J)},P=u=>{re(u.menuId).then(()=>{b()})},Q=u=>{$(u).then(l=>{e.value={...l.data},e.value.icon=l.data.icon,R.value.push(D+l.data.icon)})},X=async u=>{u||(e.value.icon=h.value[0]||"",O({...e.value}).then(l=>{b(),Ne.success({title:"保存成功",content:"保存成功"})}))},Y=()=>{U.value.validate(X)},ee=u=>{$(u).then(l=>{e.value={...l.data}})},le=({dragNode:u,dropNode:l,dropPosition:f})=>{const g=I.value;O({orderNum:"0",parentId:l.menuId,menuId:u.menuId});const y=(i,p,c)=>{i.some((v,m,s)=>v.menuId===p?(c(v,m,s),!0):v.children?y(v.children,p,c):!1)};y(g,u.menuId,(i,p,c)=>{c.splice(p,1)}),f===0?y(g,l.menuId,i=>{i.children=i.children||[],i.children.push(u)}):y(g,l.menuId,(i,p,c)=>{c.splice(f<0?p:p+1,0,u)})},te=u=>{u==1&&(_.value=!1)},ae=()=>{V.value=!V.value,L.value=V.value?"#575757":"",T.value=V.value?"IconUnlock":"IconLock"},b=async u=>{await me().then(l=>{I.value=[...l.rows]})};return b(),(u,l)=>{const f=d("a-button"),g=d("a-tooltip"),y=d("IconDelete"),i=d("a-popconfirm"),p=d("a-tree"),c=d("a-card"),v=d("a-col"),m=d("a-input"),s=d("a-form-item"),F=d("a-switch"),z=d("Upload"),B=d("a-select"),oe=d("a-space"),A=d("a-form"),ne=d("a-row"),ue=d("a-modal"),se=fe("has-permi");return k(),_e("div",xe,[t(de,{items:a(H)},null,8,["items"]),t(ne,{gutter:20},{default:n(()=>[t(v,{span:8},{default:n(()=>[t(c,{title:u.$t("menu.resource.title"),bordered:!1,"header-style":{textAlign:"left"},style:{"'width'":"'100%'",height:"calc(100vh - 250px)","overflow-y":"auto"}},{title:n(()=>[ve("span",null,ye(u.$t("menu.resource.title")),1),t(g,{content:"点击后可通过拖拽更改资源结构,再次点击来关闭","background-color":"#165DFF"},{default:n(()=>[Ve((k(),N(f,{type:"outline",style:be([{float:"right"},{color:a(L)}]),onClick:ae},{default:n(()=>[(k(),N(ge(a(T))))]),_:1},8,["style"])),[[se,"/base/syresource!update"]])]),_:1})]),default:n(()=>[t(p,{class:"tree-demo",draggable:a(V),blockNode:"","default-expand-all":!0,data:a(I),"show-line":a(G),fieldNames:{key:"menuId",title:"menuName",children:"children"},onDrop:le,onSelect:Q},{extra:n(o=>[t(a(he),{style:{position:"absolute",right:"60px","font-size":"12px",top:"10px",color:"#3370ff"},onClick:()=>W(o)},null,8,["onClick"]),o.menuName!="root"?(k(),N(i,{key:0,content:"请确认是否删除?",type:"success",onOk:()=>P(o)},{default:n(()=>[t(y,{style:{position:"absolute",right:"40px","font-size":"12px",top:"10px",color:"#3370ff"}})]),_:2},1032,["onOk"])):ke("",!0)]),_:1},8,["draggable","data","show-line"])]),_:1},8,["title"])]),_:1}),t(v,{span:16},{default:n(()=>[t(c,{title:u.$t("menu.resource.detail"),bordered:!1,style:{width:"100%"}},{default:n(()=>[t(A,{model:a(e),layout:"horizontal",ref_key:"formRef",ref:U},{default:n(()=>[t(s,{field:"parentName",label:"上级资源",disabled:""},{default:n(()=>[t(m,{modelValue:a(e).parentName,"onUpdate:modelValue":l[0]||(l[0]=o=>a(e).parentName=o)},null,8,["modelValue"])]),_:1}),t(s,{field:"status",label:"资源状态"},{default:n(()=>[t(F,{"checked-value":"0","unchecked-value":"1",modelValue:a(e).status,"onUpdate:modelValue":l[1]||(l[1]=o=>a(e).status=o)},null,8,["modelValue"])]),_:1}),t(s,{field:"menuName",label:"资源名称",rules:[{required:!0,message:"资源名称必填"},{maxLength:50,message:"长度不超过50"}]},{default:n(()=>[t(m,{modelValue:a(e).menuName,"onUpdate:modelValue":l[2]||(l[2]=o=>a(e).menuName=o)},null,8,["modelValue"])]),_:1}),t(s,{field:"menuName",label:"资源图标"},{default:n(()=>[t(z,{action:M,limit:1,url:a(e).icon,"onUpdate:fileList":q,onSuccess:S},null,8,["url"])]),_:1}),t(s,{field:"menuType",label:"资源类型",rules:[{required:!0,message:"资源类型必填"}]},{default:n(()=>[t(B,{modelValue:a(e).menuType,"onUpdate:modelValue":l[3]||(l[3]=o=>a(e).menuType=o),options:a(C),"field-names":w,style:{width:"320px"},placeholder:"请选择"},null,8,["modelValue","options"])]),_:1}),t(s,{field:"description",label:"提示词"},{default:n(()=>[t(m,{modelValue:a(e).description,"onUpdate:modelValue":l[4]||(l[4]=o=>a(e).description=o),placeholder:"请输入提示词"},null,8,["modelValue"])]),_:1}),t(s,{field:"perms",label:"资源控制权限字符",rules:[{required:!0,message:"资源控制权限字符必填"},{maxLength:50,message:"长度不超过50"}]},{default:n(()=>[t(m,{modelValue:a(e).perms,"onUpdate:modelValue":l[5]||(l[5]=o=>a(e).perms=o)},null,8,["modelValue"])]),_:1}),t(s,{field:"component",label:"资源地址",style:{align:"start"},rules:[{required:!0,message:"资源地址必填"},{maxLength:50,message:"长度不超过50"}]},{default:n(()=>[t(m,{modelValue:a(e).component,"onUpdate:modelValue":l[6]||(l[6]=o=>a(e).component=o)},null,8,["modelValue"])]),_:1}),t(s,null,{default:n(()=>[t(oe,null,{default:n(()=>[t(f,{onClick:Y},{default:n(()=>l[16]||(l[16]=[E("保存")])),_:1}),t(f,{onClick:l[7]||(l[7]=o=>ee(a(e).menuId))},{default:n(()=>l[17]||(l[17]=[E("重置")])),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])]),_:1})]),_:1}),t(ue,{width:"50%",visible:a(_),"onUpdate:visible":l[15]||(l[15]=o=>Ie(_)?_.value=o:_=o),title:"新增",onCancel:te,onOk:K},{default:n(()=>[t(A,{model:a(e),layout:"horizontal",ref_key:"addFormRef",ref:x},{default:n(()=>[t(s,{field:"parentName",label:"上级资源",disabled:""},{default:n(()=>[t(m,{modelValue:a(e).parentName,"onUpdate:modelValue":l[8]||(l[8]=o=>a(e).parentName=o)},null,8,["modelValue"])]),_:1}),t(s,{field:"status",label:"资源状态"},{default:n(()=>[t(F,{"checked-value":"0","unchecked-value":"1",modelValue:a(e).status,"onUpdate:modelValue":l[9]||(l[9]=o=>a(e).status=o)},null,8,["modelValue"])]),_:1}),t(s,{field:"menuName",label:"资源名称",rules:[{required:!0,message:"资源名称必填"},{maxLength:50,message:"长度不超过50"}]},{default:n(()=>[t(m,{modelValue:a(e).menuName,"onUpdate:modelValue":l[10]||(l[10]=o=>a(e).menuName=o)},null,8,["modelValue"])]),_:1}),t(s,{field:"icon",label:"资源图标"},{default:n(()=>[t(z,{action:M,limit:1,url:a(e).icon,"onUpdate:fileList":q,onSuccess:S},null,8,["url"])]),_:1}),t(s,{field:"menuType",label:"资源类型",rules:[{required:!0,message:"资源类型必填"}]},{default:n(()=>[t(B,{modelValue:a(e).menuType,"onUpdate:modelValue":l[11]||(l[11]=o=>a(e).menuType=o),options:a(C),"field-names":w,style:{width:"320px"},placeholder:"请选择"},null,8,["modelValue","options"])]),_:1}),t(s,{field:"description",label:"提示词"},{default:n(()=>[t(m,{modelValue:a(e).description,"onUpdate:modelValue":l[12]||(l[12]=o=>a(e).description=o),placeholder:"请输入提示词"},null,8,["modelValue"])]),_:1}),t(s,{field:"perms",label:"资源控制权限字符",rules:[{required:!0,message:"资源控制权限字符必填"},{maxLength:50,message:"长度不超过50"}]},{default:n(()=>[t(m,{modelValue:a(e).perms,"onUpdate:modelValue":l[13]||(l[13]=o=>a(e).perms=o)},null,8,["modelValue"])]),_:1}),t(s,{field:"component",label:"资源地址",style:{align:"start"},rules:[{required:!0,message:"资源地址必填"},{maxLength:50,message:"长度不超过50"}]},{default:n(()=>[t(m,{modelValue:a(e).component,"onUpdate:modelValue":l[14]||(l[14]=o=>a(e).component=o)},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible"])])}}});const Re=Ue(we,[["__scopeId","data-v-9fa49154"]]);export{Re as default};
|