var b=(a,f,n)=>new Promise((t,m)=>{var u=o=>{try{i(n.next(o))}catch(s){m(s)}},r=o=>{try{i(n.throw(o))}catch(s){m(s)}},i=o=>o.done?t(o.value):Promise.resolve(o.value).then(u,r);i((n=n.apply(a,f)).next())});import{B as D}from"./TableImg.2aabef6a.js";import{j as $}from"./BasicForm.d11b68fd.js";import{u as k}from"./useTable.13a8b0ff.js";import{aP as P,r as F,a as S,aC as N,bR as O,bf as V,aQ as h,o as j,h as x,j as E,p as _,dC as U,q as H,x as L}from"./index.0d073eaa.js";import{T as d}from"./table.0ba2e59f.js";import{b as q}from"./index.c05f9254.js";import G from"./Update.01355e05.js";import{a as K,g as Q,b as z}from"./common.f56e6fca.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./useForm.868c8e81.js";import"./index.566277e5.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useSize.bb4e5ce5.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e317a008.js";import"./uuid.2b29000c.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./get.49a42f2e.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./index.0fb15725.js";import"./sortable.esm.2632adaa.js";import"./RedoOutlined.32117fb5.js";import"./FullscreenOutlined.401a7bcd.js";import"./index.dd1f987c.js";import"./fromPairs.84aabb58.js";import"./scrollTo.f8a2fd00.js";import"./index.2ed1a060.js";/* empty css              *//* empty css              */import"./index.e8daa066.js";import"./index.81899e8a.js";import"./index.ffb8ac7d.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";import"./index.abdcab42.js";import"./index.aa6b7013.js";import"./index.78efd931.js";import"./PlusOutlined.64d8e001.js";const C=d.SELECT,B=d.INSERT,R=d.UPDATE,T=d.SCHEMA,J=d.DELETE,c=F({schemas:[]}),W=S({components:{ModalInserOrEdit:G,BasicTable:D,TableAction:$},setup(){var v,g;const{createMessage:a}=L(),{success:f}=a,t=(g=(v=N().params)==null?void 0:v.id)!=null?g:"",{setTitle:m}=O();m(`${t}\u8868`);const u=F([]),r=F("");V(()=>b(this,null,function*(){const l=yield K(T+"?table="+t),y=l.columns;for(let e of y)if(e.primary_key){r.value=e.field;break}const I=l.forms;c.value.schemas=[];for(let e of I)e.searchable&&(e.search_type=="between"?(c.value.schemas.push({field:`${e.field}[0]`,component:"Input",label:e.comment||e.field,colProps:{offset:1,span:5}}),c.value.schemas.push({field:`${e.field}[1]`,component:"Input",label:"\u3000\u5230",colProps:{span:5}})):c.value.schemas.push({field:e.field,component:"Input",label:e.comment||e.field,colProps:{offset:1,span:10}})),e.list_show&&u.value.push({dataIndex:e.field,title:e.comment||e.field,sorter:e.enable_sort})}));const[i,{openModal:o}]=q(),[s,{reload:p}]=k({title:`${t}\u8868\u6570\u636E`,api:Q(C+"?table="+t),columns:u,useSearchForm:!0,bordered:!0,formConfig:c,actionColumn:{width:250,title:"Action",dataIndex:"action",slots:{customRender:"action"}}});function A(l){return b(this,null,function*(){if(!r.value){U("\u5F53\u524D\u8868\u6CA1\u6709\u4E3B\u952E\uFF0C\u65E0\u6CD5\u7F16\u8F91");return}o(!0,{selectUrl:C+"?table="+t,insertUrl:B+"?table="+t,updateUrl:R+"?table="+t,schemaUrl:T+"?table="+t,column:r.value,value:l[r.value]})})}function M(l){return b(this,null,function*(){if(!r.value){U("\u5F53\u524D\u8868\u6CA1\u6709\u4E3B\u952E\uFF0C\u65E0\u6CD5\u5220\u9664");return}yield z(J+"?table="+t,{column:r.value,value:l[r.value]}),f("\u5220\u9664\u6210\u529F"),p()})}function w(){o(!0,{selectUrl:C+"?table="+t,insertUrl:B+"?table="+t,updateUrl:R+"?table="+t,schemaUrl:T+"?table="+t})}return{registerTable:s,handleEdit:A,handleDelete:M,openRowModal:w,register:i,reload:p}}}),X={class:"p-4"},Y=H(" \u6DFB\u52A0\u8BB0\u5F55 ");function Z(a,f,n,t,m,u){const r=h("a-button"),i=h("TableAction"),o=h("BasicTable"),s=h("ModalInserOrEdit");return j(),x("div",X,[E(o,{onRegister:a.registerTable,showTableSetting:""},{toolbar:_(()=>[E(r,{type:"primary",onClick:a.openRowModal},{default:_(()=>[Y]),_:1},8,["onClick"])]),action:_(({record:p})=>[E(i,{actions:[{label:"\u7F16\u8F91",onClick:a.handleEdit.bind(null,p)},{label:"\u5220\u9664",icon:"ic:outline-delete-outline",popConfirm:{title:"\u662F\u5426\u5220\u9664\uFF1F",confirm:a.handleDelete.bind(null,p)}}]},null,8,["actions"])]),_:1},8,["onRegister"]),E(s,{onRegister:a.register,minHeight:300,onReload:a.reload},null,8,["onRegister","onReload"])])}var it=P(W,[["render",Z]]);export{it as default};
