1 |
- import{M as C}from"./index-AOcxwHT9.js";import{u as U}from"./hooks-oYkL7aVN.js";import{T as k}from"./TextEllipsis-Csvrxmtg.js";import{ae as D,ag as A,aR as B,ah as c,ai as f,aj as g,a6 as E,a3 as T,ac as F,al as r,am as o,an as p,ap as _,aW as m,aY as R,aO as z,c1 as L,aX as N,bB as P,b5 as j,av as M,aw as X}from"./index-D68iA7pN.js";const H={class:"mt-2"},O={style:{"z-index":"1"}},W={class:"text-center"},Y={class:"text-left"},q={style:{height:"26px"}},G={class:"d-flex justify-center",style:{width:"30px"}},J={key:0,class:"border_box"},K={style:{height:"3px"}},Q=D({__name:"index",setup(Z){const{dialog:l}=U(),n=A([]),x=e=>{if(e===0)return"class:iconfont gou";if(e===1)return"class:iconfont cha"},v=e=>{if(e===0)return"#33CD2A";if(e===1)return"#ff0000"};l.onReveal(e=>{const t=[];e.externalReference.forEach(a=>{t.push({name:a,uploadState:3,progress:0,type:"ref",hash:e.hash})}),e.images.forEach(a=>{t.push({name:a,uploadState:3,progress:0,hash:e.hash,type:"img"})}),n.value=t});const y=()=>{let{baseUrl:e=""}=E()||{};e.substring(0,16)=="http://localhost"&&(e=T()+e.substring(16));const t=document.createElement("input");t.setAttribute("type","file"),t.setAttribute("accept",".dwg,image/*"),t.style.display="none",t.setAttribute("multiple","multiple"),t.setAttribute("capture","camera"),document.body.appendChild(t),t.onchange=()=>{if(!t.files||t.files.length<1)return;const a=Array.from(t.files);n.value.filter(s=>a.some(d=>{if(d.name===s.name)return s.source=d,!0})).forEach(s=>{const{type:d,name:w,source:h,hash:V}=s;s.uploadState=2;const u=new FormData;h&&u.append("file",h),u.append("src_dwgfile_hash",V),u.append("ext_ref_file",w),F({url:e+(d==="img"?"/mxcad/up_ext_reference_image":"/mxcad/up_ext_reference_dwg"),method:"post",headers:{"Content-Type":"multipart/form-data"},data:u,onUploadProgress(i){i.total&&(s.progress=i.loaded/i.total*100,console.log(s.progress))}}).then(i=>{i.data.code===0?(s.uploadState=0,t.remove()):(s.uploadState=1,t.remove())},()=>{s.uploadState=1,t.remove()})})},setTimeout(()=>{t.click()},100)},S=B(()=>n.value.some(e=>e.uploadState===2)),b=[{name:"选择文件",fun:y,disabled:()=>n.value.every(e=>e.uploadState===0)},{name:"取消",fun:()=>{l.cancel(!1),l.showDialog(!1)}},{name:"继续打开文件",fun:()=>{l.confirm(!0),l.showDialog(!1)}}];return(e,t)=>(r(),c(C,{title:e.t("706"),"max-width":"450",modelValue:g(l).isShow.value,"onUpdate:modelValue":t[0]||(t[0]=a=>g(l).isShow.value=a),footerBtnList:b},{default:f(()=>[o("div",H,[p(P,{height:"150",class:"mb-2",hover:!1},{default:f(()=>[o("thead",O,[o("tr",null,[o("th",null,_(e.t("707")),1),o("th",W,_(e.t("708")),1)])]),o("tbody",Y,[(r(!0),m(N,null,R(n.value,(a,s)=>(r(),m("tr",q,[o("td",null,[o("div",G,[a.uploadState!==2?(r(),m("div",J,[p(z,{icon:x(a.uploadState),color:v(a.uploadState),size:"16"},null,8,["icon","color"])])):(r(),c(L,{key:1,rotate:360,size:16,width:2,"model-value":a.progress,color:"teal",indeterminate:a.progress===100},null,8,["model-value","indeterminate"]))])]),o("td",null,[p(k,{class:"text-left",width:285,text:a.name,"slice-num":10},null,8,["text"])])]))),256))])]),_:1}),o("div",K,[S.value?(r(),c(j,{key:0,indeterminate:"",color:"green"})):M("",!0)])])]),_:1},8,["title","modelValue"]))}}),ae=X(Q,[["__scopeId","data-v-f71bd996"]]);export{ae as default};
|