import{d as q,O as R,l as B,m as I,k as r,r as L,o as j,c as z,a as l,b as i,u as n,M as J,z as M}from"./vue.1703796278973.js";import{M as u,L as N,a0 as O,ax as P,W as V}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.170379627897336.js";import"./index.170379627897333.js";import{c as y}from"./cascade.1703796278973.js";const $=M("h3",null,"通道列表",-1),re=q({__name:"index",props:{visible:{type:Boolean,default:!1},data:{type:Object,default:()=>({})}},emits:["update:visible","submit"],setup(_,{emit:p}){const h=_,d=R(),t=B({get:()=>h.visible,set:e=>p("update:visible",e)});I(()=>t.value,e=>{e?v({terms:[]}):a.value=[]});const m=[{title:"设备名称",dataIndex:"deviceName",key:"deviceName",search:{type:"string"}},{title:"通道名称",dataIndex:"name",key:"name",search:{type:"string",first:!0}},{title:"安装地址",dataIndex:"address",key:"address",search:{type:"string"}},{title:"厂商",dataIndex:"manufacturer",key:"manufacturer",search:{type:"string"}},{title:"状态",dataIndex:"status",key:"status",scopedSlots:!0,search:{type:"select",options:[{label:"已连接",value:"online"},{label:"未连接",value:"offline"}],handleValue:e=>e}}],f=r({}),v=e=>{f.value=e},g=r(),a=r([]),b=e=>{a.value=[...e]},c=r(!1),x=async()=>{if(!a.value.length){u.error("请勾选数据");return}c.value=!0;const e=await y.bindChannel(d.query.id,a.value);c.value=!1,e.success?(u.success("操作成功！"),t.value=!1,p("submit")):u.error("操作失败！")};return(e,s)=>{const S=L("pro-search"),k=N,C=O,w=P,T=V;return j(),z(T,{visible:n(t),"onUpdate:visible":s[1]||(s[1]=o=>J(t)?t.value=o:null),title:"绑定通道",cancelText:"取消",okText:"确定",width:"80%",onOk:x,onCancel:s[2]||(s[2]=o=>t.value=!1),confirmLoading:n(c)},{default:l(()=>[i(S,{columns:m,target:"media",onSearch:v}),i(w,{ref_key:"listRef",ref:g,model:"table",columns:m,request:n(y).queryChannelList,defaultParams:{pageSize:10,sorts:[{name:"name",order:"desc"}],terms:[{column:"id",termType:"cascade_channel$not",type:"and",value:n(d).query.id},{column:"catalogType",termType:"eq",type:"and",value:"device"}]},params:n(f),rowSelection:{selectedRowKeys:n(a),onChange:b},onCancelSelect:s[0]||(s[0]=o=>a.value=[]),pagination:{showSizeChanger:!0,pageSizeOptions:["10","20","50","100"]}},{headerTitle:l(()=>[$]),status:l(o=>[i(C,null,{default:l(()=>[i(k,{status:o.status.value==="online"?"success":"error",text:o.status.text},null,8,["status","text"])]),_:2},1024)]),_:1},8,["request","defaultParams","params","rowSelection"])]),_:1},8,["visible","confirmLoading"])}}});export{re as _};
