var D=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var w=(s,m)=>{var c={};for(var t in s)j.call(s,t)&&m.indexOf(t)<0&&(c[t]=s[t]);if(s!=null&&D)for(var t of D(s))m.indexOf(t)<0&&N.call(s,t)&&(c[t]=s[t]);return c};import{j as V,k as A,S as H,m as z,_ as E}from"./index.js";import{u as F,B as K}from"./useTable-f8594a7b.js";import{T as G}from"./useForm-322569b9.js";import{O as U,j as b}from"./antd-fb8ca017.js";import{r as W,s as Z,c as q,a as x}from"./schema-fbe47475.js";import{u as J}from"./index-922f0b14.js";import L from"./drawer-098bf44f.js";import{d as Q,a6 as X,Z as y,_ as ee,$ as S,k as p,u as l,a5 as g,l as te,G as oe,a4 as se,a8 as ae}from"./vue-08ef39cb.js";import"./index-9a268806.js";import"./useWindowSizeFn-40274562.js";import"./onMountedOrActivated-4630d53b.js";import"./sortable.esm-15c0a34e.js";import"./copyTextToClipboard-bf4926ca.js";import"./regionApi-ad45a6bd.js";const ne={class:"header"},ie=Q({name:"DevicePage",__name:"index",setup(s){V();const m=A(),[c,{openDrawer:t}]=J(),[Y,{reload:v,setSelectedRowKeys:k}]=F({api:e=>Z(T(e)),columns:q,formConfig:{labelWidth:0,schemas:x,showAdvancedButton:!1},useSearchForm:!0,showTableSetting:!1,bordered:!0,showIndexColumn:!1,canResize:!1,rowKey:e=>e.id,actionColumn:{width:240,title:"操作",dataIndex:"action",fixed:"right"}}),T=(e,n=!0)=>{const C=e,{pageNum:f,pageSize:_,field:d="id",order:M="descend"}=C,O=w(C,["pageNum","pageSize","field","order"]),a={pageNum:f,pageSize:_,orderByClause:`${d} ${M==="descend"?"desc":"asc"}`};return Object.keys(O).forEach(h=>{const r=x.find(u=>u.field===h),o=e[h],i=h;if(r){if(o!==void 0&&o!=="")if(r.component==="Input"){const u=n?"":"%";a[i]=`${u}${o.trim()}${u}`}else["Select","ApiSelect","ApiTreeSelect"].includes(r.component)?a[i]=z(o)?o.value:o:r.component==="RangePicker"?(a[`${i}From`]=b(o[0]).startOf("d").format("YYYY-MM-DD HH:mm:ss"),a[`${i}To`]=b(o[1]).endOf("d").format("YYYY-MM-DD HH:mm:ss")):r.component==="DatePicker"?a[i]=b(o).format(r.componentProps.format||"YYYY-MM-DD"):a[i]=o}else a[i]=o}),a},B=()=>{t(!0,{isUpdate:!1})},P=e=>{t(!0,{record:e,isUpdate:!0})},R=e=>{W(e.id).then(n=>{v(),k([])})},$=()=>{v()},I=e=>{m("/system/device/detail/"+e.id)};return(e,n)=>{const f=X("a-button");return y(),ee("div",null,[S("div",ne,[p(l(H),{size:"19",name:"list"}),n[0]||(n[0]=S("div",{class:"title"},"区域列表",-1))]),p(l(K),{onRegister:l(Y)},{toolbar:g(()=>[p(f,{type:"primary",onClick:B,icon:te(l(U))},{default:g(()=>n[1]||(n[1]=[oe("新增")])),_:1},8,["icon"])]),bodyCell:g(({column:_,record:d})=>[_.dataIndex==="action"?(y(),se(l(G),{key:0,actions:[{label:"编辑",icon:"clarity:note-edit-line",onClick:P.bind(null,d),divider:!0},{label:"详情",icon:"ant-design:eye-outlined",onClick:I.bind(null,d),divider:!0},{label:"删除",icon:"ant-design:delete-outlined",color:"error",popConfirm:{title:"是否确认删除",confirm:R.bind(null,d),placement:"topRight"}}]},null,8,["actions"])):ae("",!0)]),_:1},8,["onRegister"]),p(L,{onRegister:l(c),onSuccess:$},null,8,["onRegister"])])}}});const we=E(ie,[["__scopeId","data-v-f25c6f37"]]);export{we as default};
