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 tt}from"./instance.17037962789732.js";import{u as et}from"./product.17037962789738.js";import{d as at,c as ot,e as st}from"./product.17037962789737.js";import{a as M}from"./instance.1703796278973.js";import{aN as nt}from"./index.17037962789733.js";import{_ as rt}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 it=r=>($("data-v-411deb7b"),r=r(),z(),r),lt=it(()=>g("div",{class:"cat-content"},[g("p",{class:"cat-tip"}," 物模型是对设备在云端的功能描述，包括设备的属性、服务和事件。物联网平台通过定义一种物的描述语言来描述物模型，称之为 TSL（即 Thing Specification Language），采用 JSON 格式，您可以根据 TSL 组装上报设备的数据。您可以导出完整物模型，用于云端应用开发。 ")],-1)),ct={class:"cat-panel"},pt=J({name:"Cat"}),ut=J({...pt,props:{visible:{type:Boolean},type:null},emits:["update:visible"],setup(r,{emit:h}){const s=r,S=Y(),l=b(!1),_=k({get:()=>s.visible,set:e=>{h("update:visible",e)}}),w=()=>{h("update:visible",!1)},c=tt(),v=et(),p=k(()=>{var t,o;return{product:(t=v.current)==null?void 0:t.metadata,device:(o=c.current)==null?void 0:o.metadata}[s.type]}),a=b(p.value),N=async()=>{var e,t;try{Z(JSON.parse(a.value),`${s.type==="device"?(e=c.current)==null?void 0:e.name:(t=v.current)==null?void 0:t.name}-物模型`,"YYYY/MM/DD")}catch{nt.error("请先配置物模型")}},B=e=>{e==="alink"?(a.value="",p&&ot("to","alink",JSON.parse(p.value)).then(t=>{t.status===200&&(a.value=JSON.stringify(t.result))})):a.value=p.value},C=b(),L=async e=>{const t=await st();t.status===200&&(C.value=[{id:"jetlinks",name:"jetlinks"}].concat(t.result)),s.type==="device"&&e&&M(e).then(o=>{var u;if(o.status===200){c.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){l.value=!0;const{id:e}=S.params;s.type==="device"?M(e).then(t=>{l.value=!1,c.setCurrent(t.result),a.value=t.result.metadata}):at(e).then(t=>{l.value=!1,v.setCurrent(t.result),a.value=t.result.metadata})}},{immediate:!0}),(e,t)=>{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":t[1]||(t[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(l)},{default:n(()=>[lt,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",ct,[i(f,{modelValue:d(a),"onUpdate:modelValue":t[0]||(t[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 Rt=rt(ut,[["__scopeId","data-v-411deb7b"]]);export{Rt as default};
