var f=(t,p,s)=>new Promise((a,u)=>{var c=o=>{try{n(s.next(o))}catch(r){u(r)}},m=o=>{try{n(s.throw(o))}catch(r){u(r)}},n=o=>o.done?a(o.value):Promise.resolve(o.value).then(c,m);n((s=s.apply(t,p)).next())});import{B as I,u as k}from"./useTable.885579ec.js";import{T as A}from"./BasicForm.948b0243.js";import{a as D,g as $,b as x}from"./common.201fe4f0.js";import{b as P}from"./index.4b403226.js";import U from"./Update.de77965e.js";import{aH as S,r as C,a as O,cE as H,dJ as J,ac as N,aJ as h,o as V,h as j,j as b,p as v,cx as E,q,x as G}from"./index.bde7963b.js";import"./index.dcd3d2b7.js";import"./useForm.b21b423d.js";import"./index.159e9c7d.js";import"./index.e3e2a44d.js";import"./index.eb76ac7f.js";import"./index.3289c967.js";import"./index.18602d99.js";import"./useWindowSizeFn.ada338ad.js";import"./useContentViewHeight.9a4f8bdd.js";import"./ArrowLeftOutlined.284f8ef3.js";import"./transButton.3496299b.js";import"./index.bfd670f8.js";import"./index.13318916.js";import"./_baseIteratee.34b68bfe.js";import"./index.9b1e5ec7.js";import"./sortable.esm.2632adaa.js";import"./RedoOutlined.4aa527e6.js";import"./uniqBy.3333e3da.js";import"./fromPairs.84aabb58.js";import"./scrollTo.7893ea05.js";import"./index.54dd68f7.js";import"./index.498edf7f.js";import"./index.0103b3aa.js";import"./index.ce7c5e55.js";import"./index.b75cc0a1.js";import"./download.dc299cb5.js";import"./tree.36c6ae32.js";const F="/app/admin/user/user/select",T="/app/admin/user/user/insert",B="/app/admin/user/user/update",K="/app/admin/user/user/delete",g="/app/admin/user/user/schema",l=C({schemas:[]}),z=O({components:{ModalInserOrEdit:U,BasicTable:I,TableAction:A},setup(){const{createMessage:t}=G(),{success:p}=t,s=C([]),a=C("");H(()=>f(this,null,function*(){const i=yield D(g),y=i.columns;for(let e of y)if(e.primary_key){a.value=e.field;break}const M=i.forms;l.value.schemas=[];for(let e of M)if(e.searchable&&(e.search_type=="between"?(l.value.schemas.push({field:`${e.field}[0]`,component:"Input",label:e.comment||e.field,colProps:{offset:1,span:5}}),l.value.schemas.push({field:`${e.field}[1]`,component:"Input",label:"\u3000\u5230",colProps:{span:5}})):l.value.schemas.push({field:e.field,component:"Input",label:e.comment||e.field,colProps:{offset:1,span:10}})),e.list_show){let _={dataIndex:e.field,title:e.comment||e.field,sorter:e.enable_sort};s.value.push(_),e.field=="avatar"&&(_.width=50,_.customRender=({record:R})=>J("img",{src:R[e.field]}))}l.value.schemas.length||N(()=>{o({useSearchForm:!1})})}));const[u,{openModal:c}]=P(),[m,{reload:n,setProps:o}]=k({api:$(F),columns:s,useSearchForm:!0,bordered:!0,formConfig:l,actionColumn:{width:250,title:"Action",dataIndex:"action",slots:{customRender:"action"}}});function r(i){return f(this,null,function*(){if(!a.value){E("\u5F53\u524D\u8868\u6CA1\u6709\u4E3B\u952E\uFF0C\u65E0\u6CD5\u7F16\u8F91");return}c(!0,{selectUrl:F,insertUrl:T,updateUrl:B,schemaUrl:g,column:a.value,value:i[a.value]})})}function d(i){return f(this,null,function*(){if(!a.value){E("\u5F53\u524D\u8868\u6CA1\u6709\u4E3B\u952E\uFF0C\u65E0\u6CD5\u5220\u9664");return}yield x(K,{column:a.value,value:i[a.value]}),p("\u5220\u9664\u6210\u529F"),n()})}function w(){c(!0,{selectUrl:F,insertUrl:T,updateUrl:B,schemaUrl:g})}return{registerTable:m,handleEdit:r,handleDelete:d,openRowModal:w,register:u,reload:n}}}),L={class:"p-4"},Q=q(" \u6DFB\u52A0\u8BB0\u5F55 ");function W(t,p,s,a,u,c){const m=h("a-button"),n=h("TableAction"),o=h("BasicTable"),r=h("ModalInserOrEdit");return V(),j("div",L,[b(o,{onRegister:t.registerTable,showTableSetting:""},{toolbar:v(()=>[b(m,{type:"primary",onClick:t.openRowModal},{default:v(()=>[Q]),_:1},8,["onClick"])]),action:v(({record:d})=>[b(n,{actions:[{label:"\u7F16\u8F91",onClick:t.handleEdit.bind(null,d)},{label:"\u5220\u9664",icon:"ic:outline-delete-outline",popConfirm:{title:"\u662F\u5426\u5220\u9664\uFF1F",confirm:t.handleDelete.bind(null,d)}}]},null,8,["actions"])]),_:1},8,["onRegister"]),b(r,{onRegister:t.register,minHeight:300,onReload:t.reload},null,8,["onRegister","onReload"])])}var Ae=S(z,[["render",W]]);export{Ae as default};
