import{b as P,r as c,o as u,y as g,q as s,n as p,c as _,p as v,P as b,x as y,t as w,s as T,F as M,A as N,ab as x,b2 as L,d7 as F,J as H,l as J,bv as U,D as X}from"./index.8d733f79.js";import{E as q,a as K}from"./el-tab-pane.27bff4fc.js";import O from"./absAlarm.3bfe390c.js";import j from"./changeRateAlarm.729a754f.js";import z from"./trendAlarm.907145a1.js";import G from"./divideBandAlarm.cf9023a4.js";import Q from"./tiltAngleAlarm.3572ab3d.js";import{l as W}from"./deviceTree.170dfbd9.js";import"./el-input-number.60463ef8.js";import"./index.28f6da25.js";import"./setValue.1d09ba51.js";import"./el-date-picker-panel.089dbe6d.js";import"./panel-time-pick.b2dd8e75.js";import"./dialogContent.8cf6deaf.js";import"./index.26573f78.js";import"./el-text.54dc8292.js";import"./searchStore.0c98fb50.js";import"./chartTrend.c3888dfe.js";import"./deviceAnalysis.ce7ce4e7.js";import"./applyModal.ed6f4c23.js";import"./chartChangeRateOrTrend.099c4326.js";import"./spectrumChart.b3e35fb1.js";const Y={key:0,class:"dialog-footer"},Te={__name:"alarmSet",setup(Z,{expose:$}){const{t:d}=P(),{proxy:f}=X(),m=c(!1),o=c(""),a=c([]);let A;const C={absAlarm:O,changeRateAlarm:j,trendAlarm:z,divideBandAlarm:G,tiltAngleAlarm:Q},R=e=>C[e],h=c(!1),k=e=>{h.value=e},B=e=>{var n;m.value=!0,h.value=!1,e.pointId=`${e.id}`.replace("_",""),A=e;const i=((n=e.sensorProductKey)==null?void 0:n.split(","))||[];H.session.getJSON("userInfo").userType!==2?(a.value=[{name:d("absAlarm"),hasAuth:!0,identifier:"absAlarm"},{name:d("changeRateAlarm"),hasAuth:!0,identifier:"changeRateAlarm"},{name:d("trendAlarm"),hasAuth:!0,identifier:"trendAlarm"},{name:d("divideBandAlarm"),hasAuth:!0,identifier:"divideBandAlarm"}],i.includes("XHITE-L6")&&a.value.push({name:d("tiltAngleAlarm"),hasAuth:!0,identifier:"tiltAngleAlarm"}),e.pointType===2&&(a.value=a.value.filter(t=>["absAlarm","changeRateAlarm","trendAlarm"].includes(t.identifier))),o.value=a.value[0].identifier,setTimeout(()=>{f.$refs[`${o.value}Ref`][0].getPointAlarmConfig(e)},0)):E(e,i)};function E(e,i){a.value=[],W({deviceId:e.deviceId}).then(n=>{for(let t=0;t<n.data.length;t++)if(n.data[t].identifier==="alarmSet")for(let r=0;r<n.data[t].children.length;r++)n.data[t].children[r].hasAuth&&(n.data[t].children[r].identifier==="tiltAngleAlarm"&&i.includes("XHITE-L6")||n.data[t].children[r].identifier!=="tiltAngleAlarm")&&a.value.push(n.data[t].children[r]);e.pointType===2&&(a.value=a.value.filter(t=>["absAlarm","changeRateAlarm","trendAlarm"].includes(t.identifier))),a.value.length&&(o.value=a.value[0].identifier,setTimeout(()=>{f.$refs[`${o.value}Ref`][0].getPointAlarmConfig(e)},0))})}function I(){setTimeout(()=>{f.$refs[`${o.value}Ref`][0].getPointAlarmConfig(A)},0)}const S=()=>{m.value=!1},V=()=>{a.value.forEach(e=>{f.$refs[`${e.identifier}Ref`][0].saveConfigFn(A.pointId)})};return $({showModal:B}),(e,i)=>{const n=q,t=K,r=J,D=U;return u(),g(D,{title:e.$t("alarmSet"),modelValue:p(m),"onUpdate:modelValue":i[1]||(i[1]=l=>T(m)?m.value=l:null),width:"70%","align-center":!0,"append-to-body":"",class:"alarmSet_dialog"},{footer:s(()=>[p(h)?(u(),_("div",Y,[v(r,{onClick:S},{default:s(()=>[b(y(e.$t("cancel")),1)]),_:1}),v(r,{type:"primary",onClick:V},{default:s(()=>[b(y(e.$t("confirm")),1)]),_:1})])):w("",!0)]),default:s(()=>[v(t,{type:"card",modelValue:p(o),"onUpdate:modelValue":i[0]||(i[0]=l=>T(o)?o.value=l:null),class:"borderTabs",onTabChange:I},{default:s(()=>[(u(!0),_(M,null,N(p(a),l=>(u(),g(n,{key:l.identifier,label:l.name,name:l.identifier},{default:s(()=>[(u(),g(x(R(l.identifier)),L({ref_for:!0,ref:l.identifier+"Ref",embed:!0},F(l.identifier==="absAlarm"?{fn:k}:{})),null,16))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["title","modelValue"])}}};export{Te as default};
