var O=Object.defineProperty,j=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var h=(e,t,a)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,n=(e,t)=>{for(var a in t||(t={}))b.call(t,a)&&h(e,a,t[a]);if(m)for(var a of m(t))F.call(t,a)&&h(e,a,t[a]);return e},I=(e,t)=>j(e,L(t));var _=(e,t)=>{var a={};for(var s in e)b.call(e,s)&&t.indexOf(s)<0&&(a[s]=e[s]);if(e!=null&&m)for(var s of m(e))t.indexOf(s)<0&&F.call(e,s)&&(a[s]=e[s]);return a};var x=(e,t,a)=>new Promise((s,i)=>{var f=o=>{try{d(a.next(o))}catch(p){i(p)}},v=o=>{try{d(a.throw(o))}catch(p){i(p)}},d=o=>o.done?s(o.value):Promise.resolve(o.value).then(f,v);d((a=a.apply(e,t)).next())});import{u as U,B as N}from"./useForm-baba730a.js";import{a as z,B as G}from"./index-679d8a0a.js";import{a as W,u as Z}from"./deviceApi-260fcde9.js";import{d as $,f as M,c as E,u as l,Z as H,a4 as J,a5 as K,k as Q,a9 as X}from"./vue-72a104e4.js";import{_ as ee}from"./index.js";const c={xs:{span:24},sm:{span:24},lg:{span:6}},te={span:24},u={model:"Device",viewInPage:!1,properties:[{field:"id",label:"ID系统自动生成",defaultValue:void 0,form:{componentProps:{allowClear:!1,placeholder:"ID系统自动生成"},colProps:c,component:"InputNumber",rules:[{required:!0,message:"请输入ID系统自动生成！"}]},table:{}},{field:"name",label:"设备名称",defaultValue:void 0,form:{componentProps:{allowClear:!1,placeholder:"设备名称"},colProps:c,component:"Input",rules:[{required:!0,message:"请输入设备名称！"}]},table:{}},{field:"deviceSn",label:"设备序列号",defaultValue:void 0,form:{componentProps:{allowClear:!0,placeholder:"设备序列号"},colProps:c,component:"Input",rules:[{required:!0,message:"请输入设备序列号！"}]},table:{}},{field:"deviceIp",label:"设备IP地址",defaultValue:void 0,form:{componentProps:{allowClear:!0,placeholder:"设备IP地址"},colProps:c,component:"Input"},table:{}},{field:"createTime",label:"创建时间",defaultValue:void 0,form:{colProps:c,componentProps:{allowClear:!1,placeholder:["开始时间","结束时间"],format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD",showTime:!1},component:"RangePicker",rules:[{required:!0,message:"请输入CreateTime！"}]},table:{}},{field:"updateTime",label:"更新时间",defaultValue:void 0,form:{colProps:c,componentProps:{allowClear:!1,placeholder:["开始时间","结束时间"],format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD",showTime:!1},component:"RangePicker",rules:[{required:!0,message:"请输入UpdateTime！"}]},table:{}}]},B=["name","deviceSn","deviceIp"],T=["name","deviceSn","deviceIp"],C=["name","deviceSn","deviceIp","createTime","updateTime"],q=["name","deviceSn","deviceIp","createTime","updateTime"],P=new Map(B.map((e,t)=>[e,t])),pe=u.properties.filter(e=>B.includes(e.field)).map(s=>{var{field:e,label:t,form:i}=s,a=_(i,[]);return I(n({field:e,label:t,defaultValue:void 0},a),{required:!1,rules:[{required:!1}]})}).sort((e,t)=>{const a=P.get(e.field),s=P.get(t.field);return a-s}),Y=new Map(T.map((e,t)=>[e,t])),ae=u.properties.filter(e=>T.includes(e.field)).map(({field:e,label:t,defaultValue:a,form:s})=>I(n({field:e,label:t,defaultValue:a},s),{colProps:te})).sort((e,t)=>{const a=Y.get(e.field),s=Y.get(t.field);return a-s}),S=new Map(C.map((e,t)=>[e,t])),me=u.properties.filter(e=>C.includes(e.field)).map(({field:e,label:t,table:a})=>n({dataIndex:e,title:t},a)).sort((e,t)=>{const a=S.get(e.dataIndex),s=S.get(t.dataIndex);return a-s}),y=new Map(q.map((e,t)=>[e,t]));u.properties.filter(e=>q.includes(e.field)).map(({field:e,label:t,table:a})=>n({dataIndex:e,title:t},a)).sort((e,t)=>{const a=y.get(e.dataIndex),s=y.get(t.dataIndex);return a-s});const se=$({__name:"drawer",emits:["success","register"],setup(e,{emit:t}){const a=t,s=M(!0),i=M(),[f,{resetFields:v,setFieldsValue:d,validate:o}]=U({labelWidth:100,schemas:ae,showActionButtonGroup:!1}),[p,{setDrawerProps:g,closeDrawer:V}]=z(r=>x(this,null,function*(){yield v(),g({confirmLoading:!1}),s.value=!!(r!=null&&r.isUpdate),i.value=r==null?void 0:r.record,l(s)&&(yield d(n({},r.record)))})),k=E(()=>l(s)?"编辑":"新增");function R(){return x(this,null,function*(){try{const r=yield o();g({confirmLoading:!0});const w=_(r,[]),A=l(s)?Z:W,D=l(s)?Object.assign({},n(n({},l(i)),w)):n({},w);yield A(D),DeviceClientService.refreshDeviceClientBySn(D.deviceSn),V(),a("success")}catch(r){}finally{g({confirmLoading:!1})}})}return(r,w)=>(H(),J(l(G),X(r.$attrs,{onRegister:l(p),showFooter:"",title:k.value,width:"600px",onOk:R}),{default:K(()=>[Q(l(N),{onRegister:l(f)},null,8,["onRegister"])]),_:1},16,["onRegister","title"]))}});const re=ee(se,[["__scopeId","data-v-0394e0d0"]]),ue=Object.freeze(Object.defineProperty({__proto__:null,default:re},Symbol.toStringTag,{value:"Module"}));export{re as D,me as c,ue as d,pe as s};
