var _=(r,m,u)=>new Promise((b,d)=>{var B=f=>{try{v(u.next(f))}catch(g){d(g)}},s=f=>{try{v(u.throw(f))}catch(g){d(g)}},v=f=>f.done?b(f.value):Promise.resolve(f.value).then(B,s);v((u=u.apply(r,m)).next())});import{B as x}from"./BasicForm.d11b68fd.js";import{dE as h,aP as G,r as c,a as j,I as S,dw as q,aQ as M,o as H,aR as Q,p as W,i as z,j as J,aU as K,x as L}from"./index.0d073eaa.js";import{C as X}from"./index.abdcab42.js";import"./index.78efd931.js";/* empty css              */import{B as Y,a as Z}from"./index.c05f9254.js";import{a as A,b as E}from"./common.f56e6fca.js";/* empty css              */import"./index.0fb15725.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e317a008.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e8daa066.js";import"./get.49a42f2e.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.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"./useSize.bb4e5ce5.js";import"./index.81899e8a.js";import"./index.ffb8ac7d.js";import"./index.dd1f987c.js";import"./uuid.2b29000c.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";import"./index.aa6b7013.js";import"./PlusOutlined.64d8e001.js";import"./useWindowSizeFn.ef20ece8.js";import"./FullscreenOutlined.401a7bcd.js";function V(r){return(m,u)=>h.uploadFile({url:r||"/app/admin/common/upload/file",onUploadProgress:u},m)}const tt=(r,m)=>h.uploadFile({url:"/app/admin/common/upload/file",onUploadProgress:m},r);function ot(r){return m=>h.get({url:r,params:m})}const w=c(null),O=c(""),P=c(""),k=c(""),D=c(""),et=j({components:{BasicForm:x,[S.name]:S,Button:q,Card:X,BasicModal:Y},emits:["reload","register"],setup(r,{emit:m}){const u=c("\u6DFB\u52A0\u8BB0\u5F55"),b=c(""),d=c(""),B=c(""),s=c("insert"),v=[],[f,{closeModal:g}]=Z(t=>_(this,null,function*(){d.value=t.column,B.value=t.value,b.value=t.table,O.value=t.selectUrl,P.value=t.insertUrl,k.value=t.updateUrl,D.value=t.schemaUrl,d.value?(s.value="edit",u.value="\u7F16\u8F91\u8BB0\u5F55"):(s.value="insert",u.value="\u63D2\u5165\u8BB0\u5F55");const o=yield A(D.value),e=o.forms,l=o.columns,n={};for(let p of l)n[p.field]=p;const i=w.value;if(!i)return;yield i.resetSchema([]);const a={};a[d.value]=B.value;const C=s.value=="edit"?yield A(O.value,a):{},N=s.value=="edit"&&C.items.length?C.items[0]:{};for(let p of e){if(!p.form_show)continue;let[T,U,y]=$(p,N[p.field]);p.field=="password"&&(y="",s.value=="edit"&&(U={placeholder:"\u4E0D\u66F4\u65B0\u5BC6\u7801\u8BF7\u7559\u7A7A"})),i.appendSchemaByField({field:p.field,component:T,label:p.comment||p.field,colProps:{span:24},required:s.value=="edit"&&p.field=="password"?!1:!n[p.field].nullable,componentProps:U,defaultValue:y},"")}})),{createMessage:I}=L(),{success:R}=I;function $(t,o){o=F(o);let e={disabled:s.value=="edit"?!1:t.readonly};if(t.control=="Select"&&t.control_args){let l=[];for(let n of t.control_args.split(",")){let[i,a]=n.split(":");i=i.trim(),a=a.trim(),l.push({label:a,value:i})}return e.options=l,[t.control,e,o]}if(t.control=="Upload"){if(t.control_args)for(let l of t.control_args.split(",")){let n=l.indexOf(":");if(n==-1)continue;let i=l.substring(0,n).trim(),a=l.substring(n+1).trim();i==="url"?e.api=V(a):e[i]=F(a)}e.api||(e.api=tt),o&&(o=o.split(","))}if(t.control=="ApiTreeSelect"){if(e.resultField="list",t.control_args)for(let l of t.control_args.split(",")){let n=l.indexOf(":");if(n==-1)continue;let i=l.substring(0,n).trim(),a=l.substring(n+1).trim();i==="url"?e.api=ot(a):e[i]=F(a)}o&&(e.multiple&&typeof o!="number"&&(o=o.split(",")),e.value=o)}return t.control=="DatePicker"&&(e.showTime=!0),[t.control,e,o]}function F(t){return t==="true"?!0:t==="false"?!1:String(Number(t))===t?Number(t):t}return{formElRef:w,handleSubmit:()=>_(this,null,function*(){try{const t=w.value;if(!t)return;const o=yield t.validate();s.value=="edit"?yield E(k.value,{column:d.value,value:B.value,data:o}):yield E(P.value,{data:o}),g(),R("\u64CD\u4F5C\u6210\u529F"),m("reload")}catch(t){console.log(t)}}),schemas:v,register:f,title:u}}}),rt={class:"mt-3"};function it(r,m,u,b,d,B){const s=M("BasicForm"),v=M("BasicModal");return H(),Q(v,K(r.$attrs,{destroyOnClose:"",onRegister:r.register,title:r.title,onOk:r.handleSubmit}),{default:W(()=>[z("div",rt,[J(s,{schemas:r.schemas,ref:"formElRef",labelWidth:75,showActionButtonGroup:!1},null,8,["schemas"])])]),_:1},16,["onRegister","title","onOk"])}var Kt=G(et,[["render",it]]);export{Kt as default};
