Files
qhmes/deploy-qhmes/frontend/js/Workshop3D-ChJuz_FI.js
2026-05-15 11:34:12 +08:00

2 lines
4.6 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var A=Object.defineProperty,I=Object.defineProperties;var j=Object.getOwnPropertyDescriptors;var D=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var E=(r,t,o)=>t in r?A(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,k=(r,t)=>{for(var o in t||(t={}))P.call(t,o)&&E(r,o,t[o]);if(D)for(var o of D(t))R.call(t,o)&&E(r,o,t[o]);return r},z=(r,t)=>I(r,j(t));import{f as S,o as N,j as O,ar as H,as as L,au as n,ag as _,G as p,av as m,aB as X}from"./vue-vendor-C7Zq48Yl.js";import{Scene as Y,Color as q,PerspectiveCamera as T,WebGLRenderer as U,AmbientLight as Z,DirectionalLight as $,PlaneGeometry as J,MeshStandardMaterial as M,Mesh as V,GridHelper as K,BoxGeometry as Q,Raycaster as ee,Vector2 as te}from"./three.module-C62V74CF.js";import{O as oe}from"./OrbitControls-CJGLS2vR.js";import{d as ne}from"./index-BI6CMai0.js";import"./antd-vue-vendor-BPnV8VqP.js";import"./vxe-table-vendor-B88kchpX.js";const ae={class:"workshop-container"},re={key:0,class:"info-panel"},se={class:"info-header"},ie={class:"info-content"},le={__name:"Workshop3D",setup(r){const t=S(null),o=S(null);let l,u,c,f,h,w=[],x,g;const B=[{id:"DEV-001",name:"加工中心A",status:"运行中",statusColor:"#52c41a",temperature:45,runtime:1234,color:1609983},{id:"DEV-002",name:"加工中心B",status:"待机",statusColor:"#faad14",temperature:28,runtime:2456,color:5424154},{id:"DEV-003",name:"装配机器人",status:"运行中",statusColor:"#52c41a",temperature:38,runtime:3678,color:16065069},{id:"DEV-004",name:"质检设备",status:"故障",statusColor:"#f5222d",temperature:65,runtime:890,color:16419862},{id:"DEV-005",name:"包装机",status:"运行中",statusColor:"#52c41a",temperature:42,runtime:5432,color:7483089}];N(()=>{W(),F(),G(),b(),window.addEventListener("resize",y)}),O(()=>{cancelAnimationFrame(h),window.removeEventListener("resize",y),window.removeEventListener("click",C),f.dispose(),c.dispose(),l.clear()});function W(){l=new Y,l.background=new q(15790837),u=new T(75,t.value.clientWidth/t.value.clientHeight,.1,1e3),u.position.set(8,8,8),u.lookAt(0,0,0),c=new U({antialias:!0}),c.setSize(t.value.clientWidth,t.value.clientHeight),c.shadowMap.enabled=!0,t.value.appendChild(c.domElement),f=new oe(u,c.domElement),f.enableDamping=!0,f.dampingFactor=.05;const a=new Z(16777215,.6);l.add(a);const e=new $(16777215,.8);e.position.set(10,10,5),e.castShadow=!0,l.add(e);const s=new J(20,20),i=new M({color:13421772}),v=new V(s,i);v.rotation.x=-Math.PI/2,v.receiveShadow=!0,l.add(v);const d=new K(20,20,8947848,14540253);l.add(d)}function F(){const a=[{x:-4,y:1,z:-4},{x:4,y:1,z:-4},{x:0,y:1,z:0},{x:-4,y:1,z:4},{x:4,y:1,z:4}];B.forEach((e,s)=>{const i=new Q(1.5,1.5,1.5),v=new M({color:e.color,metalness:.3,roughness:.4}),d=new V(i,v);d.position.set(a[s].x,a[s].y,a[s].z),d.castShadow=!0,d.receiveShadow=!0,d.userData=z(k({},e),{position:a[s],originalColor:e.color}),l.add(d),w.push(d)})}function G(){x=new ee,g=new te,window.addEventListener("click",C)}function C(a){const e=t.value.getBoundingClientRect();g.x=(a.clientX-e.left)/e.width*2-1,g.y=-((a.clientY-e.top)/e.height)*2+1,x.setFromCamera(g,u);const s=x.intersectObjects(w);if(w.forEach(i=>{i.material.color.setHex(i.userData.originalColor),i.material.emissive.setHex(0)}),s.length>0){const i=s[0].object;i.material.emissive.setHex(5592405),o.value=i.userData}else o.value=null}function y(){u.aspect=t.value.clientWidth/t.value.clientHeight,u.updateProjectionMatrix(),c.setSize(t.value.clientWidth,t.value.clientHeight)}function b(){h=requestAnimationFrame(b),w.forEach((a,e)=>{a.rotation.y+=.005*(e%2===0?1:-1)}),f.update(),c.render(l,u)}return(a,e)=>(L(),H("div",ae,[n("div",{ref_key:"container",ref:t,class:"three-container"},null,512),o.value?(L(),H("div",re,[n("div",se,[e[1]||(e[1]=n("h3",null,"设备信息",-1)),n("button",{onClick:e[0]||(e[0]=s=>o.value=null),class:"close-btn"},"×")]),n("div",ie,[n("p",null,[e[2]||(e[2]=n("strong",null,"设备名称:",-1)),p(" "+m(o.value.name),1)]),n("p",null,[e[3]||(e[3]=n("strong",null,"设备ID:",-1)),p(" "+m(o.value.id),1)]),n("p",null,[e[4]||(e[4]=n("strong",null,"状态:",-1)),e[5]||(e[5]=p()),n("span",{style:X({color:o.value.statusColor})},m(o.value.status),5)]),n("p",null,[e[6]||(e[6]=n("strong",null,"位置:",-1)),p(" X: "+m(o.value.position.x.toFixed(2))+", Y: "+m(o.value.position.y.toFixed(2))+", Z: "+m(o.value.position.z.toFixed(2)),1)]),n("p",null,[e[7]||(e[7]=n("strong",null,"温度:",-1)),p(" "+m(o.value.temperature)+"°C",1)]),n("p",null,[e[8]||(e[8]=n("strong",null,"运行时长:",-1)),p(" "+m(o.value.runtime)+"小时",1)])])])):_("",!0)]))}},we=ne(le,[["__scopeId","data-v-22eb16a4"]]);export{we as default};