import{cP as k,cN as A,cG as w,q as E,I as F,K as O}from"./index.17037962789732.js";import"./index.170379627897315.js";import"./index.170379627897314.js";import"./index.170379627897329.js";import"./index.170379627897330.js";import{F as U}from"./system.1703796278973.js";import{T as h,L as b}from"./comm.1703796278973.js";import{d as f,k as D,m as N,o as d,x as u,F as T,h as j,b as s,a as l,u as n,t as B}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.170379627897332.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./permission.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";const P={class:"attachment-wrapper"},S=f({name:"Attachments"}),V=f({...S,props:{attachments:{type:Array,default:()=>[]}},emits:["update:attachments"],setup(v,{emit:g}){const x=v,e=D([]);N(()=>x.attachments,t=>{e.value=t.map(a=>({id:_(),...a}))},{deep:!0});const C=(t,a)=>{var o;if(t.file.status==="done"){const r=e.value.findIndex(m=>m.id===a);e.value[r].name=t.file.name,e.value[r].location=(o=t.file.response)==null?void 0:o.result,i()}},y=t=>{const a=e.value.findIndex(o=>o.id===t);e.value.splice(a,1),i()},I=()=>{e.value.push({id:_(),name:"",location:""}),i()},i=()=>{g("update:attachments",e.value.map(({name:t,location:a})=>({name:t,location:a})))},_=()=>String(new Date().getTime()+Math.random()*9);return(t,a)=>{const o=E,r=F,m=O;return d(),u("div",P,[(d(!0),u(T,null,j(n(e),(p,L)=>(d(),u("div",{class:"attachment-item",key:L},[s(r,{value:p.name,"onUpdate:value":c=>p.name=c,onChange:i},{addonAfter:l(()=>[s(o,{name:"file",action:n(U),headers:{[n(h)]:n(b).get(n(h))},showUploadList:!1,onChange:c=>C(c,p.id)},{default:l(()=>[s(n(k))]),_:2},1032,["action","headers","onChange"])]),_:2},1032,["value","onUpdate:value"]),s(n(A),{onClick:c=>y(p.id),style:{cursor:"pointer"}},null,8,["onClick"])]))),128)),s(m,{type:"dashed",onClick:I,style:{width:"100%","margin-top":"5px"}},{icon:l(()=>[s(n(w))]),default:l(()=>[B(" 添加 ")]),_:1})])}}});const ct=K(V,[["__scopeId","data-v-a32f9b42"]]);export{ct as default};