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