var F=Object.defineProperty,$=Object.defineProperties;var q=Object.getOwnPropertyDescriptors;var i=Object.getOwnPropertySymbols;var g=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var f=(e,l,a)=>l in e?F(e,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[l]=a,d=(e,l)=>{for(var a in l||(l={}))g.call(l,a)&&f(e,a,l[a]);if(i)for(var a of i(l))v.call(l,a)&&f(e,a,l[a]);return e},p=(e,l)=>$(e,q(l));var b=(e,l)=>{var a={};for(var o in e)g.call(e,o)&&l.indexOf(o)<0&&(a[o]=e[o]);if(e!=null&&i)for(var o of i(e))l.indexOf(o)<0&&v.call(e,o)&&(a[o]=e[o]);return a};import{am as r,ab as V}from"./index.js";const n="/v1/data/event",L=e=>r.post({url:`${n}/`,data:e}),T=(e,l=!1)=>r.put({url:`${n}/`,data:e,params:{updateAllFields:l}}),_=e=>r.delete({url:`${n}/${e}`}),B=e=>r.get({url:`${n}/search`,params:e}),H=e=>r.get({url:`${n}/${e}`}),S=e=>r.post({url:`${n}/batch-delete`,data:e}),{uploadUrl:u=""}=V();function y(e,l,a=!0){return r.uploadFile({url:u,onUploadProgress:l,params:{keepFileName:a}},e).then(o=>{let s=o.data.result;if(u.startsWith("http")){const m=new URL(u);s=`${m.protocol}//${m.host}${s}`}return o.data=p(d({},o.data),{url:s}),o})}const t={xs:{span:24},sm:{span:24},lg:{span:8}},D={span:24},c={model:"Event",viewInPage:!0,properties:[{field:"id",label:"ID系统自动生成",defaultValue:void 0,form:{componentProps:{allowClear:!1,placeholder:"ID系统自动生成"},colProps:t,component:"InputNumber",rules:[{required:!0,message:"请输入ID系统自动生成！"}]},table:{}},{field:"regionId",label:"sys_region.id",defaultValue:void 0,form:{componentProps:{allowClear:!1,placeholder:"sys_region.id"},colProps:t,component:"InputNumber",rules:[{required:!0,message:"请输入sys_region.id！"}]},table:{}},{field:"deviceId",label:"sys_device.id",defaultValue:void 0,form:{componentProps:{allowClear:!1,placeholder:"sys_device.id"},colProps:t,component:"InputNumber",rules:[{required:!0,message:"请输入sys_device.id！"}]},table:{}},{field:"algoCode",label:"算法code",defaultValue:void 0,form:{componentProps:{allowClear:!1,placeholder:"算法code"},colProps:t,component:"Input",rules:[{required:!0,message:"请输入算法code！"}]},table:{}},{field:"alarmLevel",label:"告警等级",defaultValue:void 0,form:{componentProps:{allowClear:!1,placeholder:"告警等级"},colProps:t,component:"Input",rules:[{required:!0,message:"请输入告警等级！"}]},table:{}},{field:"imageUrl",label:"图片",defaultValue:void 0,form:{componentProps:{api:y,maxSize:5,maxNumber:1,multiple:!1,accept:["png","jpg","jpeg","bmp","webp"],allowClear:!0,placeholder:"图片"},colProps:t,component:"Upload"},table:{}},{field:"videoUrl",label:"视频",defaultValue:void 0,form:{componentProps:{allowClear:!0,placeholder:"视频"},colProps:t,component:"Upload"},table:{}},{field:"content",label:"处理信息",defaultValue:void 0,form:{componentProps:{allowClear:!0,placeholder:"处理信息"},colProps:t,component:"Input"},table:{}},{field:"eventTime",label:"发生时间",defaultValue:void 0,form:{colProps:t,component:"DatePicker",componentProps:{allowClear:!1,placeholder:"发生时间",format:"YYYY-MM-DD HH:mm:ss",valueFormat:"YYYY-MM-DD HH:mm:ss",showTime:!0},rules:[{required:!0,message:"请输入发生时间！"}]},table:{}}]},C=["id","regionId","deviceId","algoCode","alarmLevel","videoUrl","content","eventTime"],P=["regionId","deviceId","algoCode","alarmLevel","imageUrl","videoUrl","content","eventTime"],U=["regionId","deviceId","algoCode","alarmLevel","imageUrl","videoUrl","content","eventTime"],M=["regionId","deviceId","algoCode","alarmLevel","imageUrl","videoUrl","content","eventTime"],I=new Map(C.map((e,l)=>[e,l])),N=c.properties.filter(e=>C.includes(e.field)).map(o=>{var{field:e,label:l,form:s}=o,a=b(s,[]);return p(d({field:e,label:l,defaultValue:void 0},a),{required:!1,rules:[{required:!1}]})}).sort((e,l)=>{const a=I.get(e.field),o=I.get(l.field);return a-o}),h=new Map(P.map((e,l)=>[e,l])),j=c.properties.filter(e=>P.includes(e.field)).map(({field:e,label:l,defaultValue:a,form:o})=>p(d({field:e,label:l,defaultValue:a},o),{colProps:D})).sort((e,l)=>{const a=h.get(e.field),o=h.get(l.field);return a-o}),x=new Map(U.map((e,l)=>[e,l])),R=c.properties.filter(e=>U.includes(e.field)).map(({field:e,label:l,table:a})=>d({dataIndex:e,title:l},a)).sort((e,l)=>{const a=x.get(e.dataIndex),o=x.get(l.dataIndex);return a-o}),w=new Map(M.map((e,l)=>[e,l])),k=c.properties.filter(e=>M.includes(e.field)).map(({field:e,label:l,table:a})=>d({dataIndex:e,title:l},a)).sort((e,l)=>{const a=w.get(e.dataIndex),o=w.get(l.dataIndex);return a-o});export{N as a,S as b,R as c,k as d,L as e,j as f,H as g,_ as r,B as s,T as u};
