ss-component-new 1.3.365 → 1.3.366
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/{array-DQzonH1R.cjs → array-BVGvg9oV.cjs} +1 -1
- package/dist/{array-DbUSkbo3.js → array-Buzpmqxx.js} +2 -2
- package/dist/{index-9ChVXgKw.js → index-14QhNETL.js} +1 -1
- package/dist/{index-10v9wXFg.cjs → index-B8I4TCpA.cjs} +1 -1
- package/dist/{index-seLHFErR.js → index-BCDA7SlU.js} +2 -2
- package/dist/{index-Y0jJ6HZ1.js → index-BLlBVShw.js} +1 -1
- package/dist/{index-BWe1GP27.js → index-BOmb1yOF.js} +2 -2
- package/dist/{index-XHfctZf4.cjs → index-BYaor5QC.cjs} +1 -1
- package/dist/{index-DV60CEJ1.cjs → index-CRWl9Rtz.cjs} +1 -1
- package/dist/{index-i4Kvgrq4.js → index-Cj6n4Zpo.js} +7 -7
- package/dist/{index-BmhTHaY5.cjs → index-CvU3pAZt.cjs} +1 -1
- package/dist/{index-BTqelo7x.cjs → index-D1eUShIF.cjs} +7 -7
- package/dist/{index-D2FGO5M9.js → index-D8ML_f91.js} +1 -1
- package/dist/{index-BE9qQ9Rl.js → index-DMVBf41x.js} +1016 -1016
- package/dist/{index-DsUR-J5w.js → index-DZXpHjYg.js} +3 -3
- package/dist/{index-CbjdOaL7.cjs → index-De3ztqEp.cjs} +1 -1
- package/dist/{index-EvF-0idX.cjs → index-DiScwmD1.cjs} +1 -1
- package/dist/{index-DVv4EpXm.cjs → index-Dkn9zOYg.cjs} +1 -1
- package/dist/{index-CfeJ5uLy.js → index-Drv6LFkE.js} +1 -1
- package/dist/{index-DI-J_Smu.cjs → index-HlbQT-hn.cjs} +1 -1
- package/dist/{index-DvSDsN__.js → index-RfSz1KjM.js} +1 -1
- package/dist/{index-Bhvwjl0K.js → index-TL11JgVE.js} +1 -1
- package/dist/{index-DVP63TDq.cjs → index-UWrNcZe6.cjs} +1 -1
- package/dist/{index-D44ytDdh.cjs → index-WvE1qvnd.cjs} +1 -1
- package/dist/{index-ClFgZBEV.cjs → index-XIzcfEzL.cjs} +1 -1
- package/dist/{index-2EaJ5z1T.js → index-efedHl6M.js} +2 -2
- package/dist/{main-JITebNfa.cjs → main-BDbN4DoS.cjs} +1 -1
- package/dist/{main-D608Hu_s.js → main-Dyi5uw2c.js} +2 -2
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.js +5 -5
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +8 -8
- package/dist/{threeModel-Bduj1u5i.js → threeModel-DEqLQS7r.js} +1 -1
- package/dist/{threeModel-zyKQx-mq.cjs → threeModel-DRFFJvFX.cjs} +1 -1
- package/dist/{threeSceneView-DuTljHv-.js → threeSceneView-DgNQEj93.js} +3 -3
- package/dist/{threeSceneView-CGruEwF0.cjs → threeSceneView-Dx3DcgW-.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-CEf_gGxk.cjs → threeSceneViewForCPMPIP-CCmSCkIN.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-DDjX8AQi.js → threeSceneViewForCPMPIP-tZSXieg8.js} +1 -1
- package/dist/{threeViewerHost-CW7C1w2A.js → threeViewerHost-CDFwFnu2.js} +1 -1
- package/dist/{threeViewerHost-D9Sga3sw.cjs → threeViewerHost-NwCu86-z.cjs} +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),u=require("./index-BEli6-9O.cjs"),_=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),u=require("./index-BEli6-9O.cjs"),_=require("./index-D1eUShIF.cjs"),r=require("./index-Dub2SbvH.cjs"),C=require("./index-CW4qJdP8.cjs"),g=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),v={class:"menu-content"},x=l.defineComponent({__name:"index",setup(q){const m=u.useMenuState(u.pinia),{menus:c}=u.storeToRefs(m),p=l.ref([]),f=async()=>{var i,t,n,a;const e=await C.getInsofDataApi({key:{type:"mainEquip",systemKey:sessionStorage.getItem("systemKey")}});if(((i=e==null?void 0:e.data)==null?void 0:i.type)==="success"){let o=(n=(t=e==null?void 0:e.data)==null?void 0:t.result)==null?void 0:n.map(s=>s);return o=(a=u.cloneDeep(o))==null?void 0:a.map(s=>{var d;const b=Object.values((d=s==null?void 0:s.value)==null?void 0:d.tableData);return b.unshift({id:s==null?void 0:s.id}),b}),o}else return[]};l.onMounted(async()=>{var n;const e=await f(),t=[{key:"header",contents:[{label:"主菜单名称",formType:"Select",options:(n=u.cloneDeep(c.value))==null?void 0:n.map(a=>({label:a==null?void 0:a.title,value:a==null?void 0:a.title})),prop:"主菜单名称"},{label:"隐藏三维显示",formType:"Switch",value:!1,prop:"隐藏三维显示"},{label:"操作"}]},{key:"extraButton",contents:[{label:"新增"}]},{key:"rowButton",contents:[{label:"查看"},{label:"编辑"},{label:"删除"}]}];t.push({key:"tableContents",contents:e}),p.value=t});const y=e=>{(e==null?void 0:e.buttonName)==="新增"?r.addMenuContent(e==null?void 0:e.singleContent):(e==null?void 0:e.buttonName)==="删除"?r.deleteMenuContent(e==null?void 0:e.singleContent):(e==null?void 0:e.buttonName)==="编辑"&&r.fixMenuContent(e==null?void 0:e.singleContent)};return(e,i)=>(l.openBlock(),l.createElementBlock("div",v,[l.createVNode(_.ssTable,{itemData:p.value,class:"table-content",onChange:y},null,8,["itemData"])]))}}),h=g._export_sfc(x,[["__scopeId","data-v-26f5cadc"]]);exports.default=h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("./index-D1eUShIF.cjs"),d=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),u=()=>{const l=e.ref("日志管理"),n=e.ref(),o=e.ref([{key:"header",contents:[{prop:"name",align:"center",isRun:!1,label:"日志名称",isRoute:!1,isTableColHidden:!1,isFormColHidden:!1},{prop:"time",align:"center",isRun:!1,label:"生成时间",isRoute:!1,isTableColHidden:!1,isFormColHidden:!1},{prop:"sort",align:"operator",isRun:!1,label:"操作人",isRoute:!1,isTableColHidden:!1,isFormColHidden:!1},{prop:"remark",align:"center",isRun:!1,label:"备注",isRoute:!1,isTableColHidden:!1,isFormColHidden:!1},{label:"操作",isMainKey:!0}]},{key:"extraButton",contents:[]},{key:"rowButton",contents:[{label:"删除"}]},{key:"tableFilter",contents:[]},{key:"tableContents",contents:[[{id:764397741125751},"test","test","test","test"]]}]);return{compName:l,changedRow:n,tableInfo:o,handleItemDataChange:a=>{},clickRowButton:async(a,r)=>{}}},f={class:"log-management"},m={class:"body"},p=e.defineComponent({__name:"index",setup(l){const{compName:n,changedRow:o,tableInfo:s,handleItemDataChange:i,clickRowButton:a}=u();return(r,t)=>(e.openBlock(),e.createElementBlock("div",f,[t[0]||(t[0]=e.createElementVNode("div",{class:"header"},null,-1)),e.createElementVNode("div",m,[e.createVNode(c.ssTable,{compName:e.unref(n),itemData:e.unref(s),changedContent:e.unref(o),onChange:e.unref(i),onOnButtonClick:e.unref(a)},null,8,["compName","itemData","changedContent","onChange","onOnButtonClick"])]),t[1]||(t[1]=e.createElementVNode("div",{class:"footer"},[e.createElementVNode("div",{class:"footer-left"}),e.createElementVNode("div",{class:"footer-right"})],-1))]))}}),g=d._export_sfc(p,[["__scopeId","data-v-5bfd5576"]]);exports.default=g;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as C, reactive as k, ref as v, onMounted as D, nextTick as b, resolveComponent as i, resolveDirective as T, createElementBlock as m, openBlock as u, createVNode as t, withCtx as n, withDirectives as w, createElementVNode as p, createTextVNode as _ } from "vue";
|
|
2
2
|
import { S as x } from "./index-DFjv1J5x.js";
|
|
3
|
-
import { V as B } from "./index-
|
|
3
|
+
import { V as B } from "./index-DMVBf41x.js";
|
|
4
4
|
import { s as F } from "./index-IQyGe1Ql.js";
|
|
5
|
-
import { b as y } from "./index-
|
|
5
|
+
import { b as y } from "./index-D8ML_f91.js";
|
|
6
6
|
import { u as S, p as I, s as N } from "./index-DplRG-oo.js";
|
|
7
7
|
import { _ as R } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
8
8
|
const E = { class: "menu-module" }, M = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),G=require("./array-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),G=require("./array-BVGvg9oV.cjs"),r=require("./index-BEli6-9O.cjs"),ne=require("./index-D1eUShIF.cjs"),T=require("./index-Cot4bEbR.cjs"),v=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),F=[{key:"FormName",value:"Form"},{key:"TableName",value:"Table"}],A=[{key:"FormDirect",value:"formFlex"},{key:"Form",value:"formContent"},{key:"FormButton",value:"formButton"},{key:"TableColumns",value:"header"},{key:"TableButton",value:"extraButton"},{key:"LineButton",value:"rowButton"},{key:"Table",value:"tableContents"},{key:"TableIndex",value:"tableIndex"}];n.ref(0);n.ref(0);n.ref(1);const le=s=>{let d;s.replaceAll(" ",`\r
|
|
2
2
|
`).replaceAll(`
|
|
3
3
|
`,`\r
|
|
4
4
|
`).includes(`\r
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref as U, watch as v, createElementBlock as E, createCommentVNode as q, openBlock as I, Fragment as de, renderList as fe, createElementVNode as S, createBlock as se, toDisplayString as oe, resolveDynamicComponent as ye, onMounted as he, onUnmounted as ke, createVNode as te } from "vue";
|
|
2
|
-
import { m as ge, a as _e, b as Ce, c as be } from "./array-
|
|
2
|
+
import { m as ge, a as _e, b as Ce, c as be } from "./array-Buzpmqxx.js";
|
|
3
3
|
import { c, a as ce, p as re, s as ue, u as Oe } from "./index-DplRG-oo.js";
|
|
4
|
-
import { g as Ae } from "./index-
|
|
4
|
+
import { g as Ae } from "./index-DMVBf41x.js";
|
|
5
5
|
import { v as H, a as K } from "./index-Wb0MjFbo.js";
|
|
6
6
|
import { _ as pe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
7
|
const B = [
|
package/dist/ss-component.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue");require("./index.vue_vue_type_style_index_0_scoped_6b92e250_lang-DyCuFKb2.cjs");const C=require("./index-BpPyaNFa.cjs"),v=require("./index-BEli6-9O.cjs");require("./index-Cot4bEbR.cjs");require("./request-BC2w2vGr.cjs");;/* empty css */const s=require("./ss-component2.cjs"),t=require("./index-RoXicHV9.cjs"),r=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./main-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue");require("./index.vue_vue_type_style_index_0_scoped_6b92e250_lang-DyCuFKb2.cjs");const C=require("./index-BpPyaNFa.cjs"),v=require("./index-BEli6-9O.cjs");require("./index-Cot4bEbR.cjs");require("./request-BC2w2vGr.cjs");;/* empty css */const s=require("./ss-component2.cjs"),t=require("./index-RoXicHV9.cjs"),r=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./main-BDbN4DoS.cjs")));r.install=e=>{e.component("ssComponent",r)};const i=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./index-BYaor5QC.cjs")).then(e=>e.index$1));i.install=e=>{e.component("ssTab",i)};const c=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./index-CRWl9Rtz.cjs")).then(e=>e.index));c.install=e=>{e.component("ssMenu",c)};const l=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./index-D7H81vN9.cjs")));l.install=e=>{e.component("ssMenuComponent",l)};const m=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./index-Bhz2-IqE.cjs")));m.install=e=>{e.component("ssCanvas",m)};const u=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./index-BVaHwt5f.cjs")));u.install=e=>{e.component("ssFold",u)};const a=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./index-oUjLRXiv.cjs")).then(e=>e.index));a.install=e=>{e.component("ssAvatar",a)};const h=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeModel-DRFFJvFX.cjs")));h.install=e=>{e.component("ssThree",h)};const f=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeViewerHost-NwCu86-z.cjs")).then(e=>e.threeViewerHost));f.install=e=>{e.component("threeViewerHost",f)};const p=v.useMenuState(),q=[r,i,c,l,m,u,a,h,f],P=e=>{q.forEach(o=>{e.use(o)}),e.use(s),e.config.globalProperties.$router=s},g=e=>{switch(e){case"browser":return t.browserThemeConfig;case"client":return t.clientThemeConfig;case"three":return t.threeThemeConfig}},y=e=>{const o=document.documentElement;e==null||e.forEach(d=>{o.style.setProperty(d.name,d.value)})},A=e=>{p.setPlatform(e);const o=g(e);y(o)},T={getPlatform:p.getPlatform,setPlatform:p.setPlatform,initPlatform:A};exports.SvgIcon=C.SvgIcon;exports.router=s;exports.default=P;exports.platformApi=T;
|
package/dist/ss-component.js
CHANGED
|
@@ -7,15 +7,15 @@ import "./request-B3-w_S8Z.js";
|
|
|
7
7
|
/* empty css */
|
|
8
8
|
import u from "./ss-component2.js";
|
|
9
9
|
import { t as g, c as T, b as P } from "./index-C2UiLe43.js";
|
|
10
|
-
const n = o(() => import("./main-
|
|
10
|
+
const n = o(() => import("./main-Dyi5uw2c.js"));
|
|
11
11
|
n.install = (t) => {
|
|
12
12
|
t.component("ssComponent", n);
|
|
13
13
|
};
|
|
14
|
-
const s = o(() => import("./index-
|
|
14
|
+
const s = o(() => import("./index-D8ML_f91.js").then((t) => t.p));
|
|
15
15
|
s.install = (t) => {
|
|
16
16
|
t.component("ssTab", s);
|
|
17
17
|
};
|
|
18
|
-
const r = o(() => import("./index-
|
|
18
|
+
const r = o(() => import("./index-DZXpHjYg.js").then((t) => t.i));
|
|
19
19
|
r.install = (t) => {
|
|
20
20
|
t.component("ssMenu", r);
|
|
21
21
|
};
|
|
@@ -35,11 +35,11 @@ const a = o(() => import("./index-BVpOApsG.js").then((t) => t.i));
|
|
|
35
35
|
a.install = (t) => {
|
|
36
36
|
t.component("ssAvatar", a);
|
|
37
37
|
};
|
|
38
|
-
const l = o(() => import("./threeModel-
|
|
38
|
+
const l = o(() => import("./threeModel-DEqLQS7r.js"));
|
|
39
39
|
l.install = (t) => {
|
|
40
40
|
t.component("ssThree", l);
|
|
41
41
|
};
|
|
42
|
-
const p = o(() => import("./threeViewerHost-
|
|
42
|
+
const p = o(() => import("./threeViewerHost-CDFwFnu2.js").then((t) => t.t));
|
|
43
43
|
p.install = (t) => {
|
|
44
44
|
t.component("threeViewerHost", p);
|
|
45
45
|
};
|
package/dist/ss-component2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("vue-router"),t=[{path:"/tenant",name:"Tenant",component:async()=>Promise.resolve().then(()=>require("./index-BJ-thkmN.cjs"))},{path:"/login",name:"Login",component:async()=>Promise.resolve().then(()=>require("./index-mHYDJOd1.cjs"))},{path:"/",name:"Model",component:async()=>Promise.resolve().then(()=>require("./index-
|
|
1
|
+
"use strict";const n=require("vue-router"),t=[{path:"/tenant",name:"Tenant",component:async()=>Promise.resolve().then(()=>require("./index-BJ-thkmN.cjs"))},{path:"/login",name:"Login",component:async()=>Promise.resolve().then(()=>require("./index-mHYDJOd1.cjs"))},{path:"/",name:"Model",component:async()=>Promise.resolve().then(()=>require("./index-UWrNcZe6.cjs")),children:[{path:"系统配置/站内信",name:"Message",component:async()=>Promise.resolve().then(()=>require("./index-DPIg2S6M.cjs"))},{path:"系统配置/自动生成",name:"Automatic",component:async()=>Promise.resolve().then(()=>require("./index-B2BAJXIH.cjs"))},{path:"平台管理/菜单管理",name:"Menu",component:async()=>Promise.resolve().then(()=>require("./index-DiScwmD1.cjs"))},{path:"平台管理/主菜单管理",name:"MainMenu",component:async()=>Promise.resolve().then(()=>require("./index-WvE1qvnd.cjs"))},{path:"系统管理/个人中心",name:"PersonalCenter",component:async()=>Promise.resolve().then(()=>require("./index-HlbQT-hn.cjs"))},{path:"系统维护/登录日志",name:"LoginLog",component:async()=>Promise.resolve().then(()=>require("./index-De3ztqEp.cjs"))},{path:"系统维护/操作日志",name:"OperateLog",component:async()=>Promise.resolve().then(()=>require("./index-B8I4TCpA.cjs"))},{path:"角色管理",name:"Role",component:async()=>Promise.resolve().then(()=>require("./index-CvU3pAZt.cjs"))},{path:"部门管理",name:"Department",component:async()=>Promise.resolve().then(()=>require("./index-DVGBqCVu.cjs"))},{path:"职位管理",name:"Position",component:async()=>Promise.resolve().then(()=>require("./index-Bf0HSsSz.cjs"))},{path:"个人中心",name:"PersonalCenter",component:async()=>Promise.resolve().then(()=>require("./index-BQqYCx-2.cjs"))},{path:"log",name:"log",component:async()=>Promise.resolve().then(()=>require("./index-XIzcfEzL.cjs"))}]}],o=n.createRouter({history:n.createWebHashHistory(),routes:t});o.beforeEach((r,s,e)=>{!sessionStorage.getItem("loginToken")&&r.path!=="/login"?e("/login"):e()});module.exports=o;
|
package/dist/ss-component2.js
CHANGED
|
@@ -13,7 +13,7 @@ const a = [
|
|
|
13
13
|
{
|
|
14
14
|
path: "/",
|
|
15
15
|
name: "Model",
|
|
16
|
-
component: async () => import("./index-
|
|
16
|
+
component: async () => import("./index-Cj6n4Zpo.js"),
|
|
17
17
|
// component: async ()=>import('@/components/views/model/component/main.vue'),
|
|
18
18
|
// component: async ()=>import('@/components/views/canvas/index.vue'),
|
|
19
19
|
// component: async ()=>import('@/components/views/test/index.vue'),
|
|
@@ -31,17 +31,17 @@ const a = [
|
|
|
31
31
|
{
|
|
32
32
|
path: "平台管理/菜单管理",
|
|
33
33
|
name: "Menu",
|
|
34
|
-
component: async () => import("./index-
|
|
34
|
+
component: async () => import("./index-efedHl6M.js")
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
path: "平台管理/主菜单管理",
|
|
38
38
|
name: "MainMenu",
|
|
39
|
-
component: async () => import("./index-
|
|
39
|
+
component: async () => import("./index-TL11JgVE.js")
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
path: "系统管理/个人中心",
|
|
43
43
|
name: "PersonalCenter",
|
|
44
|
-
component: async () => import("./index-
|
|
44
|
+
component: async () => import("./index-BCDA7SlU.js")
|
|
45
45
|
},
|
|
46
46
|
// {
|
|
47
47
|
// path: '系统管理/职位管理',
|
|
@@ -66,17 +66,17 @@ const a = [
|
|
|
66
66
|
{
|
|
67
67
|
path: "系统维护/登录日志",
|
|
68
68
|
name: "LoginLog",
|
|
69
|
-
component: async () => import("./index-
|
|
69
|
+
component: async () => import("./index-14QhNETL.js")
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
path: "系统维护/操作日志",
|
|
73
73
|
name: "OperateLog",
|
|
74
|
-
component: async () => import("./index-
|
|
74
|
+
component: async () => import("./index-Drv6LFkE.js")
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
path: "角色管理",
|
|
78
78
|
name: "Role",
|
|
79
|
-
component: async () => import("./index-
|
|
79
|
+
component: async () => import("./index-BOmb1yOF.js")
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
path: "部门管理",
|
|
@@ -96,7 +96,7 @@ const a = [
|
|
|
96
96
|
{
|
|
97
97
|
path: "log",
|
|
98
98
|
name: "log",
|
|
99
|
-
component: async () => import("./index-
|
|
99
|
+
component: async () => import("./index-RfSz1KjM.js")
|
|
100
100
|
}
|
|
101
101
|
// {
|
|
102
102
|
// path: 'priority',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref as b, watch as Pe, createElementBlock as q, openBlock as H, createBlock as Le, computed as ie, onMounted as $e, onUnmounted as je, Fragment as Xe, renderList as He, createElementVNode as h, createCommentVNode as xe, toDisplayString as ae, resolveComponent as Je, createVNode as z, defineComponent as Ye, normalizeStyle as Ee, normalizeClass as Fe, nextTick as Be, onBeforeUnmount as qe, withDirectives as se, unref as O, withCtx as Te, isRef as he, vModelRadio as ye, vShow as we } from "vue";
|
|
2
2
|
import { V as M, B as be, S as Ze, C as We, P as Ke, W as Ne, b as Qe, A as et, c as tt, M as Ve, X as nt, G as at, e as Me, f as ot, h as De, i as st, D as ke, H as lt, j as Re, k as Oe, l as Ue, m as ze, E as _e, n as de, o as it, p as rt, T as ct } from "./index.vue_vue_type_style_index_0_scoped_6b92e250_lang-BXSlRY5h.js";
|
|
3
3
|
import { O as ut } from "./OrbitControls-DoBQLB3l.js";
|
|
4
|
-
import { V as dt, W as pt } from "./index-
|
|
4
|
+
import { V as dt, W as pt } from "./index-DMVBf41x.js";
|
|
5
5
|
import { _ as me } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
6
|
import { c as Ge } from "./index-DplRG-oo.js";
|
|
7
7
|
import { E as Ie } from "./request-B3-w_S8Z.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./index.vue_vue_type_style_index_0_scoped_6b92e250_lang-DyCuFKb2.cjs"),fe=require("./OrbitControls-CDPEgixi.cjs"),pe=require("./index-BTqelo7x.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),me=require("./index-BEli6-9O.cjs"),de=require("./request-BC2w2vGr.cjs");function ve(z){let g=null,u=null,d=null,h=null,x=null,P=null,c=null,b=null;const D=1e3/30;let S=0;const E=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;g=new n.Scene,g.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),h=new fe.OrbitControls(u,d.domElement),h.enableDamping=!0,h.dampingFactor=.05,h.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},h.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(h),f(),C()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),b&&(g.remove(b),b.geometry.dispose(),b.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),g.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});b=new n.Mesh(B,O),b.position.copy(l),b.position.z-=.01,b.receiveShadow=!0,g.add(b)},p=()=>{if(E.value.length===0)return;const m=new n.Box3;let l=!1;if(E.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);g.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,g.add(l);const _=new n.DirectionalLight(16777215,.8);_.position.set(-8,-8,6),g.add(_);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),g.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);g.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),g.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),g.add(q)},C=()=>{P=requestAnimationFrame(C),h&&h.update();const m=performance.now(),l=m-S;l<D||(S=m-l%D,d&&g&&u&&d.render(g,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:E,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||!h||E.value.length===0)return;const l=new n.Box3;let _=!1;if(E.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),h.target.copy(O),h.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:g,camera:u,renderer:d,controls:h,gizmo:x}),clearAllModels:()=>{if(!g)return;E.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==b&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),E.value=[],p()},cleanup:()=>{P&&cancelAnimationFrame(P),c&&c.dispose(),b&&(b.geometry.dispose(),b.material.dispose()),d&&d.dispose(),h&&h.dispose(),x&&x.dispose()},updateGridForModels:p}}function ge(z,g){const u=e.ref(!1);let d=null,h=12700,x=new n.Vector3,P=new n.Vector3,c=new n.Vector3,b=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=b*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},E=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,C=Math.min(f/h,1);if(C>=1){k();return}const I=S(C);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(E)},r=()=>{if(g.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;g.value.forEach(G=>{f.expandByObject(G)});const C=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),b=Math.max(C.x,C.y,C.z)*1.2;const I=new n.Vector3(c.x+b*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const G=Date.now()-$,Y=Math.min(G/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,E())};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),G=D(J);t.position.lerpVectors(f,x,G),p.target.lerpVectors(C,P,G),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function he(z,g){const u=e.ref(!1),d=e.ref("none");let h=[],x=[],P=new n.Box3,c=new n.Vector3;const b=()=>{h=[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(),g.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(E(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(h[0].constant=-c.x,y=h[0]):d.value==="y"?(h[1].constant=-c.y,y=h[1]):d.value==="z"&&(h[2].constant=-c.z,y=h[2]),y){g.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)}}},E=()=>{g.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?(b(),g.value.length>0&&F()):(d.value="none",E(),r())},updateClippingPlanes:S,clearClippingPlanes:E,clearClippingMeshes:r}}const ye={class:"panel-content"},we={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const g=z;e.ref();const u=e.ref();return e.watch(()=>[g==null?void 0:g.animationData],()=>{var h;let d=((h=me.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,P,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(pe.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"},be={class:"joint-range"},Ee={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,ce=60,Fe={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:g}){const u=z;e.ref(!0);const d=e.ref([]),h=e.ref(null),x=e.ref(null),P=e.ref(12.5),c=e.ref(),b=e.ref(1302),F=e.ref(30),D=e.ref(!1),S=e.ref(!1),E=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ce/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;b.value=o.extra.管长,P.value=o.extra.外径/2;let v=((i=me.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(!h.value)return de.ElMessage.error("未加载 URDF"),!1;let o=null;return h.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):(de.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 U=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(U),w.localZ.applyMatrix4(U)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const U=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=U*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},G=(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,b.value-s),w=[];w.push(new n.Vector3(0,0,0));const U=new n.Vector3(0,a*ae,0);a>0&&w.push(U);let T={pos:U.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(),ue=new n.Matrix4;return ue.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(ue),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))}),G(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,E.value=0,r.value=0,B()},B=()=>{if(!D.value||S.value)return;const o=E.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ce,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>ce&&(r.value=0,E.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)};g({startAnimation:_,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),E.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),G(-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?(h.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()},re=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{re(),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",be," ["+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",Ee,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:U=>L(i.name,U.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:g}){const u=z,d=g,h=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},b=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(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),E=e.computed(()=>u!=null&&u.model?b(u.model):[]);return e.watch(E,r=>{h.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:h.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"],Ue=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 g=z,u=e.computed(()=>({backgroundColor:g.backgroundColor})),d=e.computed(()=>`#${g.prefix}-${g.name}`),h=e.computed(()=>{const{size:x}=g;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(h.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Oe)],6))],6))}}),N=oe._export_sfc(Ue,[["__scopeId","data-v-3150a90b"]]),Ge={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:g,emit:u}){const d=u;let h=null,x=!1;const P=e.ref(null),c=e.ref(!1),b=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),S=e.ref(""),E=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:G,stopAnimation:Y}=ge(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:_,updateClippingPlanes:B}=he(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=pe.useModelLoader(A,y,c,b,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,U=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(U,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}},re=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,S.value=s,s==="剖面视图"&&!m.value&&_()},i=s=>{E.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(),h=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(),$()}),g({addModelsFromUrls:re,loadModelByDefaultPath:o}),(s,a)=>{var U,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Ge,[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(G),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:E.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:E.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:(U=k.value)==null?void 0:U.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=>E.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(h),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,E.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(b.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("./index.vue_vue_type_style_index_0_scoped_6b92e250_lang-DyCuFKb2.cjs"),fe=require("./OrbitControls-CDPEgixi.cjs"),pe=require("./index-D1eUShIF.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),me=require("./index-BEli6-9O.cjs"),de=require("./request-BC2w2vGr.cjs");function ve(z){let g=null,u=null,d=null,h=null,x=null,P=null,c=null,b=null;const D=1e3/30;let S=0;const E=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;g=new n.Scene,g.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),h=new fe.OrbitControls(u,d.domElement),h.enableDamping=!0,h.dampingFactor=.05,h.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},h.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(h),f(),C()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),b&&(g.remove(b),b.geometry.dispose(),b.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),g.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});b=new n.Mesh(B,O),b.position.copy(l),b.position.z-=.01,b.receiveShadow=!0,g.add(b)},p=()=>{if(E.value.length===0)return;const m=new n.Box3;let l=!1;if(E.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);g.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,g.add(l);const _=new n.DirectionalLight(16777215,.8);_.position.set(-8,-8,6),g.add(_);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),g.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);g.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),g.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),g.add(q)},C=()=>{P=requestAnimationFrame(C),h&&h.update();const m=performance.now(),l=m-S;l<D||(S=m-l%D,d&&g&&u&&d.render(g,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:E,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||!h||E.value.length===0)return;const l=new n.Box3;let _=!1;if(E.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),h.target.copy(O),h.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:g,camera:u,renderer:d,controls:h,gizmo:x}),clearAllModels:()=>{if(!g)return;E.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==b&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),E.value=[],p()},cleanup:()=>{P&&cancelAnimationFrame(P),c&&c.dispose(),b&&(b.geometry.dispose(),b.material.dispose()),d&&d.dispose(),h&&h.dispose(),x&&x.dispose()},updateGridForModels:p}}function ge(z,g){const u=e.ref(!1);let d=null,h=12700,x=new n.Vector3,P=new n.Vector3,c=new n.Vector3,b=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=b*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},E=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,C=Math.min(f/h,1);if(C>=1){k();return}const I=S(C);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(E)},r=()=>{if(g.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;g.value.forEach(G=>{f.expandByObject(G)});const C=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),b=Math.max(C.x,C.y,C.z)*1.2;const I=new n.Vector3(c.x+b*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const G=Date.now()-$,Y=Math.min(G/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,E())};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),G=D(J);t.position.lerpVectors(f,x,G),p.target.lerpVectors(C,P,G),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function he(z,g){const u=e.ref(!1),d=e.ref("none");let h=[],x=[],P=new n.Box3,c=new n.Vector3;const b=()=>{h=[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(),g.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(E(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(h[0].constant=-c.x,y=h[0]):d.value==="y"?(h[1].constant=-c.y,y=h[1]):d.value==="z"&&(h[2].constant=-c.z,y=h[2]),y){g.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)}}},E=()=>{g.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?(b(),g.value.length>0&&F()):(d.value="none",E(),r())},updateClippingPlanes:S,clearClippingPlanes:E,clearClippingMeshes:r}}const ye={class:"panel-content"},we={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const g=z;e.ref();const u=e.ref();return e.watch(()=>[g==null?void 0:g.animationData],()=>{var h;let d=((h=me.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,P,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(pe.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"},be={class:"joint-range"},Ee={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,ce=60,Fe={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:g}){const u=z;e.ref(!0);const d=e.ref([]),h=e.ref(null),x=e.ref(null),P=e.ref(12.5),c=e.ref(),b=e.ref(1302),F=e.ref(30),D=e.ref(!1),S=e.ref(!1),E=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ce/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;b.value=o.extra.管长,P.value=o.extra.外径/2;let v=((i=me.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(!h.value)return de.ElMessage.error("未加载 URDF"),!1;let o=null;return h.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):(de.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 U=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(U),w.localZ.applyMatrix4(U)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const U=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=U*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},G=(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,b.value-s),w=[];w.push(new n.Vector3(0,0,0));const U=new n.Vector3(0,a*ae,0);a>0&&w.push(U);let T={pos:U.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(),ue=new n.Matrix4;return ue.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(ue),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))}),G(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,E.value=0,r.value=0,B()},B=()=>{if(!D.value||S.value)return;const o=E.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ce,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>ce&&(r.value=0,E.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)};g({startAnimation:_,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),E.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),G(-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?(h.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()},re=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{re(),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",be," ["+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",Ee,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:U=>L(i.name,U.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:g}){const u=z,d=g,h=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},b=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(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),E=e.computed(()=>u!=null&&u.model?b(u.model):[]);return e.watch(E,r=>{h.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:h.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"],Ue=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 g=z,u=e.computed(()=>({backgroundColor:g.backgroundColor})),d=e.computed(()=>`#${g.prefix}-${g.name}`),h=e.computed(()=>{const{size:x}=g;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(h.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Oe)],6))],6))}}),N=oe._export_sfc(Ue,[["__scopeId","data-v-3150a90b"]]),Ge={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:g,emit:u}){const d=u;let h=null,x=!1;const P=e.ref(null),c=e.ref(!1),b=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),S=e.ref(""),E=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:G,stopAnimation:Y}=ge(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:_,updateClippingPlanes:B}=he(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=pe.useModelLoader(A,y,c,b,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,U=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(U,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}},re=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,S.value=s,s==="剖面视图"&&!m.value&&_()},i=s=>{E.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(),h=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(),$()}),g({addModelsFromUrls:re,loadModelByDefaultPath:o}),(s,a)=>{var U,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Ge,[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(G),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:E.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:E.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:(U=k.value)==null?void 0:U.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=>E.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(h),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,E.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(b.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 h, watch as ae, shallowRef as be, computed as Pe, onUnmounted as Ie, resolveComponent as U, createElementBlock as Ve, openBlock as Q, createElementVNode as u, createVNode as l, withCtx as M, createBlock as ye, createCommentVNode as ke, unref as X, toDisplayString as he, onMounted as Ge, onBeforeUnmount as Ze, Fragment as He, renderList as qe, nextTick as Ke, withDirectives as pe, vShow as de, renderSlot as Me } from "vue";
|
|
2
|
-
import { r as Te, s as Ye } from "./threeViewerHost-
|
|
2
|
+
import { r as Te, s as Ye } from "./threeViewerHost-CDFwFnu2.js";
|
|
3
3
|
import { u as Je, a as Qe, b as et, C as tt } from "./iconfont-BjSu8v7G.js";
|
|
4
4
|
import { U as lt, u as ot, a as nt, W as at } from "./workpieceTreePanel-DjvO5w7t.js";
|
|
5
5
|
import { c as st } from "./index-DplRG-oo.js";
|
|
6
6
|
import { a7 as it, E as j, an as rt, ao as ct } from "./request-B3-w_S8Z.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
import { p as De, T as xe, V as D, n as H, o as ut, s as pt, h as Se, t as dt, L as mt, u as vt, v as ft, w as gt, x as ht, y as bt, z as yt, l as _t, F as wt } from "./index.vue_vue_type_style_index_0_scoped_6b92e250_lang-BXSlRY5h.js";
|
|
9
|
-
import "./index-
|
|
9
|
+
import "./index-DMVBf41x.js";
|
|
10
10
|
import "./index-BHtNKL1L.js";
|
|
11
11
|
import { _ as me } from "./index.vue_vue_type_script_setup_true_lang-DRzriV-s.js";
|
|
12
12
|
import { x as Be, y as Ct, z as kt } from "./index-Wb0MjFbo.js";
|
|
13
|
-
import "./index-
|
|
13
|
+
import "./index-BLlBVShw.js";
|
|
14
14
|
import "./index-B2Z1OF_A.js";
|
|
15
15
|
import { f as Pt, a as xt, g as Rt, b as Mt } from "./animationData-agvoKsLi.js";
|
|
16
16
|
import { g as Tt, a as Vt, b as Dt, c as St, U as At, J as $t } from "./urdfTree-CTYdhkAY.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ne=require("./threeViewerHost-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ne=require("./threeViewerHost-NwCu86-z.cjs"),pe=require("./iconfont-BLFoQPNm.cjs"),fe=require("./workpieceTreePanel-7llvdn1R.cjs"),Te=require("./index-BEli6-9O.cjs"),B=require("./request-BC2w2vGr.cjs");;/* empty css */const s=require("./index.vue_vue_type_style_index_0_scoped_6b92e250_lang-DyCuFKb2.cjs");require("./index-D1eUShIF.cjs");require("./index-BpPyaNFa.cjs");const le=require("./index.vue_vue_type_script_setup_true_lang-BKTJR2th.cjs"),me=require("./index-Cot4bEbR.cjs");require("./index-Dkn9zOYg.cjs");require("./index-D8Eqcxyf.cjs");const he=require("./animationData-C9-G8Pk-.cjs"),ie=require("./urdfTree-BwNXusFz.cjs"),ye=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Ee=require("./index-gnhHdovX.cjs"),R=require("./svgIcon-CDPAgQbj.cjs"),G=.001,W=s.MathUtils.degToRad,_e=new s.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:s.DoubleSide});function Se(V=.005,v=64){const p=new s.CatmullRomCurve3([new s.Vector3(0,0,0),new s.Vector3(0,0,0)]),n=new s.TubeGeometry(p,v,V,16,!1),m=_e;return new s.Mesh(n,m)}const ke=V=>V.reduce((v,p)=>{let n=0;const m=p.Y??0,b=p.C??0,r=p.R??0;return m>0&&(n+=m),b>0&&r>0&&(n+=r*W(b)),v+n},0),Me=V=>{const v=[],p=V.Y??0,n=V.B??0,m=V.C??0,b=V.R??0,r={pos:new s.Vector3(0,0,0),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};if(!p&&!m)return v;if(v.push(r.pos.clone()),n!==0){const g=new s.Matrix4().makeRotationAxis(r.localY,W(n));r.localX.applyMatrix4(g),r.localZ.applyMatrix4(g)}if(p>0&&(r.pos.add(r.localY.clone().multiplyScalar(p*G)),v.push(r.pos.clone())),m>0&&b>0){const g=W(m),f=b*G,w=r.pos.clone().add(r.localX.clone().multiplyScalar(-f)),a=Math.max(16,Math.ceil(m/5));for(let y=1;y<=a;y++){const d=g*y/a,_=new s.Matrix4().makeRotationAxis(r.localZ,d),u=r.localX.clone().multiplyScalar(f).applyMatrix4(_),k=w.clone().add(u);v.push(k)}}return v};function Pe(V,v){const p=new s.Group;p.name="CompletePipe";const n={pos:new s.Vector3(0,0,0),localX:new s.Vector3(1,0,0),localY:new s.Vector3(0,1,0),localZ:new s.Vector3(0,0,1)};let m=0,b=1;for(let r=0;r<V.length;r++){const g=V[r],f=g.Y??0,w=g.B??0,a=g.C??0,y=g.R??0;if(w!==0){const d=new s.Matrix4().makeRotationAxis(n.localY,W(w));n.localX.applyMatrix4(d),n.localZ.applyMatrix4(d)}if(f>0){const d=n.pos.clone();n.pos.add(n.localY.clone().multiplyScalar(f*G));const _=n.pos.clone(),c=Re(d,_,v*G);c.userData={segmentType:"straight",segmentIndex:m,frameIndex:r,length:f,frame:{Y:f,B:w,C:a,R:y}},c.name=`直段_${m}`,p.add(c);const u=d.clone();De(p,b,u,v*G),m++}if(a>0&&y>0){const d=W(a),_=y*G,c=[];c.push(n.pos.clone());const u=n.pos.clone().add(n.localX.clone().multiplyScalar(-_)),k=Math.max(16,Math.ceil(a/5));for(let h=1;h<=k;h++){const M=d*h/k,A=new s.Matrix4().makeRotationAxis(n.localZ,M),L=n.localX.clone().multiplyScalar(_).applyMatrix4(A),X=u.clone().add(L);c.push(X)}const E=Be(c,v*G);E.userData={segmentType:"bend",segmentIndex:m,frameIndex:r,angle:a,radius:y,centerPoint:u.toArray(),frame:{Y:f,B:w,C:a,R:y}},E.name=`弯段_${m}`,p.add(E),Math.floor(c.length/2),c[0],n.pos=c[c.length-1].clone();const S=new s.Matrix4().makeRotationAxis(n.localZ,d);n.localY.applyMatrix4(S),n.localX.applyMatrix4(S),m++,b++}}return p}function De(V,v,p,n){const m=new s.Vector3(0,n*2,n*5),b=p.clone().add(m),r=[p,b],g=new s.BufferGeometry().setFromPoints(r),f=new s.LineDashedMaterial({color:16711680,dashSize:n*.5,gapSize:n*.3,linewidth:1}),w=new s.Line(g,f);w.computeLineDistances(),V.add(w);const a=document.createElement("canvas"),y=a.getContext("2d");a.width=128,a.height=128,y.clearRect(0,0,128,128),y.fillStyle="#FF0000",y.font="bold 80px Arial",y.textAlign="center",y.textBaseline="middle",y.fillText(v.toString(),64,64);const d=new s.CanvasTexture(a),_=new s.SpriteMaterial({map:d,transparent:!0,depthTest:!1,depthWrite:!1}),c=new s.Sprite(_),u=n*3;c.scale.set(u,u,1),c.position.copy(b),c.name=`Label_${v}`,c.userData={labelNumber:v},V.add(c)}function Re(V,v,p){const n=new s.LineCurve3(V,v),m=new s.TubeGeometry(n,2,p,18,!1);return new s.Mesh(m,_e)}function Be(V,v){const p=new s.CatmullRomCurve3(V,!1,"catmullrom",.01),n=new s.TubeGeometry(p,Math.max(16,V.length*2),v,18,!1);return new s.Mesh(n,_e)}function Ce(V,v,p,n,m,b=0){let r=v.slice(0,m+1);const g=v[m+1];if(g&&b>0){const c={...g,B:(g.B??0)*b,C:(g.C??0)*b};r.push(c)}const f=ke(r),w=Math.max(0,p-f),a=[];a.push(new s.Vector3(0,0,0));const y=new s.Vector3(0,w*G,0);w>0&&a.push(y);let d={pos:y.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const _=[];for(let c=r.length-1;c>=0;c--){const u=r[c],k=Me(u);if(k.length>0){const E=k.map(A=>{const $=A.clone(),L=new s.Matrix4;return L.makeBasis(d.localX,d.localY,d.localZ),$.applyMatrix4(L),$.add(d.pos)});_.push(E);const S=E[E.length-1];d.pos=S.clone();const h=u.B??0,M=u.C??0;if(h!==0){const A=new s.Matrix4().makeRotationAxis(d.localY,W(h));d.localX.applyMatrix4(A),d.localZ.applyMatrix4(A)}if(M>0){const A=W(M),$=new s.Matrix4().makeRotationAxis(d.localZ,A);d.localY.applyMatrix4($),d.localX.applyMatrix4($)}}}for(const c of _)c.length>1&&a.push(...c.slice(1));a.length<2&&a.push(new s.Vector3(0,.001,0));try{const c=new s.CatmullRomCurve3(a,!1,"catmullrom",.01),u=new s.TubeGeometry(c,Math.max(2,a.length*4),n*G,18,!1);V.geometry.dispose(),V.geometry=u}catch(c){console.error("管件更新失败",c)}}function Ne(V,v,p,n=0){let m=V.slice(0,p+1);const b=V[p+1];if(b&&n>0){const d={...b,B:(b.B??0)*n,C:(b.C??0)*n};m.push(d)}const r=ke(m),g=Math.max(0,v-r),f=[];f.push(new s.Vector3(0,0,0));const w=new s.Vector3(0,g*G,0);g>0&&f.push(w);let a={pos:w.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const y=[];for(let d=m.length-1;d>=0;d--){const _=m[d],c=Me(_);if(c.length>0){const u=c.map(h=>{const M=h.clone(),A=new s.Matrix4;return A.makeBasis(a.localX,a.localY,a.localZ),M.applyMatrix4(A),M.add(a.pos)});y.push(u);const k=u[u.length-1];a.pos=k.clone();const E=_.B??0,S=_.C??0;if(E!==0){const h=new s.Matrix4().makeRotationAxis(a.localY,W(E));a.localX.applyMatrix4(h),a.localZ.applyMatrix4(h)}if(S>0){const h=W(S),M=new s.Matrix4().makeRotationAxis(a.localZ,h);a.localY.applyMatrix4(M),a.localX.applyMatrix4(M)}}}for(const d of y)d.length>1&&f.push(...d.slice(1));return f.length<2&&f.push(new s.Vector3(0,.001,0)),f}function xe(V,v,p,n,m,b,r,g=0,f=0){const w=m-f,a=Ne(n,w,r,g);let d=Ne(p,f,r,g);d.forEach(c=>c.y=-c.y),d.reverse();const _=[...d,...a];try{const c=new s.CatmullRomCurve3(_,!1,"catmullrom",.01),u=new s.TubeGeometry(c,Math.max(2,_.length*4),b*G,18,!1);v.geometry.dispose(),V.geometry.dispose(),v.parent&&v.parent.remove(v),V.geometry=u}catch(c){console.error("管件更新失败",c)}}const Ae={class:"panel-content"},$e={class:"action-bar"},Fe={class:"animation-controls"},ze={class:"control-row"},Ye={class:"control-row"},Le={class:"frame-info"},Ue={class:"control-row"},Ie={class:"progress-bar"},je={class:"dialog-footer"},Ge=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},setup(V,{expose:v}){const p=V,n=e.ref(),m=e.ref();e.watch(()=>p.threeData,t=>{const l=t==null?void 0:t.data;m.value=l==null?void 0:l.type},{immediate:!0});const b=async()=>{let t={};m.value===ne.robotMode.SINGLE&&(t=await he.fetchSingleRobotAnimationData()),m.value===ne.robotMode.DOUBLE&&(t=await he.fetchDoubleRobotAnimationData());const{initialPipeLength:l=0,pipeRadius:o=0,clampLength:i=0,animationData:x}=t;S.value=l,h.value=o,M.value=i,n.value=x;const N=Te.cloneDeep(n.value),J=re(Y.value),q=(N==null?void 0:N["输出(动画数据)"])||[];r.value=q.length?q:[J]},r=e.ref([]),g=e.ref(!1),f=e.ref(""),w=e.ref(!1),a=e.ref(0),y=e.ref(0),d=e.ref(1e3);let _=!1;const c=e.ref(null),u=e.shallowRef(null),k=e.shallowRef(null),E=e.shallowRef(null),S=e.ref(0),h=e.ref(12.5),M=e.ref(30),A=e.ref([]),$=e.ref(null),L=e.computed(()=>p.model?ie.getNonFixedJoints(p.model).map(o=>o.name):[]),X=e.ref(["Y","B","C","R"]),Y=e.computed(()=>[...L.value,...X.value]),ce=e.computed(()=>Y.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${Y.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),ae=()=>r.value.map(t=>({Y:parseFloat(t.Y)||0,B:parseFloat(t.B)||0,C:parseFloat(t.C)||0,R:parseFloat(t.R)||0})),K=()=>{const t=[],l=[];return r.value.forEach(o=>{const{Y1:i,B1:x,C1:N,R1:J,Y2:q,B2:oe,C2:de,R2:D}=o;t.push({Y:parseFloat(i)||0,B:parseFloat(x)||0,C:parseFloat(N)||0,R:parseFloat(J)||0}),l.push({Y:parseFloat(q)||0,B:parseFloat(oe)||0,C:parseFloat(de)||0,R:parseFloat(D)||0})}),{posPipeYbcr:t,negPipeYbcr:l}},T=(t=0,l=0)=>{if(u.value&&k.value){const o=K();xe(u.value,k.value,o.posPipeYbcr,o.negPipeYbcr,S.value,h.value,t,l,M.value)}else if(u.value){const o=ae();Ce(u.value,o,S.value,h.value,t,l)}},C=t=>{if(t<0||t>=r.value.length){console.error(`帧索引 ${t} 超出范围`);return}const l=r.value[t];if(console.log(`应用第 ${t} 帧数据 ${l}`),a.value=t,c.value){const o={};L.value.forEach(i=>{const x=parseFloat(l[i]);isNaN(x)||(o[i]=x)}),c.value.setJointAngles(o)}T(t,0)},U=async()=>{if(r.value.length===0){B.ElMessage.error("无法播放动画:无数据");return}if(!w.value){w.value=!0,_=!1,r.value.length-1===a.value&&(a.value=0);try{for(let t=a.value+1;t<r.value.length&&!_;t++){a.value=t;const l=r.value[t],o={};c.value&&L.value.forEach(i=>{const x=parseFloat(l[i]);isNaN(x)||(o[i]=x)}),c.value?await c.value.animateToState(o,d.value,i=>{y.value=(t+i)/r.value.length*100,T(t-1,i)}):(await new Promise(i=>setTimeout(i,d.value)),y.value=(t+1)/r.value.length*100)}_||B.ElMessage.success("动画播放完成")}catch(t){console.error("动画播放出错:",t),B.ElMessage.error("动画播放出错")}finally{w.value=!1,y.value=0}}},F=()=>{_=!0,w.value=!1,y.value=0,B.ElMessage.info("动画已停止")},I=()=>{a.value=0},z=()=>{if(u.value&&k.value){const t=K();xe(u.value,k.value,t.posPipeYbcr,t.negPipeYbcr,S.value,h.value,-1,0,M.value)}else if(u.value){const t=ae();Ce(u.value,t,S.value,h.value,-1,0)}},Z=()=>{c.value&&c.value.resetToZero(),z(),I(),B.ElMessage.success("机器人和管件已重置")},O=t=>`第 ${t+1} 帧`,j=t=>{w.value&&F(),C(t)},Q=()=>{w.value&&F(),!(a.value+1>=r.value.length)&&C(a.value+1)},P=()=>{w.value&&F(),a.value!==0&&C(a.value-1)},H=()=>{E.value&&(E.value.visible=!0),u.value&&u.value.parent&&u.value.parent.remove(u.value),E.value=null,u.value=null,k.value=null},re=t=>t==null?void 0:t.reduce((l,o)=>(l[o]="0",l),{});e.watch(Y,(t,l)=>{if(JSON.stringify(t)!==JSON.stringify(l))if(t.length>0){const o=re(t);r.value=[o]}else r.value=[]},{immediate:!0});const ee=e.ref(0),ue=t=>{ee.value=t},ge=(t,l)=>{if(!t||!l)return;const o=ie.getTargetJoint(t,l),i=Se();i.visible=!1,o==null||o.add(i)},Ve=t=>{c.value=new fe.URDFRobotController(t),A.value=ie.getAllLinkName(t),$.value="Pipe_Joint"},te=()=>{c.value=null,A.value=[],$.value=null},se=t=>{Ve(t),ge(t,$.value),ue(ee.value+1),Z()};e.watch(()=>p.model,t=>{if(H(),t){se(t);return}te()},{immediate:!0});const ve=t=>{var o,i;const l=new s.Mesh(t.geometry.clone(),t.material);return l.name="managed_pipe_clone",(i=(o=t==null?void 0:t.parent)==null?void 0:o.add)==null||i.call(o,l),l.position.copy(t.position),l.rotation.copy(t.rotation),l.scale.copy(t.scale),l};e.watch([$,M,S,ee],([t,l])=>{if(H(),p.model&&t){const o=ie.getMeshFromJoint(p.model,t);if(console.log(o,"meshToReplace"),o&&o.parent){E.value=o,o.visible=!1;const i=ve(o);if(m.value===ne.robotMode.SINGLE&&(i.position.y-=l*.001),u.value=i,m.value===ne.robotMode.DOUBLE){const x=ve(o);k.value=x}T(0,0)}else t&&console.warn(`在 link '${t}' 中未找到可替换的网格或其没有父级。`)}});const be=async()=>{if(Y.value.length===0){B.ElMessage.warning("没有可导出的表头");return}const t=Y.value.join(" ");try{await navigator.clipboard.writeText(t),B.ElMessage.success("表头已成功复制到剪贴板!")}catch(l){console.error("复制失败:",l),B.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},we=()=>{if(!f.value.trim()){B.ElMessage.warning("导入内容不能为空");return}const t=f.value.trim().split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ee=require("./threeViewerHost-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ee=require("./threeViewerHost-NwCu86-z.cjs"),q=require("./iconfont-BLFoQPNm.cjs"),J=require("./workpieceTreePanel-7llvdn1R.cjs"),Ce=require("./index-BEli6-9O.cjs");require("./index.vue_vue_type_style_index_0_scoped_6b92e250_lang-DyCuFKb2.cjs");const te=require("./index.vue_vue_type_script_setup_true_lang-BKTJR2th.cjs"),U=require("./urdfTree-BwNXusFz.cjs"),h=require("./request-BC2w2vGr.cjs"),ne=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),g=require("./svgIcon-CDPAgQbj.cjs"),_e=require("./animationData-C9-G8Pk-.cjs"),we=require("./MTLLoader-DeGVtVNV.cjs"),Se={class:"panel-content"},Pe={key:0,class:"animation-controls"},Te={class:"control-row"},Be={class:"control-row"},xe={class:"frame-info"},ze={class:"control-row"},De={key:1,class:"empty-state"},Le={class:"dialog-footer"},je=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(P,{expose:m}){const y=P,s=e.ref([]),_=e.ref(!1),T=e.ref(""),i=e.ref("stopped"),f=e.ref(0),w=e.ref(0),b=e.ref(10),u=e.ref(null);let c=0;const V=e.ref([]),N=e.computed(()=>y.model?U.getNonFixedJoints(y.model).map(p=>p.name):[]),S=e.computed(()=>[...N.value]),H=e.computed(()=>S.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${S.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),M=e.computed(()=>s.value[f.value]||{});e.watch(()=>y.model,o=>{o?(u.value=new J.URDFRobotController(o),V.value=U.getAllLinkName(o),f.value=0):(u.value=null,V.value=[])},{immediate:!0});const D=o=>{if(o<0||o>=s.value.length){console.error(`帧索引 ${o} 超出范围`);return}const n=s.value[o];if(u.value){const p={};N.value.forEach(k=>{const r=parseFloat(n[k]);isNaN(r)||(p[k]=r)}),u.value.setJointAngles(p)}f.value=o,w.value=s.value.length>1?o/(s.value.length-1)*100:100},L=async o=>{try{for(let n=f.value;n<s.value.length;n++){if(o!==c)return;const p=s.value[n],k={};if(u.value)N.value.forEach(r=>{const d=parseFloat(p[r]);isNaN(d)||(k[r]=d)}),await u.value.animateToState(k,b.value,r=>{o===c&&(w.value=(n+r)/s.value.length*100)});else{if(await new Promise(r=>setTimeout(r,b.value)),o!==c)return;w.value=(n+1)/s.value.length*100}f.value=n}o===c&&(h.ElMessage.success("动画播放完成"),i.value="stopped",w.value=100)}catch(n){console.error("动画播放出错:",n),h.ElMessage.error("动画播放出错"),i.value="stopped"}},B=()=>{if(s.value.length===0){h.ElMessage.error("无动画数据");return}i.value==="stopped"&&(f.value=0,D(0)),i.value="playing",c++,L(c),h.ElMessage.info("动画播放中")},$=()=>{i.value==="playing"&&(c++,i.value="paused",h.ElMessage.info("动画已暂停"))},R=()=>{c++,i.value="stopped",f.value=0,w.value=0,D(0),h.ElMessage.info("动画已停止并重置")},G=()=>{i.value==="playing"?$():B()},x=o=>{c++,i.value="paused",D(o)},X=()=>{if(!T.value.trim()){h.ElMessage.warning("导入内容不能为空");return}const o=T.value.trim().split(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as ge, ref as r, computed as k, watch as X, onUnmounted as De, resolveComponent as G, createElementBlock as x, openBlock as g, createElementVNode as n, createCommentVNode as U, createVNode as s, toDisplayString as L, Fragment as Be, renderList as Je, withCtx as le, shallowRef as te, onMounted as Me, nextTick as me, onBeforeUnmount as Ee, withDirectives as I, vShow as W, unref as z, renderSlot as ve, createBlock as de } from "vue";
|
|
2
|
-
import { s as pe } from "./threeViewerHost-
|
|
2
|
+
import { s as pe } from "./threeViewerHost-CDFwFnu2.js";
|
|
3
3
|
import { u as Ge, a as He, b as Ie, C as We } from "./iconfont-BjSu8v7G.js";
|
|
4
4
|
import { U as Xe, u as Ye, a as Ze, W as qe } from "./workpieceTreePanel-DjvO5w7t.js";
|
|
5
5
|
import { c as Ke } from "./index-DplRG-oo.js";
|
|
@@ -112,7 +112,7 @@ const Y = { class: "three-platform mv-inline" }, J = { class: "top-menu" }, Q =
|
|
|
112
112
|
height: { default: "100%" }
|
|
113
113
|
},
|
|
114
114
|
setup(E) {
|
|
115
|
-
const O = b(() => import("./threeSceneView-
|
|
115
|
+
const O = b(() => import("./threeSceneView-DgNQEj93.js")), y = b(() => import("./threePreview-CQpuh2pD.js")), i = b(() => import("./threeTrackPathView-DweDgiiM.js")), p = b(() => import("./threeSceneViewForCPMPIP-tZSXieg8.js")), n = E, P = A(D), { platName: f } = $(P), { isUrdf: _, isTrackPathFile: g } = z(), c = I(() => {
|
|
116
116
|
var t;
|
|
117
117
|
return (t = n == null ? void 0 : n.files) == null ? void 0 : t.map((s) => {
|
|
118
118
|
const { url: e } = s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),d=require("./index-BEli6-9O.cjs"),S=require("./index.vue_vue_type_style_index_0_scoped_6b92e250_lang-DyCuFKb2.cjs"),D=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),F={SINGLE:"单机",DOUBLE:"双机"},R={ROBOT:1,PIPECOMPARSION:2},i={ROBOT_SCENE:"robot",TRACK_PATH:"trackPath",CPMPIP_SCENE:"cpmpip",PREVIEW:"preview"},b=d.defineStore("threeState",{state:()=>({data:{files:[],data:{}}}),actions:{setData(v){this.data=v},getData(){return this.data}}});function I(){const v=d.useMenuState(d.pinia),{platform:g}=d.storeToRefs(v),P=b(d.pinia),c=["uv","cyd","nc"],m=["urdf"],r=["obj","stl"],T=[...c,...m,...r],f=t=>{if(!C())throw new Error("不是三维系统");P.setData(t)},y=()=>P.getData(),C=()=>g.value==="three",l=t=>S.getFileExtension(t),p=t=>{if(!t)return!1;const o=l(t);return T==null?void 0:T.includes(o)},E=t=>{if(!t)return!1;const o=l(t);return r==null?void 0:r.includes(o)},h=t=>{if(!t)return!1;const o=l(t);return c==null?void 0:c.includes(o)},u=t=>{if(!t)return{isCpt:!1,isCyd:!1,isUv:!1,isNc:!1};const o=l(t),a=c==null?void 0:c.find(k=>k===o);return{isCpt:a==="cpt",isCyd:a==="cyd",isUv:a==="uv",isNc:a==="nc"}},_=t=>{if(!t)return!1;const o=l(t);return m==null?void 0:m.includes(o)},B=t=>C()&&p(t),n=t=>({url:t,extension:l(t)});return{getData:y,setData:f,isThreeSystem:C,isUrdf:_,isGeneralFile:E,isTrackPathFile:h,isThreeFile:p,isUseBackdrop:B,initTrackFileType:u,getFileExtension:l,getFileInfo:n,getFilesInfo:t=>{const o=[];for(let a=0;a<t.length;a++){const w=t[a],k=n(w);o.push(k)}return o}}}const N={class:"three-platform mv-inline"},V={class:"top-menu"},A={key:4,class:"loading"},M=e.defineComponent({__name:"threeViewerHost",props:{files:{default:()=>[]},threeData:{},componentType:{},width:{default:"100%"},height:{default:"100%"}},setup(v){const g=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-
|
|
1
|
+
"use strict";const e=require("vue"),d=require("./index-BEli6-9O.cjs"),S=require("./index.vue_vue_type_style_index_0_scoped_6b92e250_lang-DyCuFKb2.cjs"),D=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),F={SINGLE:"单机",DOUBLE:"双机"},R={ROBOT:1,PIPECOMPARSION:2},i={ROBOT_SCENE:"robot",TRACK_PATH:"trackPath",CPMPIP_SCENE:"cpmpip",PREVIEW:"preview"},b=d.defineStore("threeState",{state:()=>({data:{files:[],data:{}}}),actions:{setData(v){this.data=v},getData(){return this.data}}});function I(){const v=d.useMenuState(d.pinia),{platform:g}=d.storeToRefs(v),P=b(d.pinia),c=["uv","cyd","nc"],m=["urdf"],r=["obj","stl"],T=[...c,...m,...r],f=t=>{if(!C())throw new Error("不是三维系统");P.setData(t)},y=()=>P.getData(),C=()=>g.value==="three",l=t=>S.getFileExtension(t),p=t=>{if(!t)return!1;const o=l(t);return T==null?void 0:T.includes(o)},E=t=>{if(!t)return!1;const o=l(t);return r==null?void 0:r.includes(o)},h=t=>{if(!t)return!1;const o=l(t);return c==null?void 0:c.includes(o)},u=t=>{if(!t)return{isCpt:!1,isCyd:!1,isUv:!1,isNc:!1};const o=l(t),a=c==null?void 0:c.find(k=>k===o);return{isCpt:a==="cpt",isCyd:a==="cyd",isUv:a==="uv",isNc:a==="nc"}},_=t=>{if(!t)return!1;const o=l(t);return m==null?void 0:m.includes(o)},B=t=>C()&&p(t),n=t=>({url:t,extension:l(t)});return{getData:y,setData:f,isThreeSystem:C,isUrdf:_,isGeneralFile:E,isTrackPathFile:h,isThreeFile:p,isUseBackdrop:B,initTrackFileType:u,getFileExtension:l,getFileInfo:n,getFilesInfo:t=>{const o=[];for(let a=0;a<t.length;a++){const w=t[a],k=n(w);o.push(k)}return o}}}const N={class:"three-platform mv-inline"},V={class:"top-menu"},A={key:4,class:"loading"},M=e.defineComponent({__name:"threeViewerHost",props:{files:{default:()=>[]},threeData:{},componentType:{},width:{default:"100%"},height:{default:"100%"}},setup(v){const g=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-Dx3DcgW-.cjs"))),P=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-fiZ4fBVp.cjs"))),c=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeTrackPathView-6RyMYllT.cjs"))),m=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-CCmSCkIN.cjs"))),r=v,T=d.useMenuState(d.pinia),{platName:f}=d.storeToRefs(T),{isUrdf:y,isTrackPathFile:C}=I(),l=e.computed(()=>{var n;return(n=r==null?void 0:r.files)==null?void 0:n.map(s=>{const{url:t}=s;return t})}),p=e.computed(()=>{var t;const n=(t=r==null?void 0:r.files)==null?void 0:t[0];return(n==null?void 0:n.extension)||""}),E=e.computed(()=>{var n,s;return(s=(n=r==null?void 0:r.threeData)==null?void 0:n.data)==null?void 0:s.trackFileType}),h=e.computed(()=>{if(r.componentType)switch(r.componentType){case"robot":return i.ROBOT_SCENE;case"track":return i.TRACK_PATH;case"cpmpip":return i.CPMPIP_SCENE;case"preview":return i.PREVIEW}return(f==null?void 0:f.value)===S.platNameConstants.CPMPIP&&y(p.value)?i.CPMPIP_SCENE:(f==null?void 0:f.value)===S.platNameConstants.ROBOT&&y(p.value)?i.ROBOT_SCENE:C(p.value)&&E.value?i.TRACK_PATH:i.PREVIEW}),u=e.ref([]),_=e.ref(!1);async function B(n){if(!n||!n.length){u.value=[];return}_.value=!0;try{const s=await Promise.all(n.map(t=>S.downloadFile(t)));u.value=s}catch(s){console.error("文件下载时发生错误:",s),u.value=[]}finally{_.value=!1}}return e.watch(()=>l.value,async n=>{await B(n||[])},{immediate:!0,deep:!0}),(n,s)=>(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",V,[e.renderSlot(n.$slots,"top-menu",{},void 0,!0)]),h.value===e.unref(i).ROBOT_SCENE?(e.openBlock(),e.createBlock(e.unref(g),{key:0,fileBlobs:u.value,threeData:r.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData"])):h.value===e.unref(i).TRACK_PATH?(e.openBlock(),e.createBlock(e.unref(c),{key:1,fileBlobs:u.value,threeData:r.threeData,trackFileType:E.value},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData","trackFileType"])):h.value===e.unref(i).CPMPIP_SCENE?(e.openBlock(),e.createBlock(e.unref(m),{key:2,fileBlobs:u.value,threeData:r.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData"])):h.value===e.unref(i).PREVIEW?(e.openBlock(),e.createBlock(e.unref(P),{key:3,fileBlobs:u.value},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs"])):e.createCommentVNode("",!0),_.value?(e.openBlock(),e.createElementBlock("div",A," 文件下载中,请稍候... ")):e.createCommentVNode("",!0)]))}}),O=D._export_sfc(M,[["__scopeId","data-v-9798f55b"]]),H=Object.freeze(Object.defineProperty({__proto__:null,default:O},Symbol.toStringTag,{value:"Module"}));exports.ThreeViewerHost=O;exports.robotMode=F;exports.sceneType=R;exports.threeViewerHost=H;exports.useThreeState=b;exports.useThreeSystem=I;
|