import{B as G,C as H,w as O,D as W,J as X,K as Y,L as Z,M as ee,N as te}from"./element-plus.ae8e286c.js";import{_ as oe}from"./index.vue_vue_type_script_setup_true_lang.4acf6c9d.js";import{_ as ae}from"./index.vue_vue_type_script_setup_true_lang.4e44db35.js";import{t as ie,k as R,f as le,b as ne}from"./index.fccb4ef5.js";import{u as se}from"./vue-router.ed788fee.js";import{u as ue}from"./usePaging.2a59f422.js";import{u as de}from"./useDictOptions.7b4b6189.js";import{g as re,h as ce}from"./device.719ac6f2.js";import me from"./edit.10fdb7a8.js";import{d as L,s as _e,r as $,_ as pe,a3 as fe,ae as ve,o as i,c as he,T as o,K as t,L as c,u as l,J as n,Q as p,a as g,R as s,S as f,j as ye,n as A}from"./@vue.108c970a.js";import"./@vueuse.d3d080b7.js";import"./@element-plus.d6eabd08.js";import"./lodash-es.29c53eac.js";import"./dayjs.664390f6.js";import"./axios.4ebfdb3f.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./@popperjs.36402333.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./lodash.e92d81a1.js";import"./pinia.eff1ffd5.js";import"./vue-demi.ebc8116b.js";import"./css-color-function.dbf33394.js";import"./color.e1b5fced.js";import"./clone.0a4e8ac3.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.f174a91e.js";import"./ms.a9ae1d6d.js";import"./nprogress.d7c3ab1b.js";import"./vue-clipboard3.add720e2.js";import"./clipboard.01ea18f5.js";import"./echarts.8d7a50ae.js";import"./zrender.1084fa23.js";import"./tslib.60310f1a.js";import"./highlight.js.4ebdf9a4.js";import"./@highlightjs.241b9b5d.js";import"./index.0d3bed35.js";const Ce=s("\u67E5\u8BE2"),ke=s("\u91CD\u7F6E"),Ee=s(" \u65B0\u589E "),Be=s(" \u5220\u9664 "),Fe={class:"mt-4"},be=s(" \u7F16\u8F91 "),ge=s(" \u8BE6\u60C5 "),De=s(" \u62A5\u8B66 "),we=s(" \u5220\u9664 "),Ve={class:"flex justify-end mt-4"},xe=L({name:"deviceLists"}),yt=L({...xe,setup(Pe){const{query:N}=se(),v=_e(),h=$(!1);let B=N.product_id;typeof B>"u"&&(B="");const y=pe({user_id:"",farm_id:"",product_id:B,code:"",name:"",type:"",status:"",is_online:""}),F=$([]),S=d=>{F.value=d.map(({id:a})=>a)},{dictData:b}=de("device_type,device_status,device_online_status,device_bind_status,monitor_item"),{pager:_,getLists:C,resetParams:T,resetPage:I}=ue({fetchFun:re,params:y}),q=async()=>{var d;h.value=!0,await A(),(d=v.value)==null||d.open("add")},M=async d=>{var a,k;h.value=!0,await A(),(a=v.value)==null||a.open("edit"),(k=v.value)==null||k.setFormData(d)},D=async d=>{await le.confirm("\u786E\u5B9A\u8981\u5220\u9664\uFF1F"),await ce({id:d}),C()};return C(),(d,a)=>{const k=G,w=H,r=O,j=W,V=X,J=ne,u=Y,E=Z,x=ae,P=fe("router-link"),K=ee,U=oe,m=ve("perms"),Q=te;return i(),he("div",null,[o(V,{class:"!border-none mb-4",shadow:"never"},{default:t(()=>[o(j,{class:"mb-[-16px]",model:y,inline:""},{default:t(()=>[o(w,{label:"\u8BBE\u5907\u540D\u79F0",prop:"name"},{default:t(()=>[o(k,{class:"w-[280px]",modelValue:y.name,"onUpdate:modelValue":a[0]||(a[0]=e=>y.name=e),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8BBE\u5907\u540D\u79F0"},null,8,["modelValue"])]),_:1}),o(w,null,{default:t(()=>[o(r,{type:"primary",onClick:l(I)},{default:t(()=>[Ce]),_:1},8,["onClick"]),o(r,{onClick:l(T)},{default:t(()=>[ke]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"])]),_:1}),c((i(),n(V,{class:"!border-none",shadow:"never"},{default:t(()=>[c((i(),n(r,{type:"primary",onClick:q},{icon:t(()=>[o(J,{name:"el-icon-Plus"})]),default:t(()=>[Ee]),_:1})),[[m,["device.device/add"]]]),c((i(),n(r,{disabled:!F.value.length,onClick:a[1]||(a[1]=e=>D(F.value))},{default:t(()=>[Be]),_:1},8,["disabled"])),[[m,["device.device/delete"]]]),g("div",Fe,[o(K,{data:l(_).lists,onSelectionChange:S,style:{width:"100%"}},{default:t(()=>[o(u,{type:"selection",width:"55"}),o(u,{label:"ID",prop:"id",width:"80","show-overflow-tooltip":""}),o(u,{label:"\u8BBE\u5907\u540D\u79F0",width:"200",prop:"name","show-overflow-tooltip":""}),o(u,{label:"\u6240\u5C5E\u517B\u6B96\u57FA\u5730",width:"200"},{default:t(({row:e})=>[e.farm_id!=null?(i(),n(E,{key:0,class:"mr-2",type:"info"},{default:t(()=>[s("ID: "+f(e.farm_id),1)]),_:2},1024)):p("",!0),e.farm_name!=null?(i(),n(E,{key:1,class:"mr-2",type:"info"},{default:t(()=>[s("\u540D\u79F0: "+f(e.farm_name),1)]),_:2},1024)):p("",!0)]),_:1}),o(u,{label:"\u6240\u5C5E\u4EA7\u54C1",width:"200"},{default:t(({row:e})=>[e.product_id!=null?(i(),n(E,{key:0,class:"mr-2",type:"info"},{default:t(()=>[s("ID: "+f(e.product_id),1)]),_:2},1024)):p("",!0),e.product_name!=null?(i(),n(E,{key:1,class:"mr-2",type:"info"},{default:t(()=>[s("\u540D\u79F0: "+f(e.product_name),1)]),_:2},1024)):p("",!0)]),_:1}),o(u,{label:"\u8BBE\u5907\u7F16\u7801",width:"120",prop:"code","show-overflow-tooltip":""}),o(u,{label:"\u8BBE\u5907\u72B6\u6001",width:"100",align:"center",prop:"status"},{default:t(({row:e})=>[o(x,{options:l(b).device_status,value:e.status},null,8,["options","value"])]),_:1}),o(u,{label:"\u662F\u5426\u5728\u7EBF",width:"100",align:"center",prop:"is_online"},{default:t(({row:e})=>[o(x,{options:l(b).device_online_status,value:e.is_online},null,8,["options","value"])]),_:1}),o(u,{label:"\u521B\u5EFA\u65F6\u95F4",width:"160",align:"center",prop:"create_time"},{default:t(({row:e})=>[g("span",null,f(e.create_time?l(ie)(e.create_time,"yyyy-mm-dd hh:MM:ss"):""),1)]),_:1}),o(u,{label:"\u64CD\u4F5C",width:"260",align:"center",fixed:"right"},{default:t(({row:e})=>[c((i(),n(r,{type:"primary",link:"",onClick:z=>M(e)},{default:t(()=>[be]),_:2},1032,["onClick"])),[[m,["device.device/edit"]]]),c((i(),n(r,{type:"primary",link:""},{default:t(()=>[o(P,{to:{path:l(R)("device.device/detail"),query:{device_id:e.id,userName:e.account}}},{default:t(()=>[ge]),_:2},1032,["to"])]),_:2},1024)),[[m,["device.device/detail"]]]),c((i(),n(r,{type:"primary",link:""},{default:t(()=>[o(P,{to:{path:l(R)("device.monitor_alarm/lists"),query:{device_id:e.id}}},{default:t(()=>[De]),_:2},1032,["to"])]),_:2},1024)),[[m,["device.monitor_alarm/lists"]]]),c((i(),n(r,{type:"danger",link:"",onClick:z=>D(e.id)},{default:t(()=>[we]),_:2},1032,["onClick"])),[[m,["device.device/delete"]]])]),_:1})]),_:1},8,["data"])]),g("div",Ve,[o(U,{modelValue:l(_),"onUpdate:modelValue":a[2]||(a[2]=e=>ye(_)?_.value=e:null),onChange:l(C)},null,8,["modelValue","onChange"])])]),_:1})),[[Q,l(_).loading]]),h.value?(i(),n(me,{key:0,ref_key:"editRef",ref:v,"dict-data":l(b),onSuccess:l(C),onClose:a[3]||(a[3]=e=>h.value=!1)},null,8,["dict-data","onSuccess"])):p("",!0)])}}});export{yt as default};