ss-component-new 1.2.7 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{animationData-CMKGpOzN.js → animationData-1jRSDcwE.js} +3 -3
- package/dist/{animationData-CjOlng3t.cjs → animationData-BQdcO65E.cjs} +1 -1
- package/dist/{array-zuPH84bL.js → array-BivICFct.js} +1 -1
- package/dist/{index-PBT5kNaR.cjs → index-1vs_3Pz3.cjs} +1 -1
- package/dist/{index-BnNuMzEv.js → index-B--6DX0M.js} +1 -1
- package/dist/{index-B_HoaLPL.js → index-B1NmIRwn.js} +2 -2
- package/dist/index-BBVbSXk-.cjs +1 -0
- package/dist/{index-CXchqN8w.js → index-BDVOKqI5.js} +5 -5
- package/dist/{index-CW99kzgY.cjs → index-BFl4mw2K.cjs} +1 -1
- package/dist/{index-D46pfmEc.js → index-BM6YLczV.js} +7 -7
- package/dist/index-BSa3xW1H.js +158 -0
- package/dist/{index-BoHTgzWr.js → index-BWECkG4C.js} +5 -5
- package/dist/{index-CkCmJLPU.js → index-BkrJ0cBf.js} +2 -2
- package/dist/{index-IknA4u4L.js → index-BlZXanJX.js} +1 -1
- package/dist/{index-Cia5yg2S.cjs → index-BsPQl6nI.cjs} +1 -1
- package/dist/{index-k3lVcyGc.cjs → index-BxftyAcm.cjs} +1 -1
- package/dist/{index-W6FccWpW.js → index-C9gh-jny.js} +38 -37
- package/dist/{index-d3F4mRMM.js → index-CA-edgmV.js} +1 -1
- package/dist/{index-DxukQK2k.cjs → index-CIv0zRrQ.cjs} +1 -1
- package/dist/{index-Ah-8x9yf.js → index-CVfC3cyK.js} +2 -2
- package/dist/{index-C2WJz0OJ.cjs → index-C_MIoNOd.cjs} +1 -1
- package/dist/{index-UDddsXT4.js → index-CgtkRkQ3.js} +1 -1
- package/dist/{index-MqvNXMd6.js → index-Ci_C9h8v.js} +1 -1
- package/dist/{index-Br5wm1ow.js → index-CxbH4zmS.js} +1 -1
- package/dist/{index-Czw_p2Ax.cjs → index-Cyk0Tzhx.cjs} +1 -1
- package/dist/{index-CQzgMbjC.js → index-D732VV-0.js} +2 -2
- package/dist/{index-B5Qn4jv8.js → index-D9wa1LMS.js} +2 -2
- package/dist/{index-sBAb1SLC.js → index-DGE2awa5.js} +1 -1
- package/dist/{index-1aEh3d97.cjs → index-DNm5s2Lm.cjs} +1 -1
- package/dist/{index-BhLnI2fF.cjs → index-DW7I4GY6.cjs} +1 -1
- package/dist/{index-BniAk5Lo.js → index-DWfuOOVD.js} +18 -18
- package/dist/{index-B3bZrnX5.cjs → index-DbisH6iI.cjs} +1 -1
- package/dist/{index-CJW7oNUN.js → index-Dcd9HZXq.js} +2 -2
- package/dist/index-DdFUblTC.cjs +1 -0
- package/dist/{index-HZr3I0-O.js → index-Dfhvay-Y.js} +5 -5
- package/dist/{index-Dx63Z3PG.cjs → index-Djagy2ww.cjs} +1 -1
- package/dist/{index-Dv_9EftF.cjs → index-L3WHrdzB.cjs} +1 -1
- package/dist/{index-CUUjf1P3.js → index-LjRfbvxs.js} +10 -10
- package/dist/index-YMD55UlA.cjs +1 -0
- package/dist/{index-BX3CpqTk.js → index-cA_EynOM.js} +3 -3
- package/dist/{index-CHksmnYA.js → index-fMxLuU_H.js} +1 -1
- package/dist/{index-fnqbVNnP.js → index-fzCcjoGJ.js} +1 -1
- package/dist/{index-DLN_fbq6.js → index-lyUWApVE.js} +48 -32
- package/dist/{index-UuJKyKlu.js → index-pkxiNiXI.js} +2 -2
- package/dist/{index-hseXzBbE.cjs → index-pleSKUL2.cjs} +1 -1
- package/dist/{index-DauH8AzR.cjs → index-sS7-HQlI.cjs} +1 -1
- package/dist/{index-DKHaw4wr.cjs → index-wpD5_HUA.cjs} +1 -1
- package/dist/{index-DDNAWKqD.js → index-y1YK6w8c.js} +5 -5
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DULpc85o.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DkSoLqEi.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-CtqR5lQb.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-B5nxyyO7.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-DuybmJnl.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-BfcynI3w.js} +5 -5
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-C-NVC3BN.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-86_u8ovk.js} +4115 -4103
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang--PcXwjiH.cjs → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-dAkBFPF0.cjs} +14 -14
- package/dist/{index.vue_vue_type_style_index_1_lang-Ck3aGjUr.cjs → index.vue_vue_type_style_index_1_lang-B_ESWhzz.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-Dy1Zc_t-.js → index.vue_vue_type_style_index_1_lang-Bl5IzVKi.js} +2 -2
- package/dist/{index.vue_vue_type_style_index_1_lang-D909xoIu.js → index.vue_vue_type_style_index_1_lang-Bmq_QiXo.js} +2 -2
- package/dist/{main-D6-NZoCw.js → main-CSTH0D6W.js} +4 -4
- package/dist/{main-CSuKoOz4.cjs → main-YbBj49yf.cjs} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.js +10 -10
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +11 -11
- package/dist/{threeModel-CPolYsAh.js → threeModel-Xb9BSJ_k.js} +2 -2
- package/dist/{threeModel-CIXJ7OQA.cjs → threeModel-nbfSsMNt.cjs} +1 -1
- package/dist/{threeSceneView-CUBwHIv3.js → threeSceneView-BLWTfaec.js} +8 -8
- package/dist/{threeSceneView-C_0lI1AI.cjs → threeSceneView-JPxH8xcz.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-D4KdOIxO.cjs → threeSceneViewForCPMPIP-CT63Js8f.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-BHhBMxdP.js → threeSceneViewForCPMPIP-skA3ZWC-.js} +6 -6
- package/dist/{threeViewerHost-Cbz8Cw7s.js → threeViewerHost-Enxz60zh.js} +3 -3
- package/dist/{threeViewerHost-DOwyFQG3.cjs → threeViewerHost-UHWY3q2v.cjs} +1 -1
- package/dist/{useRayCaster-CF6KDZ1R.js → useRayCaster-CQ61IQT5.js} +1 -1
- package/dist/{useRayCaster-CqS7g8Ix.cjs → useRayCaster-CvOiIyjA.cjs} +1 -1
- package/package.json +1 -1
- package/dist/index-B7PZ70Ke.cjs +0 -1
- package/dist/index-BPOERPtt.js +0 -22
- package/dist/index-BQ7is--r.cjs +0 -1
- package/dist/index-Bc20prdj.cjs +0 -1
- package/dist/index-CJXXl1EN.cjs +0 -1
- package/dist/index-DsnxblRp.js +0 -144
- package/dist/index-Kbl8xHWJ.js +0 -24
- package/dist/index-tEinx-qZ.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./three-viewport-gizmo-BV37JzRa.cjs"),pe=require("./OrbitControls-Co_9huz0.cjs"),me=require("./index-BhLnI2fF.cjs"),fe=require("./index.vue_vue_type_style_index_1_lang-Ck3aGjUr.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./index-1z9RrjZc.cjs");function ve(z){let h=null,u=null,d=null,g=null,x=null,P=null,c=null,E=null;const D=1e3/30;let S=0;const b=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;h=new n.Scene,h.background=new n.Color(15790320);const m=z.value;u=new n.PerspectiveCamera(75,m.clientWidth/m.clientHeight,.1,1e4),u.position.set(8,-8,6),u.up.set(0,0,1),u.lookAt(0,0,0),d=new n.WebGLRenderer({antialias:!0,alpha:!0}),d.setSize(m.clientWidth,m.clientHeight),d.localClippingEnabled=!0,d.shadowMap.enabled=!0,d.shadowMap.type=n.PCFSoftShadowMap,d.toneMapping=n.ACESFilmicToneMapping,d.toneMappingExposure=1,d.outputColorSpace=n.SRGBColorSpace,m.appendChild(d.domElement),g=new pe.OrbitControls(u,d.domElement),g.enableDamping=!0,g.dampingFactor=.05,g.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},g.panSpeed=.7,x=new n.Xe(u,d,{container:m,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),x.attachControls(g),f(),C()},t=(m,l)=>{c&&(h.remove(c),c.dispose()),E&&(h.remove(E),E.geometry.dispose(),E.material.dispose());const _=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,_,13421772,14540253),c.rotateX(Math.PI/2),c.position.copy(l),h.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});E=new n.Mesh(B,O),E.position.copy(l),E.position.z-=.01,E.receiveShadow=!0,h.add(E)},p=()=>{if(b.value.length===0)return;const m=new n.Box3;let l=!1;if(b.value.forEach(X=>{if(X.userData.boundingBox)m.union(X.userData.boundingBox),l=!0;else if(X.userData.modelId&&modelBoundingBoxes.has(X.userData.modelId)){const Z=modelBoundingBoxes.get(X.userData.modelId);m.union(Z.box),l=!0}else m.expandByObject(X),l=!0}),!l){console.warn("无法计算包围盒,网格更新失败");return}const _=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(_.x,_.y,_.z),j=Math.max(O*8,50),q=new n.Vector3(B.x,B.y,m.min.z);t(j,q)},f=()=>{const m=new n.AmbientLight(4210752,.6);h.add(m);const l=new n.DirectionalLight(16777215,2);l.position.set(10,10,8),l.castShadow=!0,l.shadow.mapSize.width=4096,l.shadow.mapSize.height=4096,l.shadow.camera.near=.5,l.shadow.camera.far=50,l.shadow.camera.left=-50,l.shadow.camera.right=50,l.shadow.camera.top=50,l.shadow.camera.bottom=-50,h.add(l);const _=new n.DirectionalLight(16777215,.8);_.position.set(-8,-8,6),h.add(_);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),h.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);h.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),h.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),h.add(q)},C=()=>{P=requestAnimationFrame(C),g&&g.update();const m=performance.now(),l=m-S;l<D||(S=m-l%D,d&&h&&u&&d.render(h,u),x&&x.render())},I=m=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(_=>{m[_]&&m[_].dispose&&m[_].dispose()}),m.dispose&&m.dispose()},A=m=>{m==null||m.traverse(l=>{l.geometry&&l.geometry.dispose(),l.material&&(Array.isArray(l.material)?l.material.forEach(_=>{I(_)}):I(l.material))})};return{currentModels:b,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,_=m.clientHeight;u.aspect=l/_,u.updateProjectionMatrix(),d.setSize(l,_),x.update()},fitCameraToAllModels:m=>{if(!u||!g||b.value.length===0)return;const l=new n.Box3;let _=!1;if(b.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),_=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),_=!0}else l.expandByObject(Z),_=!0}),!_){console.warn("无法计算包围盒");return}const B=l.getSize(new n.Vector3),O=l.getCenter(new n.Vector3),q=Math.max(B.x,B.y,B.z)*.8,X=new n.Vector3(O.x+q,O.y-q,O.z+q);u.position.copy(X),u.lookAt(O),g.target.copy(O),g.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:h,camera:u,renderer:d,controls:g,gizmo:x}),clearAllModels:()=>{if(!h)return;b.value.forEach(l=>{h.remove(l),A(l)});const m=[];h.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==E&&m.push(l)}),m.forEach(l=>{h.remove(l),A(l)}),b.value=[],p()},cleanup:()=>{P&&cancelAnimationFrame(P),c&&c.dispose(),E&&(E.geometry.dispose(),E.material.dispose()),d&&d.dispose(),g&&g.dispose(),x&&x.dispose()},updateGridForModels:p}}function he(z,h){const u=e.ref(!1);let d=null,g=12700,x=new n.Vector3,P=new n.Vector3,c=new n.Vector3,E=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,S=t=>{const p=new n.Vector3,f=E*1.2,C=new n.Vector3(c.x+f,c.y,c.z),I=new n.Vector3(c.x,c.y+f,c.z),A=new n.Vector3(c.x,c.y-f,c.z);if(t<=.567){const $=t/.567*Math.PI*2;p.x=c.x+Math.cos($)*f,p.z=c.z+Math.sin($)*f,p.y=c.y}else if(t<=.724){const L=(t-.567)/.157,$=D(L);p.lerpVectors(C,I,$)}else if(t<=.881){const L=(t-.724)/.157,J=D(L)*Math.PI;p.x=c.x+Math.sin(J)*f,p.y=c.y+Math.cos(J)*f,p.z=c.z}else{const L=(t-.881)/.119,$=D(L);p.lerpVectors(A,x,$)}return p},b=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,C=Math.min(f/g,1);if(C>=1){k();return}const I=S(C);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(b)},r=()=>{if(h.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),P.copy(p.target);const f=new n.Box3;h.value.forEach(U=>{f.expandByObject(U)});const C=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),E=Math.max(C.x,C.y,C.z)*1.2;const I=new n.Vector3(c.x+E*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const U=Date.now()-$,Y=Math.min(U/L,1),m=D(Y);t.position.lerpVectors(A,I,m),t.lookAt(c),p.target.copy(c),Y<1?requestAnimationFrame(J):(u.value=!0,d=null,b())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(P))};return{isAnimating:u,toggleAnimation:()=>{if(u.value){u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{camera:t,controls:p}=z();if(!t||!p)return;p.enabled=!0;const f=t.position.clone(),C=p.target.clone(),I=1500,A=Date.now(),L=()=>{const $=Date.now()-A,J=Math.min($/I,1),U=D(J);t.position.lerpVectors(f,x,U),p.target.lerpVectors(C,P,U),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function ge(z,h){const u=e.ref(!1),d=e.ref("none");let g=[],x=[],P=new n.Box3,c=new n.Vector3;const E=()=>{g=[new n.Plane(new n.Vector3(1,0,0),0),new n.Plane(new n.Vector3(0,1,0),0),new n.Plane(new n.Vector3(0,0,1),0)]},F=()=>{P.makeEmpty(),h.value.forEach(y=>{P.expandByObject(y)}),c=P.getCenter(new n.Vector3)},D=y=>{const t=P.getSize(new n.Vector3);let p,f,C;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,Math.PI/2,0)):y==="y"?(p=new n.PlaneGeometry(t.x*1.2,t.z*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(Math.PI/2,0,0)):y==="z"&&(p=new n.PlaneGeometry(t.x*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,0,0));const I=new n.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:n.DoubleSide,depthWrite:!1}),A=new n.Mesh(p,I);return A.position.copy(f),A.rotation.copy(C),A},S=()=>{if(b(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(g[0].constant=-c.x,y=g[0]):d.value==="y"?(g[1].constant=-c.y,y=g[1]):d.value==="z"&&(g[2].constant=-c.z,y=g[2]),y){h.value.forEach(p=>{p.traverse(f=>{f.isMesh&&f.material&&(Array.isArray(f.material)?f.material.forEach(C=>{C.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},b=()=>{h.value.forEach(y=>{y.traverse(t=>{t.isMesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(p=>{p.clippingPlanes=[]}):t.material.clippingPlanes=[])})})},r=()=>{const{scene:y}=z();y&&x.forEach(t=>{y.remove(t),t.geometry.dispose(),t.material.dispose()}),x=[]};return{isClipping:u,activeClippingAxis:d,toggleClipping:()=>{u.value=!u.value,u.value?(E(),h.value.length>0&&F()):(d.value="none",b(),r())},updateClippingPlanes:S,clearClippingPlanes:b,clearClippingMeshes:r}}const ye={class:"panel-content"},we={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const h=z;e.ref();const u=e.ref();return e.watch(()=>[h==null?void 0:h.animationData],()=>{var g;let d=((g=re.cloneDeep(h==null?void 0:h.animationData))==null?void 0:g["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,g)=>{var x,P,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(me.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(P=u.value)==null?void 0:P.id,index:(c=u.value)==null?void 0:c.id,showHeader:!1},null,8,["itemData","index"]))])}}},xe=oe._export_sfc(we,[["__scopeId","data-v-2387536e"]]),Ve={class:"panel-content"},Me={key:0,class:"joints-list"},ke={class:"joint-info-row"},Pe={class:"joint-left"},Ce={class:"joint-name"},Ee={class:"joint-range"},be={class:"joint-type"},_e={key:0,class:"joint-control-row"},ze={class:"slider-container"},De=["min","max","value","onInput","disabled"],Ne={class:"value-display"},Se={class:"joint-value"},Be={class:"unit"},Ae={key:1,class:"empty-state"},ae=.001,Re=1e3,ue=60,Fe={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:h}){const u=z;e.ref(!0);const d=e.ref([]),g=e.ref(null),x=e.ref(null),P=e.ref(12.5),c=e.ref(),E=e.ref(1302),F=e.ref(30),D=e.ref(!1),S=e.ref(!1),b=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ue/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;E.value=o.extra.管长,P.value=o.extra.外径/2;let v=((i=re.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const C=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!g.value)return re.ElMessage.error("未加载 URDF"),!1;let o=null;return g.value.traverse(v=>{o||v.name==="Pipe_Link"&&v.traverse(i=>{i instanceof n.Mesh&&!o&&(o=i)})}),o?(o.position.y-=F.value*ae,c.value=o,o.material=new n.MeshPhongMaterial({color:11184810,shininess:80,side:n.DoubleSide}),!0):(re.ElMessage.error('在 "Pipe_Link" 内未找到任何 Mesh'),!1)},A=o=>{if(!o||!o.joints)return console.warn("URDF模型没有关节信息"),[];let v=null;if(o.traverse(V=>{V.name==="Pipe_Link"&&!v&&(v=V)}),v)c.value=v;else return console.warn("未找到管子模型"),[];const i=[];return Object.keys(o.joints).forEach(V=>{const s=o.joints[V];if(s._jointType==="fixed")return;const a=s.limit?{lower:s.limit.lower??C(s._jointType,!1),upper:s.limit.upper??C(s._jointType,!0)}:{lower:C(s._jointType,!1),upper:C(s._jointType,!0)};i.push({name:V,type:s._jointType||"unknown",limit:a,currentValue:s.angle||0,urdfJoint:s})}),i.sort((V,s)=>V.name.localeCompare(s.name))},L=(o,v)=>{const i=d.value.find(s=>s.name===o);if(!i)return;const V=parseFloat(v);if(i.limit){const s=Math.max(i.limit.lower,Math.min(i.limit.upper,V));i.currentValue=s}else i.currentValue=V;u.model&&u.model.setJointValue?u.model.setJointValue(o,i.currentValue):i.urdfJoint&&i.urdfJoint.setJointValue(i.currentValue)},$=o=>o.reduce((v,i)=>{let V=0;const s=i.Y??0,a=i.C??0,w=i.R??0;return s>0&&(V+=s),a>0&&w>0&&(V+=w*y(a)),v+V},0),J=o=>{const v=[],i=o.Y??0,V=o.B??0,s=o.C??0,a=o.R??0,w={pos:new n.Vector3(0,0,0),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};if(!i&&!s)return v;if(v.push(w.pos.clone()),V!==0){const G=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(G),w.localZ.applyMatrix4(G)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const G=y(s),T=a*ae,W=w.pos.clone().add(w.localX.clone().multiplyScalar(-T)),R=Math.max(16,Math.ceil(s/5));for(let M=1;M<=R;M++){const H=G*M/R,K=new n.Matrix4().makeRotationAxis(w.localZ,H),se=w.localX.clone().multiplyScalar(T).applyMatrix4(K),ie=W.clone().add(se);v.push(ie)}}return v},U=(o,v=0)=>{let i=f.slice(0,o+1);const V=f[o+1];if(V&&v>0){const R={...V,B:(V.B??0)*v,C:(V.C??0)*v};i.push(R)}const s=$(i),a=Math.max(0,E.value-s),w=[];w.push(new n.Vector3(0,0,0));const G=new n.Vector3(0,a*ae,0);a>0&&w.push(G);let T={pos:G.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const W=[];for(let R=i.length-1;R>=0;R--){const M=i[R],H=J(M);if(H.length>0){const K=H.map(Q=>{const ne=Q.clone(),de=new n.Matrix4;return de.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(de),ne.add(T.pos)});W.push(K);const te=K[K.length-1];T.pos=te.clone();const se=M.B??0,ie=M.C??0;if(se!==0){const Q=new n.Matrix4().makeRotationAxis(T.localY,y(se));T.localX.applyMatrix4(Q),T.localZ.applyMatrix4(Q)}if(ie>0){const Q=y(ie),ne=new n.Matrix4().makeRotationAxis(T.localZ,Q);T.localY.applyMatrix4(ne),T.localX.applyMatrix4(ne)}}}for(const R of W)R.length>1&&w.push(...R.slice(1));w.length<2&&w.push(new n.Vector3(0,.001,0));try{const R=new n.CatmullRomCurve3(w,!1,"catmullrom",.01),M=new n.TubeGeometry(R,Math.max(2,w.length*4),P.value*ae,18,!1);c.value.geometry.dispose(),c.value.geometry=M}catch(R){console.error("管件更新失败",R)}},Y=(o,v,i=1)=>{o&&(Object.keys(o).forEach(V=>{const s=o[V],a=d.value.find(w=>w.name===V);a&&(a.currentValue=s,u.model&&u.model.setJointValue?u.model.setJointValue(V,s):a.urdfJoint&&a.urdfJoint.setJointValue(s))}),U(v,i))},m=(o,v,i)=>o+(v-o)*i,l=(o,v,i)=>{if(!o||!v)return o||v;const V={};return Object.keys(o).forEach(s=>{const a=o[s],w=v[s];V[s]=m(a,w||a,i)}),V},_=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,S.value=!1,b.value=0,r.value=0,B()},B=()=>{if(!D.value||S.value)return;const o=b.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ue,i=f[o],V=f[o+1];if(V){const s=l(i,V,v);Y(s,o,v)}else Y(i,o);r.value++,r.value>ue&&(r.value=0,b.value++),k.value=setTimeout(B,p())},O=()=>{S.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,S.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};h({startAnimation:_,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),b.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),U(-1,0)},fastForward:()=>{t.value<4&&(t.value=Math.min(4,t.value*2))},fastBackward:()=>{t.value>.25&&(t.value=Math.max(.25,t.value/2))}}),e.watch(()=>u.model,o=>{o?(g.value=o,d.value=A(o)):d.value=[]},{immediate:!0});const ee=()=>{!u.model||D.value&&!S.value||d.value.forEach(o=>{o.urdfJoint&&o.urdfJoint.angle!==void 0&&(o.currentValue=o.urdfJoint.angle)})},le=()=>{const o=()=>{ee(),x.value=requestAnimationFrame(o)};o()},ce=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{ce(),j()}),(o,v)=>(e.openBlock(),e.createElementBlock("div",Ve,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>{var V,s,a,w;return e.openBlock(),e.createElementBlock("div",{key:i.name,class:"joint-item"},[e.createElementVNode("div",ke,[e.createElementVNode("div",Pe,[e.createElementVNode("span",Ce,e.toDisplayString(i.name),1),e.createElementVNode("span",Ee," ["+e.toDisplayString(((V=i.limit)==null?void 0:V.lower.toFixed(2))??(i.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((s=i.limit)==null?void 0:s.upper.toFixed(2))??(i.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",be,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",ze,[e.createElementVNode("input",{type:"range",min:((a=i.limit)==null?void 0:a.lower)??(i.type==="revolute"?-Math.PI:-1),max:((w=i.limit)==null?void 0:w.upper)??(i.type==="revolute"?Math.PI:1),step:.01,value:i.currentValue,onInput:G=>L(i.name,G.target.value),class:"joint-slider",disabled:D.value&&!S.value},null,40,De)]),e.createElementVNode("div",Ne,[e.createElementVNode("span",Se,e.toDisplayString(i.currentValue?Number(i.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Be,e.toDisplayString(i.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Ae,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},Te=oe._export_sfc(Fe,[["__scopeId","data-v-035ae936"]]),Le={class:"panel-content"},Ie="id",$e={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:z=>["breadth","firstLevel"].includes(z)}},emits:["nodeClick"],setup(z,{emit:h}){const u=z,d=h,g=e.ref([]),x={children:"children",label:"label"},P=r=>{d("nodeClick",r)},c=(r,k=0)=>{const y=[];return Array.isArray(r)&&(r==null?void 0:r.length)>0&&r.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const p={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:k+1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:c(t==null?void 0:t.children,k+1),path:t==null?void 0:t.name};y.push(p)}}),y},E=r=>r?[{name:r==null?void 0:r.name,label:r==null?void 0:r.name,show:!0,level:1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:c(r==null?void 0:r.children,1),path:r==null?void 0:r.name}]:[],F=(r,k)=>{const y=[],t=[...r];for(;t.length>0&&y.length<k;){const p=t.shift();p.children&&p.children.length>0&&(y.push(p.id),t.push(...p.children))}return y},D=(r,k)=>{const y=[];return r.forEach(t=>{if(t.children&&t.children.length>0){y.push(t.id);const p=t.children.filter(f=>f.children&&f.children.length>0).slice(0,k).map(f=>f.id);y.push(...p)}}),y.slice(0,k+1)},S=e.computed(()=>!g.value||g.value.length===0?[]:u.expandStrategy==="firstLevel"?D(g.value,u.maxExpandCount):F(g.value,u.maxExpandCount)),b=e.computed(()=>u!=null&&u.model?E(u.model):[]);return e.watch(b,r=>{g.value=JSON.parse(JSON.stringify(r))},{immediate:!0}),(r,k)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(y,{data:g.value,props:x,"default-expanded-keys":S.value,"node-key":Ie,onNodeClick:P},null,8,["data","default-expanded-keys"])])}}},Je=oe._export_sfc($e,[["__scopeId","data-v-290ff4e1"]]),Oe=["xlink:href"],Ge=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(z){const h=z,u=e.computed(()=>({backgroundColor:h.backgroundColor})),d=e.computed(()=>`#${h.prefix}-${h.name}`),g=e.computed(()=>{const{size:x}=h;let P=`${x}`;return P=`${P.replace("px","")}px`,{width:P,height:P}});return(x,P)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:x.active}]),style:e.normalizeStyle(u.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[x.$attrs.class,x.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(g.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Oe)],6))],6))}}),N=oe._export_sfc(Ge,[["__scopeId","data-v-3150a90b"]]),Ue={class:"obj-viewer-container"},je={class:"buttonGroup-top"},qe={class:"buttonGroup-topLeft"},Xe={class:"buttonGroup-left"},He={class:"buttonGroup-right"},Ye={class:"buttonGroup-bottom"},Ze={class:"left-panel"},We={class:"panel-header"},Ke={key:1,class:"clipping-content"},Qe={class:"radio-group"},et={class:"radio-label"},tt={class:"radio-label"},nt={class:"radio-label"},at={class:"radio-label"},ot={class:"right-panel"},lt={class:"panel-header"},st={key:0,class:"loading-overlay"},it={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(z,{expose:h,emit:u}){const d=u;let g=null,x=!1;const P=e.ref(null),c=e.ref(!1),E=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),S=e.ref(""),b=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:C,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ve(P),{isAnimating:J,toggleAnimation:U,stopAnimation:Y}=he(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:_,updateClippingPlanes:B}=ge(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=fe.useModelLoader(A,y,c,E,L),Z=()=>{if(F.value||y.value.length===0)return;F.value=!0,J.value&&Y();const{camera:s,controls:a}=A();if(!s||!a)return;a.enabled=!0;const w=H=>H<.5?4*H*H*H:1-Math.pow(-2*H+2,3)/2,G=s.position.clone(),T=a.target.clone(),W=1500,R=Date.now(),M=()=>{const H=Date.now()-R,K=Math.min(H/W,1),te=w(K);s.position.lerpVectors(G,t.value,te),a.target.lerpVectors(T,p.value,te),K<1?requestAnimationFrame(M):F.value=!1};M()},ee=async()=>x?Promise.resolve():new Promise(s=>{const a=()=>{x?s():requestAnimationFrame(a)};a()}),le=async(s,a)=>{try{await ee(),J.value&&Y(),m.value&&_();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},ce=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,S.value=s,s==="剖面视图"&&!m.value&&_()},i=s=>{b.value=!0,r.value=s,s==="动画仿真"&&d("getAnimationData")},V=()=>{e.nextTick(()=>{var s;(s=k.value)==null||s.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{f(),g=A().scene,x=!0,window.addEventListener("resize",C)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,S.value="",r.value="",window.removeEventListener("resize",C),J.value&&Y(),$()}),h({addModelsFromUrls:ce,loadModelByDefaultPath:o}),(s,a)=>{var G,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:P,class:"threejs-container"},null,512),e.createElementVNode("div",je,[e.createVNode(N,{name:"guanjianjiexi",size:"34"}),e.createVNode(N,{name:"guanjiekongzhi",size:"34"}),e.createVNode(N,{name:"gongyishengcheng",size:"34"}),e.createVNode(N,{name:"buchangshezhi",size:"34"}),e.createVNode(N,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",qe,[e.createVNode(N,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(N,{name:"fangda",size:"24",title:"放大"}),e.createVNode(N,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(N,{name:"lookAround",size:"24",onClick:e.unref(U),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",Xe,[e.createVNode(N,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&S.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(N,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&S.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",He,[e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:b.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:b.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ye,[e.createVNode(N,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(G=k.value)==null?void 0:G.fastBackward},null,8,["onClick"]),e.createVNode(N,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(N,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(N,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(N,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(R=k.value)==null?void 0:R.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",Ze,[e.createElementVNode("div",We,[e.createElementVNode("span",null,e.toDisplayString(S.value),1),e.createElementVNode("span",{class:"close",onClick:a[6]||(a[6]=M=>D.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[S.value==="场景树"?(e.openBlock(),e.createBlock(Je,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),S.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Ke,[e.createElementVNode("div",Qe,[e.createElementVNode("label",et,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":a[7]||(a[7]=M=>e.isRef(l)?l.value=M:null),onChange:a[8]||(a[8]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[16]||(a[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",tt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":a[9]||(a[9]=M=>e.isRef(l)?l.value=M:null),onChange:a[10]||(a[10]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[17]||(a[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",nt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":a[11]||(a[11]=M=>e.isRef(l)?l.value=M:null),onChange:a[12]||(a[12]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[18]||(a[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",at,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":a[13]||(a[13]=M=>e.isRef(l)?l.value=M:null),onChange:a[14]||(a[14]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[19]||(a[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,D.value]]),e.withDirectives(e.createElementVNode("div",ot,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(r.value),1),e.createElementVNode("span",{class:"close",onClick:a[15]||(a[15]=M=>b.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(Te,{ref_key:"jointRef",ref:k,model:e.unref(q),scene:e.unref(g),animationData:z.animationData},null,8,["model","scene","animationData"]),[[e.vShow,r.value==="关节控制"]]),e.withDirectives(e.createVNode(xe,{animationData:z.animationData},null,8,["animationData"]),[[e.vShow,r.value==="动画仿真"]])]),_:1})],512),[[e.vShow,b.value]]),c.value?(e.openBlock(),e.createElementBlock("div",st,[a[20]||(a[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(E.value),1)])):e.createCommentVNode("",!0)])}}},rt=oe._export_sfc(it,[["__scopeId","data-v-7bc47bb3"]]);exports.default=rt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./three-viewport-gizmo-BV37JzRa.cjs"),pe=require("./OrbitControls-Co_9huz0.cjs"),me=require("./index-DW7I4GY6.cjs"),fe=require("./index.vue_vue_type_style_index_1_lang-B_ESWhzz.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./index-1z9RrjZc.cjs");function ve(z){let h=null,u=null,d=null,g=null,x=null,P=null,c=null,E=null;const D=1e3/30;let S=0;const b=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;h=new n.Scene,h.background=new n.Color(15790320);const m=z.value;u=new n.PerspectiveCamera(75,m.clientWidth/m.clientHeight,.1,1e4),u.position.set(8,-8,6),u.up.set(0,0,1),u.lookAt(0,0,0),d=new n.WebGLRenderer({antialias:!0,alpha:!0}),d.setSize(m.clientWidth,m.clientHeight),d.localClippingEnabled=!0,d.shadowMap.enabled=!0,d.shadowMap.type=n.PCFSoftShadowMap,d.toneMapping=n.ACESFilmicToneMapping,d.toneMappingExposure=1,d.outputColorSpace=n.SRGBColorSpace,m.appendChild(d.domElement),g=new pe.OrbitControls(u,d.domElement),g.enableDamping=!0,g.dampingFactor=.05,g.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},g.panSpeed=.7,x=new n.Xe(u,d,{container:m,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),x.attachControls(g),f(),C()},t=(m,l)=>{c&&(h.remove(c),c.dispose()),E&&(h.remove(E),E.geometry.dispose(),E.material.dispose());const _=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,_,13421772,14540253),c.rotateX(Math.PI/2),c.position.copy(l),h.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});E=new n.Mesh(B,O),E.position.copy(l),E.position.z-=.01,E.receiveShadow=!0,h.add(E)},p=()=>{if(b.value.length===0)return;const m=new n.Box3;let l=!1;if(b.value.forEach(X=>{if(X.userData.boundingBox)m.union(X.userData.boundingBox),l=!0;else if(X.userData.modelId&&modelBoundingBoxes.has(X.userData.modelId)){const Z=modelBoundingBoxes.get(X.userData.modelId);m.union(Z.box),l=!0}else m.expandByObject(X),l=!0}),!l){console.warn("无法计算包围盒,网格更新失败");return}const _=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(_.x,_.y,_.z),j=Math.max(O*8,50),q=new n.Vector3(B.x,B.y,m.min.z);t(j,q)},f=()=>{const m=new n.AmbientLight(4210752,.6);h.add(m);const l=new n.DirectionalLight(16777215,2);l.position.set(10,10,8),l.castShadow=!0,l.shadow.mapSize.width=4096,l.shadow.mapSize.height=4096,l.shadow.camera.near=.5,l.shadow.camera.far=50,l.shadow.camera.left=-50,l.shadow.camera.right=50,l.shadow.camera.top=50,l.shadow.camera.bottom=-50,h.add(l);const _=new n.DirectionalLight(16777215,.8);_.position.set(-8,-8,6),h.add(_);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),h.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);h.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),h.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),h.add(q)},C=()=>{P=requestAnimationFrame(C),g&&g.update();const m=performance.now(),l=m-S;l<D||(S=m-l%D,d&&h&&u&&d.render(h,u),x&&x.render())},I=m=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(_=>{m[_]&&m[_].dispose&&m[_].dispose()}),m.dispose&&m.dispose()},A=m=>{m==null||m.traverse(l=>{l.geometry&&l.geometry.dispose(),l.material&&(Array.isArray(l.material)?l.material.forEach(_=>{I(_)}):I(l.material))})};return{currentModels:b,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,_=m.clientHeight;u.aspect=l/_,u.updateProjectionMatrix(),d.setSize(l,_),x.update()},fitCameraToAllModels:m=>{if(!u||!g||b.value.length===0)return;const l=new n.Box3;let _=!1;if(b.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),_=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),_=!0}else l.expandByObject(Z),_=!0}),!_){console.warn("无法计算包围盒");return}const B=l.getSize(new n.Vector3),O=l.getCenter(new n.Vector3),q=Math.max(B.x,B.y,B.z)*.8,X=new n.Vector3(O.x+q,O.y-q,O.z+q);u.position.copy(X),u.lookAt(O),g.target.copy(O),g.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:h,camera:u,renderer:d,controls:g,gizmo:x}),clearAllModels:()=>{if(!h)return;b.value.forEach(l=>{h.remove(l),A(l)});const m=[];h.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==E&&m.push(l)}),m.forEach(l=>{h.remove(l),A(l)}),b.value=[],p()},cleanup:()=>{P&&cancelAnimationFrame(P),c&&c.dispose(),E&&(E.geometry.dispose(),E.material.dispose()),d&&d.dispose(),g&&g.dispose(),x&&x.dispose()},updateGridForModels:p}}function he(z,h){const u=e.ref(!1);let d=null,g=12700,x=new n.Vector3,P=new n.Vector3,c=new n.Vector3,E=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,S=t=>{const p=new n.Vector3,f=E*1.2,C=new n.Vector3(c.x+f,c.y,c.z),I=new n.Vector3(c.x,c.y+f,c.z),A=new n.Vector3(c.x,c.y-f,c.z);if(t<=.567){const $=t/.567*Math.PI*2;p.x=c.x+Math.cos($)*f,p.z=c.z+Math.sin($)*f,p.y=c.y}else if(t<=.724){const L=(t-.567)/.157,$=D(L);p.lerpVectors(C,I,$)}else if(t<=.881){const L=(t-.724)/.157,J=D(L)*Math.PI;p.x=c.x+Math.sin(J)*f,p.y=c.y+Math.cos(J)*f,p.z=c.z}else{const L=(t-.881)/.119,$=D(L);p.lerpVectors(A,x,$)}return p},b=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,C=Math.min(f/g,1);if(C>=1){k();return}const I=S(C);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(b)},r=()=>{if(h.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),P.copy(p.target);const f=new n.Box3;h.value.forEach(U=>{f.expandByObject(U)});const C=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),E=Math.max(C.x,C.y,C.z)*1.2;const I=new n.Vector3(c.x+E*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const U=Date.now()-$,Y=Math.min(U/L,1),m=D(Y);t.position.lerpVectors(A,I,m),t.lookAt(c),p.target.copy(c),Y<1?requestAnimationFrame(J):(u.value=!0,d=null,b())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(P))};return{isAnimating:u,toggleAnimation:()=>{if(u.value){u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{camera:t,controls:p}=z();if(!t||!p)return;p.enabled=!0;const f=t.position.clone(),C=p.target.clone(),I=1500,A=Date.now(),L=()=>{const $=Date.now()-A,J=Math.min($/I,1),U=D(J);t.position.lerpVectors(f,x,U),p.target.lerpVectors(C,P,U),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function ge(z,h){const u=e.ref(!1),d=e.ref("none");let g=[],x=[],P=new n.Box3,c=new n.Vector3;const E=()=>{g=[new n.Plane(new n.Vector3(1,0,0),0),new n.Plane(new n.Vector3(0,1,0),0),new n.Plane(new n.Vector3(0,0,1),0)]},F=()=>{P.makeEmpty(),h.value.forEach(y=>{P.expandByObject(y)}),c=P.getCenter(new n.Vector3)},D=y=>{const t=P.getSize(new n.Vector3);let p,f,C;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,Math.PI/2,0)):y==="y"?(p=new n.PlaneGeometry(t.x*1.2,t.z*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(Math.PI/2,0,0)):y==="z"&&(p=new n.PlaneGeometry(t.x*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,0,0));const I=new n.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:n.DoubleSide,depthWrite:!1}),A=new n.Mesh(p,I);return A.position.copy(f),A.rotation.copy(C),A},S=()=>{if(b(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(g[0].constant=-c.x,y=g[0]):d.value==="y"?(g[1].constant=-c.y,y=g[1]):d.value==="z"&&(g[2].constant=-c.z,y=g[2]),y){h.value.forEach(p=>{p.traverse(f=>{f.isMesh&&f.material&&(Array.isArray(f.material)?f.material.forEach(C=>{C.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},b=()=>{h.value.forEach(y=>{y.traverse(t=>{t.isMesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(p=>{p.clippingPlanes=[]}):t.material.clippingPlanes=[])})})},r=()=>{const{scene:y}=z();y&&x.forEach(t=>{y.remove(t),t.geometry.dispose(),t.material.dispose()}),x=[]};return{isClipping:u,activeClippingAxis:d,toggleClipping:()=>{u.value=!u.value,u.value?(E(),h.value.length>0&&F()):(d.value="none",b(),r())},updateClippingPlanes:S,clearClippingPlanes:b,clearClippingMeshes:r}}const ye={class:"panel-content"},we={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const h=z;e.ref();const u=e.ref();return e.watch(()=>[h==null?void 0:h.animationData],()=>{var g;let d=((g=re.cloneDeep(h==null?void 0:h.animationData))==null?void 0:g["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,g)=>{var x,P,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(me.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(P=u.value)==null?void 0:P.id,index:(c=u.value)==null?void 0:c.id,showHeader:!1},null,8,["itemData","index"]))])}}},xe=oe._export_sfc(we,[["__scopeId","data-v-2387536e"]]),Ve={class:"panel-content"},Me={key:0,class:"joints-list"},ke={class:"joint-info-row"},Pe={class:"joint-left"},Ce={class:"joint-name"},Ee={class:"joint-range"},be={class:"joint-type"},_e={key:0,class:"joint-control-row"},ze={class:"slider-container"},De=["min","max","value","onInput","disabled"],Ne={class:"value-display"},Se={class:"joint-value"},Be={class:"unit"},Ae={key:1,class:"empty-state"},ae=.001,Re=1e3,ue=60,Fe={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:h}){const u=z;e.ref(!0);const d=e.ref([]),g=e.ref(null),x=e.ref(null),P=e.ref(12.5),c=e.ref(),E=e.ref(1302),F=e.ref(30),D=e.ref(!1),S=e.ref(!1),b=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ue/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;E.value=o.extra.管长,P.value=o.extra.外径/2;let v=((i=re.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const C=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!g.value)return re.ElMessage.error("未加载 URDF"),!1;let o=null;return g.value.traverse(v=>{o||v.name==="Pipe_Link"&&v.traverse(i=>{i instanceof n.Mesh&&!o&&(o=i)})}),o?(o.position.y-=F.value*ae,c.value=o,o.material=new n.MeshPhongMaterial({color:11184810,shininess:80,side:n.DoubleSide}),!0):(re.ElMessage.error('在 "Pipe_Link" 内未找到任何 Mesh'),!1)},A=o=>{if(!o||!o.joints)return console.warn("URDF模型没有关节信息"),[];let v=null;if(o.traverse(V=>{V.name==="Pipe_Link"&&!v&&(v=V)}),v)c.value=v;else return console.warn("未找到管子模型"),[];const i=[];return Object.keys(o.joints).forEach(V=>{const s=o.joints[V];if(s._jointType==="fixed")return;const a=s.limit?{lower:s.limit.lower??C(s._jointType,!1),upper:s.limit.upper??C(s._jointType,!0)}:{lower:C(s._jointType,!1),upper:C(s._jointType,!0)};i.push({name:V,type:s._jointType||"unknown",limit:a,currentValue:s.angle||0,urdfJoint:s})}),i.sort((V,s)=>V.name.localeCompare(s.name))},L=(o,v)=>{const i=d.value.find(s=>s.name===o);if(!i)return;const V=parseFloat(v);if(i.limit){const s=Math.max(i.limit.lower,Math.min(i.limit.upper,V));i.currentValue=s}else i.currentValue=V;u.model&&u.model.setJointValue?u.model.setJointValue(o,i.currentValue):i.urdfJoint&&i.urdfJoint.setJointValue(i.currentValue)},$=o=>o.reduce((v,i)=>{let V=0;const s=i.Y??0,a=i.C??0,w=i.R??0;return s>0&&(V+=s),a>0&&w>0&&(V+=w*y(a)),v+V},0),J=o=>{const v=[],i=o.Y??0,V=o.B??0,s=o.C??0,a=o.R??0,w={pos:new n.Vector3(0,0,0),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};if(!i&&!s)return v;if(v.push(w.pos.clone()),V!==0){const G=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(G),w.localZ.applyMatrix4(G)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const G=y(s),T=a*ae,W=w.pos.clone().add(w.localX.clone().multiplyScalar(-T)),R=Math.max(16,Math.ceil(s/5));for(let M=1;M<=R;M++){const H=G*M/R,K=new n.Matrix4().makeRotationAxis(w.localZ,H),se=w.localX.clone().multiplyScalar(T).applyMatrix4(K),ie=W.clone().add(se);v.push(ie)}}return v},U=(o,v=0)=>{let i=f.slice(0,o+1);const V=f[o+1];if(V&&v>0){const R={...V,B:(V.B??0)*v,C:(V.C??0)*v};i.push(R)}const s=$(i),a=Math.max(0,E.value-s),w=[];w.push(new n.Vector3(0,0,0));const G=new n.Vector3(0,a*ae,0);a>0&&w.push(G);let T={pos:G.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const W=[];for(let R=i.length-1;R>=0;R--){const M=i[R],H=J(M);if(H.length>0){const K=H.map(Q=>{const ne=Q.clone(),de=new n.Matrix4;return de.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(de),ne.add(T.pos)});W.push(K);const te=K[K.length-1];T.pos=te.clone();const se=M.B??0,ie=M.C??0;if(se!==0){const Q=new n.Matrix4().makeRotationAxis(T.localY,y(se));T.localX.applyMatrix4(Q),T.localZ.applyMatrix4(Q)}if(ie>0){const Q=y(ie),ne=new n.Matrix4().makeRotationAxis(T.localZ,Q);T.localY.applyMatrix4(ne),T.localX.applyMatrix4(ne)}}}for(const R of W)R.length>1&&w.push(...R.slice(1));w.length<2&&w.push(new n.Vector3(0,.001,0));try{const R=new n.CatmullRomCurve3(w,!1,"catmullrom",.01),M=new n.TubeGeometry(R,Math.max(2,w.length*4),P.value*ae,18,!1);c.value.geometry.dispose(),c.value.geometry=M}catch(R){console.error("管件更新失败",R)}},Y=(o,v,i=1)=>{o&&(Object.keys(o).forEach(V=>{const s=o[V],a=d.value.find(w=>w.name===V);a&&(a.currentValue=s,u.model&&u.model.setJointValue?u.model.setJointValue(V,s):a.urdfJoint&&a.urdfJoint.setJointValue(s))}),U(v,i))},m=(o,v,i)=>o+(v-o)*i,l=(o,v,i)=>{if(!o||!v)return o||v;const V={};return Object.keys(o).forEach(s=>{const a=o[s],w=v[s];V[s]=m(a,w||a,i)}),V},_=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,S.value=!1,b.value=0,r.value=0,B()},B=()=>{if(!D.value||S.value)return;const o=b.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ue,i=f[o],V=f[o+1];if(V){const s=l(i,V,v);Y(s,o,v)}else Y(i,o);r.value++,r.value>ue&&(r.value=0,b.value++),k.value=setTimeout(B,p())},O=()=>{S.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,S.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};h({startAnimation:_,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),b.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),U(-1,0)},fastForward:()=>{t.value<4&&(t.value=Math.min(4,t.value*2))},fastBackward:()=>{t.value>.25&&(t.value=Math.max(.25,t.value/2))}}),e.watch(()=>u.model,o=>{o?(g.value=o,d.value=A(o)):d.value=[]},{immediate:!0});const ee=()=>{!u.model||D.value&&!S.value||d.value.forEach(o=>{o.urdfJoint&&o.urdfJoint.angle!==void 0&&(o.currentValue=o.urdfJoint.angle)})},le=()=>{const o=()=>{ee(),x.value=requestAnimationFrame(o)};o()},ce=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{ce(),j()}),(o,v)=>(e.openBlock(),e.createElementBlock("div",Ve,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>{var V,s,a,w;return e.openBlock(),e.createElementBlock("div",{key:i.name,class:"joint-item"},[e.createElementVNode("div",ke,[e.createElementVNode("div",Pe,[e.createElementVNode("span",Ce,e.toDisplayString(i.name),1),e.createElementVNode("span",Ee," ["+e.toDisplayString(((V=i.limit)==null?void 0:V.lower.toFixed(2))??(i.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((s=i.limit)==null?void 0:s.upper.toFixed(2))??(i.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",be,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",ze,[e.createElementVNode("input",{type:"range",min:((a=i.limit)==null?void 0:a.lower)??(i.type==="revolute"?-Math.PI:-1),max:((w=i.limit)==null?void 0:w.upper)??(i.type==="revolute"?Math.PI:1),step:.01,value:i.currentValue,onInput:G=>L(i.name,G.target.value),class:"joint-slider",disabled:D.value&&!S.value},null,40,De)]),e.createElementVNode("div",Ne,[e.createElementVNode("span",Se,e.toDisplayString(i.currentValue?Number(i.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Be,e.toDisplayString(i.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Ae,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},Te=oe._export_sfc(Fe,[["__scopeId","data-v-035ae936"]]),Le={class:"panel-content"},Ie="id",$e={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:z=>["breadth","firstLevel"].includes(z)}},emits:["nodeClick"],setup(z,{emit:h}){const u=z,d=h,g=e.ref([]),x={children:"children",label:"label"},P=r=>{d("nodeClick",r)},c=(r,k=0)=>{const y=[];return Array.isArray(r)&&(r==null?void 0:r.length)>0&&r.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const p={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:k+1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:c(t==null?void 0:t.children,k+1),path:t==null?void 0:t.name};y.push(p)}}),y},E=r=>r?[{name:r==null?void 0:r.name,label:r==null?void 0:r.name,show:!0,level:1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:c(r==null?void 0:r.children,1),path:r==null?void 0:r.name}]:[],F=(r,k)=>{const y=[],t=[...r];for(;t.length>0&&y.length<k;){const p=t.shift();p.children&&p.children.length>0&&(y.push(p.id),t.push(...p.children))}return y},D=(r,k)=>{const y=[];return r.forEach(t=>{if(t.children&&t.children.length>0){y.push(t.id);const p=t.children.filter(f=>f.children&&f.children.length>0).slice(0,k).map(f=>f.id);y.push(...p)}}),y.slice(0,k+1)},S=e.computed(()=>!g.value||g.value.length===0?[]:u.expandStrategy==="firstLevel"?D(g.value,u.maxExpandCount):F(g.value,u.maxExpandCount)),b=e.computed(()=>u!=null&&u.model?E(u.model):[]);return e.watch(b,r=>{g.value=JSON.parse(JSON.stringify(r))},{immediate:!0}),(r,k)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(y,{data:g.value,props:x,"default-expanded-keys":S.value,"node-key":Ie,onNodeClick:P},null,8,["data","default-expanded-keys"])])}}},Je=oe._export_sfc($e,[["__scopeId","data-v-290ff4e1"]]),Oe=["xlink:href"],Ge=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(z){const h=z,u=e.computed(()=>({backgroundColor:h.backgroundColor})),d=e.computed(()=>`#${h.prefix}-${h.name}`),g=e.computed(()=>{const{size:x}=h;let P=`${x}`;return P=`${P.replace("px","")}px`,{width:P,height:P}});return(x,P)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:x.active}]),style:e.normalizeStyle(u.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[x.$attrs.class,x.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(g.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Oe)],6))],6))}}),N=oe._export_sfc(Ge,[["__scopeId","data-v-3150a90b"]]),Ue={class:"obj-viewer-container"},je={class:"buttonGroup-top"},qe={class:"buttonGroup-topLeft"},Xe={class:"buttonGroup-left"},He={class:"buttonGroup-right"},Ye={class:"buttonGroup-bottom"},Ze={class:"left-panel"},We={class:"panel-header"},Ke={key:1,class:"clipping-content"},Qe={class:"radio-group"},et={class:"radio-label"},tt={class:"radio-label"},nt={class:"radio-label"},at={class:"radio-label"},ot={class:"right-panel"},lt={class:"panel-header"},st={key:0,class:"loading-overlay"},it={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(z,{expose:h,emit:u}){const d=u;let g=null,x=!1;const P=e.ref(null),c=e.ref(!1),E=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),S=e.ref(""),b=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:C,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ve(P),{isAnimating:J,toggleAnimation:U,stopAnimation:Y}=he(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:_,updateClippingPlanes:B}=ge(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=fe.useModelLoader(A,y,c,E,L),Z=()=>{if(F.value||y.value.length===0)return;F.value=!0,J.value&&Y();const{camera:s,controls:a}=A();if(!s||!a)return;a.enabled=!0;const w=H=>H<.5?4*H*H*H:1-Math.pow(-2*H+2,3)/2,G=s.position.clone(),T=a.target.clone(),W=1500,R=Date.now(),M=()=>{const H=Date.now()-R,K=Math.min(H/W,1),te=w(K);s.position.lerpVectors(G,t.value,te),a.target.lerpVectors(T,p.value,te),K<1?requestAnimationFrame(M):F.value=!1};M()},ee=async()=>x?Promise.resolve():new Promise(s=>{const a=()=>{x?s():requestAnimationFrame(a)};a()}),le=async(s,a)=>{try{await ee(),J.value&&Y(),m.value&&_();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},ce=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,S.value=s,s==="剖面视图"&&!m.value&&_()},i=s=>{b.value=!0,r.value=s,s==="动画仿真"&&d("getAnimationData")},V=()=>{e.nextTick(()=>{var s;(s=k.value)==null||s.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{f(),g=A().scene,x=!0,window.addEventListener("resize",C)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,S.value="",r.value="",window.removeEventListener("resize",C),J.value&&Y(),$()}),h({addModelsFromUrls:ce,loadModelByDefaultPath:o}),(s,a)=>{var G,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:P,class:"threejs-container"},null,512),e.createElementVNode("div",je,[e.createVNode(N,{name:"guanjianjiexi",size:"34"}),e.createVNode(N,{name:"guanjiekongzhi",size:"34"}),e.createVNode(N,{name:"gongyishengcheng",size:"34"}),e.createVNode(N,{name:"buchangshezhi",size:"34"}),e.createVNode(N,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",qe,[e.createVNode(N,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(N,{name:"fangda",size:"24",title:"放大"}),e.createVNode(N,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(N,{name:"lookAround",size:"24",onClick:e.unref(U),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",Xe,[e.createVNode(N,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&S.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(N,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&S.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",He,[e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:b.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:b.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ye,[e.createVNode(N,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(G=k.value)==null?void 0:G.fastBackward},null,8,["onClick"]),e.createVNode(N,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(N,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(N,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(N,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(R=k.value)==null?void 0:R.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",Ze,[e.createElementVNode("div",We,[e.createElementVNode("span",null,e.toDisplayString(S.value),1),e.createElementVNode("span",{class:"close",onClick:a[6]||(a[6]=M=>D.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[S.value==="场景树"?(e.openBlock(),e.createBlock(Je,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),S.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Ke,[e.createElementVNode("div",Qe,[e.createElementVNode("label",et,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":a[7]||(a[7]=M=>e.isRef(l)?l.value=M:null),onChange:a[8]||(a[8]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[16]||(a[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",tt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":a[9]||(a[9]=M=>e.isRef(l)?l.value=M:null),onChange:a[10]||(a[10]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[17]||(a[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",nt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":a[11]||(a[11]=M=>e.isRef(l)?l.value=M:null),onChange:a[12]||(a[12]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[18]||(a[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",at,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":a[13]||(a[13]=M=>e.isRef(l)?l.value=M:null),onChange:a[14]||(a[14]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[19]||(a[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,D.value]]),e.withDirectives(e.createElementVNode("div",ot,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(r.value),1),e.createElementVNode("span",{class:"close",onClick:a[15]||(a[15]=M=>b.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(Te,{ref_key:"jointRef",ref:k,model:e.unref(q),scene:e.unref(g),animationData:z.animationData},null,8,["model","scene","animationData"]),[[e.vShow,r.value==="关节控制"]]),e.withDirectives(e.createVNode(xe,{animationData:z.animationData},null,8,["animationData"]),[[e.vShow,r.value==="动画仿真"]])]),_:1})],512),[[e.vShow,b.value]]),c.value?(e.openBlock(),e.createElementBlock("div",st,[a[20]||(a[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(E.value),1)])):e.createCommentVNode("",!0)])}}},rt=oe._export_sfc(it,[["__scopeId","data-v-7bc47bb3"]]);exports.default=rt;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { defineComponent as Le, ref as _, watch as de, shallowRef as he, computed as _e, onUnmounted as Ie, resolveComponent as J, createElementBlock as ge, openBlock as ee, createElementVNode as o, createCommentVNode as ve, createVNode as t, withCtx as A, createBlock as Ce, unref as F, Fragment as Je, renderList as Ne, toDisplayString as fe, onBeforeUnmount as Ee, createTextVNode as qe, onMounted as He, nextTick as We, withDirectives as oe, vShow as me, renderSlot as be, isRef as ke, vModelRadio as Pe } from "vue";
|
|
2
|
-
import { U as Ke, r as xe, s as Ye, u as Qe, a as et, W as tt } from "./useRayCaster-
|
|
2
|
+
import { U as Ke, r as xe, s as Ye, u as Qe, a as et, W as tt } from "./useRayCaster-CQ61IQT5.js";
|
|
3
3
|
import { u as Oe, a as lt, b as ot, S as U } from "./iconfont-pt17sMx3.js";
|
|
4
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
4
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DkSoLqEi.js";
|
|
5
5
|
import { R as at, c as nt, E as Z, a as st, aC as it, ak as rt } from "./index-DbzvXPKu.js";
|
|
6
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
6
|
+
import "./index.vue_vue_type_style_index_1_lang-Bl5IzVKi.js";
|
|
7
7
|
import "./index-BHtNKL1L.js";
|
|
8
|
-
import { _ as ue, s as ut } from "./index-
|
|
9
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
8
|
+
import { _ as ue, s as ut } from "./index-Ci_C9h8v.js";
|
|
9
|
+
import "./index.vue_vue_type_style_index_1_lang-Bmq_QiXo.js";
|
|
10
10
|
import { m as Be, T as Me, V as X, k as ne, l as ct, n as pt, L as dt, e as we, o as mt, p as vt, q as ft, r as gt, s as ht, t as bt, u as yt, i as _t } from "./three-viewport-gizmo-CkQ98n-T.js";
|
|
11
|
-
import "./index-
|
|
12
|
-
import { f as wt, a as Ct } from "./animationData-
|
|
13
|
-
import { o as kt, p as Pt } from "./index-
|
|
11
|
+
import "./index-BlZXanJX.js";
|
|
12
|
+
import { f as wt, a as Ct } from "./animationData-1jRSDcwE.js";
|
|
13
|
+
import { o as kt, p as Pt } from "./index-CA-edgmV.js";
|
|
14
14
|
import { _ as je } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
15
15
|
import { U as xt, J as Tt } from "./urdfTree-BuTtRGdl.js";
|
|
16
16
|
const ae = 1e-3, ce = ct.degToRad, Xe = new mt({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),K=require("./useRayCaster-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),K=require("./useRayCaster-CvOiIyjA.cjs"),R=require("./iconfont-t5epssvu.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-hGi9c2Ju.cjs");const F=require("./index-1z9RrjZc.cjs");require("./index.vue_vue_type_style_index_1_lang-Cb3WPLY1.cjs");require("./index-BpPyaNFa.cjs");const te=require("./index-BzOBvH4x.cjs");require("./index.vue_vue_type_style_index_1_lang-B_ESWhzz.cjs");const r=require("./three-viewport-gizmo-BV37JzRa.cjs");require("./index-BaOQV1JK.cjs");const ge=require("./animationData-BQdcO65E.cjs"),he=require("./index-Dy3FE211.cjs"),fe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Ve=require("./urdfTree-CCktg0FK.cjs"),W=.001,le=r.MathUtils.degToRad,be=new r.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:r.DoubleSide}),we=C=>C.reduce((b,E)=>{let s=0;const N=E.Y??0,k=E.C??0,v=E.R??0;return N>0&&(s+=N),k>0&&v>0&&(s+=v*le(k)),b+s},0),Ne=C=>{const b=[],E=C.Y??0,s=C.B??0,N=C.C??0,k=C.R??0,v={pos:new r.Vector3(0,0,0),localY:new r.Vector3(0,1,0),localX:new r.Vector3(1,0,0),localZ:new r.Vector3(0,0,1)};if(!E&&!N)return b;if(b.push(v.pos.clone()),s!==0){const x=new r.Matrix4().makeRotationAxis(v.localY,le(s));v.localX.applyMatrix4(x),v.localZ.applyMatrix4(x)}if(E>0&&(v.pos.add(v.localY.clone().multiplyScalar(E*W)),b.push(v.pos.clone())),N>0&&k>0){const x=le(N),S=k*W,c=v.pos.clone().add(v.localX.clone().multiplyScalar(-S)),i=Math.max(16,Math.ceil(N/5));for(let g=1;g<=i;g++){const l=x*g/i,h=new r.Matrix4().makeRotationAxis(v.localZ,l),V=v.localX.clone().multiplyScalar(S).applyMatrix4(h),f=c.clone().add(V);b.push(f)}}return b};function Ce(C,b){const E=new r.Group;E.name="CompletePipe";const s={pos:new r.Vector3(0,0,0),localX:new r.Vector3(1,0,0),localY:new r.Vector3(0,1,0),localZ:new r.Vector3(0,0,1)};let N=0,k=1;for(let v=0;v<C.length;v++){const x=C[v],S=x.Y??0,c=x.B??0,i=x.C??0,g=x.R??0;if(c!==0){const l=new r.Matrix4().makeRotationAxis(s.localY,le(c));s.localX.applyMatrix4(l),s.localZ.applyMatrix4(l)}if(S>0){const l=s.pos.clone();s.pos.add(s.localY.clone().multiplyScalar(S*W));const h=s.pos.clone(),a=Ee(l,h,b*W);a.userData={segmentType:"straight",segmentIndex:N,frameIndex:v,length:S,frame:{Y:S,B:c,C:i,R:g}},a.name=`直段_${N}`,E.add(a);const V=l.clone();_e(E,k,V,b*W),N++}if(i>0&&g>0){const l=le(i),h=g*W,a=[];a.push(s.pos.clone());const V=s.pos.clone().add(s.localX.clone().multiplyScalar(-h)),f=Math.max(16,Math.ceil(i/5));for(let M=1;M<=f;M++){const Y=l*M/f,P=new r.Matrix4().makeRotationAxis(s.localZ,Y),I=s.localX.clone().multiplyScalar(h).applyMatrix4(P),J=V.clone().add(I);a.push(J)}const _=xe(a,b*W);_.userData={segmentType:"bend",segmentIndex:N,frameIndex:v,angle:i,radius:g,centerPoint:V.toArray(),frame:{Y:S,B:c,C:i,R:g}},_.name=`弯段_${N}`,E.add(_),Math.floor(a.length/2),a[0],s.pos=a[a.length-1].clone();const m=new r.Matrix4().makeRotationAxis(s.localZ,l);s.localY.applyMatrix4(m),s.localX.applyMatrix4(m),N++,k++}}return E}function _e(C,b,E,s){const N=new r.Vector3(0,s*2,s*5),k=E.clone().add(N),v=[E,k],x=new r.BufferGeometry().setFromPoints(v),S=new r.LineDashedMaterial({color:16711680,dashSize:s*.5,gapSize:s*.3,linewidth:1}),c=new r.Line(x,S);c.computeLineDistances(),C.add(c);const i=document.createElement("canvas"),g=i.getContext("2d");i.width=128,i.height=128,g.clearRect(0,0,128,128),g.fillStyle="#FF0000",g.font="bold 80px Arial",g.textAlign="center",g.textBaseline="middle",g.fillText(b.toString(),64,64);const l=new r.CanvasTexture(i),h=new r.SpriteMaterial({map:l,transparent:!0,depthTest:!1,depthWrite:!1}),a=new r.Sprite(h),V=s*3;a.scale.set(V,V,1),a.position.copy(k),a.name=`Label_${b}`,a.userData={labelNumber:b},C.add(a)}function Ee(C,b,E){const s=new r.LineCurve3(C,b),N=new r.TubeGeometry(s,2,E,18,!1);return new r.Mesh(N,be)}function xe(C,b){const E=new r.CatmullRomCurve3(C,!1,"catmullrom",.01),s=new r.TubeGeometry(E,Math.max(16,C.length*2),b,18,!1);return new r.Mesh(s,be)}function se(C,b,E,s,N,k=0){let v=b.slice(0,N+1);const x=b[N+1];if(x&&k>0){const a={...x,B:(x.B??0)*k,C:(x.C??0)*k};v.push(a)}const S=we(v),c=Math.max(0,E-S),i=[];i.push(new r.Vector3(0,0,0));const g=new r.Vector3(0,c*W,0);c>0&&i.push(g);let l={pos:g.clone(),localY:new r.Vector3(0,1,0),localX:new r.Vector3(1,0,0),localZ:new r.Vector3(0,0,1)};const h=[];for(let a=v.length-1;a>=0;a--){const V=v[a],f=Ne(V);if(f.length>0){const _=f.map(P=>{const D=P.clone(),I=new r.Matrix4;return I.makeBasis(l.localX,l.localY,l.localZ),D.applyMatrix4(I),D.add(l.pos)});h.push(_);const m=_[_.length-1];l.pos=m.clone();const M=V.B??0,Y=V.C??0;if(M!==0){const P=new r.Matrix4().makeRotationAxis(l.localY,le(M));l.localX.applyMatrix4(P),l.localZ.applyMatrix4(P)}if(Y>0){const P=le(Y),D=new r.Matrix4().makeRotationAxis(l.localZ,P);l.localY.applyMatrix4(D),l.localX.applyMatrix4(D)}}}for(const a of h)a.length>1&&i.push(...a.slice(1));i.length<2&&i.push(new r.Vector3(0,.001,0));try{const a=new r.CatmullRomCurve3(i,!1,"catmullrom",.01),V=new r.TubeGeometry(a,Math.max(2,i.length*4),s*W,18,!1);C.geometry.dispose(),C.geometry=V}catch(a){console.error("管件更新失败",a)}}function ye(C,b,E,s=0){let N=C.slice(0,E+1);const k=C[E+1];if(k&&s>0){const l={...k,B:(k.B??0)*s,C:(k.C??0)*s};N.push(l)}const v=we(N),x=Math.max(0,b-v),S=[];S.push(new r.Vector3(0,0,0));const c=new r.Vector3(0,x*W,0);x>0&&S.push(c);let i={pos:c.clone(),localY:new r.Vector3(0,1,0),localX:new r.Vector3(1,0,0),localZ:new r.Vector3(0,0,1)};const g=[];for(let l=N.length-1;l>=0;l--){const h=N[l],a=Ne(h);if(a.length>0){const V=a.map(M=>{const Y=M.clone(),P=new r.Matrix4;return P.makeBasis(i.localX,i.localY,i.localZ),Y.applyMatrix4(P),Y.add(i.pos)});g.push(V);const f=V[V.length-1];i.pos=f.clone();const _=h.B??0,m=h.C??0;if(_!==0){const M=new r.Matrix4().makeRotationAxis(i.localY,le(_));i.localX.applyMatrix4(M),i.localZ.applyMatrix4(M)}if(m>0){const M=le(m),Y=new r.Matrix4().makeRotationAxis(i.localZ,M);i.localY.applyMatrix4(Y),i.localX.applyMatrix4(Y)}}}for(const l of g)l.length>1&&S.push(...l.slice(1));return S.length<2&&S.push(new r.Vector3(0,.001,0)),S}function ae(C,b,E,s,N,k,v,x=0,S=0){const c=N-S,i=ye(s,c,v,x);let l=ye(E,S,v,x);l.forEach(a=>a.y=-a.y),l.reverse();const h=[...l,...i];try{const a=new r.CatmullRomCurve3(h,!1,"catmullrom",.01),V=new r.TubeGeometry(a,Math.max(2,h.length*4),k*W,18,!1);b.geometry.dispose(),C.geometry.dispose(),b.parent&&b.parent.remove(b),C.geometry=V}catch(a){console.error("管件更新失败",a)}}const ke={class:"panel-content"},Me={class:"action-bar"},Se={key:0,class:"animation-controls"},Pe={class:"control-row"},De={class:"control-row"},Re={class:"control-row"},Te={class:"frame-info"},$e={class:"control-row"},Be={class:"progress-bar"},ze={class:"dialog-footer"},Ae=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},emits:["getThreeData"],setup(C,{expose:b,emit:E}){const s=C,N=E,k=e.ref(),v=e.ref(),x=e.ref("单机器人弯管");e.watch(()=>s.threeData,n=>{const o=n==null?void 0:n.data;x.value=o==null?void 0:o.任务类型},{immediate:!0});const S=async()=>{if(!sessionStorage.getItem("systemKey")){N("getThreeData");return}let o={};x.value===K.robotMode.SINGLE&&(o=await ge.fetchSingleRobotAnimationData()),x.value===K.robotMode.DOUBLE&&(o=await ge.fetchDoubleRobotAnimationData());const{initialPipeLength:u=0,pipeRadius:w=0,clampLength:p=0,animationData:B}=o;P.value=u,D.value=w,I.value=p,k.value=B;const A=F.cloneDeep(k.value);c.value=(A==null?void 0:A["输出(动画数据)"])||[];let j=(A==null?void 0:A["输出(动画数据)Content"])??[];j&&(v.value=j)},c=e.ref([]),i=e.ref(!1),g=e.ref(""),l=e.ref(!1),h=e.ref(0),a=e.ref(0),V=e.ref(1e3),f=e.ref(null);let _=!1;const m=e.shallowRef(null),M=e.shallowRef(null),Y=e.shallowRef(null),P=e.ref(1302),D=e.ref(12.5),I=e.ref(30),J=e.ref([]),$=e.ref(null),y=e.computed(()=>s.model?Object.values(s.model.joints).filter(n=>n.jointType!=="fixed").map(n=>n.name):[]),U=e.ref(["Y","B","C","R"]),L=e.computed(()=>[...y.value,...U.value]),X=e.computed(()=>L.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${L.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),H=(n,o)=>{if(!o)return null;const u=n.links[o];if(!u)return console.warn(`在模型中未找到名为 '${o}' 的 link`),console.log("可用的链接:",Object.keys(n.links)),null;let w=null;return u.traverse(p=>{p instanceof r.Mesh&&!w&&(w=p)}),w||console.warn(`在 link '${o}' 中未找到可用的 Mesh 对象`),w},Q=()=>{Y.value&&(Y.value.visible=!0),m.value&&m.value.parent&&m.value.parent.remove(m.value),Y.value=null,m.value=null,M.value=null};e.watch(L,(n,o)=>{if(JSON.stringify(n)!==JSON.stringify(o))if(n.length>0){const u=n.reduce((w,p)=>(w[p]="0",w),{});c.value=[u]}else c.value=[]},{immediate:!0}),e.watch(()=>s.model,n=>{Q(),n?(f.value=new K.URDFRobotController(n),J.value=Object.keys(n.links),J.value.includes("Pipe_Link")?$.value="Pipe_Link":$.value=null):(f.value=null,J.value=[],$.value=null)},{immediate:!0}),e.watch([$,I],([n,o])=>{if(Q(),s.model&&n){const u=H(s.model,n);if(console.log(u,"meshToReplace"),u&&u.parent){Y.value=u;const w=new r.Mesh(u.geometry.clone(),u.material);if(w.name="managed_pipe_clone",u.parent.add(w),w.position.copy(u.position),w.rotation.copy(u.rotation),w.scale.copy(u.scale),u.visible=!1,x.value===K.robotMode.SINGLE&&(w.position.y-=o*.001),m.value=w,x.value===K.robotMode.DOUBLE){const p=new r.Mesh(u.geometry.clone(),u.material);p.name="managed_oppsite_pipe_clone",p.position.copy(u.position),p.rotation.copy(u.rotation),p.scale.copy(u.scale),u.parent.add(p),M.value=p}m.value&&M.value&&ae(m.value,M.value,[],[],P.value,D.value,0,0,I.value)}else n&&console.warn(`在 link '${n}' 中未找到可替换的网格或其没有父级。`)}});const oe=()=>c.value.map(n=>({Y:parseFloat(n.Y)||0,B:parseFloat(n.B)||0,C:parseFloat(n.C)||0,R:parseFloat(n.R)||0})),q=()=>{const n=[],o=[];return c.value.forEach(u=>{const{Y1:w,B1:p,C1:B,R1:A,Y2:j,B2:G,C2:d,R2:t}=u;n.push({Y:parseFloat(w)||0,B:parseFloat(p)||0,C:parseFloat(B)||0,R:parseFloat(A)||0}),o.push({Y:parseFloat(j)||0,B:parseFloat(G)||0,C:parseFloat(d)||0,R:parseFloat(t)||0})}),{posPipeYbcr:n,negPipeYbcr:o}},z=n=>{if(n<0||n>=c.value.length){console.error(`帧索引 ${n} 超出范围`);return}const o=c.value[n];if(console.log(`应用第 ${n} 帧数据 ${o}`),h.value=n,f.value){const u={};y.value.forEach(w=>{const p=parseFloat(o[w]);isNaN(p)||(u[w]=p)}),f.value.setJointAngles(u)}if(m.value&&M.value){const u=q();console.log("ybcr数据:",u),ae(m.value,M.value,u.posPipeYbcr,u.negPipeYbcr,P.value,D.value,n,0,I.value);return}if(m.value){const u=oe();console.log("ybcr数据:",u),se(m.value,u,P.value,D.value,n,0);return}},ne=async()=>{if(c.value.length===0){F.ElMessage.error("无法播放动画:无数据");return}l.value=!0,_=!1;const n=m.value?oe():[];try{for(let o=h.value+1;o<c.value.length&&!_;o++){h.value=o;const u=c.value[o],w={};f.value&&y.value.forEach(p=>{const B=parseFloat(u[p]);isNaN(B)||(w[p]=B)}),f.value?await f.value.animateToState(w,V.value,p=>{if(a.value=(o+p)/c.value.length*100,m.value&&M.value){const B=q();console.log("ybcr数据:",n),ae(m.value,M.value,B.posPipeYbcr,B.negPipeYbcr,P.value,D.value,o-1,p,I.value)}else m.value&&se(m.value,n,P.value,D.value,o-1,p)}):m.value&&M.value?await new Promise(p=>{const B=performance.now();let A;const j=G=>{if(_){cancelAnimationFrame(A),p();return}const d=G-B,t=Math.min(d/V.value,1);a.value=(o+t)/c.value.length*100;const ee=q();ae(m.value,M.value,ee.posPipeYbcr,ee.negPipeYbcr,P.value,D.value,o-1,t,I.value),t<1?A=requestAnimationFrame(j):p()};A=requestAnimationFrame(j)}):m.value?await new Promise(p=>{const B=performance.now();let A;const j=G=>{if(_){cancelAnimationFrame(A),p();return}const d=G-B,t=Math.min(d/V.value,1);a.value=(o+t)/c.value.length*100,se(m.value,n,P.value,D.value,o-1,t),t<1?A=requestAnimationFrame(j):p()};A=requestAnimationFrame(j)}):(await new Promise(p=>setTimeout(p,V.value)),a.value=(o+1)/c.value.length*100)}_||F.ElMessage.success("动画播放完成")}catch(o){console.error("动画播放出错:",o),F.ElMessage.error("动画播放出错")}finally{l.value=!1,a.value=0}},T=()=>{_=!0,l.value=!1,a.value=0,F.ElMessage.info("动画已停止")},re=()=>{if(f.value&&f.value.resetToZero(),console.log("pipeMesh.value",m.value),m.value&&M.value){const n=q();ae(m.value,M.value,n.posPipeYbcr,n.negPipeYbcr,P.value,D.value,-1,0,I.value)}else if(m.value){const n=oe();se(m.value,n,P.value,D.value,-1,0)}h.value=0,F.ElMessage.success("机器人和管件已重置")},ie=()=>{console.log("当前管件Mesh:",m.value)},ce=n=>{l.value&&T(),z(n)},ue=()=>{l.value&&T(),!(h.value+1>=c.value.length)&&z(h.value+1)},de=()=>{l.value&&T(),h.value!==0&&z(h.value-1)},pe=async()=>{if(L.value.length===0){F.ElMessage.warning("没有可导出的表头");return}const n=L.value.join(" ");try{await navigator.clipboard.writeText(n),F.ElMessage.success("表头已成功复制到剪贴板!")}catch(o){console.error("复制失败:",o),F.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},me=()=>{if(!g.value.trim()){F.ElMessage.warning("导入内容不能为空");return}const n=g.value.trim().split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./index-1z9RrjZc.cjs"),Q=require("./index.vue_vue_type_style_index_1_lang-Cb3WPLY1.cjs"),R=require("./useRayCaster-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./index-1z9RrjZc.cjs"),Q=require("./index.vue_vue_type_style_index_1_lang-Cb3WPLY1.cjs"),R=require("./useRayCaster-CvOiIyjA.cjs"),m=require("./iconfont-t5epssvu.cjs"),ne=require("./index-BzOBvH4x.cjs");require("./index.vue_vue_type_style_index_1_lang-B_ESWhzz.cjs");const ce=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./urdfTree-CCktg0FK.cjs"),Be=require("./animationData-BQdcO65E.cjs"),Ue=require("./STLLoader-RU7KqloS.cjs"),Le=require("./index-BBVbSXk-.cjs"),Ae=require("./isUndefined-ClRzgwTy.cjs"),Oe=require("./three-viewport-gizmo-BV37JzRa.cjs"),Ie={class:"panel-content"},qe={class:"action-bar"},Fe={key:0,class:"animation-controls"},Ge={class:"control-row"},Je={class:"control-row"},He={class:"frame-info"},Xe={class:"control-row"},Ke={key:1,class:"empty-state"},We={class:"dialog-footer"},Ye=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(U,{expose:J}){const w=U,a=e.ref([]),D=e.ref(!1),$=e.ref(""),h=e.ref("stopped"),b=e.ref(0),T=e.ref(0),L=e.ref(10),N=e.ref(null);let f=0;const k=e.ref([]),M=e.computed(()=>w.model?Object.values(w.model.joints).filter(s=>s.jointType!=="fixed").map(s=>s.name):[]),j=e.computed(()=>[...M.value]),z=e.computed(()=>j.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${j.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),C=e.computed(()=>a.value[b.value]||{});e.watch(()=>w.model,s=>{s?(N.value=new R.URDFRobotController(s),k.value=Object.keys(s.links),b.value=0):(N.value=null,k.value=[])},{immediate:!0});const S=s=>{if(s<0||s>=a.value.length){console.error(`帧索引 ${s} 超出范围`);return}const l=a.value[s];if(N.value){const p={};M.value.forEach(d=>{const r=parseFloat(l[d]);isNaN(r)||(p[d]=r)}),N.value.setJointAngles(p)}b.value=s,T.value=a.value.length>1?s/(a.value.length-1)*100:100},H=async s=>{try{for(let l=b.value;l<a.value.length;l++){if(s!==f)return;const p=a.value[l],d={};if(N.value)M.value.forEach(r=>{const i=parseFloat(p[r]);isNaN(i)||(d[r]=i)}),await N.value.animateToState(d,L.value,r=>{s===f&&(T.value=(l+r)/a.value.length*100)});else{if(await new Promise(r=>setTimeout(r,L.value)),s!==f)return;T.value=(l+1)/a.value.length*100}b.value=l}s===f&&(u.ElMessage.success("动画播放完成"),h.value="stopped",T.value=100)}catch(l){console.error("动画播放出错:",l),u.ElMessage.error("动画播放出错"),h.value="stopped"}},X=()=>{if(a.value.length===0){u.ElMessage.error("无动画数据");return}h.value==="stopped"&&(b.value=0,S(0)),h.value="playing",f++,H(f),u.ElMessage.info("动画播放中")},K=()=>{h.value==="playing"&&(f++,h.value="paused",u.ElMessage.info("动画已暂停"))},A=()=>{f++,h.value="stopped",b.value=0,T.value=0,S(0),u.ElMessage.info("动画已停止并重置")},B=()=>{h.value==="playing"?K():X()},O=s=>{f++,h.value="paused",S(s)},W=()=>{if(!$.value.trim()){u.ElMessage.warning("导入内容不能为空");return}const s=$.value.trim().split(`
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { defineComponent as Ue, ref as u, computed as T, watch as H, onUnmounted as at, resolveComponent as K, createElementBlock as O, openBlock as z, createElementVNode as l, createCommentVNode as I, createVNode as i, toDisplayString as R, Fragment as nt, renderList as ot, withCtx as ne, inject as ve, shallowRef as pe, onMounted as st, nextTick as it, onBeforeUnmount as ut, withDirectives as x, vShow as F, renderSlot as ae, unref as c, createBlock as $e, isRef as me, vModelRadio as fe } from "vue";
|
|
2
2
|
import { c as rt, E as y, p as be, s as ye, u as dt } from "./index-DbzvXPKu.js";
|
|
3
|
-
import { k as ct, a as vt, u as pt, aG as mt } from "./index.vue_vue_type_style_index_1_lang-
|
|
4
|
-
import { U as ft, s as ke, u as gt, a as ht, W as bt } from "./useRayCaster-
|
|
3
|
+
import { k as ct, a as vt, u as pt, aG as mt } from "./index.vue_vue_type_style_index_1_lang-Bl5IzVKi.js";
|
|
4
|
+
import { U as ft, s as ke, u as gt, a as ht, W as bt } from "./useRayCaster-CQ61IQT5.js";
|
|
5
5
|
import { u as yt, a as kt, b as Pt, S as h } from "./iconfont-pt17sMx3.js";
|
|
6
|
-
import { _ as Pe } from "./index-
|
|
7
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
6
|
+
import { _ as Pe } from "./index-Ci_C9h8v.js";
|
|
7
|
+
import "./index.vue_vue_type_style_index_1_lang-Bmq_QiXo.js";
|
|
8
8
|
import { _ as je } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
9
9
|
import { U as Ct, J as wt } from "./urdfTree-BuTtRGdl.js";
|
|
10
|
-
import { i as _t } from "./animationData-
|
|
10
|
+
import { i as _t } from "./animationData-1jRSDcwE.js";
|
|
11
11
|
import { O as xt } from "./STLLoader-CiUjaQtA.js";
|
|
12
|
-
import { h as Tt } from "./index-
|
|
12
|
+
import { h as Tt } from "./index-C9gh-jny.js";
|
|
13
13
|
import { d as $t } from "./isUndefined-chfCDxUU.js";
|
|
14
14
|
import { e as zt } from "./three-viewport-gizmo-CkQ98n-T.js";
|
|
15
15
|
const Ut = { class: "panel-content" }, jt = { class: "action-bar" }, Vt = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed as _, defineComponent as $, defineAsyncComponent as S, ref as M, watch as G, createElementBlock as B, openBlock as y, normalizeClass as j, createBlock as b, createCommentVNode as L, unref as P } from "vue";
|
|
2
2
|
import { a as R, bY as Y, p as I, s as O } from "./index-DbzvXPKu.js";
|
|
3
|
-
import { u as H } from "./index.vue_vue_type_style_index_1_lang-
|
|
4
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
3
|
+
import { u as H } from "./index.vue_vue_type_style_index_1_lang-Bl5IzVKi.js";
|
|
4
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DkSoLqEi.js";
|
|
5
5
|
import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
6
|
function se(c) {
|
|
7
7
|
const f = sessionStorage.getItem("loginToken") ?? "123456";
|
|
@@ -137,7 +137,7 @@ const X = {
|
|
|
137
137
|
},
|
|
138
138
|
emits: ["getThreeData"],
|
|
139
139
|
setup(c, { emit: f }) {
|
|
140
|
-
const h = S(() => import("./threeSceneView-
|
|
140
|
+
const h = S(() => import("./threeSceneView-BLWTfaec.js")), g = S(() => import("./threePreview-CYX5wKoL.js")), p = S(() => import("./threeLatheView-BmVBnC8n.js")), T = S(() => import("./threeSceneViewForCPMPIP-skA3ZWC-.js")), o = {
|
|
141
141
|
ROBOT_SCENE: "robot",
|
|
142
142
|
// 机器人场景
|
|
143
143
|
LATHE_SCENE: "latheScene",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),m=require("./index-1z9RrjZc.cjs"),A=require("./index.vue_vue_type_style_index_1_lang-Cb3WPLY1.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-hGi9c2Ju.cjs");const L=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function O(l){const f=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/uploadFile",method:"post",data:l,headers:{Authorization:f,"Content-Type":"multipart/form-data"}})}function B(l){const f=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/downloadFile",method:"post",data:l,headers:{Authorization:f,Accept:"application/octet-stream"},responseType:"blob"})}function q(l){const f=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/uploadFiles",method:"post",data:l,headers:{Authorization:f,"Content-Type":"multipart/form-data"}})}const I=m.defineStore("threeState",{state:()=>({data:{extension:"",url:[],data:{},isThreeScene:!0}}),actions:{setData(l){this.data=l},getData(){return this.data}}});function R(){const l=A.useMenuState(m.pinia),{platform:f}=m.storeToRefs(l),y=I(m.pinia),S=t.computed(()=>{var e;return(e=y==null?void 0:y.data)==null?void 0:e.extension}),d=["uv","cpt","cyd"],v=["urdf"],s=["obj","stl"],o=[...d,...v,...s],P=e=>{if(!E())throw new Error("不是三维系统");y.setData(e)},h=()=>y.getData(),E=()=>f.value==="three",u=e=>{const i=e==null?void 0:e.toLowerCase(),c=i==null?void 0:i.lastIndexOf(".");let T=i;return c>=0&&(T=T==null?void 0:T.slice(c+1)),T},w=e=>{if(!e)return!1;const i=u(e);return o==null?void 0:o.includes(i)};return{getData:h,setData:P,isThreeSystem:E,isUrdf:e=>{if(!e)return!1;const i=u(e);return v==null?void 0:v.includes(i)},isGeneralFile:e=>{if(!e)return!1;const i=u(e);return s==null?void 0:s.includes(i)},isTrackPathFile:e=>{if(!e)return!1;const i=u(e);return d==null?void 0:d.includes(i)},isThreeFile:w,isUseBackdrop:e=>E()&&w(e),initTrackFileType:e=>{if(!e)return{isCpt:!1,isCyd:!1,isUv:!1};const i=u(e),c=d==null?void 0:d.find(b=>b===i);return{isCpt:c==="cpt",isCyd:c==="cyd",isUv:c==="uv"}},getFileExtension:u,extraExtension:S}}const x={key:4,class:"loading"},z=t.defineComponent({__name:"threeViewerHost",props:{fileUrls:{default:()=>[]},host:{default:"inline"},extension:{},animationData:{default:()=>({})},width:{default:"100%"},height:{default:"100%"},threeData:{},componentType:{}},emits:["getThreeData"],setup(l,{emit:f}){const y=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-
|
|
1
|
+
"use strict";const t=require("vue"),m=require("./index-1z9RrjZc.cjs"),A=require("./index.vue_vue_type_style_index_1_lang-Cb3WPLY1.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-hGi9c2Ju.cjs");const L=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function O(l){const f=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/uploadFile",method:"post",data:l,headers:{Authorization:f,"Content-Type":"multipart/form-data"}})}function B(l){const f=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/downloadFile",method:"post",data:l,headers:{Authorization:f,Accept:"application/octet-stream"},responseType:"blob"})}function q(l){const f=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/uploadFiles",method:"post",data:l,headers:{Authorization:f,"Content-Type":"multipart/form-data"}})}const I=m.defineStore("threeState",{state:()=>({data:{extension:"",url:[],data:{},isThreeScene:!0}}),actions:{setData(l){this.data=l},getData(){return this.data}}});function R(){const l=A.useMenuState(m.pinia),{platform:f}=m.storeToRefs(l),y=I(m.pinia),S=t.computed(()=>{var e;return(e=y==null?void 0:y.data)==null?void 0:e.extension}),d=["uv","cpt","cyd"],v=["urdf"],s=["obj","stl"],o=[...d,...v,...s],P=e=>{if(!E())throw new Error("不是三维系统");y.setData(e)},h=()=>y.getData(),E=()=>f.value==="three",u=e=>{const i=e==null?void 0:e.toLowerCase(),c=i==null?void 0:i.lastIndexOf(".");let T=i;return c>=0&&(T=T==null?void 0:T.slice(c+1)),T},w=e=>{if(!e)return!1;const i=u(e);return o==null?void 0:o.includes(i)};return{getData:h,setData:P,isThreeSystem:E,isUrdf:e=>{if(!e)return!1;const i=u(e);return v==null?void 0:v.includes(i)},isGeneralFile:e=>{if(!e)return!1;const i=u(e);return s==null?void 0:s.includes(i)},isTrackPathFile:e=>{if(!e)return!1;const i=u(e);return d==null?void 0:d.includes(i)},isThreeFile:w,isUseBackdrop:e=>E()&&w(e),initTrackFileType:e=>{if(!e)return{isCpt:!1,isCyd:!1,isUv:!1};const i=u(e),c=d==null?void 0:d.find(b=>b===i);return{isCpt:c==="cpt",isCyd:c==="cyd",isUv:c==="uv"}},getFileExtension:u,extraExtension:S}}const x={key:4,class:"loading"},z=t.defineComponent({__name:"threeViewerHost",props:{fileUrls:{default:()=>[]},host:{default:"inline"},extension:{},animationData:{default:()=>({})},width:{default:"100%"},height:{default:"100%"},threeData:{},componentType:{}},emits:["getThreeData"],setup(l,{emit:f}){const y=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-JPxH8xcz.cjs"))),S=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-C_mY_TBC.cjs"))),d=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeLatheView-CZdorls1.cjs"))),v=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-CT63Js8f.cjs"))),s={ROBOT_SCENE:"robot",LATHE_SCENE:"latheScene",CPMPIP_SCENE:"cpmpip",PREVIEW:"preview"},o=l,P=A.useMenuState(m.pinia),{platName:h}=m.storeToRefs(P),{isGeneralFile:E,isUrdf:u,isTrackPathFile:w,extraExtension:g}=R(),F=t.computed(()=>(o==null?void 0:o.extension)||g.value),k=t.computed(()=>{var n,r;return(r=(n=o==null?void 0:o.threeData)==null?void 0:n.data)==null?void 0:r.trackFileType}),C=t.computed(()=>{var r;if(o.componentType)switch(o.componentType){case"robot":return s.ROBOT_SCENE;case"latheScene":return s.LATHE_SCENE;case"cpmpip":return s.CPMPIP_SCENE;case"preview":return s.PREVIEW}const n=(r=o==null?void 0:o.fileUrls)==null?void 0:r[0];return E(n)?s.PREVIEW:(h==null?void 0:h.value)==="CPMPIP"&&(u(n)||u(F.value))?s.CPMPIP_SCENE:(h==null?void 0:h.value)==="SFRTubeBend"&&(u(n)||u(F.value))?s.ROBOT_SCENE:w(F.value)&&k.value?s.LATHE_SCENE:s.PREVIEW}),D=f,e=t.ref([]),i=t.ref(!1);function c(n){try{const r=new URL(n).pathname,p=r.substring(r.lastIndexOf("/")+1);return decodeURIComponent(p)}catch(r){return console.error("无法解析URL以提取文件名:",n,r),"未知文件名"}}async function T(n){let r,p;if(/^https?:\/\//.test(n))try{const a=await fetch(n);if(!a.ok)throw new Error(`下载文件失败: ${a.statusText} (URL: ${n})`);r=await a.blob(),p=c(n)}catch(a){throw console.error("使用 fetch 下载文件时出错:",a),a}else try{const a=await B({url:n});if(a.status!==200)throw new Error(`下载失败: ${a.status}`);const _=a.headers["content-disposition"];p=b(_)||"无文件名",r=a.data}catch(a){throw console.error("通过 API 下载文件时出错:",a),a}return new File([r],p,{type:r.type})}function b(n){if(!n)return;const r=n.match(/filename\*\s*=\s*([^;]+)/i);if(r){let a=r[1].trim();a=a.replace(/^"(.*)"$/,"$1");const _=a.split("''");if(_.length===2){const H=_[0].toUpperCase(),U=_[1];try{if(H==="UTF-8")return decodeURIComponent(U)}catch{}return U}try{return decodeURIComponent(a)}catch{return a}}const p=n.match(/filename\s*=\s*("?)([^";]+)\1/i);if(p)return p[2].trim()}async function N(n){if(!n||!n.length){e.value=[];return}i.value=!0;try{const r=await Promise.all(n.map(p=>T(p)));e.value=r}catch(r){console.error("文件下载时发生错误:",r),e.value=[]}finally{i.value=!1}}const M=()=>{D("getThreeData")};return t.watch(()=>o.fileUrls,async n=>{await N(n??[])},{immediate:!0,deep:!0}),(n,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass([o.host==="electron"?"mv-electron":"mv-inline","three-platform"])},[C.value===s.ROBOT_SCENE?(t.openBlock(),t.createBlock(t.unref(y),{key:0,"file-blobs":e.value,"animation-data":n.animationData,onGetThreeData:M,threeData:o.threeData},null,8,["file-blobs","animation-data","threeData"])):C.value===s.LATHE_SCENE?(t.openBlock(),t.createBlock(t.unref(d),{key:1,fileUrls:n.fileUrls,threeData:o.threeData,trackFileType:k.value},null,8,["fileUrls","threeData","trackFileType"])):C.value===s.CPMPIP_SCENE?(t.openBlock(),t.createBlock(t.unref(v),{key:2,"file-blobs":e.value,threeData:o.threeData},null,8,["file-blobs","threeData"])):C.value===s.PREVIEW?(t.openBlock(),t.createBlock(t.unref(S),{key:3,"file-blobs":e.value,"animation-data":n.animationData},null,8,["file-blobs","animation-data"])):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createElementBlock("div",x," 文件下载中,请稍候... ")):t.createCommentVNode("",!0)],2))}}),V=L._export_sfc(z,[["__scopeId","data-v-5e37b1fe"]]),W=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));exports.ThreeViewerHost=V;exports.downloadAvatarApi=B;exports.threeViewerHost=W;exports.uploadAmountApi=q;exports.uploadFile=O;exports.useThreeState=I;exports.useThreeSystem=R;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var de = Object.defineProperty;
|
|
2
2
|
var me = (n, s, t) => s in n ? de(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t;
|
|
3
3
|
var x = (n, s, t) => me(n, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
import { U as pe } from "./index.vue_vue_type_style_index_1_lang-
|
|
4
|
+
import { U as pe } from "./index.vue_vue_type_style_index_1_lang-Bmq_QiXo.js";
|
|
5
5
|
import { S as ve, M as fe, O as be } from "./STLLoader-CiUjaQtA.js";
|
|
6
6
|
import { ay as we, n as E, h as he, e as _e, B as ge, V as z, Q as Me, E as ye, az as Re, J as Se } from "./three-viewport-gizmo-CkQ98n-T.js";
|
|
7
7
|
import { defineComponent as $e, ref as V, computed as D, watch as ue, resolveComponent as J, createElementBlock as j, openBlock as I, createVNode as F, createElementVNode as c, withCtx as L, createTextVNode as U, toDisplayString as C } from "vue";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var te=Object.defineProperty;var oe=(r,i,o)=>i in r?te(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o;var D=(r,i,o)=>oe(r,typeof i!="symbol"?i+"":i,o);const se=require("./index.vue_vue_type_style_index_1_lang-Ck3aGjUr.cjs"),C=require("./STLLoader-RU7KqloS.cjs"),R=require("./three-viewport-gizmo-BV37JzRa.cjs"),e=require("vue"),ie=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),le={SINGLE:"单机器人弯管",DOUBLE:"双机器人弯管"},ne={ROBOT:1,PIPECOMPARSION:2},re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function x(r){if(r==null||!isFinite(r))return"";const i=r/(1024*1024);if(i>=1)return`${i.toFixed(1)} MB`;const o=r/1024;return o>=1?`${o.toFixed(1)} KB`:`${r} B`}function ee(r){try{const i=r.split("?")[0].split("#")[0];return i.substring(i.lastIndexOf("/")+1)||i}catch{return r}}function ae(r){const{manager:i,baseFolderUrl:o,onFileProgress:l}=r,m=new se.URDFLoader(i);return m.packages=n=>`${o.endsWith("/")?o:o+"/"}${n}/`,m.loadMeshCb=(n,N,h)=>{const g=(()=>{const _=n.split("?")[0].split("#")[0],u=_.lastIndexOf(".");return u>=0?_.slice(u+1).toLowerCase():void 0})();switch(g){case"obj":{const _=(()=>{try{return new URL(".",n).toString()}catch{const c=n.lastIndexOf("/");return c>=0?n.slice(0,c+1):n}})(),u=(()=>{var v;return(((v=n.split("/").pop())==null?void 0:v.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${_}${u}.mtl`,E=c=>{const v=new C.OBJLoader(N);c&&v.setMaterials(c),v.load(n,b=>h(b),b=>l==null?void 0:l(n,b==null?void 0:b.loaded,b==null?void 0:b.total),b=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${n}`,b),h(new R.Group)})},w=new C.MTLLoader(N);w.setResourcePath(_),w.load(f,c=>{try{c.preload()}catch{}E(c)},c=>l==null?void 0:l(f,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),E(void 0)});break}case"stl":{new C.STLLoader(N).load(n,u=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),E=new R.Mesh(u,f);E.castShadow=!0,E.receiveShadow=!0,h(E)},u=>l==null?void 0:l(n,u==null?void 0:u.loaded,u==null?void 0:u.total),u=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${n}`,u),h(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${n})`),h(new R.Group)}},m}function ce(r,i,o,l){return{loadSceneFromFile:n=>new Promise((N,h)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,_=0,u=null;const f=new R.LoadingManager;f.onStart=(w,c,v)=>{g=v||0,_=c||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(w,c,v)=>{_=c,g=v;const b=`正在加载 ${c} / ${v} 个文件: ${ee(w)}`;l.value=b,c===v&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(u){u.updateMatrixWorld(!0);const p=new R.Box3().setFromObject(u);p.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),u.userData.boundingBox=p,u.traverse(d=>{d.isMesh&&(d.castShadow=!0,d.receiveShadow=!0)}),N(u)}else h(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=w=>{console.warn(`LoadingManager 报告一个资源加载失败: ${w}。加载流程将继续。`)};const E=(w,c,v)=>{const b=ee(w);let p;v&&v>0?p=`${b}(${x(c)} / ${x(v)})`:c&&c>0?p=`${b}(已下载 ${x(c)})`:p=`${b}`,l.value=`正在下载第 ${_+1} / ${g} 个文件: ${p}`};try{const w=URL.createObjectURL(n);ae({manager:f,baseFolderUrl:re,onFileProgress:E}).load(w,v=>{u=v},void 0,v=>{console.error(`加载 URDF 文件 (${n.name}) 时发生致命错误:`,v),l.value="URDF 文件解析失败",o.value=!1,h(new Error(`加载 URDF 文件失败: ${n.name}`,{cause:v}))})}catch(w){console.error("初始化 URDF 加载时发生致命错误:",w),l.value="模型加载失败",o.value=!1,h(w)}})}}class ue{constructor(i){D(this,"robot");D(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),n=Date.now();return new Promise(N=>{const h=()=>{const g=Date.now()-n,_=Math.min(g/o,1),u=this.easeInOutCubic(_),f={};Object.keys(i).forEach(E=>{const w=m[E]||0,c=i[E];f[E]=w+(c-w)*u}),this.setJointAngles(f),l&&l(_),_<1?requestAnimationFrame(h):N()};h()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,n=>{l&&l(m,n)})}}const de=(r,i="YZX")=>{const o=new R.Vector3,l=new R.Quaternion,m=new R.Vector3,n=new R.Euler;r.getWorldPosition(o),r.getWorldQuaternion(l),r.getWorldScale(m),n.setFromQuaternion(l,i);const N={x:r.rotation.x*180/Math.PI,y:r.rotation.y*180/Math.PI,z:r.rotation.z*180/Math.PI},h={x:n.x*180/Math.PI,y:n.y*180/Math.PI,z:n.z*180/Math.PI};return{position:r.position,rotation:N,scale:r.scale,worldPosition:o,worldRotation:h,worldScale:m}},me=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.position[i]=l,r.updateMatrixWorld(!0))},pe=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.rotation[i]=l*Math.PI/180,r.updateMatrixWorld(!0))},ve={class:"panel-content"},fe={class:"obj"},we={key:0,class:"obj-base"},be=["title"],he=["title"],Ve={key:1},_e={class:"obj-position"},Ee={class:"coord-item"},Ne={class:"coord-item"},ge={class:"coord-item"},ye={class:"obj-rotation"},Re={class:"coord-item"},Se={class:"coord-item"},Me={class:"coord-item"},De={class:"world"},Ce={class:"coord-line"},xe={class:"coord-text"},Fe={class:"world-position-item"},$e={class:"world-position-item"},Le={class:"world-position-item"},Oe={class:"coord-line"},Ue={class:"coord-text"},je={class:"world-rotation-item"},Je={class:"world-rotation-item"},ke={class:"world-rotation-item"},Ie=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(r,{emit:i}){const o=r,l=i,m=e.ref([]),n=e.ref({}),N=(t,s=0)=>{const V=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(a=>{if(!(a!=null&&a.isMesh)){const y={name:a==null?void 0:a.name,label:(a==null?void 0:a.name)||(a==null?void 0:a.type),show:!0,level:s+1,isPenultimate:!1,type:a==null?void 0:a.type,id:a==null?void 0:a.id,limit:(a==null?void 0:a.limit)??"",children:N(a==null?void 0:a.children,s+1),path:a==null?void 0:a.name};V.push(y)}}),V},h=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:N(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const V=[],a=[...t];for(;a.length>0&&V.length<s;){const y=a.shift();y.children&&y.children.length>0&&(V.push(y.id),a.push(...y.children))}return V},_=(t,s)=>{const V=[];return t.forEach(a=>{if(a.children&&a.children.length>0){V.push(a.id);const y=a.children.filter(M=>M.children&&M.children.length>0).slice(0,s).map(M=>M.id);V.push(...y)}}),V.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?_(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const u=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,E=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},w=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},c=t=>{l("visibleChange",t)},v=e.computed(()=>o!=null&&o.model?h(o.model):[]),b=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),p=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),d=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(n.value=de(o.model))},{deep:!0,immediate:!0}),e.watch(v,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var M,F,$,L,O,U,j,J,k,I,T,P,z,B,A,W,q,G,Q,X,Y,Z,K,H;const V=e.resolveComponent("el-divider"),a=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(V,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",{class:"obj-name",title:b.value},e.toDisplayString(b.value),9,be),e.createElementVNode("div",{class:"obj-type",title:p.value},"["+e.toDisplayString(p.value)+"]",9,he)])):(e.openBlock(),e.createElementBlock("div",Ve,"空")),e.createVNode(a,{"model-value":d.value,onChange:c},null,8,["model-value"])]),e.createVNode(V,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",_e,[e.createElementVNode("div",Ee,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":u((F=(M=n.value)==null?void 0:M.position)==null?void 0:F.x),onChange:s[0]||(s[0]=S=>E(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":u((L=($=n.value)==null?void 0:$.position)==null?void 0:L.y),onChange:s[1]||(s[1]=S=>E(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":u((U=(O=n.value)==null?void 0:O.position)==null?void 0:U.z),onChange:s[2]||(s[2]=S=>E(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",ye,[e.createElementVNode("div",Re,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((J=(j=n.value)==null?void 0:j.rotation)==null?void 0:J.x),onChange:s[3]||(s[3]=S=>w(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((I=(k=n.value)==null?void 0:k.rotation)==null?void 0:I.y),onChange:s[4]||(s[4]=S=>w(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Me,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((P=(T=n.value)==null?void 0:T.rotation)==null?void 0:P.z),onChange:s[5]||(s[5]=S=>w(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",De,[e.createElementVNode("div",Ce,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",xe,[e.createElementVNode("div",Fe,e.toDisplayString(u((B=(z=n.value)==null?void 0:z.worldPosition)==null?void 0:B.x))+", ",1),e.createElementVNode("div",$e,e.toDisplayString(u((W=(A=n.value)==null?void 0:A.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Le,e.toDisplayString(u((G=(q=n.value)==null?void 0:q.worldPosition)==null?void 0:G.z)),1)])]),e.createElementVNode("div",Oe,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Ue,[e.createElementVNode("div",je,e.toDisplayString(f((X=(Q=n.value)==null?void 0:Q.worldRotation)==null?void 0:X.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((Z=(Y=n.value)==null?void 0:Y.worldRotation)==null?void 0:Z.y))+"°, ",1),e.createElementVNode("div",ke,e.toDisplayString(f((H=(K=n.value)==null?void 0:K.worldRotation)==null?void 0:H.z))+"° ",1)])])])])}}}),Te=ie._export_sfc(Ie,[["__scopeId","data-v-00d48931"]]);function Pe(r,i,o,l=["URDFVisual"]){let m=null;const n=e.ref(null),N=new R.Raycaster,h=new R.Vector2,g=new Map;function _(){o.value.forEach(p=>{p.traverse(d=>{l!=null&&l.includes(d.type)&&g.set(d.id,{obj:d,axis:d.axis||new R.Vector3(1,0,0),limits:d.limits})})})}function u(p){n.value&&n.value.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(0))}),n.value=p,p.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(65280))})}function f(p){const d=r.value.getBoundingClientRect();h.x=(p.clientX-d.left)/d.width*2-1,h.y=-((p.clientY-d.top)/d.height)*2+1,N.setFromCamera(h,m);const t=N.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,V=null;for(;s;){if(g.has(s.id)){V=g.get(s.id);break}s=s.parent}V&&u(V)}function E(){r.value&&r.value.removeEventListener("click",f,!1)}function w(){const{scene:p,camera:d}=i();m=d,_(),r.value&&r.value.addEventListener("click",f,!1)}function c(p){n.value&&(n.value.obj.visible=p)}function v(p){var s;const{axis:d,value:t}=p;me((s=n.value)==null?void 0:s.obj,d,t)}function b(p){var s;const{axis:d,value:t}=p;pe((s=n.value)==null?void 0:s.obj,d,t)}return{initRaycaster:w,dispose:E,selectedObject3D:n,setSelectedObjVisible:c,updatePosition:v,updateRotation:b}}exports.URDFRobotController=ue;exports.WorkpieceTreePanel=Te;exports.robotMode=le;exports.sceneType=ne;exports.useRaycaster=Pe;exports.useUrdfLoader=ce;
|
|
1
|
+
"use strict";var te=Object.defineProperty;var oe=(r,i,o)=>i in r?te(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o;var D=(r,i,o)=>oe(r,typeof i!="symbol"?i+"":i,o);const se=require("./index.vue_vue_type_style_index_1_lang-B_ESWhzz.cjs"),C=require("./STLLoader-RU7KqloS.cjs"),R=require("./three-viewport-gizmo-BV37JzRa.cjs"),e=require("vue"),ie=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),le={SINGLE:"单机器人弯管",DOUBLE:"双机器人弯管"},ne={ROBOT:1,PIPECOMPARSION:2},re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function x(r){if(r==null||!isFinite(r))return"";const i=r/(1024*1024);if(i>=1)return`${i.toFixed(1)} MB`;const o=r/1024;return o>=1?`${o.toFixed(1)} KB`:`${r} B`}function ee(r){try{const i=r.split("?")[0].split("#")[0];return i.substring(i.lastIndexOf("/")+1)||i}catch{return r}}function ae(r){const{manager:i,baseFolderUrl:o,onFileProgress:l}=r,m=new se.URDFLoader(i);return m.packages=n=>`${o.endsWith("/")?o:o+"/"}${n}/`,m.loadMeshCb=(n,N,h)=>{const g=(()=>{const _=n.split("?")[0].split("#")[0],u=_.lastIndexOf(".");return u>=0?_.slice(u+1).toLowerCase():void 0})();switch(g){case"obj":{const _=(()=>{try{return new URL(".",n).toString()}catch{const c=n.lastIndexOf("/");return c>=0?n.slice(0,c+1):n}})(),u=(()=>{var v;return(((v=n.split("/").pop())==null?void 0:v.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${_}${u}.mtl`,E=c=>{const v=new C.OBJLoader(N);c&&v.setMaterials(c),v.load(n,b=>h(b),b=>l==null?void 0:l(n,b==null?void 0:b.loaded,b==null?void 0:b.total),b=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${n}`,b),h(new R.Group)})},w=new C.MTLLoader(N);w.setResourcePath(_),w.load(f,c=>{try{c.preload()}catch{}E(c)},c=>l==null?void 0:l(f,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),E(void 0)});break}case"stl":{new C.STLLoader(N).load(n,u=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),E=new R.Mesh(u,f);E.castShadow=!0,E.receiveShadow=!0,h(E)},u=>l==null?void 0:l(n,u==null?void 0:u.loaded,u==null?void 0:u.total),u=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${n}`,u),h(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${n})`),h(new R.Group)}},m}function ce(r,i,o,l){return{loadSceneFromFile:n=>new Promise((N,h)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,_=0,u=null;const f=new R.LoadingManager;f.onStart=(w,c,v)=>{g=v||0,_=c||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(w,c,v)=>{_=c,g=v;const b=`正在加载 ${c} / ${v} 个文件: ${ee(w)}`;l.value=b,c===v&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(u){u.updateMatrixWorld(!0);const p=new R.Box3().setFromObject(u);p.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),u.userData.boundingBox=p,u.traverse(d=>{d.isMesh&&(d.castShadow=!0,d.receiveShadow=!0)}),N(u)}else h(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=w=>{console.warn(`LoadingManager 报告一个资源加载失败: ${w}。加载流程将继续。`)};const E=(w,c,v)=>{const b=ee(w);let p;v&&v>0?p=`${b}(${x(c)} / ${x(v)})`:c&&c>0?p=`${b}(已下载 ${x(c)})`:p=`${b}`,l.value=`正在下载第 ${_+1} / ${g} 个文件: ${p}`};try{const w=URL.createObjectURL(n);ae({manager:f,baseFolderUrl:re,onFileProgress:E}).load(w,v=>{u=v},void 0,v=>{console.error(`加载 URDF 文件 (${n.name}) 时发生致命错误:`,v),l.value="URDF 文件解析失败",o.value=!1,h(new Error(`加载 URDF 文件失败: ${n.name}`,{cause:v}))})}catch(w){console.error("初始化 URDF 加载时发生致命错误:",w),l.value="模型加载失败",o.value=!1,h(w)}})}}class ue{constructor(i){D(this,"robot");D(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),n=Date.now();return new Promise(N=>{const h=()=>{const g=Date.now()-n,_=Math.min(g/o,1),u=this.easeInOutCubic(_),f={};Object.keys(i).forEach(E=>{const w=m[E]||0,c=i[E];f[E]=w+(c-w)*u}),this.setJointAngles(f),l&&l(_),_<1?requestAnimationFrame(h):N()};h()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,n=>{l&&l(m,n)})}}const de=(r,i="YZX")=>{const o=new R.Vector3,l=new R.Quaternion,m=new R.Vector3,n=new R.Euler;r.getWorldPosition(o),r.getWorldQuaternion(l),r.getWorldScale(m),n.setFromQuaternion(l,i);const N={x:r.rotation.x*180/Math.PI,y:r.rotation.y*180/Math.PI,z:r.rotation.z*180/Math.PI},h={x:n.x*180/Math.PI,y:n.y*180/Math.PI,z:n.z*180/Math.PI};return{position:r.position,rotation:N,scale:r.scale,worldPosition:o,worldRotation:h,worldScale:m}},me=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.position[i]=l,r.updateMatrixWorld(!0))},pe=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.rotation[i]=l*Math.PI/180,r.updateMatrixWorld(!0))},ve={class:"panel-content"},fe={class:"obj"},we={key:0,class:"obj-base"},be=["title"],he=["title"],Ve={key:1},_e={class:"obj-position"},Ee={class:"coord-item"},Ne={class:"coord-item"},ge={class:"coord-item"},ye={class:"obj-rotation"},Re={class:"coord-item"},Se={class:"coord-item"},Me={class:"coord-item"},De={class:"world"},Ce={class:"coord-line"},xe={class:"coord-text"},Fe={class:"world-position-item"},$e={class:"world-position-item"},Le={class:"world-position-item"},Oe={class:"coord-line"},Ue={class:"coord-text"},je={class:"world-rotation-item"},Je={class:"world-rotation-item"},ke={class:"world-rotation-item"},Ie=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(r,{emit:i}){const o=r,l=i,m=e.ref([]),n=e.ref({}),N=(t,s=0)=>{const V=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(a=>{if(!(a!=null&&a.isMesh)){const y={name:a==null?void 0:a.name,label:(a==null?void 0:a.name)||(a==null?void 0:a.type),show:!0,level:s+1,isPenultimate:!1,type:a==null?void 0:a.type,id:a==null?void 0:a.id,limit:(a==null?void 0:a.limit)??"",children:N(a==null?void 0:a.children,s+1),path:a==null?void 0:a.name};V.push(y)}}),V},h=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:N(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const V=[],a=[...t];for(;a.length>0&&V.length<s;){const y=a.shift();y.children&&y.children.length>0&&(V.push(y.id),a.push(...y.children))}return V},_=(t,s)=>{const V=[];return t.forEach(a=>{if(a.children&&a.children.length>0){V.push(a.id);const y=a.children.filter(M=>M.children&&M.children.length>0).slice(0,s).map(M=>M.id);V.push(...y)}}),V.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?_(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const u=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,E=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},w=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},c=t=>{l("visibleChange",t)},v=e.computed(()=>o!=null&&o.model?h(o.model):[]),b=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),p=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),d=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(n.value=de(o.model))},{deep:!0,immediate:!0}),e.watch(v,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var M,F,$,L,O,U,j,J,k,I,T,P,z,B,A,W,q,G,Q,X,Y,Z,K,H;const V=e.resolveComponent("el-divider"),a=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(V,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",{class:"obj-name",title:b.value},e.toDisplayString(b.value),9,be),e.createElementVNode("div",{class:"obj-type",title:p.value},"["+e.toDisplayString(p.value)+"]",9,he)])):(e.openBlock(),e.createElementBlock("div",Ve,"空")),e.createVNode(a,{"model-value":d.value,onChange:c},null,8,["model-value"])]),e.createVNode(V,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",_e,[e.createElementVNode("div",Ee,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":u((F=(M=n.value)==null?void 0:M.position)==null?void 0:F.x),onChange:s[0]||(s[0]=S=>E(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":u((L=($=n.value)==null?void 0:$.position)==null?void 0:L.y),onChange:s[1]||(s[1]=S=>E(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":u((U=(O=n.value)==null?void 0:O.position)==null?void 0:U.z),onChange:s[2]||(s[2]=S=>E(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",ye,[e.createElementVNode("div",Re,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((J=(j=n.value)==null?void 0:j.rotation)==null?void 0:J.x),onChange:s[3]||(s[3]=S=>w(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((I=(k=n.value)==null?void 0:k.rotation)==null?void 0:I.y),onChange:s[4]||(s[4]=S=>w(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Me,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((P=(T=n.value)==null?void 0:T.rotation)==null?void 0:P.z),onChange:s[5]||(s[5]=S=>w(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",De,[e.createElementVNode("div",Ce,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",xe,[e.createElementVNode("div",Fe,e.toDisplayString(u((B=(z=n.value)==null?void 0:z.worldPosition)==null?void 0:B.x))+", ",1),e.createElementVNode("div",$e,e.toDisplayString(u((W=(A=n.value)==null?void 0:A.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Le,e.toDisplayString(u((G=(q=n.value)==null?void 0:q.worldPosition)==null?void 0:G.z)),1)])]),e.createElementVNode("div",Oe,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Ue,[e.createElementVNode("div",je,e.toDisplayString(f((X=(Q=n.value)==null?void 0:Q.worldRotation)==null?void 0:X.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((Z=(Y=n.value)==null?void 0:Y.worldRotation)==null?void 0:Z.y))+"°, ",1),e.createElementVNode("div",ke,e.toDisplayString(f((H=(K=n.value)==null?void 0:K.worldRotation)==null?void 0:H.z))+"° ",1)])])])])}}}),Te=ie._export_sfc(Ie,[["__scopeId","data-v-00d48931"]]);function Pe(r,i,o,l=["URDFVisual"]){let m=null;const n=e.ref(null),N=new R.Raycaster,h=new R.Vector2,g=new Map;function _(){o.value.forEach(p=>{p.traverse(d=>{l!=null&&l.includes(d.type)&&g.set(d.id,{obj:d,axis:d.axis||new R.Vector3(1,0,0),limits:d.limits})})})}function u(p){n.value&&n.value.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(0))}),n.value=p,p.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(65280))})}function f(p){const d=r.value.getBoundingClientRect();h.x=(p.clientX-d.left)/d.width*2-1,h.y=-((p.clientY-d.top)/d.height)*2+1,N.setFromCamera(h,m);const t=N.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,V=null;for(;s;){if(g.has(s.id)){V=g.get(s.id);break}s=s.parent}V&&u(V)}function E(){r.value&&r.value.removeEventListener("click",f,!1)}function w(){const{scene:p,camera:d}=i();m=d,_(),r.value&&r.value.addEventListener("click",f,!1)}function c(p){n.value&&(n.value.obj.visible=p)}function v(p){var s;const{axis:d,value:t}=p;me((s=n.value)==null?void 0:s.obj,d,t)}function b(p){var s;const{axis:d,value:t}=p;pe((s=n.value)==null?void 0:s.obj,d,t)}return{initRaycaster:w,dispose:E,selectedObject3D:n,setSelectedObjVisible:c,updatePosition:v,updateRotation:b}}exports.URDFRobotController=ue;exports.WorkpieceTreePanel=Te;exports.robotMode=le;exports.sceneType=ne;exports.useRaycaster=Pe;exports.useUrdfLoader=ce;
|
package/package.json
CHANGED
package/dist/index-B7PZ70Ke.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");require("./index-BpPyaNFa.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-hGi9c2Ju.cjs");const n=require("./index.vue_vue_type_style_index_1_lang-Cb3WPLY1.cjs"),o=require("./index-1z9RrjZc.cjs"),u=require("./index-BhLnI2fF.cjs"),c=require("./index-Bc20prdj.cjs"),s={class:"role-wrapper"},i=e.defineComponent({__name:"index",setup(d){const t=e.reactive({...c.State}),a=n.useMenuState(),{activeMenuPath:r}=o.storeToRefs(a);return e.onMounted(async()=>{t.structureId=await n.getActivePageStructureId(r.value)}),(_,l)=>(e.openBlock(),e.createElementBlock("div",s,[e.createVNode(u.ssTable,{itemData:t.pageData,onChange:t.handleItemDataChange},null,8,["itemData","onChange"])]))}});exports.default=i;
|
package/dist/index-BPOERPtt.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defineComponent as n, reactive as o, onMounted as r, createElementBlock as s, openBlock as c, createVNode as m } from "vue";
|
|
2
|
-
import { s as u } from "./index-D46pfmEc.js";
|
|
3
|
-
import { S as i } from "./index-DsnxblRp.js";
|
|
4
|
-
import { u as p, at as l } from "./index.vue_vue_type_style_index_1_lang-Dy1Zc_t-.js";
|
|
5
|
-
import { s as d } from "./index-DbzvXPKu.js";
|
|
6
|
-
const x = /* @__PURE__ */ n({
|
|
7
|
-
__name: "index",
|
|
8
|
-
setup(f) {
|
|
9
|
-
const e = o({ ...i }), t = p(), { activeMenuPath: a } = d(t);
|
|
10
|
-
return r(async () => {
|
|
11
|
-
e.structureId = await l(a.value);
|
|
12
|
-
}), (_, g) => (c(), s("div", null, [
|
|
13
|
-
m(u, {
|
|
14
|
-
itemData: e.pageData,
|
|
15
|
-
onChange: e.handleItemDataChange
|
|
16
|
-
}, null, 8, ["itemData", "onChange"])
|
|
17
|
-
]));
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
export {
|
|
21
|
-
x as default
|
|
22
|
-
};
|
package/dist/index-BQ7is--r.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("vue"),u=require("./index-1z9RrjZc.cjs"),r=require("./index.vue_vue_type_style_index_1_lang-Cb3WPLY1.cjs"),d=r.useModelComp(),{itemData:g}=u.storeToRefs(d),y=n.ref(0),D=n.ref([{label:"机构名称",value:"",name:"deptName"}]),f=e=>{console.log("handleQueryChange",e)},s=n.ref([{key:"extraButton",contents:[{label:"新增"}]},{key:"rowButton",contents:[{label:"编辑"},{label:"删除"}]},{key:"header",contents:[{label:"职位名称",prop:"postName"},{label:"职位排序",formType:"Number",prop:"postOrder"},{label:"备注",formType:"TextArea",prop:"remark"},{label:"操作"}]},{key:"tableContents",contents:[]}]),i=e=>{r.submitTableAsyncByVerify(e.singleContent,e.buttonName,y.value)},m=e=>{console.log("onDoubleClick",e)},h=(e,a)=>{console.log("onButtonClick",e,a)},k=async e=>{const a=await r.handleSubmitAsync(u.getInsofDataApi,{key:{type:"data",systemKey:sessionStorage.getItem("systemKey"),pageKey:e}},"查询"),l=a==null?void 0:a.map(t=>{var o;return{id:t.id,tableData:(o=t==null?void 0:t.value)==null?void 0:o.tableData}});return l==null?void 0:l.map(t=>{var o;if(Array.isArray(t==null?void 0:t.tableData)){let c={id:t.id};return(o=t==null?void 0:t.tableData)==null||o.forEach((p,b)=>{c[`a${b}`]=p}),c}else return{...t.tableData,id:t.id}})},C={comp:"Group",name:"/系统管理/职位管理",compData:[{key:"groupContents",contents:[{comp:"Table",compData:s.value,name:""}]}]};n.watch(()=>g.value,e=>{var a;e&&(e==null?void 0:e.length)>0&&(s.value=(a=e==null?void 0:e[0])==null?void 0:a.compData)});const _=Object.freeze(Object.defineProperty({__proto__:null,getPageDataAsync:k,handleItemDataChange:i,handleQueryChange:f,onButtonClick:h,onDoubleClick:m,pageData:s,queryFormData:D,structureId:y,tempPostPageData:C},Symbol.toStringTag,{value:"Module"}));exports.State=_;
|
package/dist/index-Bc20prdj.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("vue"),u=require("./index-1z9RrjZc.cjs"),s=require("./index.vue_vue_type_style_index_1_lang-Cb3WPLY1.cjs"),d=s.useModelComp(),{itemData:g}=u.storeToRefs(d),b=o.ref(0),D=o.ref([{label:"机构名称",value:"",name:"deptName"}]),i=e=>{console.log("handleQueryChange",e)},r=o.ref([{key:"extraButton",contents:[{label:"新增"}]},{key:"rowButton",contents:[{label:"编辑"},{label:"删除"}]},{key:"header",contents:[{label:"机构名称",prop:"deptName"},{label:"机构类型",prop:"deptType",formType:"Select",options:[{label:"集团",value:"集团"},{label:"公司",value:"公司"},{label:"部门",value:"部门"},{label:"区域",value:"区域"},{label:"组",value:"组"}]},{label:"机构状态",formType:"Radio",prop:"deptStatus",options:[{label:"启用",value:"启用"},{label:"禁用",value:"禁用"}]},{label:"操作"}]},{key:"tableContents",contents:[]}]),f=e=>{s.submitTableAsyncByVerify(e.singleContent,e.buttonName,b.value)},h=e=>{console.log("onDoubleClick",e)},C=(e,t)=>{console.log("onButtonClick",e,t)},_=async e=>{const t=await s.handleSubmitAsync(u.getInsofDataApi,{key:{systemKey:sessionStorage.getItem("systemKey"),type:"data",pageKey:e}},"查询"),n=t==null?void 0:t.map(a=>{var l;return{id:a.id,tableData:(l=a==null?void 0:a.value)==null?void 0:l.tableData}});return n==null?void 0:n.map(a=>{var l;if(Array.isArray(a==null?void 0:a.tableData)){let c={id:a.id};return(l=a==null?void 0:a.tableData)==null||l.forEach((p,y)=>{c[`a${y}`]=p}),c}else return{...a.tableData,id:a.id}})},k={comp:"Group",name:"/系统管理/部门管理",compData:[{key:"groupContents",contents:[{comp:"Table",compData:r.value,name:""}]}]};o.watch(()=>g.value,e=>{var t;e&&(e==null?void 0:e.length)>0&&(r.value=(t=e==null?void 0:e[0])==null?void 0:t.compData)});const m=Object.freeze(Object.defineProperty({__proto__:null,getPageDataAsync:_,handleItemDataChange:f,handleQueryChange:i,onButtonClick:C,onDoubleClick:h,pageData:r,queryFormData:D,structureId:b,tempDeptPageData:k},Symbol.toStringTag,{value:"Module"}));exports.State=m;
|