import{M as f,L as C,ax as D,W as I}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import"./index.1703796278973300.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import"./index.1703796278973305.js";import"./index.1703796278973306.js";import"./index.170379627897333.js";import{k as M,z as L}from"./instance.1703796278973.js";import{h as B}from"./moment.1703796278973.js";import{u as N}from"./instance.17037962789732.js";import{d as R,s as q,k as n,r as A,o as Y,c as J,a as i,z as V,b as c,u as e,t as j,A as z}from"./vue.1703796278973.js";const H={style:{"margin-top":"10px"}},le=R({__name:"index",emits:["change"],setup(K,{emit:l}){const y=N(),{detail:m}=q(y),h=n({}),p=n({}),t=n([]),r=n(!1),o=new Map;o.set("online","success"),o.set("offline","error"),o.set("notActive","warning");const d=[{title:"ID",dataIndex:"id",key:"id",ellipsis:!0,fixed:"left",search:{type:"string"}},{title:"设备名称",dataIndex:"name",key:"name",ellipsis:!0,search:{type:"string"}},{title:"所属产品",dataIndex:"productName",key:"productName",search:{type:"string"}},{title:"注册时间",dataIndex:"registryTime",key:"registryTime",scopedSlots:!0,search:{type:"date"}},{title:"状态",dataIndex:"state",key:"state",scopedSlots:!0,search:{type:"select",options:[{label:"禁用",value:"notActive"},{label:"离线",value:"offline"},{label:"在线",value:"online"}]}}],g=a=>{p.value=a},v=(a,k)=>{t.value=[...a]},u=()=>{t.value=[]},_=()=>{if(t.value.length===0){f.warning("请选择需要绑定的设备");return}r.value=!0,L(m.value.id,t.value).then(a=>{l("change",!0),u(),f.success("操作成功")}).finally(()=>{r.value=!1})},x=()=>{l("change",!1)};return(a,k)=>{const b=A("pro-search"),T=C,S=D,w=I;return Y(),J(w,{maskClosable:!1,width:"1000px",visible:!0,title:"绑定子设备",okText:"确定",cancelText:"取消",onOk:_,onCancel:x,confirmLoading:e(r)},{default:i(()=>[V("div",H,[c(b,{columns:d,target:"child-device-bind",onSearch:g,type:"simple"}),c(S,{ref_key:"bindDeviceRef",ref:h,columns:d,request:e(M),model:"TABLE",defaultParams:{terms:[{terms:[{column:"parentId$isnull",value:"",type:"or"}]},{terms:[{column:"id$not",value:e(m).id,type:"and"}],type:"and"},{terms:[{termType:"eq",column:"deviceType",value:"childrenDevice"}],type:"and"}]},rowSelection:{selectedRowKeys:e(t),onChange:v},onCancelSelect:u,params:e(p)},{registryTime:i(s=>[j(z(s.registryTime?e(B)(s.registryTime).format("YYYY-MM-DD HH:mm:ss"):""),1)]),state:i(s=>[c(T,{text:s.state.text,status:e(o).get(s.state.value)},null,8,["text","status"])]),_:1},8,["request","defaultParams","rowSelection","params"])])]),_:1},8,["confirmLoading"])}}});export{le as _};
