import{u as J,a as L,r as c,J as g,$ as O,o as r,c as f,v as b,p as a,q as l,x as V,n,y as v,F as j,A as z,t as y,P as A,C as K,s as G,ay as H,S as Q,ak as W,br as X,j as Y,k as Z,l as ee,cp as ae,cq as te}from"./index.8d733f79.js";import{E as le,a as oe}from"./el-tab-pane.27bff4fc.js";import{E as se}from"./el-input-number.60463ef8.js";import{E as ne}from"./el-text.54dc8292.js";import{g as re,f as ce}from"./deviceType.30ac56e5.js";import"./index.28f6da25.js";const ie={class:"subPage-content"},ue={class:"nav"},pe={class:"details-wrap",style:{display:"flex"}},he={__name:"deviceModel",setup(me){const w=J(),N=L(),i=c([]),T={children:"points",label:"label"},s=c("params"),m=c([]),d=c([]),h=c(),C=g.session.getJSON("userInfo").userLevel===0&&g.session.getJSON("userInfo").superType===1,I=()=>{w.push("/device/deviceType")},M=async()=>{const e=await re({deviceTypeId:N.query.id});e.data.forEach(t=>{t.label=t.name,t.points.forEach(u=>{u.label=u.pointName})}),i.value=e.data,H(()=>{h.value.setCurrentKey(i.value[0].name),m.value=i.value[0].params})},$=e=>{e.name&&(s.value="params",m.value=e.params),e.pointName&&(s.value="metric",d.value=e.metrics)},B=()=>{const e=[];d.value.forEach(t=>{e.push({id:t.id,sort:t.sort})}),ce(e).then(t=>{Q.success(t.msg)})};return M(),(e,t)=>{const u=O("Back"),S=W,x=ne,k=X,U=Y,D=Z,E=le,R=ee,p=ae,P=se,q=te,F=oe;return r(),f("div",ie,[b("div",ue,[a(S,{color:"#0052D9",size:"24",onClick:I,style:{cursor:"pointer"}},{default:l(()=>[a(u)]),_:1}),b("span",null,V(e.$t("deviceModeling")),1)]),b("div",pe,[a(k,{style:{width:"220px","margin-right":"20px"}},{default:l(()=>[a(x,{ref_key:"treeRef",ref:h,"node-key":"label",data:n(i),props:T,"default-expand-all":"","highlight-current":"","expand-on-click-node":!1,onNodeClick:$},null,8,["data"])]),_:1}),a(F,{class:"noBorderTabs",style:{flex:"1",width:"0"},modelValue:n(s),"onUpdate:modelValue":t[1]||(t[1]=o=>G(s)?s.value=o:null),type:"card"},{default:l(()=>[n(s)==="params"?(r(),v(E,{key:0,label:e.$t("paramsInfo"),name:"params"},{default:l(()=>[a(k,null,{default:l(()=>[(r(!0),f(j,null,z(n(m),o=>(r(),f("div",{class:"content-wrap",key:o.identifier},[a(D,{label:o.name},{default:l(()=>[a(U,{modelValue:o.value,"onUpdate:modelValue":_=>o.value=_,readonly:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]))),128))]),_:1})]),_:1},8,["label"])):y("",!0),n(s)==="metric"?(r(),v(E,{key:1,label:e.$t("monitorMetric"),name:"metric"},{default:l(()=>[n(C)?(r(),v(R,{key:0,type:"primary",onClick:B,style:{"margin-bottom":"12px"}},{default:l(()=>[A(V(e.$t("save")),1)]),_:1})):y("",!0),a(q,{data:n(d),style:{height:"calc(100% - 44px)"}},{default:l(()=>[a(p,{label:e.$t("metricName"),prop:"metricName"},null,8,["label"]),a(p,{label:e.$t("identifier"),prop:"metricIdentifier"},null,8,["label"]),a(p,{label:e.$t("unit"),prop:"metricUnit"},null,8,["label"]),a(p,{label:e.$t("overViewSort"),prop:"sort"},{default:l(o=>[a(P,{style:{width:"90%"},modelValue:o.row.sort,"onUpdate:modelValue":_=>o.row.sort=_,step:0,precision:0,onMousewheel:t[0]||(t[0]=K(()=>{},["prevent"])),max:999,min:1,controls:!1},null,8,["modelValue","onUpdate:modelValue"])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1},8,["label"])):y("",!0)]),_:1},8,["modelValue"])])])}}};export{he as default};
