index-hk-c126ef3b.js 5.1 KB

1
  1. import{d as E,k as u,U as p,V as w,a8 as C,f as m,a0 as S,u as o,W as Y,E as K,a4 as I,$ as V,F as z,e as T,w as U,a3 as A,X as H}from"./vue-18ee037d.js";import{d as J}from"./dayjs-4778c158.js";import{al as L,J as O,x as W,ag as B}from"./index-421a14fe.js";import{u as X}from"./device-7f4f68cd.js";import{l as q}from"./hk-list-level-dc9970c0.js";import{I as G,T as Q}from"./index-15629871.js";import{D as Z}from"./index-78834803.js";import{i as ee}from"./gb28281-89f88f1c.js";import{u as M,R as ae,V as te,_ as se}from"./video-view-hk-f562b92a.js";import{C as N}from"./Card-d71cd81e.js";import"./mockjs-890b569b.js";import"./index-9374feb1.js";import"./useModal-dcba92a3.js";import"./jb4-28542242.js";import"./index-6c52c4cf.js";import"./createForOfIteratorHelper-0e399d34.js";import"./index-f96d75f8.js";import"./useFlexGapSupport-cba5400e.js";const ne={class:"p-16px"},oe={class:"m-16px overscroll-contain overflow-y-auto overflow-x-hidden",style:{"max-height":"calc(100% - 64px)"}},le={class:"text-red"},re=E({__name:"device-hk",props:{single:{type:Boolean,default:!1}},emits:["select"],setup(_,{emit:x}){const v=_,l=window.allEnv.media+"/hk/api",r=u([]);L.post(l+"/resource/v2/camrea/search",{pageNo:1,pageSize:1e3,regionIndexCodes:[]}).then(a=>{var e,t;r.value=q((t=(e=a.data)==null?void 0:e.data)==null?void 0:t.list)}),X().fetchdeviceTree();const b=u([]),c=a=>a.key.includes("-")&&a.hasOwnProperty("LiveStatus"),y=(a,e)=>{const t=i.value.filter(n=>n!==a[0]);t.length<i.value.length?i.value=t:i.value=i.value.concat(a),v.single&&c(e.node)&&(b.value=[e.node.key]),e.node.data&&x("select",e.node)},f=u(""),i=u([]),k=u(!0),$=a=>{i.value=a,k.value=!1},g=(a,e)=>{let t;if(!(e!=null&&e.length))return t;for(let n=0;n<e.length;n++){const h=e[n];h.children&&(h.children.some(D=>D.key===a)?t=h.key:g(a,h.children)&&(t=g(a,h.children)))}return t};let P=[];const s=a=>{P.map(e=>e.title.indexOf(a)>-1?g(e.key,r.value):null).filter((e,t,n)=>e&&n.indexOf(e)===t),f.value=a,k.value=!0},d=W(a=>s(a.target.value),250);return(a,e)=>(p(),w(z,null,[C("div",ne,[m(o(G),{placeholder:"模糊搜索设备名称",allowClear:"",onInput:o(d)},{prefix:S(()=>[m(o(O),{icon:"ic:outline-search"})]),_:1},8,["onInput"])]),m(o(Z),{class:"m0"}),C("div",oe,[m(o(Q),{showIcon:"","tree-data":r.value,defaultExpandAll:"","expanded-keys":i.value,"auto-expand-parent":k.value,onExpand:$,selectedKeys:b.value,onSelect:y},{title:S(({title:t,isLeaf:n,disabled:h,DeviceID:D})=>[t.indexOf(f.value)>-1?(p(),w("span",{key:0,class:Y({"text-primary":!h&&n&&D})},[K(I(t.substr(0,t.indexOf(f.value)))+" ",1),C("span",le,I(f.value),1),K(" "+I(t.substr(t.indexOf(f.value)+f.value.length)),1)],2)):(p(),w("span",{key:1,onClick:e[0]||(e[0]=j=>y("test",j)),class:Y({"text-primary":!h&&n&&D})},I(t),3))]),icon:S(({disabled:t,type:n})=>[n!=="group"?(p(),V(o(O),{key:0,icon:"mdi:web-camera",class:Y(["v-text-bottom",{"text-primary":!t}])},null,8,["class"])):(p(),V(o(O),{key:1,icon:"icon-park-solid:tree-diagram",class:"v-text-bottom rotate-90"}))]),_:1},8,["tree-data","expanded-keys","auto-expand-parent","selectedKeys"])])],64))}}),F=(_,x="YYYY-MM-DDTHH:mm:ss")=>J(_).format(x)+".000+08:00",ce={class:"h-full"},ie={class:"flex justify-between mb-16px"},de=E({__name:"content-hk",setup(_){const x=window.allEnv.media+"/hk/api",v=M(),l=T(()=>v.getCurrentChannel),r=T(()=>v.getTimeRange),R=T(()=>r.value.map(s=>s.format("YYYY-MM-DDTHH:mm:ss"))),b=u("video"),c=u(),y=u(),f=s=>{if(!c.value||c.value.length===0)return!1;const d=c.value[0]&&s.diff(c.value[0],"days")>2;return c.value[1]&&c.value[1].diff(s,"days")>2||d},i=s=>{s?(c.value=[],y.value=[]):y.value=void 0},k=s=>{c.value=s},$=s=>{v.setTimeRange(s)};T(()=>`${l.value.ID}/${l.value.DeviceID}`);const g=u([]);U([()=>{var s;return(s=v.getCurrentChannel)==null?void 0:s.key},()=>r.value],()=>{var d;const{indexCode:s}=((d=l.value)==null?void 0:d.data)||{};s&&L.post(x+"/video/v2/cameras/playbackurls",{cameraIndexCode:s,protocol:"ws",beginTime:F(r.value[0]),endTime:F(r.value[1])}).then(a=>{var t,n;const e=(t=a.data)==null?void 0:t.data;if(!(e!=null&&e.url)){B.warn("当前无可播放的录像!!!");return}g.value=e.list,l.value.url=e.url,l.value,(n=e.list)!=null&&n.length?P():B.warn("当前无可播放的录像!!!")}).catch(a=>{console.error(`getRecords-error: ${a}`)})});const P=()=>{const{ID:s,DeviceID:d}=l.value;ee({id:s,channel:d})};return(s,d)=>(p(),w("div",ce,[C("div",ie,[m(o(ae),{value:y.value||o(r),disabledDate:f,onOpenChange:i,onChange:$,onCalendarChange:k,allowClear:!1},null,8,["value"])]),C("div",{class:"w-full",style:H({height:"calc(100% - 32px)"})},[(p(),V(te,{data:g.value,start:o(R)[0],end:o(R)[1],streamPathPre:o(l).url,key:o(l).url},null,8,["data","start","end","streamPathPre"])),b.value==="list"?(p(),V(se,{key:0,data:g.value},null,8,["data"])):A("",!0)],4)]))}}),ue=E({name:"Record"}),Ee=E({...ue,setup(_){const x=M(),v=l=>{x.setCurrentChannel(l)};return(l,r)=>(p(),w("div",{class:"flex",style:H({height:"calc(100% - 8px)"})},[m(o(N),{class:"w-342px m-r-8px flex-shrink-0",bordered:!1,bodyStyle:{height:"100%",padding:0}},{default:S(()=>[m(re,{onSelect:v,single:""})]),_:1}),m(o(N),{class:"flex-1",bordered:!1,bodyStyle:{height:"100%",padding:"16px"}},{default:S(()=>[m(de)]),_:1})],4))}});export{Ee as default};