import{r as u,w as k,v as S,e as h}from"./vendor-39c32a1b.js";import{q as J}from"./qiNiu.config-a8af251c.js";import{n as L,g as $}from"./index-8fa791df.js";const E="/svg/upload-img-icon-b49be46a.svg";const j={__name:"LJUploadImages",props:{value:{type:String,default:null},accept:{type:String,default:".jpg,.jpeg,.png,.gif,.bmp,.pdf,.JPG,.JPEG,.PBG,.GIF,.BMP,.PDF"},autoUpload:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0},limit:{type:Number,default:10}},emits:["input"],setup(p,{expose:l,emit:e}){const t=p,n="http://sms.9haoai.com/api/upload_qiniu/",c=u(),m=u(""),f=u(!1),b=u(!1),x=u(J.uploadFileField),r=u(v(t.value));k(()=>r.value,a=>{e("input",_(a))},{deep:!0});function _(a){return a.filter(s=>s.status==="success").map(s=>s.urls).join(",")}function v(a){function s(i){return{name:i,url:i,urls:i,uid:S()}}return a?a.indexOf(",")>-1?a.split(",").map(i=>s(i)):[s(a)]:[]}function C(a){const s=r.value.findIndex(i=>i.uid===a.uid);r.value.splice(s,1)}function F(a){m.value=a.url,f.value=!0}function U(a){function s(i,o){let d=document.createElement("a");d.download=o,d.href=i,d.click(),d.remove()}s(a.url,a.name)}function w(a,s,i){r.value=i,r.value.filter(o=>o.status==="success"&&!o.urls).map(o=>{o.urls=o.response.data})}function y(){h.exports.Message({type:"error",message:"\u4E0A\u4F20\u5931\u8D25",offset:"20px"})}function I(a){h.exports.Message.warning(`\u5F53\u524D\u9650\u5236\u9009\u62E9 ${t.limit} \u4E2A\u6587\u4EF6\uFF0C\u672C\u6B21\u9009\u62E9\u4E86 ${a.length} \u4E2A\u6587\u4EF6`)}function g(){c.value.clearFiles()}function P(){return{Authorization:"token "+$("token")}}return l({clearFiles:g}),{__sfc:!0,uploadUrl:n,emits:e,props:t,LJUploadImagesRef:c,dialogImageUrl:m,dialogVisible:f,disabled:b,uploadFileNameField:x,modelFiles:r,formatValueStr:_,formatValueArray:v,handleRemove:C,handlePictureCardPreview:F,handleDownload:U,handleUploadSuccess:w,handleError:y,handleExceed:I,clearFiles:g,setHeaders:P}}};var R=function(){var l=this,e=l._self._c,t=l._self._setupProxy;return e("div",{staticClass:"lj-upload-images"},[e("el-upload",{ref:"LJUploadImagesRef",attrs:{"list-type":"picture-card",accept:l.accept,headers:t.setHeaders(),name:t.uploadFileNameField,"file-list":t.modelFiles,action:t.uploadUrl,"auto-upload":l.autoUpload,"on-success":t.handleUploadSuccess,"on-error":t.handleError,"on-exceed":t.handleExceed,multiple:l.multiple,limit:l.limit},scopedSlots:l._u([{key:"file",fn:function({file:n}){return e("div",{},[e("img",{staticClass:"el-upload-list__item-thumbnail",attrs:{src:n.url,alt:""}}),e("span",{staticClass:"el-upload-list__item-actions"},[e("span",{staticClass:"el-upload-list__item-preview",on:{click:function(c){return t.handlePictureCardPreview(n)}}},[e("i",{staticClass:"el-icon-zoom-in"})]),t.disabled?l._e():e("span",{staticClass:"el-upload-list__item-delete",on:{click:function(c){return t.handleDownload(n)}}},[e("i",{staticClass:"el-icon-download"})]),t.disabled?l._e():e("span",{staticClass:"el-upload-list__item-delete",on:{click:function(c){return t.handleRemove(n)}}},[e("i",{staticClass:"el-icon-delete"})])])])}}])},[e("div",{staticClass:"tip",attrs:{slot:"tip"},slot:"tip"},[l._v(" \u9009\u62E9"+l._s(l.accept!=="."?l.accept:"")+"\u6587\u4EF6 ")]),e("div",{staticClass:"uploadFile"},[e("img",{staticStyle:{transform:"translateY(-30%)","margin-top":"32px"},attrs:{src:E}})])]),e("el-dialog",{attrs:{visible:t.dialogVisible,top:"20px"},on:{"update:visible":function(n){t.dialogVisible=n}}},[e("img",{attrs:{width:"100%",src:t.dialogImageUrl,alt:""}})])],1)},V=[],q=L(j,R,V,!1,null,"1506131b",null,null);const z=q.exports;export{z as L};
