import{M as T,L as w,ax as C,W as D}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{q as I,b as M}from"./cardManagement.1703796278973.js";import{h as B}from"./moment.1703796278973.js";import{d as L,k as n,r as R,o as q,c as z,a as i,z as A,b as c,u as t,t as Y,A as j}from"./vue.1703796278973.js";const N={style:{"margin-top":"10px"}},ne=L({__name:"BindDevice",props:{cardId:{type:String}},emits:["change"],setup(m,{emit:l}){const u=m,f=n({}),p=n({}),s=n([]),r=n(!1),o=new Map;o.set("online","processing"),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:"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=e=>{p.value=e},_=e=>{s.value=[e.id]},h=()=>{s.value=[]},y=()=>{r.value=!0,M(u.cardId,s.value[0]).then(e=>{e.status===200&&(T.success("操作成功"),l("change",!0))}).finally(()=>{r.value=!1})},v=()=>{l("change",!1)};return(e,O)=>{const x=R("pro-search"),b=w,S=C,k=D;return q(),z(k,{maskClosable:!1,width:"1100px",visible:!0,title:"选择设备",okText:"确定",cancelText:"取消",onOk:y,onCancel:v,confirmLoading:t(r)},{default:i(()=>[A("div",N,[c(x,{columns:d,target:"iot-card-bind-device",onSearch:g,type:"simple"}),c(S,{ref_key:"bindDeviceRef",ref:f,alertRender:!1,columns:d,request:t(I),model:"TABLE",defaultParams:{pageSize:10,sorts:[{name:"createTime",order:"desc"}]},pagination:{showSizeChanger:!0,pageSizeOptions:["10","20","50","100"]},rowSelection:{type:"radio",selectedRowKeys:t(s),onSelect:_},onCancelSelect:h,params:t(p)},{registryTime:i(a=>[Y(j(a.registryTime?t(B)(a.registryTime).format("YYYY-MM-DD HH:mm:ss"):""),1)]),state:i(a=>[c(b,{text:a.state.text,status:t(o).get(a.state.value)},null,8,["text","status"])]),_:1},8,["request","rowSelection","params"])])]),_:1},8,["confirmLoading"])}}});export{ne as _};
