import{a5 as N,b as B,r as m,ah as D,$ as j,o as q,c as z,p as l,q as s,v as p,P as g,x as c,n as f,s as _,F as L,S as v,cx as M,ak as O,l as J,bv as R}from"./index.8d733f79.js";import{E as T}from"./el-progress.ee3fa77d.js";import{U as A}from"./deviceTree.170dfbd9.js";const G={style:{"margin-bottom":"16px"}},H={style:{color:"#F53F3F","margin-left":"10px"}},K={class:"dialog-footer"},Q=["src"],W=N({name:"PointImage"}),oe=Object.assign(W,{emits:["refresh"],setup(X,{expose:V,emit:P}){const{t:I}=B(),y="./",a=m([]),n=m(!1),d=m(!1),h=m(),t=D({images:[],pointId:""});function C(e){n.value=!0,t.pointId=e.id,t.images=JSON.parse(JSON.stringify(e.images)),t.images.forEach(o=>{const i=`${y}/equipment-web/file/downloadImage?fileId=${o}`;a.value.push({url:i,fileId:o})})}const E=e=>e.size/1024/1024>30?(v.error(I("imgSizeLimit")),!1):!0,U=e=>{t.images=t.images.filter(o=>o!==e.fileId)},$=e=>{h.value=e.url,d.value=!0},S=e=>{const o=e.file,i=new FormData;i.append("file",o),M(i).then(u=>{u.data&&(t.images.push(u.data),a.value[a.value.length-1].fileId=u.data)})},F=()=>{if(!t.images.length){v.error(I("uploadImgP"));return}A({...t}).then(e=>{v.success(e.msg),n.value=!1,P("refresh")})},k=()=>{a.value=[]};return V({showModal:C}),(e,o)=>{const i=j("Plus"),u=O,x=T,w=J,b=R;return q(),z(L,null,[l(b,{title:"\u4F20\u611F\u5668\u5B89\u88C5\u56FE\u7247",modelValue:f(n),"onUpdate:modelValue":o[2]||(o[2]=r=>_(n)?n.value=r:null),width:"600px","align-center":!0,onClosed:k,"append-to-body":""},{footer:s(()=>[p("div",K,[l(w,{onClick:o[1]||(o[1]=r=>n.value=!1)},{default:s(()=>[g(c(e.$t("cancel")),1)]),_:1}),l(w,{type:"primary",onClick:F},{default:s(()=>[g(c(e.$t("confirm")),1)]),_:1})])]),default:s(()=>[p("div",G,[g(c(e.$t("uploadImg")),1),p("span",H,c(e.$t("imgSizeLimitDesc")),1)]),l(x,{class:"uploadImg-wrap","file-list":f(a),"onUpdate:file-list":o[0]||(o[0]=r=>_(a)?a.value=r:null),action:"#",accept:".jpg,.png,jpeg","list-type":"picture-card","before-upload":E,"http-request":S,"on-preview":$,"on-remove":U},{default:s(()=>[l(u,null,{default:s(()=>[l(i)]),_:1})]),_:1},8,["file-list"])]),_:1},8,["modelValue"]),l(b,{modelValue:f(d),"onUpdate:modelValue":o[3]||(o[3]=r=>_(d)?d.value=r:null)},{default:s(()=>[p("img",{src:f(h),alt:"Preview Image",class:"img-pre"},null,8,Q)]),_:1},8,["modelValue"])],64)}}});export{oe as default};
