index-949a02fd.js 6.8 KB

1
  1. import{f as e,d as y,U as C,V as D,u as t,a0 as d,E as s,F as O,g as F,e as k}from"./vue-18ee037d.js";import{u as N}from"./formily-50822a21.js";import{J as V,aa as w,ah as T,ag as B,ai as H,R as W,aj as G,ak as g}from"./index-d6683aa1.js";import{u as L}from"./index-9374feb1.js";import"./dayjs-4778c158.js";import{_ as M}from"./scroll-tip.vue_vue_type_script_setup_true_lang-bec2f385.js";import{u as U}from"./useModal-d838986e.js";import{s as K}from"./gb28281-1cbc78a4.js";import{u as $}from"./usePlay-8b145533.js";import{D as z}from"./index-7cb1e4d3.js";import{u as j}from"./device-897003a9.js";import{C as S}from"./Card-426a0a07.js";import{S as q}from"./index-e5488da0.js";import"./index-b25ec580.js";import"./LeftOutlined-831130e8.js";import"./index-bd2c519f.js";import"./index-9a007b7d.js";import"./index-39ddc5b4.js";import"./index-65707ee0.js";import"./Group-c3a73bd7.js";import"./useFlexGapSupport-7d657c95.js";import"./index-adac165a.js";import"./index-896e35d3.js";import"./scrollTo-d3af3d0d.js";import"./mockjs-890b569b.js";import"./index-f10069cf.js";import"./index-b89a41df.js";import"./jb4-d3e27a52.js";import"./index-6b648d46.js";const J=l=>({type:"object",properties:{layout:{type:"void","x-component":"FormLayout","x-component-props":{layout:"inline"},properties:{Name:{type:"string","x-decorator":"FormItem","x-decorator-props":{style:"margin-right: 10px;width: 260px"},"x-component":"Input","x-component-props":{placeholder:"请输入设备编号或名称搜索","@keyup":l},"x-content":{prefix:()=>e(V,{icon:"ic:outline-search"},null)}}}}}}),X=y({name:"Channel"}),Y=y({...X,props:{detail:null,device:null},setup(l){const p=l,m={0:"空闲",1:"拉流中",2:"已拉流"},c=L(),f={maxHeight:"530px",rowConfig:{keyField:"DeviceID",useKey:!0},columnConfig:{useKey:!0},columns:[{field:"DeviceID",title:"编号",showOverflow:"tooltip",width:"200px",fixed:"left"},{field:"Name",title:"名称",showOverflow:"tooltip",width:"120px",fixed:"left"},{field:"Status",title:"状态",minWidth:"100px"},{field:"LiveStatus",title:"拉流状态",minWidth:"120px",formatter:({cellValue:o})=>m[o]},{field:"Manufacturer",title:"厂商",width:"120px"},{field:"Address",title:"地址",showOverflow:"tooltip",width:"180px"},{field:"Port",title:"端口",width:"70px"},{field:"Model",title:"型号",width:"180px"},{field:"Owner",title:"Owner",width:"120px"},{field:"CivilCode",title:"CivilCode",width:"120px"},{field:"Parental",title:"Parental",width:"120px"},{field:"SafetyWay",title:"SafetyWay",width:"120px"},{field:"RegisterWay",title:"RegisterWay",width:"120px"},{field:"Secrecy",title:"Secrecy",width:"120px"},{field:"operate",title:"操作",width:"140px",slots:{default:"operate"},align:"center",fixed:"right"}],data:p.detail},u=async o=>{const{DeviceID:x,Name:n}=o;await K({id:p.device.ID,channel:x}).then(E=>{const _=p.detail.map(r=>(r.DeviceID===x&&(r.LiveStatus=0),r));c.tableRef.reloadData(_),B.success(`通道 ${n||x} 已停止拉流`)})};return(o,x)=>(C(),D(O,null,[e(t(M)),e(t(T),{uid:t(c).uid,gridOptions:t(f)},{operate:d(({row:n})=>[e(t(w),{size:"small",type:"link",onClick:()=>t($)({id:l.device.ID,deviceName:l.device.Name,deviceID:n.DeviceID,channelName:n.Name})},{default:d(()=>[s(" 播放 ")]),_:2},1032,["onClick"]),e(t(z),{type:"vertical",class:"m-0"}),e(t(w),{size:"small",type:"link",danger:"",disabled:n.LiveStatus===0,onClick:()=>u(n)},{default:d(()=>[s(" 停止拉流 ")]),_:2},1032,["disabled","onClick"])]),_:1},8,["uid","gridOptions"])],64))}}),Q=({row:l,appContext:p,pause:m,resume:c})=>{m();const{Name:f,Channels:u,ID:o}=l;U({content:e(Y,{detail:u||[],device:{ID:o,Name:f}},null),modalConfig:{appContext:p,width:"78%",title:`${f} 通道详情`,okButtonProps:{style:{display:"none"}},cancelText:"关闭",maskClosable:!1,onCancel:()=>c()}})},Z=y({name:"Device"}),Le=y({...Z,setup(l){var I;const p=(I=F())==null?void 0:I.appContext;H.renderer.add("moreFields",{renderExpand(i,h){const{row:a}=h;return e("p",{class:"flex flex-col p-10px m-0"},[e("span",null,[e("b",null,[s("型号(Model):  ")]),a.Model]),e("span",null,[e("b",null,[s("纬度(Latitude):  ")]),a.Latitude]),e("span",null,[e("b",null,[s("经度(Longitude):  ")]),a.Longitude]),e("span",null,[e("b",null,[s("GpsTime:  ")]),a.GpsTime]),e("span",null,[e("b",null,[s("Owner:  ")]),a.Owner])])}});const m=j(),c=k(()=>m.deviceList),{httpRefreshTime:f}=W({VITE_PORT:"3000",VITE_GLOB_APP_TITLE:"SagooMedia",VITE_GLOB_APP_SHORT_NAME:"SagooMedia",VITE_M7S_SERVER:"/media",VITE_USE_MOCK:"true",VITE_PUBLIC_PATH:"/plugin/media",VITE_DROP_CONSOLE:"true",VITE_BUILD_COMPRESS:"none",VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE:"false",VITE_GLOB_HTTP_REFRESH_TIME:"5000",VITE_USE_IMAGEMIN:"true",VITE_LEGACY:"false",BASE_URL:"/plugin/media",MODE:"production",DEV:!1,PROD:!0,SSR:!1}),{pause:u,resume:o}=G(v,f),x=i=>{const h=String(i.target.value).trim().toLowerCase();if(h){const a=["ID","Name"],R=c.value.filter(b=>a.some(P=>String(b[P]).toLowerCase().indexOf(h)>-1));r(R),u()}else r(c.value),o()},{FormilyForm:n}=N({schema:J(x)}),E={toggleRowExpand:({expanded:i})=>{i?u():o()}},_=L(),r=i=>{_.tableRef.reloadData(i)};async function v(){await m.fetchDeviceList(),r(m.deviceList)}v();const A={maxHeight:"100%",rowConfig:{keyField:"ID",useKey:!0},columnConfig:{useKey:!0},columns:[{title:"...",width:"30px",type:"expand",contentRender:{name:"moreFields"},fixed:"left"},{field:"ID",title:"设备编号",showOverflow:"tooltip",width:"200px",fixed:"left",type:"html"},{field:"Name",title:"设备名称",showOverflow:"tooltip",width:"120px",type:"html"},{field:"NetAddr",title:"网络地址",showOverflow:"tooltip",width:"180px"},{field:"Channels",title:"通道数",width:"70px",formatter:({cellValue:i})=>(i==null?void 0:i.length)||0},{field:"Status",title:"状态",minWidth:"120px"},{field:"Manufacturer",title:"厂商",width:"120px"},{field:"LastKeepaliveAt",title:"最后保活时间",minWidth:"180px",formatter:({cellValue:i})=>g.toDateString(new Date(i),"yyyy-MM-dd HH:ss:mm")},{field:"RegisterTime",title:"注册时间",minWidth:"180px",formatter:({cellValue:i})=>g.toDateString(new Date(i),"yyyy-MM-dd HH:ss:mm")},{field:"UpdateTime",title:"更新时间",minWidth:"180px",formatter:({cellValue:i})=>g.toDateString(new Date(i),"yyyy-MM-dd HH:ss:mm")},{field:"operate",title:"操作",width:"120px",fixed:"right",align:"center",slots:{default:"operate"}}],data:[]};return(i,h)=>(C(),D(O,null,[e(t(S),{bordered:!1,bodyStyle:{padding:"26px 10px 0 10px",marginBottom:"8px"}},{default:d(()=>[e(t(n))]),_:1}),e(t(S),{bordered:!1,bodyStyle:{padding:"10px",height:"calc(100% - 50px)"},style:{height:"calc(100% - 100px)"}},{default:d(()=>[e(t(M),{windowWidth:1716}),e(t(T),{uid:t(_).uid,gridOptions:t(A),gridEvent:t(E)},{operate:d(({row:a})=>[e(t(q),null,{default:d(()=>[e(t(w),{size:"small",type:"link",onClick:()=>t(Q)({row:a,appContext:t(p),pause:t(u),resume:t(o)})},{default:d(()=>[s(" 通道详情 ")]),_:2},1032,["onClick"])]),_:2},1024)]),_:1},8,["uid","gridOptions","gridEvent"])]),_:1},8,["bodyStyle"])],64))}});export{Le as default};