import{M as $,Y as M,a0 as J,aE as T,aF as L}from"./index.17037962789732.js";import"./index.1703796278973310.js";import"./index.170379627897336.js";import{_ as R}from"./index.vue_vue_type_script_setup_true_name_PermissionButton_lang.1703796278973.js";import{u as Y}from"./instance.17037962789732.js";import{Z,x as q,$ as G}from"./instance.1703796278973.js";import{_ as H}from"./Save.vue_vue_type_script_setup_true_lang.17037962789733.js";import{d as K,k as b,w as U,r as j,u as a,o,x as _,z as k,b as n,a as t,t as m,c as p,B as f,F as z,h as A,A as C}from"./vue.1703796278973.js";const W={key:0,style:{"margin-top":"20px"}},X={style:{display:"flex","margin-bottom":"20px","align-items":"center"}},ee=k("div",{style:{"font-size":"16px","font-weight":"700"}},"配置",-1),te={style:{"font-size":"15px"}},ne={key:0},oe={key:1},fe=K({__name:"index",setup(ie){const e=Y(),y=b(!1),g=b([]);U(()=>{e.current.id&&Z(e.current.id).then(i=>{i.status===200&&(g.value=i==null?void 0:i.result)})});const N=i=>{var c,s,d,u,h;return((c=e.current)==null?void 0:c.cachedConfiguration)&&((s=e.current)==null?void 0:s.cachedConfiguration[i])!==void 0&&((d=e.current)==null?void 0:d.configuration)&&((u=e.current)==null?void 0:u.configuration[i])!==((h=e.current)==null?void 0:h.cachedConfiguration[i])},P=async()=>{e.current.id&&(await q(e.current.id)).status===200&&($.success("操作成功"),e.refresh(e.current.id))},Q=async()=>{e.current.id&&(await G(e.current.id)).status===200&&($.success("恢复默认配置成功"),e.refresh(e.current.id))},V=()=>{y.value=!1,e.current.id&&e.refresh(e.current.id)};return(i,c)=>{const s=j("AIcon"),d=R,u=M,h=J,v=j("Ellipsis"),D=T,F=L;return a(g).length?(o(),_("div",W,[k("div",X,[ee,n(h,null,{default:t(()=>{var l;return[n(d,{type:"link",onClick:c[0]||(c[0]=r=>y.value=!0),hasPermission:"device/Instance:update"},{icon:t(()=>[n(s,{type:"EditOutlined"})]),default:t(()=>[m(" 编辑 ")]),_:1}),((l=a(e).detail.current)==null?void 0:l.value)!=="notActive"?(o(),p(d,{key:0,type:"link",popConfirm:{title:"确认重新应用该配置？",onConfirm:P},hasPermission:"device/Instance:update"},{default:t(()=>[n(s,{type:"CheckOutlined"}),m("应用配置"),n(u,{title:"修改配置后需重新应用后才能生效。"},{default:t(()=>[n(s,{type:"QuestionCircleOutlined"})]),_:1})]),_:1},8,["popConfirm"])):f("",!0),a(e).detail.aloneConfiguration?(o(),p(d,{key:1,type:"link",popConfirm:{title:"确认恢复默认配置？",onConfirm:Q},hasPermission:"device/Instance:update"},{default:t(()=>[n(s,{type:"SyncOutlined"}),m("恢复默认"),n(u,{title:"该设备单独编辑过配置信息，点击此将恢复成默认的配置信息，请谨慎操作。"},{default:t(()=>[n(s,{type:"QuestionCircleOutlined"})]),_:1})]),_:1},8,["popConfirm"])):f("",!0)]}),_:1})]),(o(!0),_(z,null,A(a(g),l=>(o(),p(F,{bordered:"",size:"small",key:l.name},{title:t(()=>[k("h4",te,C(l.name),1)]),default:t(()=>[(o(!0),_(z,null,A(l.properties,r=>(o(),p(D,{key:r.property},{label:t(()=>[n(v,{style:{"margin-right":"5px"}},{default:t(()=>[m(C(r.name)+" ",1),r.description?(o(),p(u,{key:0,title:r.description},{default:t(()=>[n(s,{type:"QuestionCircleOutlined"})]),_:2},1032,["title"])):f("",!0)]),_:2},1024)]),default:t(()=>{var x,B,w,E,I;return[r.type.type==="password"&&((w=(B=(x=a(e).current)==null?void 0:x.configuration)==null?void 0:B[r.property])==null?void 0:w.length)>0?(o(),_("span",ne,"******")):(o(),_("span",oe,[n(v,null,{default:t(()=>{var O,S;return[m(C(((S=(O=a(e).current)==null?void 0:O.configuration)==null?void 0:S[r.property])||""),1)]}),_:2},1024),N(r.property)?(o(),p(u,{key:0,title:`有效值:${(I=(E=a(e).current)==null?void 0:E.configuration)==null?void 0:I[r.property]}`},{default:t(()=>[n(s,{type:"QuestionCircleOutlined"})]),_:2},1032,["title"])):f("",!0)]))]}),_:2},1024))),128))]),_:2},1024))),128)),a(y)?(o(),p(H,{key:0,onSave:V,onClose:c[1]||(c[1]=l=>y.value=!1),config:a(g)},null,8,["config"])):f("",!0)])):f("",!0)}}});export{fe as _};
