var E=(s,h,i)=>new Promise((o,n)=>{var m=t=>{try{l(i.next(t))}catch(u){n(u)}},a=t=>{try{l(i.throw(t))}catch(u){n(u)}},l=t=>t.done?o(t.value):Promise.resolve(t.value).then(m,a);l((i=i.apply(s,h)).next())});import{B as S,u as P}from"./useTable.885579ec.js";import{T as U}from"./BasicForm.948b0243.js";import{aH as N,r as $,a as x,d0 as H,dN as O,cE as V,ac as L,aJ as T,o as j,h as q,j as _,p as C,cx as M,q as G,x as J}from"./index.bde7963b.js";import{T as d}from"./table.0ba2e59f.js";import{b as K}from"./index.4b403226.js";import z from"./Update.de77965e.js";import{a as Q,g as W,b as X}from"./common.201fe4f0.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";let f="",F="",v="",b="",g="";const p=$({schemas:[]}),Y=x({components:{ModalInserOrEdit:z,BasicTable:S,TableAction:U},setup(){var B,A;const{createMessage:s}=J(),{success:h}=s,i=H(),o=(A=(B=i.params)==null?void 0:B.id)!=null?A:"",n=i.path;if(o){f=d.SELECT+"?table="+o,F=d.INSERT+"?table="+o,v=d.UPDATE+"?table="+o,g=d.DELETE+"?table="+o,b=d.SCHEMA+"?table="+o;const{setTitle:r}=O();r(`${o}\u8868`)}else f=`/app/admin${n}/select`,F=`/app/admin${n}/insert`,v=`/app/admin${n}/update`,g=`/app/admin${n}/delete`,b=`/app/admin${n}/schema`;const m=$([]),a=$("");V(()=>E(this,null,function*(){const r=yield Q(b),D=r.columns;for(let e of D)if(e.primary_key){a.value=e.field;break}const k=r.forms;p.value.schemas=[];for(let e of k)e.searchable&&(e.search_type=="between"?(p.value.schemas.push({field:`${e.field}[0]`,component:"Input",label:e.comment||e.field,colProps:{offset:1,span:5}}),p.value.schemas.push({field:`${e.field}[1]`,component:"Input",label:"\u3000\u5230",colProps:{span:5}})):p.value.schemas.push({field:e.field,component:"Input",label:e.comment||e.field,colProps:{offset:1,span:10}})),e.list_show&&m.value.push({dataIndex:e.field,title:e.comment||e.field,sorter:e.enable_sort});p.value.schemas.length||L(()=>{R({useSearchForm:!1})})}));const[l,{openModal:t}]=K(),[u,{reload:c,setProps:R}]=P({title:`${o}\u8868\u6570\u636E`,api:W(f),columns:m,useSearchForm:!0,bordered:!0,formConfig:p,actionColumn:{width:250,title:"Action",dataIndex:"action",slots:{customRender:"action"}}});function w(r){return E(this,null,function*(){if(!a.value){M("\u5F53\u524D\u8868\u6CA1\u6709\u4E3B\u952E\uFF0C\u65E0\u6CD5\u7F16\u8F91");return}t(!0,{selectUrl:f,insertUrl:F,updateUrl:v,schemaUrl:b,column:a.value,value:r[a.value]})})}function y(r){return E(this,null,function*(){if(!a.value){M("\u5F53\u524D\u8868\u6CA1\u6709\u4E3B\u952E\uFF0C\u65E0\u6CD5\u5220\u9664");return}yield X(g,{column:a.value,value:r[a.value]}),h("\u5220\u9664\u6210\u529F"),c()})}function I(){t(!0,{selectUrl:f,insertUrl:F,updateUrl:v,schemaUrl:b})}return{registerTable:u,handleEdit:w,handleDelete:y,openRowModal:I,register:l,reload:c}}}),Z={class:"p-4"},ee=G(" \u6DFB\u52A0\u8BB0\u5F55 ");function te(s,h,i,o,n,m){const a=T("a-button"),l=T("TableAction"),t=T("BasicTable"),u=T("ModalInserOrEdit");return j(),q("div",Z,[_(t,{onRegister:s.registerTable,showTableSetting:""},{toolbar:C(()=>[_(a,{type:"primary",onClick:s.openRowModal},{default:C(()=>[ee]),_:1},8,["onClick"])]),action:C(({record:c})=>[_(l,{actions:[{label:"\u7F16\u8F91",onClick:s.handleEdit.bind(null,c)},{label:"\u5220\u9664",icon:"ic:outline-delete-outline",popConfirm:{title:"\u662F\u5426\u5220\u9664\uFF1F",confirm:s.handleDelete.bind(null,c)}}]},null,8,["actions"])]),_:1},8,["onRegister"]),_(u,{onRegister:s.register,minHeight:300,onReload:s.reload},null,8,["onRegister","onReload"])])}var Ne=N(Y,[["render",te]]);export{Ne as default};
