import{d as e,r as l,s as a,o as i,a as s,b as t,h as n,F as u,i as o,f as d,e as f,w as r,j as c,l as p,k as m,c as v,t as _,v as k,x,E as h,_ as y}from"./index-d052b22f-1780912037814v=1.0.0.js";import{D as C}from"./Document-61a10b68-1780912037814v=1.0.0.js";import"./upload-f9f23203-1780912037814v=1.0.0.js";const w={class:"plan-container"},b={class:"item flex"},L={class:"item"},E={class:"flex flex-s"},U={key:1,class:"flx-center"},D={class:"mr5"},F={key:1,class:"flex",style:{width:"100%",overflow:"hidden"}},V={class:"flex flex-s"},j=y(e({__name:"UploadData",props:{value:{},isEdit:{type:Boolean,default:!0}},emits:["update:value","update:loading","cancel","submit"],setup(e,{expose:y,emit:j}){const g=e,P=j;l([]);const B=a({get:()=>I(g.value),set(e){P("update:value",z(e))}}),I=e=>{let l=e;return l.forEach((e=>{e.fileList=[],e.file_url&&e.fileList.push({url:e.file_url,name:e.name,file_path:e.file_url})})),l},z=e=>{let l=e;return l=l.map((e=>{const{name:l,file_url:a}=e;return{name:l,file_url:a}})),l},R=()=>{B.value.push({title:"",url:""})},q=l(!1),A=e=>{e.preventDefault(),q.value=!0};return i((()=>{})),y({elsePlan:B}),(e,l)=>{const a=s("el-input"),i=s("el-button"),y=s("CircleCloseFilled"),j=s("el-icon"),g=s("View"),P=s("el-link"),I=s("Download"),z=s("Delete"),q=s("Plus");return t(),n("div",w,[(t(!0),n(u,null,o(d(B),((s,u)=>(t(),n("div",{key:u,class:"else-plan mb20"},[m("div",b,[l[0]||(l[0]=m("span",null,"文件名称：",-1)),f(a,{modelValue:s.name,"onUpdate:modelValue":e=>s.name=e,rows:1,autosize:"",class:"flex1",type:"textarea",placeholder:"请输入文件名称"},null,8,["modelValue","onUpdate:modelValue"])]),m("div",L,[m("div",E,[l[2]||(l[2]=m("span",null,"文件附件：",-1)),s.url?(t(),n("div",F,[m("span",{onClick:A,class:"url"},_(s.url),1)])):(t(),v(C,{key:0,fileList:s.fileList,"onUpdate:fileList":e=>s.fileList=e,onUploadFile:e=>((e,l)=>{B.value[l].name=e[0].name,B.value[l].file_url=e[0].file_url,B.value[l].file_path=e[0].file_url,B.value[l].file_name=e[0].name})(e,u),limit:1,showFileList:!1,disabled:!e.isEdit},{default:r((()=>[s.file_url?(t(),n("div",U,[m("div",D,_(s.name),1),f(j,{onClick:k((e=>(e=>{B.value[e].file_url="",B.value[e].file_path=""})(u)),["stop"])},{default:r((()=>[f(y)])),_:2},1032,["onClick"])])):(t(),v(i,{key:0,disabled:!e.isEdit},{default:r((()=>l[1]||(l[1]=[c("点击上传")]))),_:1},8,["disabled"]))])),_:2},1032,["fileList","onUpdate:fileList","onUploadFile","disabled"]))])]),m("div",V,[f(P,null,{default:r((()=>[s.file_url?(t(),v(j,{key:0,class:"icon mr5",onClick:e=>(async e=>{e.file_url?window.open("http://14.17.80.135:28012/onlinePreview?url="+encodeURIComponent(x.exports.Base64.encode(e.file_url))):h.warning("预览地址无效")})(s)},{default:r((()=>[f(g)])),_:2},1032,["onClick"])):p("v-if",!0)])),_:2},1024),f(P,null,{default:r((()=>[s.file_url?(t(),v(j,{key:0,class:"icon mr5",onClick:e=>(e=>{const l=document.createElement("a");l.href=e.file_url,l.download=e.name?e.name:"exportdata",l.click()})(s)},{default:r((()=>[f(I)])),_:2},1032,["onClick"])):p("v-if",!0)])),_:2},1024),e.isEdit?(t(),v(j,{key:0,onClick:e=>(e=>{B.value.splice(e,1)})(u),class:"icon"},{default:r((()=>[f(z)])),_:2},1032,["onClick"])):p("v-if",!0)])])))),128)),e.isEdit?(t(),n("div",{key:0,class:"add-button",onClick:R},[f(j,null,{default:r((()=>[f(q)])),_:1}),l[3]||(l[3]=c(" 新增 "))])):p("v-if",!0)])}}}),[["__scopeId","data-v-312dff32"]]);export{j as default};
