import{d as J,O as Y,k as b,l as k,p as E,m as F,o as y,c as j,a as n,b as i,t as G,u as d,x as H,F as R,h as U,z as g,M as x,G as $,H as z}from"./vue.1703796278973.js";import{K as A,a0 as K,a7 as P,G as q,H as Q,aA as W,cD as X}from"./index.17037962789732.js";import"./index.1703796278973318.js";import"./index.1703796278973303.js";import"./index.170379627897334.js";import"./index.170379627897338.js";import"./index.170379627897336.js";import"./index.170379627897315.js";import{a as Z}from"./utils.1703796278973.js";import{u as ee}from"./instance.17037962789732.js";import{u as te}from"./product.17037962789738.js";import{d as ae,c as oe,e as se}from"./product.17037962789737.js";import{a as M}from"./instance.1703796278973.js";import{aN as ne}from"./index.17037962789733.js";import{_ as re}from"./_plugin-vue_export-helper.1703796278973.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./moment.1703796278973.js";import"./consts.1703796278973.js";import"./encodeQuery.1703796278973.js";import"./system.1703796278973.js";import"./comm.1703796278973.js";import"./index.170379627897332.js";import"./index.170379627897333.js";import"./default.1703796278973.js";import"./permission.1703796278973.js";import"./404.1703796278973.js";const ie=r=>($("data-v-beecc4e5"),r=r(),z(),r),ce=ie(()=>g("div",{class:"cat-content"},[g("p",{class:"cat-tip"}," 物模型是对设备在云端的功能描述，包括设备的属性、服务和事件。物联网平台通过定义一种物的描述语言来描述物模型，称之为 TSL（即 Thing Specification Language），采用 JSON 格式，您可以根据 TSL 组装上报设备的数据。您可以导出完整物模型，用于云端应用开发。 ")],-1)),le={class:"cat-panel"},pe=J({name:"Cat"}),ue=J({...pe,props:{visible:{type:Boolean},type:null},emits:["update:visible"],setup(r,{emit:h}){const s=r,S=Y(),c=b(!1),_=k({get:()=>s.visible,set:t=>{h("update:visible",t)}}),w=()=>{h("update:visible",!1)},l=ee(),v=te(),p=k(()=>{var e,o;return{product:(e=v.current)==null?void 0:e.metadata,device:(o=l.current)==null?void 0:o.metadata}[s.type]}),a=b(p.value),N=async()=>{var t,e;try{Z(JSON.parse(a.value),`${s.type==="device"?(t=l.current)==null?void 0:t.name:(e=v.current)==null?void 0:e.name}-物模型`,"YYYY/MM/DD")}catch{ne.error("请先配置物模型")}},B=t=>{t==="alink"?(a.value="",p&&oe("to","alink",JSON.parse(p.value)).then(e=>{e.status===200&&(a.value=JSON.stringify(e.result))})):a.value=p.value},C=b(),L=async t=>{const e=await se();e.status===200&&(C.value=[{id:"jetlinks",name:"jetlinks"}].concat(e.result)),s.type==="device"&&t&&M(t).then(o=>{var u;if(o.status===200){l.setCurrent(o.result);const f=(u=o.result)==null?void 0:u.metadata;a.value=f}})};return E(()=>{L(S.params.id)}),F(()=>[s.visible,s.type],()=>{if(s.visible){c.value=!0;const{id:t}=S.params;s.type==="device"?M(t).then(e=>{c.value=!1,l.setCurrent(e.result),a.value=e.result.metadata}):ae(t).then(e=>{c.value=!1,v.setCurrent(e.result),a.value=e.result.metadata})}},{immediate:!0}),(t,e)=>{const o=A,u=K,f=P,O=q,V=Q,I=W,D=X;return y(),j(D,{"mask-closable":!1,title:"查看物模型",width:"700",visible:d(_),"onUpdate:visible":e[1]||(e[1]=m=>x(_)?_.value=m:null),"destroy-on-close":"",onClose:w},{extra:n(()=>[i(u,null,{default:n(()=>[i(o,{type:"primary",onClick:N},{default:n(()=>[G(" 导出 ")]),_:1})]),_:1})]),default:n(()=>[i(I,{spinning:d(c)},{default:n(()=>[ce,i(V,{onChange:B,"destroy-inactive-tab-pane":""},{default:n(()=>[(y(!0),H(R,null,U(d(C),m=>(y(),j(O,{key:m.id,tab:m.name},{default:n(()=>[g("div",le,[i(f,{modelValue:d(a),"onUpdate:modelValue":e[0]||(e[0]=T=>x(a)?a.value=T:null),theme:"vs",style:{height:"100%"},lang:"javascript"},null,8,["modelValue"])])]),_:2},1032,["tab"]))),128))]),_:1})]),_:1},8,["spinning"])]),_:1},8,["visible"])}}});const Re=re(ue,[["__scopeId","data-v-beecc4e5"]]);export{Re as default};
