index.d930afe0.js 4.2 KB

1
  1. import{M as U}from"./index.a696a3d7.js";import{d as V,C as S,o as u,X as c,a as o,t as g,b9 as E,a0 as F,n as z,_ as k,c$ as A,r as N,c as y,w as b,b as v,Y as T,S as $,d0 as M,bQ as L,k as R,e as C,p as P,m as I,ck as W,d1 as X,d2 as j}from"./index.6c36cb53.js";import{V as H}from"./VTable.c59a0e01.js";const O={key:0,className:"mx_text_parent_main"},Q={class:"mx_text_next_span"},Y=V({__name:"TextEllipsis",props:{text:{},width:{default:100},size:{},family:{},sliceNum:{default:6}},setup(r){const n=document.body.currentStyle||document.defaultView.getComputedStyle(document.body,""),i=parseInt(n.fontSize),_=parseInt(n.fontFamily);function f(l){const e=document.createElement("canvas").getContext("2d");e.font=`${r.size||i}px ${r.family||_}`;const a=e.measureText(l),s=Math.abs(a.actualBoundingBoxLeft)+Math.abs(a.actualBoundingBoxRight);return Math.max(a.width,s)}const p=S(()=>f(r.text)),x=S(()=>p.value>r.width);return(l,t)=>(u(),c("div",{class:"mx_text_parent",style:E({width:l.width+"px"})},[x.value?(u(),c("div",O,[o("span",{class:"mx_text_prev_span",style:E({width:p.value})},g(l.text.slice(0,-l.sliceNum)),5),o("span",Q,g(l.text.slice(-l.sliceNum)),1)])):(u(),c(F,{key:1},[z(g(l.text),1)],64))],4))}});const q=k(Y,[["__scopeId","data-v-66f61507"]]),G=r=>(P("data-v-0698232a"),r=r(),I(),r),J={class:"mt-2"},K=G(()=>o("thead",{style:{"z-index":"1"}},[o("tr",null,[o("th",null,"\u72B6\u6001"),o("th",{class:"text-center"},"\u6587\u4EF6\u540D")])],-1)),Z={class:"text-left"},ee={style:{height:"26px"}},te={class:"d-flex justify-center",style:{width:"30px"}},ae={key:0,class:"border_box"},se={style:{height:"3px"}},oe=V({__name:"index",setup(r){const{dialog:n}=A(),i=N([]),_=t=>{if(t===0)return"class:iconfont gou";if(t===1)return"class:iconfont cha"},f=t=>{if(t===0)return"#33CD2A";if(t===1)return"#ff0000"};n.onReveal(t=>{const e=[];t.externalReference.forEach(a=>{e.push({name:a,uploadState:3,progress:0,type:"ref",hash:t.hash})}),t.images.forEach(a=>{e.push({name:a,uploadState:3,progress:0,hash:t.hash,type:"img"})}),i.value=e});const p=()=>{let{baseUrl:t=""}=W()||{};t.substring(0,16)=="http://localhost"&&(t=X()+t.substring(16));const e=document.createElement("input");e.setAttribute("type","file"),e.setAttribute("accept",".dwg,image/*"),e.style.display="none",e.setAttribute("multiple","multiple"),e.setAttribute("capture","camera"),document.body.appendChild(e),e.onchange=()=>{if(!e.files||e.files.length<1)return;const a=Array.from(e.files);i.value.filter(s=>a.some(m=>{if(m.name===s.name)return s.source=m,!0})).forEach(s=>{const{type:m,name:D,source:w,hash:B}=s;s.uploadState=2;const h=new FormData;w&&h.append("file",w),h.append("src_dwgfile_hash",B),h.append("ext_ref_file",D),j({url:t+(m==="img"?"/mxcad/up_ext_reference_image":"/mxcad/up_ext_reference_dwg"),method:"post",headers:{"Content-Type":"multipart/form-data"},data:h,onUploadProgress(d){!d.total||(s.progress=d.loaded/d.total*100,console.log(s.progress))}}).then(d=>{d.data.code===0?(s.uploadState=0,e.remove()):(s.uploadState=1,e.remove())},()=>{s.uploadState=1,e.remove()})})},setTimeout(()=>{e.click()},100)},x=S(()=>i.value.some(t=>t.uploadState===2)),l=[{name:"\u9009\u62E9\u6587\u4EF6",fun:p,disabled:()=>i.value.every(t=>t.uploadState===0)},{name:"\u53D6\u6D88",fun:()=>{n.cancel(!1),n.showDialog(!1)}},{name:"\u7EE7\u7EED\u6253\u5F00\u6587\u4EF6",fun:()=>{n.confirm(!0),n.showDialog(!1)}}];return(t,e)=>(u(),y(U,{title:"\u9009\u62E9\u4E0A\u4F20\u5916\u90E8\u53C2\u7167\u6587\u4EF6","max-width":"450",modelValue:C(n).isShow.value,"onUpdate:modelValue":e[0]||(e[0]=a=>C(n).isShow.value=a),footerBtnList:l},{default:b(()=>[o("div",J,[v(H,{height:"150",class:"mb-2",hover:!1},{default:b(()=>[K,o("tbody",Z,[(u(!0),c(F,null,T(i.value,(a,s)=>(u(),c("tr",ee,[o("td",null,[o("div",te,[a.uploadState!==2?(u(),c("div",ae,[v($,{icon:_(a.uploadState),color:f(a.uploadState),size:"16"},null,8,["icon","color"])])):(u(),y(M,{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,[v(q,{class:"text-left",width:285,text:a.name,"slice-num":10},null,8,["text"])])]))),256))])]),_:1}),o("div",se,[x.value?(u(),y(L,{key:0,indeterminate:"",color:"green"})):R("",!0)])])]),_:1},8,["modelValue"]))}});const ue=k(oe,[["__scopeId","data-v-0698232a"]]);export{ue as default};