import{I,r as P,aH as q,aG as J,F as L,K as $,W as N}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import{_ as O}from"./index.vue_vue_type_script_setup_true_name_PermissionButton_lang.1703796278973.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.170379627897314.js";import"./index.1703796278973311.js";import{a as y}from"./comm.1703796278973.js";import{F as R,s as D,u as G}from"./FileUpload.17037962789732.js";import{d as H,k as m,m as w,o as d,c as _,a as i,b as n,t as k,u as a}from"./vue.1703796278973.js";import{_ as K}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897320.js";import"./index.170379627897321.js";import"./permission.1703796278973.js";import"./system.1703796278973.js";import"./index.170379627897332.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";import"./index.1703796278973303.js";import"./index.170379627897329.js";import"./index.170379627897330.js";const M=H({__name:"index",props:{data:{type:Object,default:()=>{}}},emits:["change"],setup(f,{emit:g}){const u=f,p=m(!1);m(!1);const v=m(),c=u.data.id,x=[{label:"Jar",value:"jar",iconUrl:y("/jar.png")},{label:"Local",value:"local",iconUrl:y("/local.png")}],t=m({type:"jar",name:"",configuration:{location:""},description:""}),j=o=>{t.value.type=o[0]},h=async()=>{var r,s;const o=await((r=v.value)==null?void 0:r.validate());p.value=!0;const e=c?await G({...u.data,...o}).catch(()=>{}):await D(o).catch(()=>{});(e==null?void 0:e.status)===200&&(g("change",(e==null?void 0:e.status)===200),window.onTabSaveSuccess&&(s=e.result)!=null&&s.id&&(window.onTabSaveSuccess(e),setTimeout(()=>window.close(),300))),p.value=!1},C=()=>{h()},b=()=>{g("change",!1)};return w(()=>t.value.type,()=>{t.value.configuration.location=""}),w(()=>u.data,o=>{var e;o.id&&(t.value=o,(e=o.type[0])!=null&&e.value&&(t.value.type=o.type.map(r=>r.value)))},{immediate:!0,deep:!0}),(o,e)=>{const r=I,s=P,U=q,S=J,T=L,V=$,B=O,F=N;return d(),_(F,{title:f.data.id?"编辑":"新增",visible:!0,width:"700px",onCancel:b},{footer:i(()=>[n(V,{key:"back",onClick:b},{default:i(()=>[k("取消")]),_:1}),n(B,{key:"submit",type:"primary",loading:a(p),onClick:C,style:{"margin-left":"8px"},hasPermission:`link/Protocol:${a(c)?"update":"add"}`},{default:i(()=>[k(" 确认 ")]),_:1},8,["loading","hasPermission"])]),default:i(()=>[n(T,{class:"form",layout:"vertical",model:a(t),name:"basic",autocomplete:"off",ref_key:"formRef",ref:v},{default:i(()=>[n(s,{label:"名称",name:"name",rules:[{required:!0,message:"请输入名称",trigger:"blur"},{max:64,message:"最多可输入64个字符"}]},{default:i(()=>[n(r,{placeholder:"请输入名称",value:a(t).name,"onUpdate:value":e[0]||(e[0]=l=>a(t).name=l)},null,8,["value"])]),_:1}),n(s,{label:"类型",name:"type",rules:[{required:!0,message:"请选择类型",trigger:"blur"}]},{default:i(()=>[n(U,{disabled:!!a(c),value:a(t).type,"onUpdate:value":e[1]||(e[1]=l=>a(t).type=l),options:x,column:2,onChange:j},null,8,["disabled","value"])]),_:1}),n(s,{label:"文件地址",name:["configuration","location"],rules:[{required:!0,message:"请输入文件地址",trigger:"blur"}]},{default:i(()=>[a(t).type==="local"?(d(),_(r,{key:0,placeholder:"请输入文件地址",value:a(t).configuration.location,"onUpdate:value":e[2]||(e[2]=l=>a(t).configuration.location=l)},null,8,["value"])):(d(),_(R,{key:1,modelValue:a(t).configuration.location,"onUpdate:modelValue":e[3]||(e[3]=l=>a(t).configuration.location=l)},null,8,["modelValue"]))]),_:1}),n(s,{label:"说明",name:"description"},{default:i(()=>[n(S,{placeholder:"请输入说明",value:a(t).description,"onUpdate:value":e[4]||(e[4]=l=>a(t).description=l),maxlength:200,rows:3,showCount:""},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])}}});const je=K(M,[["__scopeId","data-v-4eb03ab6"]]);export{je as default};
