import{b as J,J as M,r as d,cE as q,o as h,c as b,v as p,n as a,aH as G,y as E,q as n,P as c,x as o,p as s,t as $,s as I,C as j,cG as z,cH as Q,F as W,l as ee,cK as te,k as ae,m as le,bv as ne,D as oe}from"./index.8d733f79.js";import{t as se}from"./index.26573f78.js";import{E as ie}from"./el-input-number.60463ef8.js";import{f as de,h as re,i as ue,s as pe}from"./setValue.1d09ba51.js";import"./el-text.54dc8292.js";import"./deviceTree.170dfbd9.js";import"./searchStore.0c98fb50.js";import"./index.28f6da25.js";const me={style:{height:"100%"}},ce={key:0,style:{"margin-bottom":"20px"}},ve={key:0},fe={style:{width:"100%"}},he={style:{width:"100%"}},ye={style:{width:"100%"}},ge={style:{width:"100%"}},_e={style:{width:"100%"}},be={style:{width:"100%"}},$e={key:0,style:{"padding-top":"20px",height:"330px"}},Ce={class:"dialog-footer"},Ae={__name:"tiltAngleAlarm",props:{embed:{type:Boolean,default:!1}},emits:["logView"],setup(D,{expose:P,emit:A}){const{proxy:g}=oe(),{t:F}=J(),N=M.session.getJSON("userInfo").userLevel!==0,V=d("angle"),r=d(!1),C=d(),m=d(null),w=d(null),T=d(null),v=d(30),f=d(!1),l=d({}),y=d(!1),B=e=>{m.value=e.pointId,w.value=e.deviceId,T.value=e.deviceTypeId,k()},k=()=>{y.value=!1,l.value={},f.value=!1,v.value=30,de({pointId:m.value}).then(e=>{y.value=!0,e.data&&(f.value=e.data.isEnable,v.value=e.data.angleThreshold,l.value=e.data)})},O=()=>{C.value.setCheckedFn(w.value)},x=()=>{g.$modal.confirm(F("confirmApplySameTypeDevice")).then(()=>{const e={alarmType:V.value,deviceTypeId:T.value,pointId:m.value};re(e).then(t=>{r.value=!1,g.$modal.msgSuccess(t.msg)})}).catch(()=>{})},X=()=>{const e=C.value.getCheckedFn()||[],t={alarmType:V.value,pointId:m.value,nodeIds:e};ue(t).then(u=>{r.value=!1,g.$modal.msgSuccess(u.msg)})},S=()=>{const e={isEnable:f.value,angleThreshold:v.value,deviceId:w.value,pointId:m.value};pe(e).then(t=>{g.$modal.msgSuccess(t.msg),k()})},Y=()=>{A("logView",{alarmType:"tiltAngle",pointId:m.value})};return P({getPointAlarmConfig:B,saveConfigFn:e=>{y.value&&+e==+m.value&&S()}}),(e,t)=>{const u=ee,Z=te,_=ae,K=ie,L=le,R=se,U=ne,H=q("hasPermi");return h(),b(W,null,[p("div",me,[a(y)&&N&&!D.embed?(h(),b("div",ce,[G((h(),E(u,{type:"primary",onClick:S},{default:n(()=>[c(o(e.$t("save")),1)]),_:1})),[[H,["alarm_setValue_save"]]]),s(u,{type:"primary",plain:"",onClick:t[0]||(t[0]=i=>r.value=!0)},{default:n(()=>[c(o(e.$t("applyOtherPoint")),1)]),_:1}),s(u,{type:"primary",onClick:Y},{default:n(()=>[c(o(e.$t("changeLog")),1)]),_:1})])):$("",!0),a(y)?(h(),E(L,{key:1,"label-position":"top"},{default:n(()=>[s(_,{label:e.$t("isEnabled")},{default:n(()=>[s(Z,{modelValue:a(f),"onUpdate:modelValue":t[1]||(t[1]=i=>I(f)?f.value=i:null),"inline-prompt":"","active-text":e.$t("yes"),"inactive-text":e.$t("no")},null,8,["modelValue","active-text","inactive-text"])]),_:1},8,["label"]),s(_,{label:e.$t("angleThreshold"),style:{width:"200px"}},{default:n(()=>[s(K,{class:"input-number",modelValue:a(v),"onUpdate:modelValue":t[2]||(t[2]=i=>I(v)?v.value=i:null),step:.01,onMousewheel:t[3]||(t[3]=j(()=>{},["prevent"])),max:99999,min:0,controls:!1,onKeydown:t[4]||(t[4]=i=>a(z)(i,2)),onPaste:t[5]||(t[5]=i=>a(Q)(i,2)),placeholder:e.$t("angleThresholdP")},null,8,["modelValue","step","placeholder"])]),_:1},8,["label"]),a(l).isEnable?(h(),b("div",ve,[s(_,{label:`\u57FA\u51C6\u503C\uFF1A${a(l).standardValueTime?`(${a(l).standardValueTime})`:""}`},{default:n(()=>[p("div",fe,"X\uFF1A"+o(a(l).standardX),1),p("div",he,"Y\uFF1A"+o(a(l).standardY),1),p("div",ye,"Z\uFF1A"+o(a(l).standardZ),1)]),_:1},8,["label"]),s(_,{label:`\u6700\u65B0\u503C\uFF1A${a(l).latestStandardValueTime?`(${a(l).latestStandardValueTime})`:""}`},{default:n(()=>[p("div",ge,"X\uFF1A"+o(a(l).latestStandardX),1),p("div",_e,"Y\uFF1A"+o(a(l).latestStandardY),1),p("div",be,"Z\uFF1A"+o(a(l).latestStandardZ),1)]),_:1},8,["label"]),p("div",null,"\u503E\u89D2\u503C\uFF1A"+o(a(l).latestAngleThreshold),1)])):$("",!0)]),_:1})):$("",!0)]),s(U,{title:e.$t("applyOtherPoint"),modelValue:a(r),"onUpdate:modelValue":t[7]||(t[7]=i=>I(r)?r.value=i:null),width:"480px","align-center":!0,onClose:t[8]||(t[8]=i=>r.value=!1)},{footer:n(()=>[p("div",Ce,[s(u,{type:"primary",plain:"",onClick:x},{default:n(()=>[c(o(e.$t("sameTypeDevice")),1)]),_:1}),s(u,{onClick:t[6]||(t[6]=i=>r.value=!1)},{default:n(()=>[c(o(e.$t("cancel")),1)]),_:1}),s(u,{type:"primary",onClick:X},{default:n(()=>[c(o(e.$t("confirm")),1)]),_:1})])]),default:n(()=>[s(u,{type:"primary",plain:"",onClick:O},{default:n(()=>[c(o(e.$t("curDevice")),1)]),_:1}),a(r)?(h(),b("div",$e,[s(R,{showCheckbox:"",ref_key:"treeSearchRef",ref:C},null,512)])):$("",!0)]),_:1},8,["title","modelValue"])],64)}}};export{Ae as default};
