index-CZjiVl8-.js 4.2 KB

123
  1. import{ag as v,bs as I,aQ as U,af as j,A as N,E as W,G as $,b as E,_ as w,z,bt as K,b4 as O,d as f,J as G,ae as J,aS as Q,bD as k,ah as X,ai as C,aj as x,ak as V,al as M,am as u,an as F,at as Y,ap as _,aP as Z,aA as R,bz as q,aW as B,aY as H,aZ as ee,aX as te,bB as ae,bE as se,bA as ne,aw as ie}from"./index-D68iA7pN.js";import{M as le}from"./index-AOcxwHT9.js";const oe=()=>{const S=v(0),h=I(),{createLineType:D}=h,{currentLineType:T,lineTypeList:p}=U(h),L=v([]),m=j(!1,"Mx_Linetype",async()=>{const t=new N,a=new W;t.setKeyWords("[从文件加载线型(F)/设置全局比例(S)/设置默认比例(R)/修改对象比例(A)]"),t.setDynamicInputType($.kNoInput);const i=E.getCurrentMxCAD(),n=await t.go();if(n==="F"&&m.showDialog(!0,T.value),n==="S"){if(a.setMessage(w("LinearManagerDialog_LTSCALE",`输入比例<${i.getSysVarDouble("LTSCALE")}>`)),!await a.go())return;i.setSysVarDouble("LTSCALE",a.value())}if(n==="R"){if(a.setMessage(w("LinearManagerDialog_CELTSCALE",`输入比例<${i.getSysVarDouble("CELTSCALE")}>`)),!await a.go())return;i.setSysVarDouble("CELTSCALE",a.value())}if(n==="A"){const o=await z.userSelect(`
  2. 选择修改线型比例的对象`),s=[];if(o.forEach(r=>{if(r.type===K.kMxCAD){const e=r.getMcDbEntity();e&&s.push(e)}}),s.length===0||(a.setMessage(w("LinearManagerDialog_Object_lineType",`输入比例<${s[0].linetypeScale}>`)),!await a.go()))return;s.forEach(r=>{r.linetypeScale=a.value()})}}),y=v("");return{lineTypeList:L,createLineType:D,index:S,filePath:y,parseTextLineTypes:t=>{const a=t.split(`
  3. `),i=[];let n=null;for(let o=0;o<a.length;o++){const s=a[o].trim();if(s.startsWith("*")){n&&i.push(n);const r=s.split(","),e=r[0].slice(1).trim(),c=r.slice(1).join(",").trim(),l=a[o+1].trim().replace(/^A,/,"");n=D({name:e,appearance:c,explain:c,value:l}),o+=1}}return n&&i.push(n),i},addLineType:async t=>{let a=!1;const i=E.getCurrentMxCAD(),n=i.database.getLinetypeTable().get(t.name);if(n.isErase())a=!0;else{if(!await new Promise(e=>{O().open({title:"MxCAD",text:f("183")+" "+t.name+f("764")+","+f("765"),cancelTitle:f("141"),defineTitle:f("140"),cancel:()=>{e(!1)},define:()=>{e(!0)}})}))return;n.erase()}if(!i.addLinetypeEx(t.name,t.value||"","").isValid()){G().error(f("183")+":"+t.name+f("766")+"!");return}a&&p.value.push(t);const s=p.value.find(({name:r})=>t.name===r);s&&(s.value=t.value,s.explain=s.appearance=t.appearance),T.value=s||t},...m}},re={class:"d-flex algin-center mt-3"},ce={class:"mt-2"},ue={class:"w-100"},pe={class:"w-100"},de={class:"text-left"},fe={class:"text-left"},me={class:"w-100"},ye=["onClick"],ge={class:"text-left"},_e={class:"text-left"},Le=J({__name:"index",emits:["change"],setup(S,{expose:h,emit:D}){const{createLineType:T,lineTypeList:p,showDialog:L,isShow:m,index:y,filePath:g,parseTextLineTypes:b,addLineType:t,onReveal:a}=oe(),i=()=>{t(p.value[y.value]),L(!1)},n=[{name:"确定",fun:i,primary:!0},{name:"取消",fun:()=>L(!1)}],o=v(),s=()=>{o.value&&o.value.click()},r=async e=>{const l=e.target.files;if(!l)return;const d=l[0],A=await se(d),P=await k(A);p.value=b(P),g.value=d.name};return Q(async()=>{const e=new URL(""+new URL("mx-CeEsFOMF.lin",import.meta.url).href,import.meta.url).href,l=await(await fetch(e)).blob(),d=await k(l);g.value=e,p.value=b(d)}),a(e=>{y.value=p.value.findIndex(({name:c})=>e.name===c)}),h({showDialog:L}),(e,c)=>(M(),X(le,{title:e.t("606"),"max-width":"600",modelValue:x(m),"onUpdate:modelValue":c[1]||(c[1]=l=>V(m)?m.value=l:null),footerBtnList:n},{default:C(()=>[u("div",re,[F(Z,{onClick:s,class:"ml-1"},{default:C(()=>[Y(_(e.t("203"))+"(F)...",1)]),_:1}),R(u("input",{class:"form__inset w-100",disabled:!0,"onUpdate:modelValue":c[0]||(c[0]=l=>V(g)?g.value=l:null)},null,512),[[q,x(g)]])]),u("input",{type:"file",ref_key:"fillSelectEl",ref:o,onChange:r,style:{display:"none"},accept:".lin"},null,544),u("div",ce,[u("p",null,_(e.t("607")),1),F(ae,{class:"w-100",cellpadding:"20",height:"300"},{default:C(()=>[u("thead",ue,[u("tr",pe,[u("th",de,_(e.t("183")),1),u("th",fe,_(e.t("151")),1)])]),u("tbody",me,[(M(!0),B(te,null,H(x(p),(l,d)=>R((M(),B("tr",{key:l.id,class:ee(x(y)===d?"active":""),onClick:A=>y.value=d,onDblclick:i},[u("td",ge,_(l.name),1),u("td",_e,_(l.appearance),1)],42,ye)),[[ne]])),128))])]),_:1})])]),_:1},8,["title","modelValue"]))}}),ve=ie(Le,[["__scopeId","data-v-0878c23d"]]);export{ve as default};