import{_ as V}from"./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";import"./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";import{u as N}from"./useModal-CO65vga3.js";import{B as O}from"./BasicForm-dL_oCSPM.js";import{u as T}from"./useForm-CKmgcynv.js";import{d as j,r as t,a4 as c,u as z,c as A,o as C,l as s,aG as G,w as P,i as q,j as I}from"./index-9PRMimni.js";const L={class:"pt-6"},Q=j({__name:"Modal",props:{title:{type:String,default:"编辑"},width:{type:String,default:"720px"},data:{type:Array,default:()=>[]},formInfo:{type:Object,default:()=>{}}},emits:["fetch-edit","register"],setup(m,{expose:u,emit:f}){const d=t(!1),a=m,p=f,g=c(()=>a.data),h=c(()=>({width:a.width})),_=t(null),o=t("新增"),r=t([]),y=z(),[R,{openModal:v,closeModal:l,setSubLoading:i}]=N({title:o,subBtuText:"保存"}),[w,{submit:B,setFieldsValue:S,getFieldsValue:M}]=T({gridProps:{cols:2},collapsedRows:3,layout:"horizontal",showActionButtonGroup:!1,requireMarkPlacement:"left"});function k(e){o.value=e}function x(e){r.value=e,console.log(r.value),d.value=!0}async function b(){if(await B()){const n=o.value==="新增"?"fetch-add":"fetch-edit";p(n,M(),F=>{F===!0&&l()}),i(!1)}else y.error("验证失败，请填写完整信息"),i(!1)}return u({openModal:v,closeModal:l,setSchemas:x,setFieldsValue:S,setTitle:k}),(e,n)=>(C(),A(s(V),{onRegister:s(R),ref_key:"modalRef",ref:_,onOnOk:b,style:G(h.value)},{default:P(()=>[q("div",L,[I(s(O),{onRegister:s(w),schemas:g.value},null,8,["onRegister","schemas"])])]),_:1},8,["onRegister","style"]))}});export{Q as _};
