import{a5 as U,b as z,r,o as A,y as q,q as u,v as N,p as s,P as m,x as g,n,B as J,aH as K,aI as O,s as j,J as T,S as L,d5 as F,j as H,cp as Q,cq as G,l as W,bv as X,D as Y}from"./index.8d733f79.js";import{_ as Z}from"./index.45cae72e.js";import{F as ee}from"./deviceTree.170dfbd9.js";const oe={style:{border:"1px solid #2153A3","border-radius":"4px"}},ae={class:"dialog-footer"},ne=U({name:"AssociateSensor"}),ue=Object.assign(ne,{emits:["ensureSensor"],setup(te,{expose:C,emit:v}){const{t:D}=z(),{proxy:I}=Y(),V=e=>{var o;return(o=T.session.getJSON("enums").type.find(c=>+c.key===e))==null?void 0:o.desc},k=e=>{var o;return(o=T.session.getJSON("enums").axial.find(c=>+c.key===e))==null?void 0:o.desc},b=r([]),i=r(!1),_=r(0),t=r({}),l=r({pointId:"",nameSn:"",pageNo:1,pageSize:10}),S=r(),h=r(),d=r({});function B(e,o){i.value=!0,S.value=o==="replace"?"\u66F4\u6362\u4F20\u611F\u5668":"\u5173\u8054\u4F20\u611F\u5668",h.value=o,d.value=e,l.value.pointId=e.id,y()}function y(){ee(l.value).then(e=>{b.value=e.data.content||[],_.value=e.data.totalElements||0})}function w(){t.value={},I.$refs.tableRef.setCurrentRow(),l.value.pageNo=1,y()}function E(e){console.log("----coloumn----",e),t.value=e}function $(){if(!t.value.sensorId){L.error(D("sensorP"));return}h.value==="replace"&&d.value.axial===t.value.axial&&d.value.sensorType!==3&&t.value.sensorType!==3&&d.value.sensorType!==2&&t.value.sensorType!==2?F.confirm("\u5B89\u88C5\u70B9\u4F4D\u548C\u65B9\u5411\u662F\u5426\u4E0E\u66F4\u6362\u524D\u76F8\u540C\uFF1F","\u7CFB\u7EDF\u63D0\u793A",{confirmButtonText:"\u4E00\u81F4",cancelButtonText:"\u4E0D\u540C",type:"warning"}).then(()=>{v("ensureSensor",{...t.value},"same"),p()}).catch(()=>{v("ensureSensor",{...t.value},"diff"),p()}):(v("ensureSensor",{...t.value}),p())}function p(){i.value=!1,l.value={pointId:"",nameSn:"",pageNo:1,pageSize:10},t.value={}}return C({showModal:B}),(e,o)=>{const c=H,f=Q,M=G,P=Z,x=W,R=X;return A(),q(R,{title:n(S),modelValue:n(i),"onUpdate:modelValue":o[3]||(o[3]=a=>j(i)?i.value=a:null),width:"800px","align-center":!0,"append-to-body":"",onClose:p},{footer:u(()=>[N("div",ae,[s(x,{onClick:p},{default:u(()=>[m(g(e.$t("cancel")),1)]),_:1}),s(x,{type:"primary",onClick:$},{default:u(()=>[m(g(e.$t("confirm")),1)]),_:1})])]),default:u(()=>[s(c,{modelValue:n(l).nameSn,"onUpdate:modelValue":o[0]||(o[0]=a=>n(l).nameSn=a),onKeyup:J(w,["enter"]),onInput:w,style:{width:"382px","margin-bottom":"16px"},placeholder:e.$t("sensorSnP"),"suffix-icon":"Search"},null,8,["modelValue","onKeyup","placeholder"]),N("div",oe,[s(M,{ref:"tableRef",data:n(b),"highlight-current-row":"",onRowClick:E,style:{"border-radius":"4px"},"max-height":"370"},{default:u(()=>[s(f,{label:e.$t("sensorSn"),prop:"sn","show-overflow-tooltip":!0},null,8,["label"]),s(f,{label:e.$t("channelNo"),prop:"channelNo","show-overflow-tooltip":!0},null,8,["label"]),s(f,{label:e.$t("sensorType"),prop:"type"},{default:u(a=>[m(g(V(a.row.type)),1)]),_:1},8,["label"]),s(f,{label:e.$t("sensorAxial"),prop:"axial"},{default:u(a=>[m(g(k(a.row.axial)),1)]),_:1},8,["label"])]),_:1},8,["data"])]),K(s(P,{total:n(_),page:n(l).pageNo,"onUpdate:page":o[1]||(o[1]=a=>n(l).pageNo=a),limit:n(l).pageSize,"onUpdate:limit":o[2]||(o[2]=a=>n(l).pageSize=a),layout:"total, prev, pager, next",onPagination:y},null,8,["total","page","limit"]),[[O,n(_)>0]])]),_:1},8,["title","modelValue"])}}});export{ue as default};
