import{d as R,r as C,a as S,b as T,e as i,o,c as r,L as X,M as j,n as c,g as a,f,w as d,l as F,t as w,X as q,V as G,p as m,h as H,J as O,K as Q,_ as W}from"./index-17740f03-1778929502341v=1.0.0.js";const Y={class:"plan-container"},Z={class:"item flex"},ee={class:"item"},le={class:"flex flex-s"},te={key:1,class:"flx-center"},oe={class:"mr5"},ne={key:1,class:"flex",style:{width:"100%",overflow:"hidden"}},se={class:"flex flex-s"},ae=R({__name:"UploadData",props:{value:{},isEdit:{type:Boolean,default:!0}},emits:["update:value","update:loading","cancel","submit"],setup(y,{expose:E,emit:D}){const b=y,L=D;C([]);const n=S({get(){return B(b.value)},set(e){L("update:value",x(e))}}),B=e=>{let l=e;return l.forEach(s=>{s.fileList=[],s.file_url&&s.fileList.push({url:s.file_url,name:s.name,file_path:s.file_url})}),l},U=(e,l)=>{n.value[l].name=e[0].name,n.value[l].file_url=e[0].file_url,n.value[l].file_path=e[0].file_url,n.value[l].file_name=e[0].name},V=async e=>{e.file_url?window.open("http://14.17.80.135:28012/onlinePreview?url="+encodeURIComponent(O.exports.Base64.encode(e.file_url))):Q.warning("\u9884\u89C8\u5730\u5740\u65E0\u6548")},g=e=>{const l=document.createElement("a");l.href=e.file_url,l.download=e.name?e.name:"exportdata",l.click()},x=e=>{let l=e;return l=l.map(s=>{const{name:v,file_url:k}=s;return{name:v,file_url:k}}),l},P=()=>{n.value.push({title:"",url:""})},A=e=>{n.value.splice(e,1)},M=C(!1),N=e=>{e.preventDefault(),M.value=!0},$=(e,l)=>{n.value[e].file_url="",n.value[e].file_path=""};return T(()=>{}),E({elsePlan:n}),(e,l)=>{const s=i("el-input"),v=i("el-button"),k=i("CircleCloseFilled"),_=i("el-icon"),I=i("View"),h=i("el-link"),z=i("Download"),J=i("Delete"),K=i("Plus");return o(),r("div",Y,[(o(!0),r(X,null,j(H(n),(t,p)=>(o(),r("div",{key:p,class:"else-plan mb20"},[c("div",Z,[l[0]||(l[0]=c("span",null,"\u6587\u4EF6\u540D\u79F0\uFF1A",-1)),a(s,{modelValue:t.name,"onUpdate:modelValue":u=>t.name=u,rows:1,autosize:"",class:"flex1",type:"textarea",placeholder:"\u8BF7\u8F93\u5165\u6587\u4EF6\u540D\u79F0"},null,8,["modelValue","onUpdate:modelValue"])]),c("div",ee,[c("div",le,[l[2]||(l[2]=c("span",null,"\u6587\u4EF6\u9644\u4EF6\uFF1A",-1)),t.url?(o(),r("div",ne,[c("span",{onClick:N,class:"url"},w(t.url),1)])):(o(),f(G,{key:0,fileList:t.fileList,"onUpdate:fileList":u=>t.fileList=u,onUploadFile:u=>U(u,p),limit:1,showFileList:!1,disabled:!e.isEdit},{default:d(()=>[t.file_url?(o(),r("div",te,[c("div",oe,w(t.name),1),a(_,{onClick:q(u=>$(p,t),["stop"])},{default:d(()=>[a(k)]),_:2},1032,["onClick"])])):(o(),f(v,{key:0,disabled:!e.isEdit},{default:d(()=>l[1]||(l[1]=[F("\u70B9\u51FB\u4E0A\u4F20")])),_:1},8,["disabled"]))]),_:2},1032,["fileList","onUpdate:fileList","onUploadFile","disabled"]))])]),c("div",se,[a(h,null,{default:d(()=>[t.file_url?(o(),f(_,{key:0,class:"icon mr5",onClick:u=>V(t)},{default:d(()=>[a(I)]),_:2},1032,["onClick"])):m("v-if",!0)]),_:2},1024),a(h,null,{default:d(()=>[t.file_url?(o(),f(_,{key:0,class:"icon mr5",onClick:u=>g(t)},{default:d(()=>[a(z)]),_:2},1032,["onClick"])):m("v-if",!0)]),_:2},1024),e.isEdit?(o(),f(_,{key:0,onClick:u=>A(p),class:"icon"},{default:d(()=>[a(J)]),_:2},1032,["onClick"])):m("v-if",!0)])]))),128)),e.isEdit?(o(),r("div",{key:0,class:"add-button",onClick:P},[a(_,null,{default:d(()=>[a(K)]),_:1}),l[3]||(l[3]=F(" \u65B0\u589E "))])):m("v-if",!0)])}}});const ie=W(ae,[["__scopeId","data-v-312dff32"]]);export{ie as default};
