!function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,l,o,r,i=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(a=o.call(n)).done)&&(i.push(a.value),i.length!==t);u=!0);}catch(e){c=!0,l=e}finally{try{if(!u&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw l}}return i}}(e,t)||r(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function a(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,a=Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},d=n.pointerTypes,s=n.preventDefault,p=n.stopPropagation,y=n.exact,g=n.onMove,m=n.onEnd,b=n.onStart,h=n.initialValue,x=n.axis,w=void 0===x?"both":x,k=n.draggingElement,_=void 0===k?V:k,O=n.containerElement,C=n.handle,S=void 0===C?e:C,M=n.buttons,j=void 0===M?[0]:M,A=f(null!==(t=c(h))&&void 0!==t?t:{x:0,y:0}),P=f(),z=function(e){return!d||d.includes(e.pointerType)},I=function(e){c(s)&&e.preventDefault(),c(p)&&e.stopPropagation()};if(q){var T=function(){var e;return{capture:null===(e=n.capture)||void 0===e||e,passive:!c(s)}};J(S,"pointerdown",function(t){var a;if(c(j).includes(t.button)&&!c(n.disabled)&&z(t)&&(!c(y)||t.target===c(e))){var l=c(O),o=null==l||null===(a=l.getBoundingClientRect)||void 0===a?void 0:a.call(l),r=c(e).getBoundingClientRect(),i={x:t.clientX-(l?r.left-o.left+l.scrollLeft:r.left),y:t.clientY-(l?r.top-o.top+l.scrollTop:r.top)};!1!==(null==b?void 0:b(i,t))&&(P.value=i,I(t))}},T),J(_,"pointermove",function(t){if(!c(n.disabled)&&z(t)&&P.value){var a=c(O),l=c(e).getBoundingClientRect(),o=A.value,r=o.x,i=o.y;"x"!==w&&"both"!==w||(r=t.clientX-P.value.x,a&&(r=Math.min(Math.max(0,r),a.scrollWidth-l.width))),"y"!==w&&"both"!==w||(i=t.clientY-P.value.y,a&&(i=Math.min(Math.max(0,i),a.scrollHeight-l.height))),A.value={x:r,y:i},null==g||g(A.value,t),I(t)}},T),J(_,"pointerup",function(e){!c(n.disabled)&&z(e)&&P.value&&(P.value=void 0,null==m||m(A.value,e),I(e))},T)}return a(a({},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!r(e))return i(e);var n=Array.isArray(e.value)?Array.from({length:e.value.length}):{},d=function(r){n[r]=u(function(){return{get:function(){return e.value[r]},set:function(n){var i;if(null===(i=c(t.replaceRef))||void 0===i||i)if(Array.isArray(e.value)){var u=o(e.value);u[r]=n,e.value=u}else{var d=a(a({},e.value),{},l({},r,n));Object.setPrototypeOf(d,Object.getPrototypeOf(e.value)),e.value=d}else e.value[r]=n}}})};for(var f in e.value)d(f);return n}(A)),{},{position:A,isDragging:v(function(){return!!P.value}),style:v(function(){return"left:".concat(A.value.x,"px;top:").concat(A.value.y,"px;")})})}var Y=p({__name:"Add",emits:["onSuccess"],setup:function(e,t){var n=t.expose,a=t.emit,l=f(),o=f(null),r=f(!1),i=f(!0),u=X(l),c=u.x,s=u.y,p=u.isDragging,P=a,z=y([{value:"123",label:"网络泵"},{value:"456",label:"化疗泵"},{value:"789",label:"其他"}]),I=y({id:void 0,mac:"",name:"",productId:"",netMac:"",description:"",gateWay:"",netMask:"",ipAddress:""}),T=function(e){var t;console.log("handleOK",e),null===(t=o.value)||void 0===t||t.validate().then(function(){var e;console.log("11"),e="",e=i.value?"/device/add":"/device/edit",B({url:e,data:I},function(e){console.log(e),A.info(e.msg),R(),P("onSuccess",e)})},function(){console.log("22")})},E=function(){r.value=!0},R=function(){r.value=!1};g(function(){console.log("onMounted"),z.splice(0),B({url:"/product/search",data:{size:20,page:1,sort:"createtime",order:"desc"}},function(e){console.log(e),e.data.forEach(function(e){var t={value:e.code,label:e.name};z.push(t)})},function(e){console.log(e)})}),m(function(){console.log("onUnmounted")}),n({add:function(){var e;i.value=!0,k(I),null===(e=o.value)||void 0===e||e.clearValidate(),E()},update:function(e){var t;i.value=!1,e.id=e.deviceId,Object.assign(I,e),null===(t=o.value)||void 0===t||t.clearValidate(),E()}});var U=f(0),W=f(0),D=f(!1),N=f(0),L=f(0),q=f(0),G=f(0),H=f({left:0,right:0,top:0,bottom:0});d([c,s],function(){if(!D.value){U.value=c.value,W.value=s.value;var e=document.body.getBoundingClientRect(),t=l.value.getBoundingClientRect();H.value.right=e.width-t.width,H.value.bottom=e.height-t.height,q.value=N.value,G.value=L.value}D.value=!0}),d(p,function(){p||(D.value=!1)}),b(function(){D.value&&(N.value=q.value+Math.min(Math.max(H.value.left,c.value),H.value.right)-U.value,L.value=G.value+Math.min(Math.max(H.value.top,s.value),H.value.bottom)-W.value)});var V=v(function(){return{transform:"translate(".concat(N.value,"px, ").concat(L.value,"px)")}});return function(e,t){var n=_("a-select"),a=_("a-form-item"),u=_("a-input"),c=_("a-textarea"),d=_("a-form"),f=_("a-modal");return h(),x(f,{visible:r.value,"onUpdate:visible":t[7]||(t[7]=function(e){return r.value=e}),maskClosable:!1,width:580,bodyStyle:{height:"480px","overflow-y":"auto"},cancelText:"取消",okText:"确定",onOk:T},{title:w(function(){return[O("div",{ref_key:"modalTitleRef",ref:l,style:{width:"100%",cursor:"move"}},C(i.value?"添加设备":"编辑设备"),513)]}),modalRender:w(function(e){var t=e.originVNode;return[O("div",{style:M(V.value)},[(h(),x(S(t)))],4)]}),default:w(function(){return[j(d,{ref_key:"formRef",ref:o,model:I,name:"basic","label-align":"left","label-col":{span:4},"wrapper-col":{span:20},autocomplete:"off",layout:"vertical"},{default:w(function(){return[j(a,{"wrapper-col":{offset:0,span:24},label:"产品",name:"productId",rules:[{required:!0,message:"请输入设备名称!"}]},{default:w(function(){return[j(n,{size:"large",value:I.productId,"onUpdate:value":t[0]||(t[0]=function(e){return I.productId=e}),options:z},null,8,["value","options"])]}),_:1}),j(a,{"wrapper-col":{offset:0,span:24},label:"设备编号",name:"mac",rules:[{required:!0,message:"请输入设备编号!"}]},{default:w(function(){return[j(u,{size:"large",value:I.mac,"onUpdate:value":t[1]||(t[1]=function(e){return I.mac=e})},null,8,["value"])]}),_:1}),j(a,{"wrapper-col":{offset:0,span:24},label:"IP",name:"ipAddress"},{default:w(function(){return[j(u,{size:"large",value:I.ipAddress,"onUpdate:value":t[2]||(t[2]=function(e){return I.ipAddress=e})},null,8,["value"])]}),_:1}),j(a,{"wrapper-col":{offset:0,span:24},label:"网关",name:"gateWay"},{default:w(function(){return[j(u,{size:"large",value:I.gateWay,"onUpdate:value":t[3]||(t[3]=function(e){return I.gateWay=e})},null,8,["value"])]}),_:1}),j(a,{"wrapper-col":{offset:0,span:24},label:"子网掩码",name:"netMask"},{default:w(function(){return[j(u,{size:"large",value:I.netMask,"onUpdate:value":t[4]||(t[4]=function(e){return I.netMask=e})},null,8,["value"])]}),_:1}),j(a,{"wrapper-col":{offset:0,span:24},label:"通信MAC",name:"netMac"},{default:w(function(){return[j(u,{size:"large",value:I.netMac,"onUpdate:value":t[5]||(t[5]=function(e){return I.netMac=e})},null,8,["value"])]}),_:1}),j(a,{"wrapper-col":{offset:0,span:24},label:"描述",name:"description",rules:[{required:!1,message:"请输入设备名称!"}]},{default:w(function(){return[j(c,{value:I.description,"onUpdate:value":t[6]||(t[6]=function(e){return I.description=e}),placeholder:"请输入描述","allow-clear":""},null,8,["value"])]}),_:1})]}),_:1},8,["model"])]}),_:1},8,["visible"])}}}),Z=p({__name:"Location",setup:function(e,t){var n=t.expose,a=f(!1),l=window.BMapGL,r=f(null),i=function(e){console.log(e),a.value=!1},u=f();return g(function(){console.log("onMounted")}),m(function(){console.log("onUnmounted")}),P(function(){var e;if(a.value){console.log("onUpdate"),function(){if(!r.value){r.value=new l.Map("map_1",{mapType:window.BMAP_EARTH_MAP}),r.value.centerAndZoom(new l.Point(114.404,39.915),15),r.value.enableScrollWheelZoom(!0);var e=new l.ScaleControl;r.value.addControl(e)}}(),r.value.clearOverlays();var t=JSON.parse(null===(e=u.value)||void 0===e?void 0:e.data);if(console.log(t),t.lat&&t.lng){var n=t.lng.value,o=t.lat.value,i=new l.Point(n,o);console.log(n,o);var c=new l.Marker(i),d=new l.Circle(i,500,{strokeColor:"red",strokeWeight:1,strokeOpacity:1,fillOpacity:0});r.value.addOverlay(c),r.value.addOverlay(d),setTimeout(function(){r.value.setCenter(i)},100)}else A.error("暂无定位")}}),n({show:function(e){a.value=!0,u.value=e},hidden:function(){a.value=!1}}),function(e,t){var n=_("a-button"),l=_("a-modal");return h(),x(l,{visible:a.value,"onUpdate:visible":t[0]||(t[0]=function(e){return a.value=e}),maskClosable:!1,destroyOnClose:!1,width:900},{title:w(function(){return o(t[1]||(t[1]=[O("div",{style:{"font-weight":"bold"}},[O("span",null,"设备定位")],-1)]))}),footer:w(function(){return[j(n,{type:"primary",onClick:i},{default:w(function(){return o(t[2]||(t[2]=[z("知道了",-1)]))}),_:1})]}),default:w(function(){return[t[3]||(t[3]=O("div",{id:"map_1",style:{"flex-grow":"1",width:"100%",height:"500px"}},null,-1))]}),_:1},8,["visible"])}}}),$={class:"cus-animation",style:{height:"100%",width:"100%",padding:"16px 20px",display:"flex","flex-direction":"column"}},F={style:{display:"flex","justify-content":"space-between","align-items":"flex-end"}},K={style:{display:"flex"}},Q={key:0,style:{"text-align":"left"}},ee={key:1,style:{"text-align":"left"}},te={key:0,style:{"text-align":"left"}},ne={key:1,style:{"text-align":"left"}},ae={key:0,style:{color:"green"}},le={key:1},oe={key:0},re={key:1},ie=["onClick"],ue={key:1,class:"cus-forbidden",style:{color:"rgba(0, 0, 0, 0.25)","margin-left":"0px"}},ce=["onClick"],de=["onClick"];e("default",D(p({__name:"Index",setup:function(e){var t=f(null),n=y({x:1600}),a=y({pageSize:20,current:1,size:"default",showSizeChanger:!0,showQuickJumper:!0,showTotal:function(e){return"共 ".concat(e," 条数据")},onChange:function(e,t){console.log("111",e,t),this.current=e,this.pageSize=t,u()}}),l=f([]),r=f(!1),i=y({size:20,page:1,sort:"createtime",order:"desc",keyWord:"",mac:""}),u=function(){r.value=!0,i.size=a.pageSize,i.page=a.current,B({url:"/device/search",data:i},function(e){console.log(e),a.total=e.total,l.value=e.data,r.value=!1})},c=function(){a.current=1,u()},d=f(null),v=function(e){var t;console.log(e),null===(t=d.value)||void 0===t||t.add()},p=f(null),m=I(),b=function(e){console.log(e),u()};return g(function(){var e;console.log("device onMounted..."),n.y=(null===(e=t.value)||void 0===e?void 0:e.clientHeight)-113,u()}),function(e,f){var y=_("a-button"),g=_("a-tooltip"),x=_("a-input"),k=_("a-form-item"),S=_("a-form"),M=_("a-table-column"),P=_("a-popconfirm"),z=_("a-table");return h(),T(E,null,[O("div",$,[j(s(N),{title:"设备"}),O("div",F,[O("div",K,[j(y,{type:"primary",style:{"margin-right":"10px",background:"#0058ff"},onClick:v},{icon:w(function(){return[j(s(R))]}),default:w(function(){return[f[1]||(f[1]=O("span",null,"添加",-1))]}),_:1}),j(S,{layout:"inline",model:i},{default:w(function(){return[j(k,null,{default:w(function(){return[j(x,{allowClear:"",value:i.keyWord,"onUpdate:value":f[0]||(f[0]=function(e){return i.keyWord=e}),placeholder:"请输入设备编号或SIM号进行查询",style:{width:"280px"}},{suffix:w(function(){return[j(g,{title:"点击搜索",onClick:c},{default:w(function(){return[j(s(U),{style:{color:"rgba(0, 0, 0, 0.45)"}})]}),_:1})]}),_:1},8,["value"])]}),_:1})]}),_:1},8,["model"])]),O("div",null,[j(g,{onClick:u},{default:w(function(){return[j(s(L),{style:{"font-size":"16px"},spin:r.value},null,8,["spin"])]}),_:1})])]),O("div",{ref_key:"table_container",ref:t,style:{"margin-top":"9px","border-top":"1px solid #eee",display:"flex","flex-direction":"column",overflow:"hidden",height:"0px","flex-grow":"1"}},[j(z,{"data-source":l.value,pagination:a,scroll:n,bordered:!0,loading:r.value,size:"middle"},{default:w(function(){return[j(M,{title:"序号",width:60,fixed:"left",align:"center"},{default:w(function(e){var t=e.index;return[O("div",null,C(t+1),1)]}),_:1}),j(M,{title:"设备编号","data-index":"mac",width:200,fixed:"left"}),j(M,{title:"绑定用户","data-index":"username",width:200,fixed:"left"},{default:w(function(e){var t=e.record;return[t.username?(h(),T("div",Q,[O("span",null,C(t.username),1)])):(h(),T("div",ee,o(f[2]||(f[2]=[O("span",{style:{color:"#dba7a7"}},"未知",-1)]))))]}),_:1}),j(M,{title:"所属产品","data-index":"productName",width:200,fixed:"left"},{default:w(function(e){var t=e.record;return[t.productName?(h(),T("div",te,[O("span",null,C(t.productName),1)])):(h(),T("div",ne,o(f[3]||(f[3]=[O("span",{style:{color:"#dba7a7"}},"未知",-1)]))))]}),_:1}),j(M,{title:"SIM卡号","data-index":"sim",width:200}),j(M,{title:"通信MAC","data-index":"netMac",width:200}),j(M,{title:"IP","data-index":"ipAddress",width:200}),j(M,{title:"网关","data-index":"gateWay",width:200}),j(M,{title:"子网掩码","data-index":"netMask",width:200}),j(M,{title:"设备状态",width:120},{default:w(function(e){return[e.record.isDelete?(h(),T("div",ae,o(f[4]||(f[4]=[O("span",null,"正常",-1)])))):(h(),T("div",le,o(f[5]||(f[5]=[O("span",{style:{color:"#dba7a7"}},"异常",-1)]))))]}),_:1}),j(M,{title:"描述","data-index":"description",width:220},{default:w(function(e){var t=e.record;return[t.description?(h(),T("div",oe,[O("span",null,C(t.description),1)])):(h(),T("div",re,o(f[6]||(f[6]=[O("span",{style:{color:"#dba7a7"}},"无描述",-1)]))))]}),_:1}),j(M,{title:"最近上传时间","data-index":"modifytime",width:200}),j(M,{title:"创建时间","data-index":"createtime",width:200}),j(M,{title:"操作",width:220,fixed:"right"},{default:w(function(e){var t,n=e.record;return[O("div",null,[null!==(t=n.data)&&void 0!==t&&t.includes("lat")?(h(),T("a",{key:0,style:{"margin-left":"0px"},onClick:function(e){return function(e){var t;console.log(e),null===(t=p.value)||void 0===t||t.show(e)}(n)}},"位置",8,ie)):(h(),T("a",ue,"位置")),O("a",{style:{"margin-left":"26px"},onClick:function(e){return function(e){console.log(e),m.push("/"+W+"/device/detail/"+e.mac)}(n)}},"查看",8,ce),O("a",{style:{"margin-left":"26px"},onClick:function(e){return function(e){var t;console.log(e),null===(t=d.value)||void 0===t||t.update(e)}(n)}},"编辑",8,de),j(P,{title:"确定删除?",okText:"确定",cancelText:"取消",onConfirm:function(e){return function(e){console.log(e);var t={id:e.id};B({url:"/device/delete",data:t},function(e){console.log(e),A.info(e.msg),u()})}(n)}},{default:w(function(){return o(f[7]||(f[7]=[O("a",{style:{"margin-left":"26px"}},"删除",-1)]))}),_:1},8,["onConfirm"])])]}),_:1})]}),_:1},8,["data-source","pagination","scroll","loading"])],512)]),j(Y,{ref_key:"addRef",ref:d,onOnSuccess:b},null,512),j(Z,{ref_key:"locationRef",ref:p},null,512)],64)}}}),[["__scopeId","data-v-d40a1040"]]))}}})}();