import{a as q,b as M,r as c,ah as K,o as d,y as f,q as a,v as A,p as n,P as N,x as g,n as l,c as C,F as w,A as k,cG as E,cH as h,s as G,k as H,E as O,i as j,cK as z,j as J,m as Q,l as W,bv as X,D as Y}from"./index.8d733f79.js";import{E as Z}from"./el-input-number.60463ef8.js";import"./index.28f6da25.js";const ee={class:"dialog-footer"},ae={__name:"addChannelModal",emits:["onSave"],setup(le,{expose:F,emit:x}){const{proxy:y}=Y();q(),M();const u=c(!1),o=K({channelNo:null,speedChannelNo:null,productKey:"",isTemperature:!1,remark:"",type:1,temperatureCompensation:0,sensitivity:null}),T=K({channelNo:[{required:!0,message:"\u8BF7\u8F93\u5165\u901A\u9053\u53F7",trigger:"blur"}],productKey:[{required:!0,message:"\u8BF7\u9009\u62E9\u4F20\u611F\u4EA7\u54C1",trigger:"change"}]}),_=c(),p=c();function U(s){u.value=!0,_.value=s.channelList,p.value=s.productList}const S=()=>{const s=p.value.find(t=>t.productKey===o.productKey);o.isTemperature=s.sensorType===1,o.sensitivity=s.sensitivity},P=()=>o.productKey?p.value.find(s=>s.productKey===o.productKey).sensorType!==1:!0;function B(){y.$refs.setFormRef.validate(s=>{s?x("onSave",o):console.log("error submit!")})}function m(){u.value=!1}const D=()=>{y.$refs.setFormRef.resetFields()};return F({showModal:U,closeModal:m}),(s,t)=>{const i=Z,r=H,b=O,V=j,I=z,L=J,R=Q,v=W,$=X;return d(),f($,{title:"\u65B0\u589E\u3010\u632F\u52A8\u901A\u9053\u3011",modelValue:l(u),"onUpdate:modelValue":t[9]||(t[9]=e=>G(u)?u.value=e:null),width:"480px","align-center":!0,onClose:m,onClosed:D},{footer:a(()=>[A("div",ee,[n(v,{onClick:m},{default:a(()=>[N(g(s.$t("cancel")),1)]),_:1}),n(v,{type:"primary",onClick:B},{default:a(()=>[N(g(s.$t("confirm")),1)]),_:1})])]),default:a(()=>[n(R,{ref:"setFormRef",model:l(o),rules:l(T),"label-width":"160","label-position":"left"},{default:a(()=>[n(r,{label:s.$t("channelNo"),prop:"channelNo"},{default:a(()=>[n(i,{class:"input-number",modelValue:l(o).channelNo,"onUpdate:modelValue":t[0]||(t[0]=e=>l(o).channelNo=e),max:24,min:17,controls:!1},null,8,["modelValue"])]),_:1},8,["label"]),n(r,{label:"\u5173\u8054\u8F6C\u901F\u901A\u9053",prop:"speedChannelNo"},{default:a(()=>[n(V,{modelValue:l(o).speedChannelNo,"onUpdate:modelValue":t[1]||(t[1]=e=>l(o).speedChannelNo=e),style:{width:"100%"},clearable:"",teleported:!1},{default:a(()=>[(d(!0),C(w,null,k(l(_),e=>(d(),f(b,{key:e.channelNo,label:e.channelNo,value:e.channelNo},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(r,{label:"\u4F20\u611F\u5668\u4EA7\u54C1",prop:"productKey"},{default:a(()=>[n(V,{modelValue:l(o).productKey,"onUpdate:modelValue":t[2]||(t[2]=e=>l(o).productKey=e),style:{width:"100%"},onChange:S,teleported:!1},{default:a(()=>[(d(!0),C(w,null,k(l(p),e=>(d(),f(b,{key:e.productKey,label:e.name,value:e.productKey},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(r,{label:"\u662F\u5426\u6D4B\u6E29",prop:"isTemperature"},{default:a(()=>[n(I,{modelValue:l(o).isTemperature,"onUpdate:modelValue":t[3]||(t[3]=e=>l(o).isTemperature=e),disabled:P()},null,8,["modelValue","disabled"])]),_:1}),n(r,{label:"\u4F20\u611F\u5668\u7F16\u7801\uFF08\u673A\u8EABSN\uFF09",prop:"remark"},{default:a(()=>[n(L,{modelValue:l(o).remark,"onUpdate:modelValue":t[4]||(t[4]=e=>l(o).remark=e),maxlength:"100"},null,8,["modelValue"])]),_:1}),n(r,{label:"\u6E29\u5EA6\u8865\u507F",prop:"temperatureCompensation"},{default:a(()=>[n(i,{class:"input-number",modelValue:l(o).temperatureCompensation,"onUpdate:modelValue":t[5]||(t[5]=e=>l(o).temperatureCompensation=e),step:.01,max:1e4,min:-1e4,controls:!1,onKeydown:t[6]||(t[6]=e=>l(E)(e,2)),onPaste:t[7]||(t[7]=e=>l(h)(e,2))},null,8,["modelValue","step"])]),_:1}),n(r,{label:"\u7075\u654F\u7CFB\u6570",prop:"sensitivity"},{default:a(()=>[n(i,{class:"input-number",modelValue:l(o).sensitivity,"onUpdate:modelValue":t[8]||(t[8]=e=>l(o).sensitivity=e),step:.001,max:1e3,min:0,controls:!1,onKeydown:l(E),onPaste:l(h)},null,8,["modelValue","step","onKeydown","onPaste"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}};export{ae as default};
