Files
monibuca/plugin/admin/web/assets/mp4-e6c38067.js
2024-11-05 20:03:52 +08:00

2 lines
4.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{d as V,k as u,o as j,e as z,w as q,U as v,V as A,f as r,$ as s,u as t,E as x,a4 as Y,a8 as n,X as M,_ as S,a3 as k}from"./vue-14860272.js";import{d as l}from"./dayjs-4778c158.js";import{at as E,au as K,af as L,a9 as D,J as R,ag as F}from"./index-6c19eff1.js";import{u as G,d as T,R as J,V as X,a as Q}from"./usePlay-01e6fc4d.js";import{u as W}from"./index-79686afe.js";import{L as _}from"./index-c6e096a3.js";import{C as w}from"./Card-2e616ea4.js";import{R as Z}from"./Group-8793f768.js";import{R as b}from"./RadioButton-fd725ab6.js";import"./mockjs-890b569b.js";import"./useModal-1fa44c95.js";import"./index-b761c39b.js";import"./jb4-8326f710.js";import"./index-7743fdb9.js";import"./gb28281-bff8df35.js";import"./index-f566a6ba.js";import"./LeftOutlined-42ce2cd6.js";import"./eagerComputed-49254c56.js";import"./useFlexGapSupport-6710d548.js";const B=E({requestOptions:{apiUrl:()=>K("mp4")}});function ee(){return B.get({url:"/catalog"})}function te(p){return B.get({url:"/list/"+p.streamPath,params:{range:p.range}})}const ae={class:"h-full"},re={class:"flex justify-between mb-16px"},oe=n("span",null," 时间轴视图",-1),se=n("span",null," 列表视图",-1),le=V({name:"Record"}),ke=V({...le,setup(p){const o=G(),y=W(),$=e=>{o.setCurrentStreamPath(e.streamPath),o.setTimeRangeMP4([l(e.startTime),l(e.startTime).add(1,"day")])},h=u([]);j(async()=>{h.value=await ee()});const m=z(()=>o.getTimeRangeMP4),c=u("list"),f=u(),g=u(),I=e=>{if(!f.value||f.value.length===0)return!1;if(o.getCurrentStreamPath){const{startTime:i,endTime:a}=h.value.find(d=>d.streamPath===o.getCurrentStreamPath)||{};return e.isBefore(l(i))||e.isAfter(l(a))}return!1},O=e=>{e?(f.value=[],g.value=[]):g.value=void 0},H=e=>{f.value=e},N=e=>{o.setTimeRangeMP4(e)},C=u([]);q([()=>o.getCurrentStreamPath,()=>m.value],()=>{te({streamPath:o.getCurrentStreamPath,range:`${T(m.value[0],"YYYY-MM-DD 00:00:00")/1e3}~${T(m.value[1],"YYYY-MM-DD 24:00:00")/1e3}`}).then(e=>{C.value=e,P.data=e,y.tableRef.reloadData(e),e!=null&&e.length?U():L.warn("当前无可播放的录像!!!")}).catch(e=>{console.error(`getRecords-error: ${e}`)})});const P={height:"auto",rowConfig:{keyField:"startTime",useKey:!0},columnConfig:{useKey:!0},columns:[{field:"id",title:"ID",width:"70px"},{field:"filePath",title:"文件路径"},{field:"startTime",title:"录像开始时间",formatter:({cellValue:e})=>l(e).format("YYYY-MM-DD HH:mm:ss")},{field:"endTime",title:"录像结束时间",formatter:({cellValue:e})=>l(e).format("YYYY-MM-DD HH:mm:ss")},{field:"any",title:"录像时长",width:"100px",formatter:({row:e})=>{const{startTime:i,endTime:a}=e,d=l(a).diff(l(i),"seconds");return`${Math.floor(d/60)}${d%60}`}},{field:"operate",title:"操作",width:"70px",slots:{default:"operate"},align:"center",fixed:"right"}]},U=()=>{};return(e,i)=>(v(),A("div",{class:"flex",style:M({height:"calc(100% - 8px)"})},[r(t(w),{class:"w-342px m-r-8px flex-shrink-0",bordered:!1,bodyStyle:{height:"100%",padding:"16px"}},{default:s(()=>[r(t(_),{dataSource:h.value,"item-layout":"horizontal"},{renderItem:s(({item:a})=>[r(t(_).Item,null,{default:s(()=>[r(t(_).Item.Meta,{description:t(l)(a.startTime).format("YYYY-MM-DD")+"-"+t(l)(a.endTime).format("YYYY-MM-DD")},{title:s(()=>[r(t(D),{type:t(o).getCurrentStreamPath===a.streamPath?"primary":"link",onClick:d=>$(a)},{default:s(()=>[x(Y(a.streamPath),1)]),_:2},1032,["type","onClick"])]),_:2},1032,["description"]),n("div",null,Y(a.count)+"个文件",1)]),_:2},1024)]),_:1},8,["dataSource"])]),_:1}),r(t(w),{class:"flex-1",bordered:!1,bodyStyle:{height:"100%",padding:"16px"}},{default:s(()=>[n("div",ae,[n("div",re,[r(t(J),{value:g.value||t(m),disabledDate:I,onOpenChange:O,onChange:N,onCalendarChange:H,allowClear:!1},null,8,["value"]),r(t(Z),{value:c.value,"onUpdate:value":i[0]||(i[0]=a=>c.value=a)},{default:s(()=>[r(t(b),{value:"video"},{default:s(()=>[r(t(R),{icon:"mdi:timeline-clock-outline",class:"v-text-bottom"}),oe]),_:1}),r(t(b),{value:"list"},{default:s(()=>[r(t(R),{icon:"pixelarticons:list-box",class:"v-text-bottom"}),se]),_:1})]),_:1},8,["value"])]),n("div",{class:"w-full",style:M({height:"calc(100% - 32px)"})},[c.value==="video"?(v(),S(X,{data:C.value,streamPathPre:t(o).getCurrentStreamPath,key:t(o).getCurrentStreamPath},null,8,["data","streamPathPre"])):k("",!0),c.value==="list"?(v(),S(t(F),{key:1,uid:t(y).uid,gridOptions:t(P)},{operate:s(({row:a})=>[r(t(D),{size:"small",type:"link",onClick:()=>t(Q)({row:a})},{default:s(()=>[x(" 播放 ")]),_:2},1032,["onClick"])]),_:1},8,["uid","gridOptions"])):k("",!0)],4)])]),_:1})],4))}});export{ke as default};