import{M as d,v as S,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"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.170379627897320.js";import"./index.170379627897321.js";import"./index.170379627897322.js";import"./index.170379627897323.js";import"./index.170379627897324.js";import"./index.170379627897325.js";import"./index.170379627897326.js";import"./index.170379627897327.js";import"./index.170379627897328.js";import"./Item.1703796278973.js";import{k as M,z as L}from"./instance.1703796278973.js";import{a as j}from"./dayjs.min.1703796278973.js";import{d as A,k as r,o as q,c as B,a as n,b as c,u as t,t as N,A as R}from"./vue.1703796278973.js";const ye=A({__name:"index",props:{data:{type:Object,default:()=>{}}},emits:["cancel","ok"],setup(u,{emit:l}){const f=u,y=r({}),m=r({}),a=r([]),i=r(!1),s=new Map;s.set("online","success"),s.set("offline","error"),s.set("notActive","warning");const g={terms:[{column:"productId$product-info",value:[{column:"deviceType",termType:"eq",value:"gateway"}]}]},p=[{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"}]}}],v=e=>{m.value=e},_=e=>{a.value=[...e]},h=()=>{if(a.value.length===0){d.warning("请选择需要绑定的设备");return}i.value=!0,L(a.value[0],f.data.id).then(e=>{e.status===200&&(l("ok",a.value[0]),d.success("操作成功"))}).finally(()=>{i.value=!1})},x=()=>{l("cancel",!1)};return(e,Y)=>{const b=S,k=C,T=D,w=I;return q(),B(w,{maskClosable:!1,width:"1000px",visible:!0,title:"绑定父设备",okText:"确定",cancelText:"取消",onOk:h,onCancel:x,confirmLoading:t(i)},{default:n(()=>[c(b,{columns:p,target:"child-device-bind",onSearch:v,type:"simple"}),c(T,{ref_key:"bindDeviceRef",ref:y,columns:p,request:t(M),model:"TABLE",bodyStyle:{padding:"0 0 0 24px"},defaultParams:g,rowSelection:{selectedRowKeys:t(a),onChange:_},params:t(m)},{registryTime:n(o=>[N(R(o.registryTime?t(j)(o.registryTime).format("YYYY-MM-DD HH:mm:ss"):""),1)]),state:n(o=>[c(k,{text:o.state.text,status:t(s).get(o.state.value)},null,8,["text","status"])]),_:1},8,["request","rowSelection","params"])]),_:1},8,["confirmLoading"])}}});export{ye as _};
