| 12 |
- import{b0 as I,bo as w,n as a,bc as F,d as b,Z as O,a1 as B,a0 as i,T as l,a2 as S,b4 as C,b9 as L,aG as W,aQ as f,a5 as g,ba as j}from"./index-a8341fa1.js";import{u as M}from"./index-7b240cde.js";import{q as R,t as z,v as T,w as $}from"./gb28181-0e98f3aa.js";import"./dayjs-919e6097.js";const E=({handleSubmit:e,handleReset:p,handleAdd:r})=>({type:"object",properties:{layout:{type:"void","x-component":"FormLayout","x-component-props":{layout:"inline",style:"marginTop: 22px",labelCol:8,wrapperCol:16},properties:{channelId:{type:"string",title:"通道ID","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"请输入通道ID",allowClear:!0}},customChannelId:{type:"string",title:"自定义通道ID","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"请输入自定义通道ID",allowClear:!0}},channelName:{type:"string",title:"通道名称","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"请输入通道名称",allowClear:!0}},btns:{type:"void","x-component":"FormButtonGroup","x-component-props":{style:"marginLeft: 8px"},properties:{submit:{type:"void","x-component":"Button","x-component-props":{type:"primary","@click":()=>e(),style:"width: 70px;"},"x-content":"查询"},reset:{type:"void","x-component":"Button","x-component-props":{"@click":()=>p(),style:"width: 70px"},"x-content":"重置"},add:{type:"void","x-component":"Button","x-component-props":{type:"primary","@click":()=>r(),style:"width: 90px"},"x-content":"新增通道"}}}}}}}),V=()=>({type:"object",properties:{layout:{type:"void","x-component":"FormLayout","x-component-props":{labelCol:8,wrapperCol:16},properties:{deviceId:{type:"string",title:"设备ID","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"不填则与通道ID一致",allowClear:!0}},channelId:{type:"string",title:"通道ID","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"请输入通道ID",allowClear:!0},required:!0},customChannelId:{type:"string",title:"自定义通道ID","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"不填则与通道ID一致",allowClear:!0}},channelName:{type:"string",title:"通道名称","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"请输入通道名称",allowClear:!0},required:!0},customChannelName:{type:"string",title:"自定义通道名称","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"不填则与通道名称一致",allowClear:!0}},streamPath:{type:"string",title:"流路径","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"请输入流路径",allowClear:!0},required:!0}}}}}),A=e=>({type:"object",properties:{layout:{type:"void","x-component":"FormLayout","x-component-props":{labelCol:8,wrapperCol:16},properties:{deviceId:{type:"string",title:"设备ID","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"不填则与通道ID一致",allowClear:!0}},channelId:{type:"string",title:"通道ID","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"请输入通道ID",allowClear:!0},required:!0},customChannelId:{type:"string",title:"自定义通道ID","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"不填则与通道ID一致",allowClear:!0}},channelName:{type:"string",title:"通道名称","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"请输入通道名称",allowClear:!0},required:!0},customChannelName:{type:"string",title:"自定义通道名称","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"不填则与通道名称一致",allowClear:!0}},streamPath:{type:"string",title:"流路径","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:e?"有值时不允许删除":"无值时不允许填写",allowClear:!1,disabled:!e}}}}}}),G=e=>{const{FormilyForm:p,form:r,submit:d}=I({schema:V()});w({content:()=>a(p,null,null),modalConfig:{title:"新增通道",maskClosable:!1,width:"600px",onOk:async()=>{const t=await d();if(t){const u={deviceId:t.deviceId||t.channelId,channelId:t.channelId,customChannelId:t.customChannelId||t.channelId,channelName:t.channelName,customChannelName:t.customChannelName||t.channelName,streamPath:t.streamPath};return await R(u),F.success("新增成功"),e(),Promise.resolve(!0)}return Promise.reject(!1)},onClose:()=>{r.reset()}}})},K=(e,p)=>{const r=!!e.streamPath,{FormilyForm:d,form:t,submit:u}=I({schema:A(r),formProps:{initialValues:{deviceId:e.deviceId,channelId:e.channelId,customChannelId:e.customChannelId,channelName:e.channelName,customChannelName:e.customChannelName,streamPath:e.streamPath}}});w({content:()=>a(d,null,null),modalConfig:{title:"编辑通道",maskClosable:!1,width:"600px",onOk:async()=>{const o=await u();if(o){const s={id:e.id,deviceId:o.deviceId||o.channelId,channelId:o.channelId,customChannelId:o.customChannelId||o.channelId,channelName:o.channelName,customChannelName:o.customChannelName||o.channelName,streamPath:r?o.streamPath:void 0};return await z(s),F.success("编辑成功"),p(),Promise.resolve(!0)}return Promise.reject(!1)},onClose:()=>{t.reset()}}})},Q=b({name:"Channel"}),X=b({...Q,setup(e){const p=async()=>{s.submit(),!(s.errors.length>0)&&c.tableRef.commitProxy("query")},r=()=>{s.reset(),c.tableRef.commitProxy("query")},d=()=>{G(()=>{c.tableRef.commitProxy("query")})},t=n=>{K(n,()=>{c.tableRef.commitProxy("query")})},u=n=>{j.confirm({title:"确认删除",content:`确定要删除通道"${n.channelName}"吗?`,onOk:async()=>{await T(n.id),c.tableRef.commitProxy("query")}})},{FormilyForm:o,form:s}=I({schema:E({handleSubmit:p,handleReset:r,handleAdd:d})}),v=(n,m)=>{const{channelId:h,customChannelId:x,channelName:P}=s.values;return new Promise(async D=>{const{data:_,total:k}=await $({channelId:h,customChannelId:x,channelName:P,page:n,count:m}),q=_.map(y=>({...y,type:y.streamPath?"自定义通道":"设备通道"}));D({total:k,data:q})})},c=M(),N={height:"auto",rowConfig:{keyField:"id",useKey:!0},columnConfig:{useKey:!0},pagerConfig:{pageSize:10},proxyConfig:{autoLoad:!0,seq:!0,props:{result:"data",total:"total"},ajax:{query:({page:n})=>v(n.currentPage,n.pageSize)}},columns:[{field:"id",title:"ID",minWidth:"80px",showOverflow:"tooltip"},{field:"channelId",title:"通道ID",minWidth:"150px",showOverflow:"tooltip"},{field:"customChannelId",title:"自定义通道ID",minWidth:"150px",showOverflow:"tooltip"},{field:"channelName",title:"通道名称",minWidth:"150px",showOverflow:"tooltip"},{field:"customChannelName",title:"自定义通道名称",minWidth:"150px",showOverflow:"tooltip"},{field:"deviceName",title:"设备名称",minWidth:"150px",showOverflow:"tooltip"},{field:"type",title:"类型",minWidth:"120px",showOverflow:"tooltip"},{field:"operate",title:"操作",width:"150px",fixed:"right",align:"center",slots:{default:"operate"}}]};return(n,m)=>(O(),B(S,null,[a(l(C),{bordered:!1,bodyStyle:{padding:"10px",marginBottom:"8px"}},{default:i(()=>[a(l(o))]),_:1}),a(l(C),{bordered:!1,bodyStyle:{padding:"10px",height:"100%"},style:{height:"calc(100% - 100px)"}},{default:i(()=>[a(l(L),{uid:l(c).uid,gridOptions:N},{operate:i(({row:h})=>[a(l(W),null,{default:i(()=>[a(l(f),{size:"small",type:"link",onClick:x=>t(h)},{default:i(()=>m[0]||(m[0]=[g(" 编辑 ")])),_:2},1032,["onClick"]),a(l(f),{size:"small",type:"link",danger:"",onClick:x=>u(h)},{default:i(()=>m[1]||(m[1]=[g(" 删除 ")])),_:2},1032,["onClick"])]),_:2},1024)]),_:1},8,["uid"])]),_:1})],64))}});export{X as default};
- //# sourceMappingURL=index-b46cdce3.js.map
|