import{a5 as A,u as R,b as J,J as k,r as c,o as b,y as g,q as i,n as o,P as p,x as N,t as C,p as s,aH as O,aI as K,s as F,S as $,l as H,cp as G,cq as Q,bv as W,D as X}from"./index.8d733f79.js";import{_ as Y}from"./index.45cae72e.js";import{r as Z,M as ee}from"./collector.4eeb72e6.js";const te=A({name:"AssociateSensor"}),se=Object.assign(te,{setup(ne,{expose:w}){const h=R(),{t:_}=J(),T=k.session.getJSON("userInfo").userLevel!==0,{proxy:I}=X(),j=k.session.getJSON("userInfo").deployType==="factory",f=c([]),d=c(!1),u=c(0),m=c([]),l=c({sensorId:"",factoryId:"",pageNo:1,pageSize:10}),y=c(!1);function E(e){d.value=!0;const t=e.isLocalProject||e.localProjectFlag;y.value=!(!j&&t)&&T,setTimeout(()=>{l.value.factoryId=e.factoryId,l.value.sensorId=e.id,v()},0)}const D=e=>e.isSpeedSensorPoint!==1;function v(){Z(l.value).then(e=>{f.value=e.data.content,u.value=e.data.totalElements||0})}function L(e){m.value=e}function M(){P(m.value)}function P(e){const t=[];for(let n=0;n<e.length;n++)t.push({channelNo:e[n].channelNo,pointId:e[n].pointId,sensorId:l.value.sensorId});I.$modal.confirm(_("confirmUnbind")).then(()=>ee(t)).then(n=>{n.success&&n.data.length?$.success(n.data.join(",")):$.success(_("unbindSuccess")),v()}).catch(()=>{})}function V(){l.value={sensorId:"",factoryId:"",pageNo:1,pageSize:10},d.value=!1,u.value=0,f.value=[],I.$refs.tableRef.clearSelection()}const q=e=>{const t={pointId:e.pointId,pointName:e.pointName,deviceId:e.deviceId,allName:e.pointPath,pointType:e.pointType,sensorProductKey:e.sensorProductKey};h.push({path:"/comprehensiveAnalysis/deviceAnalysis",query:{...t}})},B=e=>{const t={deviceId:e.deviceId,pointId:e.pointId};h.push({path:"/device/deviceTree",query:{...t}})};return w({showModal:E}),(e,t)=>{const n=H,r=G,U=Q,x=Y,z=W;return b(),g(z,{title:e.$t("associatedPoint"),modelValue:o(d),"onUpdate:modelValue":t[2]||(t[2]=a=>F(d)?d.value=a:null),width:"600px","align-center":!0,"append-to-body":"",onClose:V},{default:i(()=>[o(y)?(b(),g(n,{key:0,type:"primary",onClick:M,style:{"margin-bottom":"16px"},disabled:!o(m).length},{default:i(()=>[p(N(e.$t("unbindPoint")),1)]),_:1},8,["disabled"])):C("",!0),s(U,{ref:"tableRef",data:o(f),onSelectionChange:L,style:{"border-radius":"4px"}},{default:i(()=>[s(r,{type:"selection",width:"55",selectable:D}),s(r,{label:e.$t("channelNo"),prop:"channelNo",width:"80"},null,8,["label"]),s(r,{label:e.$t("linkPoint"),prop:"pointPath","show-overflow-tooltip":!0},null,8,["label"]),s(r,{label:e.$t("action"),width:"220"},{default:i(a=>[o(y)?(b(),g(n,{key:0,type:"primary",link:"",onClick:S=>P([a.row]),disabled:a.row.isSpeedSensorPoint===1},{default:i(()=>[p(N(e.$t("unbindPoint")),1)]),_:2},1032,["onClick","disabled"])):C("",!0),s(n,{type:"primary",link:"",onClick:S=>q(a.row)},{default:i(()=>[p("\u7CBE\u5BC6\u8BCA\u65AD")]),_:2},1032,["onClick"]),s(n,{type:"primary",link:"",onClick:S=>B(a.row)},{default:i(()=>[p("\u8BBE\u5907\u6811")]),_:2},1032,["onClick"])]),_:1},8,["label"])]),_:1},8,["data"]),O(s(x,{total:o(u),page:o(l).pageNo,"onUpdate:page":t[0]||(t[0]=a=>o(l).pageNo=a),limit:o(l).pageSize,"onUpdate:limit":t[1]||(t[1]=a=>o(l).pageSize=a),layout:"total, prev, pager, next",onPagination:v},null,8,["total","page","limit"]),[[K,o(u)>0]])]),_:1},8,["title","modelValue"])}}});export{se as default};
