123456 |
- import{bo as Le,aQ as Se,bp as pe,bq as Ne,br as ve,B as Ae,bs as Ee,e as m,z as L,bt as oe,h as X,b as ce,bu as be,k as Ve,v as Z,A as he,O as Ce,p as Te,aL as Ie,bv as Ke,c as Pe,b1 as je,ae as Ue,ag as G,af as We,a$ as Re,aR as $e,aW as b,an as h,ai as E,aj as u,ak as Oe,aX as ue,bw as Be,bx as we,al as g,am as r,aY as _e,aA as w,ah as de,ap as v,b6 as ee,au as ze,aO as U,at as W,aZ as Fe,by as xe,av as He,bz as Ye,bA as V,a_ as qe,bB as Je,ar as Qe,bC as Xe,aw as Ze}from"./index-D68iA7pN.js";import{M as Ge}from"./index-AOcxwHT9.js";import et from"./index-zOzy80IM.js";import{u as ke}from"./hooks-Bm-hi6ta.js";const De=Le(),{add:tt,remove:te,putCurrent:ye,toggle:nt,setValue:_,setIndex:T,getIndex:Me,stringifyJSON:st,create:Rt,initLayerList:at,setLayerList:lt,recoveryLayerStateHistory:it}=De,{index:c,list:f,currentLayer:rt,rootId:fe}=Se(De),ot=({onAddLayer:ne})=>{const S=pe("Shift"),P=pe("Control"),x=()=>Array.isArray(c.value)&&c.value.length>1,se=(e,s,...n)=>{const[t,a,l]=n;if(S.value||P.value)return e.preventDefault();if(!s.isSelect)return _(t,a,l);if(x())return e.stopPropagation(),_(t,a),!1;_(t,a,l)};let D;const R=(e,s)=>{if(s&&s.target&&O(s.target),S.value){typeof D>"u"&&(D=c.value);const n=Math.max(D,e);T(Ke(n===e?D:e,n));return}if(P.value){let n=[];if(Array.isArray(c.value)){const t=c.value.indexOf(e);t>=0&&c.value.length>1?(n=[...c.value],n.splice(t,1)):n=[...c.value,e]}else n=[c.value,e];T(n);return}T(e),D=e,j()},ae=(e,s)=>{(!x()||!f.value[e].isSelect)&&R(e,s)};let N;const j=()=>{Array.isArray(c.value)?N=c.value[c.value.length-1]:N=c.value},$=()=>{ne&&ne(tt()),S&&(D=f.value.length-1)};let A;const O=e=>{if(e)if(e.tagName==="INPUT")A=e;else{let n=e?.getElementsByTagName("input")[0];n?A=n:O(e.parentNode)}},B=e=>{const s=Me();if(Array.isArray(s)&&s.length>1)return;const n=Array.isArray(s)?s[0]:s;rt.value!==f.value[n]&&f.value[n].id!==fe.value&&e&&setTimeout(()=>{e.focus(),e.select()})},le=(e,s)=>{A=e.target,c.value===s&&B(A)},ie=()=>{N&&T(N),N=void 0},ge=()=>{T(f.value.map((e,s)=>s))},me=()=>{T([]),j()},z=()=>{const e=Array.isArray(c.value)?c.value:[c.value];let s=[];j(),nt("isSelect",f.value.map((n,t)=>(e.includes(t)||s.push(t),t))),c.value=s},I=Ne({hasIcon:!0,iconType:"svg-icon",menuList:[{label:"置为当前",fn:()=>ye(void 0,!0),disabled:x},{label:"新建图层",fn:()=>$()},{label:"删除",fn:()=>te(),disabled:()=>{if(x())return!1;let e=Me(c.value);return e=typeof e=="number"?e:e[0],f.value[e]?.id===fe.value},icon:ve("youjianshanchu")},{label:"重命名",tips:"F2",fn:()=>B(A),disabled:x,icon:ve("youjianzhongmingming")},{line:!0},{label:"全部选择",fn:()=>ge()},{label:"全部清除",fn:()=>me()},{label:"反转选择",fn:()=>z()}]}),{createColor:F}=Ae(),H=e=>{Pe("Mx_Color",{call:(s,n)=>{_("color",F({...je(s,n)}),c)},color:e})};Ee();const re=e=>{_("lineType",e,c)};let K=!1;const Y=e=>{e=typeof e=="boolean"?e:K,_("visible",e,f.value.map((s,n)=>n)),K=!e,J[3].name=K?"开启所有图层":"关闭所有图层"};m("_OpenAllLayer",()=>{Y(!0),i()}),m("_SelOffLayer",async()=>{const e=await L.userSelect("选择需要关闭图层的实体"),s=new Set;e.forEach(n=>{if(n.type===oe.kMxCAD){const t=n.getMcDbEntity();if(!t)return;const a=f.value.findIndex(({name:l})=>l===t.layer);a>=0&&s.add(a)}}),_("visible",!1,Array.from(s)),i()}),m("_layer_recovery",it),m("_layer_putCurrent",async()=>{const e=new X;e.setMessage("选择将使其图层将成为当前图层的对象");const s=await e.go();if(!s||!s.isValid())return;const n=s.getMcDbEntity();if(!n)return;const t=f.value.findIndex(({name:a})=>n.layer===a);t<0||ye(t)});const k=async e=>{const{dialog:s}=ke();s.showDialog(!0,e);try{return await new Promise((n,t)=>{s.onConfirm(n),s.onCancel(t)})}catch{return[""]}};m("_layer_matching",async()=>{const e=await L.userSelect("选择需要修改图层的对象"),s=new X;s.setMessage("选择匹配图层的对象"),s.setKeyWords("[名称(N)]");const n=await s.go();let t="";if(s.isKeyWordPicked("N")){const{dialog:a}=ke();a.showDialog(!0);try{t=(await k())[0]}catch{return}}else{if(!n||!n.isValid())return;const a=n.getMcDbEntity();if(!a)return;t=a.layer}t!==""&&(e.forEach(a=>{const l=a.getMcDbEntity();l&&(l.layer=t)}),ce.getCurrentMxCAD().updateDisplay())}),m("_layer_setEntToCurrentLayer",async()=>{const e=await L.userSelect("选择需要修改图层的对象"),s=be().getCurrentlyLayerName();e.forEach(n=>{const t=n.getMcDbEntity();t&&(t.layer=s)}),ce.getCurrentMxCAD().updateDisplay()}),m("_layer_CopyObjectsToNewLayer",async()=>{const e=await L.userSelect("选择要复制的对象"),s=new X;s.setMessage("选择目标图层上的对象"),s.setKeyWords("[名称(N)]");const n=await s.go();let t="";if(s.isKeyWordPicked("N"))t=(await k())[0];else{if(!n||!n.isValid())return;const M=n.getMcDbEntity();if(!M)return;t=M.layer}const a=new Ve;a.setMessage("指定基点");let l=await a.go();if(!l)return;a.setMessage("指定位移的第二个点"),a.setUserDraw((M,d)=>{e.forEach(y=>{if(!l)return;const o=y.clone();o&&(o.layer=t,o.move(l,M),d.drawMcDbEntity(o))})});let C=await a.go();e.forEach(M=>{if(!l||!C)return;const d=M.clone();if(!d)return;d.move(l,C);const o=ce.getCurrentMxCAD().drawEntity(d).getMcDbEntity();o&&(o.layer=t)})}),m("_layer_freeze",async()=>{const e=await L.userSelect("选择需要冻结图层的对象"),s=new Set;e.forEach(n=>{if(n.type===oe.kMxCAD){const t=n.getMcDbEntity();if(!t)return;const a=f.value.findIndex(({name:l})=>l===t.layer);a>=0&&s.add(a)}}),_("freeze",!0,Array.from(s),!0)}),m("_layer_thawedAll",()=>{_("freeze",!1,f.value.map((e,s)=>s),!0)});const q=async e=>{const s=await L.userSelect(`选择需要${e?"锁定":"解锁"}图层的对象`),n=new Set;s.forEach(t=>{if(t.type===oe.kMxCAD){const a=t.getMcDbEntity();if(!a)return;const l=f.value.findIndex(({name:C})=>C===a.layer);l>=0&&n.add(l)}}),_("lock",e,Array.from(n),!0)};m("_layer_lock",()=>q(!0)),m("_layer_unlock",()=>q(!1)),m("_layer_combined",async()=>{let e,s=await L.userSelect("选择要合并的图层上的对象",null,async(d,y)=>{e=y,y.setKeyWords("[命名(N)]")}),n=[];if(console.log(s),e&&e.isKeyWordPicked("N"))n=await k({isMultiple:!0});else if(s){const d=new Set;s.forEach(y=>{const o=y.getMcDbEntity();o&&d.add(o.layer)}),n=Array.from(d)}if(n.length>0&&n[0]==="")return;Z.acutPrintf(`
- 选定的图层:`+n.join(","));const t=new X;t.setMessage("选择目标图层上的对象"),t.setKeyWords("名称(N)");const a=await t.go();let l="";if(t.isKeyWordPicked("N"))l=(await k())[0];else{if(!a||!a.isValid())return;const d=a.getMcDbEntity();if(!d)return;l=d.layer}Z.acutPrintf(`
- 将要把`+n.length+'个图层合并到图层"'+l+'"中。');const C=new he;if(C.setMessage("是否继续?"),C.setKeyWords("[是(Y)/否(N)]"),(await C.go())?.toLocaleUpperCase()==="Y"){const d=new Ce;d.allSelect(),d.forEach(o=>{const p=o.getMcDbEntity();p&&n.includes(p.layer)&&(p.layer=l)});const y=n.map(o=>f.value.findIndex(p=>p.name===o));te(y),i()}}),m("_layer_remove",async()=>{let e,s=await L.userSelect("选择要合并的图层上的对象",null,async(y,o)=>{e=o,o.setKeyWords("[命名(N)]")}),n=[];if(e&&e.isKeyWordPicked("N"))n=await k({isMultiple:!0});else if(s){const y=new Set;s.forEach(o=>{const p=o.getMcDbEntity();p&&y.add(p.layer)}),n=Array.from(y)}if(n.length>0&&n[0]==="")return;const t=new he;t.setMessage("删除图层上的对象"),t.setKeyWords("[删除(D)/不删除对象改为当前图层(C)]");const a=await t.go();if(t.getStatus()===Te.kCancel)return;const l=a?.toLocaleUpperCase()==="D",C=be().getCurrentlyLayerName(),M=n.map(y=>f.value.findIndex(o=>o.name===y)),d=te(M);if(i(),!d)Z.acutPrintf(`删除图层失败
- 命令`);else{const y=new Ce;y.allSelect();const o=d.map(({name:p})=>p);y.forEach(p=>{const Q=p.getMcDbEntity();Q&&o.includes(Q.layer)&&(l?Q.erase():Q.layer=C)}),Z.acutPrintf(`
- 已删除的图层:`+o.join(",")+`"
- 命令`)}});const J=Ie([{name:"新增图层",fun:()=>{$()}},{name:"删除图层",fun:()=>te()},{name:"置为当前",fun:()=>ye()},{name:"关闭所有图层",fun:()=>Y()}]),i=()=>{lt(st())};return{onClickLayer:R,onClickStopTD:se,onClickLayerName:le,resumeIndex:ie,reverseSelection:z,selectColor:H,selectLineType:re,setIndex:T,onRightClickLayer:ae,initLayerList:at,setLayerList:i,list:f,bodyRightClickMenuOptions:I,isShiftKeyMultipleChoice:S,isCtrlKeyMultipleChoice:P,btnList:J,rootId:fe}},ct={class:"d-flex align-center"},ut={class:"d-flex align-center my-2"},dt={class:"w-100",style:{"z-index":"1"}},yt={class:"w-100"},ft={class:"w-20"},gt={class:""},mt={class:""},pt={class:""},vt={class:"w-20"},bt={class:"w-20"},ht={class:"w-100",ref:"tbody"},Ct=["id","onClick","onContextmenu"],wt={class:"text-no-wrap"},_t={style:{width:"18px"},class:"d-inline-block"},xt=["for"],kt=["disabled","id","onClick","onUpdate:modelValue"],Mt=["onClick"],Dt=["onClick"],Lt=["onClick"],St=["onClick"],Nt=["onClick"],At={class:"w-100 my-3",cellpadding:"20"},Et={class:"w-100"},Vt={class:"w-100"},Tt={class:"w-auto px-6"},It={class:"d-flex justify-end w-auto"},Kt=Ue({__name:"index",setup(ne){const S=G(),{onClickLayer:P,onClickStopTD:x,onClickLayerName:se,resumeIndex:D,reverseSelection:R,selectColor:ae,selectLineType:N,setIndex:j,onRightClickLayer:$,initLayerList:A,setLayerList:O,list:B,bodyRightClickMenuOptions:le,btnList:ie,isShiftKeyMultipleChoice:ge,isCtrlKeyMultipleChoice:me,rootId:z}=ot({onAddLayer(){const e=(S.value?.$el).getElementsByClassName("v-table__wrapper")[0];Be(()=>{e.scrollTo({top:e.scrollHeight-e.clientHeight,behavior:"smooth"})})}}),{isShow:I,showDialog:F}=We(!1,"MxLayerManager");Re(I,i=>{i&&A()});const H=G([]),re=i=>{const{map:e}=i(H.value,(s,n)=>n);e.length>0&&j(e)},K=G(),Y=i=>{K.value?.showDialog(!0,i)},k=G(""),q=Xe(i=>{i===null&&(i=""),k.value=i},500),J=$e(()=>B.value.filter(i=>i.name.toLowerCase().includes(k.value.toLowerCase())));return(i,e)=>{const s=we("box-selection"),n=we("right-click-menu");return g(),b(ue,null,[h(Ge,{maxWidth:"800",ref:"layerDialog",modelValue:u(I),"onUpdate:modelValue":e[4]||(e[4]=t=>Oe(I)?I.value=t:null),title:i.t("598")},{actions:E(()=>e[9]||(e[9]=[r("div",{class:"mt-1"},null,-1)])),default:E(()=>[r("div",ct,[r("div",ut,[(g(!0),b(ue,null,_e(u(ie),(t,a)=>w((g(),de(ee,{onClick:t.fun,ripple:!1,class:"mx-2 px-2 bg-undertint-bg",variant:"text",key:t.name+a,textContent:v(i.t(t.name))},null,8,["onClick","textContent"])),[[V,void 0,void 0,{center:!0}]])),128))]),h(ze,{"model-values":k.value,"onUpdate:modelValue":u(q),class:"pa-1 rounded bg-undertint-bg",clearable:"",density:"compact",label:i.t("63"),variant:"solo","hide-details":"","single-line":""},{"append-inner":E(()=>[h(U,{icon:"$mdi-magnify",class:"v-icon--clickable"})]),_:1},8,["model-values","onUpdate:modelValue","label"])]),w((g(),de(u(Je),{class:"w-100 layer-table",height:"300",ref_key:"boxRef",ref:S,onClick:e[0]||(e[0]=t=>u(D)())},{default:E(()=>[r("thead",dt,[r("tr",yt,[r("th",ft,[e[5]||(e[5]=r("div",{style:{width:"10px"},class:"d-inline-block"},null,-1)),e[6]||(e[6]=W()),r("span",null,v(i.t("117")+i.t("138")),1)]),r("th",gt,v(i.t("152")),1),r("th",mt,v(i.t("153")),1),r("th",pt,v(i.t("154")),1),r("th",vt,v(i.t("155")),1),r("th",bt,v(i.t("156")),1)])]),w((g(),b("tbody",ht,[(g(!0),b(ue,null,_e(J.value,(t,a)=>(g(),b("tr",{class:Fe(["text-center layer-info",t.isSelect?"active":""]),ref_for:!0,ref_key:"refItems",ref:H,key:t.id,id:t.id.toString(),onClick:xe(l=>u(P)(a),["prevent"]),onContextmenu:xe(l=>u($)(a,l),["prevent"])},[w((g(),b("td",wt,[r("div",_t,[t.status?(g(),de(U,{key:0,icon:"class:iconfont gou",size:"x-small",color:"#16FD21"})):He("",!0)]),r("label",{class:"d-inline-block",for:t.id.toString()},[w(r("input",{disabled:t.id===u(z),id:t.id.toString(),class:"text-truncate text-center",type:"text",onClick:l=>u(se)(l,a),"onUpdate:modelValue":l=>t.name=l},null,8,kt),[[Ye,t.name]])],8,xt)])),[[V]]),w((g(),b("td",{class:"text-orange",onClick:l=>u(x)(l,t,"visible",!t.visible,a)},[h(U,{icon:t.visible?"yanjing1":"yanjing"},null,8,["icon"])],8,Mt)),[[V,void 0,void 0,{prevent:!0}]]),w((g(),b("td",{class:"text-orange",onClick:l=>u(x)(l,t,"lock",!t.lock,a)},[h(U,{icon:t.lock?"suo":"jiesuo1"},null,8,["icon"])],8,Dt)),[[V]]),w((g(),b("td",{onClick:l=>u(x)(l,t,"print",!t.print,a)},[h(U,{icon:t.print?"dayin":"budayinbiaoqian"},null,8,["icon"])],8,Lt)),[[V]]),w((g(),b("td",{class:"d-flex align-center justify-center",onClick:l=>u(ae)(t.color)},[r("div",{class:"colorBox mr-2",style:qe({background:`${t.color.color}`})},null,4),r("span",null,v(i.t(t.color.name)),1)],8,St)),[[V]]),w((g(),b("td",{class:"w-20 text-truncate",onClick:l=>Y(t.lineType)},[W(v(t.lineType.name),1)],8,Nt)),[[V]])],42,Ct))),128))])),[[s,re]])]),_:1})),[[n,u(le)]]),h(Qe,{color:"#576375",class:"border-opacity-75"}),r("table",At,[r("thead",Et,[r("tr",Vt,[e[7]||(e[7]=r("th",{class:"w-20"},null,-1)),r("th",Tt,[h(ee,{class:"bg-undertint-bg","min-width":"76",onClick:e[1]||(e[1]=t=>u(R)())},{default:E(()=>[W(v(i.t("157")),1)]),_:1})]),e[8]||(e[8]=r("th",{class:"w-50"},null,-1)),r("th",It,[h(ee,{class:"bg-light-blue-darken-1","min-width":"76",onClick:e[2]||(e[2]=t=>(u(O)(),u(F)(!1)))},{default:E(()=>[W(v(i.t("158")),1)]),_:1}),h(ee,{class:"ml-10 mr-6 bg-undertint-bg","min-width":"76",onClick:e[3]||(e[3]=t=>u(F)())},{default:E(()=>[W(v(i.t("159")),1)]),_:1})])])])])]),_:1},8,["modelValue","title"]),h(et,{ref_key:"linearManager",ref:K,onChange:u(N)},null,8,["onChange"])],64)}}}),$t=Ze(Kt,[["__scopeId","data-v-7247afc1"]]);export{$t as default};
|