2 lines
4.2 KiB
JavaScript
2 lines
4.2 KiB
JavaScript
var b=(t,f,n)=>new Promise((a,m)=>{var c=o=>{try{s(n.next(o))}catch(r){m(r)}},p=o=>{try{s(n.throw(o))}catch(r){m(r)}},s=o=>o.done?a(o.value):Promise.resolve(o.value).then(c,p);s((n=n.apply(t,f)).next())});import{B as k,u as A}from"./useTable.656d2bae.js";import{x as I}from"./BasicForm.6056307a.js";import{a as P,g as x,b as D}from"./common.6cef50b2.js";import{b as $}from"./index.7ea231b7.js";import S from"./Update.16232ceb.js";import{aG as U,r as w,a as O,cE as N,ac as G,aI as _,o as H,h as V,j as v,p as F,dJ as j,cx as E,q,x as J}from"./index.9e465e98.js";import{t as K}from"./util.fd2dc0a3.js";import"./index.7cdee0ed.js";import"./useForm.7c9a0ef0.js";import"./index.967f417a.js";import"./index.d342c0df.js";import"./index.82faa0b7.js";import"./index.af33b015.js";import"./useWindowSizeFn.14b10c39.js";import"./useContentViewHeight.c6c711f4.js";import"./ArrowLeftOutlined.8cc9af78.js";import"./transButton.088152fa.js";import"./index.7e01442e.js";import"./index.1396ba67.js";import"./index.17dc3642.js";import"./_baseIteratee.2f88fd8b.js";import"./index.892b83b2.js";import"./sortable.esm.c20789c1.js";import"./RedoOutlined.e5187225.js";import"./FullscreenOutlined.0624c6a3.js";import"./scrollTo.e1b29360.js";import"./index.d11f5ba1.js";import"./index.caea034d.js";import"./index.a9758a55.js";import"./index.9dc129cb.js";import"./index.8f156bb7.js";import"./uniqBy.b001b07b.js";import"./download.8926825a.js";import"./index.2c96af2d.js";const g="/app/admin/auth/admin/select",T="/app/admin/auth/admin/insert",B="/app/admin/auth/admin/update",z="/app/admin/auth/admin/delete",C="/app/admin/auth/admin/schema",u=w({schemas:[]}),L=O({components:{ModalInserOrEdit:S,BasicTable:k,TableAction:I},setup(){const{createMessage:t}=J(),{success:f}=t,n=w([]),a=w("");N(()=>b(this,null,function*(){const l=yield P(C),M=l.columns;for(let e of M)if(e.primary_key){a.value=e.field;break}const R=l.forms;u.value.schemas=[];for(let e of R){if(e.searchable){let[i,d]=K(e,"","search");e.search_type=="between"?(u.value.schemas.push({field:`${e.field}[0]`,component:i,label:e.comment||e.field,colProps:{offset:1,span:5},componentProps:d}),u.value.schemas.push({field:`${e.field}[1]`,component:i,label:"\u3000\u5230",colProps:{span:5},componentProps:d})):u.value.schemas.push({field:e.field,component:i,label:e.comment||e.field,colProps:{offset:1,span:10},componentProps:d})}if(e.list_show){let i={dataIndex:e.field,title:e.comment||e.field,sorter:e.enable_sort,defaultHidden:!e.list_show};["InputNumber","Switch"].indexOf(e.control)!=-1&&(i.width=120),e.field=="avatar"&&(i.width=50,i.customRender=({record:d})=>j("img",{src:d[e.field]})),n.value.push(i)}}u.value.schemas.length||G(()=>{o({useSearchForm:!1})})}));const[m,{openModal:c}]=$(),[p,{reload:s,setProps:o}]=A({api:x(g),columns:n,useSearchForm:!0,bordered:!0,formConfig:u,actionColumn:{width:250,title:"Action",dataIndex:"action",slots:{customRender:"action"}}});function r(l){return b(this,null,function*(){if(!a.value){E("\u5F53\u524D\u8868\u6CA1\u6709\u4E3B\u952E\uFF0C\u65E0\u6CD5\u7F16\u8F91");return}c(!0,{selectUrl:g,insertUrl:T,updateUrl:B,schemaUrl:C,column:a.value,value:l[a.value]})})}function h(l){return b(this,null,function*(){if(!a.value){E("\u5F53\u524D\u8868\u6CA1\u6709\u4E3B\u952E\uFF0C\u65E0\u6CD5\u5220\u9664");return}yield D(z,{column:a.value,value:l[a.value]}),f("\u5220\u9664\u6210\u529F"),s()})}function y(){c(!0,{selectUrl:g,insertUrl:T,updateUrl:B,schemaUrl:C})}return{registerTable:p,handleEdit:r,handleDelete:h,openRowModal:y,register:m,reload:s}}}),Q={class:"p-4"},W=q(" \u6DFB\u52A0\u8BB0\u5F55 ");function X(t,f,n,a,m,c){const p=_("a-button"),s=_("TableAction"),o=_("BasicTable"),r=_("ModalInserOrEdit");return H(),V("div",Q,[v(o,{onRegister:t.registerTable,showTableSetting:""},{toolbar:F(()=>[v(p,{type:"primary",onClick:t.openRowModal},{default:F(()=>[W]),_:1},8,["onClick"])]),action:F(({record:h})=>[v(s,{actions:[{label:"\u7F16\u8F91",onClick:t.handleEdit.bind(null,h)},{label:"\u5220\u9664",icon:"ic:outline-delete-outline",popConfirm:{title:"\u662F\u5426\u5220\u9664\uFF1F",confirm:t.handleDelete.bind(null,h)}}]},null,8,["actions"])]),_:1},8,["onRegister"]),v(r,{onRegister:t.register,minHeight:300,onReload:t.reload},null,8,["onRegister","onReload"])])}var xe=U(L,[["render",X]]);export{xe as default};
|