import{_ as U,a5 as K,b as x,r as I,ah as v,o as f,c as F,p as i,q as r,v as P,P as L,x as p,n as a,F as h,A as V,y as B,C as z,cG as G,cH as H,s as j,E as J,i as Q,k as W,m as X,l as Y,bv as Z,D as A}from"./index.8d733f79.js";import{E as ee}from"./el-input-number.60463ef8.js";import{E as oe}from"./deviceAnalysis.ce7ce4e7.js";import{z as te}from"./deviceTree.170dfbd9.js";import ae from"./bearingLib.05230f01.js";import"./index.28f6da25.js";const ne={class:"dialog-footer"},le=K({name:"FaultLib"}),ie=Object.assign(le,{emits:["confirm"],setup(re,{expose:w,emit:$}){const{t:s}=x(),{proxy:b}=A(),c=I(!1),m=I([]),g=v({pointId:""}),n=v({carrierFrequency:null,bearingIdentification:"",troubleLocation:"BPFI"}),E=v({carrierFrequency:[{required:!0,message:s("rotateFreqP"),trigger:"blur"}],bearingIdentification:[{required:!0,message:s("bearingP"),trigger:"change"}],troubleLocation:[{required:!0,message:s("faultComponentP"),trigger:"change"}]}),k=I([{value:"BPFI",label:s("innerRing"),key:"innerRing"},{value:"BPFO",label:s("outerRing"),key:"outerRing"},{value:"BSF",label:s("roller"),key:"roller"},{value:"FTF",label:s("holder"),key:"holder"}]),C=e=>{c.value=!0,g.pointId=e.pointId,e.rotate&&(n.carrierFrequency=(e.rotate/60).toFixed(2)),q()},q=async()=>{const e=await oe({pointId:g.pointId});m.value=e.data||[]},R=e=>{if(console.log("\u9009\u62E9\u7684",e),!e.length)return;const o=[];e.forEach(l=>{o.push({bearingId:l.id,bearingIdentification:l.bearingIdentification?l.bearingIdentification:`${l.factory}-${l.model}`})});const d={pointId:g.pointId,bearingList:o};te(d).then(l=>{b.$modal.msgSuccess(l.msg),q()})},D=()=>{b.$refs.formRef.validate(e=>{if(e){const o=m.value.find(u=>u.identification===n.bearingIdentification).faultLibraryDTO,d=k.value.find(u=>u.value===n.troubleLocation).key,l={name:`${n.bearingIdentification}-${n.troubleLocation}`,value:(o[d]*n.carrierFrequency).toFixed(3)};$("confirm",l,"add"),_()}else console.log("error submit!")})},O=()=>{$("confirm"),_()},S=()=>{const e=[];m.value.forEach(o=>{e.push({bearingId:o.faultLibraryDTO.id,bearingIdentification:o.identification})}),b.$refs.faultLibRef.showModal(e)};function _(){c.value=!1}return w({showModal:C}),(e,o)=>{const d=J,l=Q,u=W,M=ee,T=X,y=Y,N=Z;return f(),F(h,null,[i(N,{title:e.$t("bearingFaultLib"),modelValue:a(c),"onUpdate:modelValue":o[4]||(o[4]=t=>j(c)?c.value=t:null),width:"420","align-center":!0},{footer:r(()=>[P("div",ne,[i(y,{onClick:_},{default:r(()=>[L(p(e.$t("cancel")),1)]),_:1}),i(y,{onClick:O},{default:r(()=>[L(p(e.$t("clearLine")),1)]),_:1}),i(y,{type:"primary",onClick:D},{default:r(()=>[L(p(e.$t("confirm")),1)]),_:1})])]),default:r(()=>[i(T,{ref:"formRef",model:a(n),rules:a(E),"label-width":"80","label-position":"left"},{default:r(()=>[i(u,{label:e.$t("bearing"),prop:"bearingIdentification"},{default:r(()=>[i(l,{modelValue:a(n).bearingIdentification,"onUpdate:modelValue":o[0]||(o[0]=t=>a(n).bearingIdentification=t),placeholder:e.$t("bearingP"),teleported:!1},{default:r(()=>[(f(!0),F(h,null,V(a(m),t=>(f(),B(d,{key:t.identification,label:t.identification,value:t.identification},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),P("div",{class:"btnLink",onClick:S},p(e.$t("bindBearing")),1)]),_:1},8,["label"]),i(u,{label:e.$t("faultComponent"),prop:"troubleLocation"},{default:r(()=>[i(l,{modelValue:a(n).troubleLocation,"onUpdate:modelValue":o[1]||(o[1]=t=>a(n).troubleLocation=t),placeholder:e.$t("faultComponentP"),teleported:!1},{default:r(()=>[(f(!0),F(h,null,V(a(k),t=>(f(),B(d,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),i(u,{label:e.$t("rotateFreq"),prop:"carrierFrequency",style:{width:"295px"}},{default:r(()=>[i(M,{class:"input-number",modelValue:a(n).carrierFrequency,"onUpdate:modelValue":o[2]||(o[2]=t=>a(n).carrierFrequency=t),placeholder:e.$t("rotateFreqP"),onMousewheel:o[3]||(o[3]=z(()=>{},["prevent"])),step:.001,min:.001,max:1e6,controls:!1,onKeydown:a(G),onPaste:a(H)},null,8,["modelValue","placeholder","step","min","onKeydown","onPaste"])]),_:1},8,["label"])]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"]),i(a(ae),{ref:"faultLibRef",onConfirm:R},null,512)],64)}}}),pe=U(ie,[["__scopeId","data-v-acf06e4e"]]);export{pe as default};
