import{B as R}from"./BasicForm-dL_oCSPM.js";import{u as k}from"./useForm-CKmgcynv.js";import{_ as T}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 v}from"./useModal-CO65vga3.js";import{V as p,ad as c,d as F,u as M,r as d,c as I,o as V,w as C,i as q,j as S,l as a,ac as z}from"./index-9PRMimni.js";const{t:e}=p(),A=[{field:"companyNameCn",component:"NInput",label:e("sysDoc.doc.chineseName"),componentProps:{placeholder:e("sysDoc.doc.chineseNamePlaceholder")},rules:[{required:!0,message:e("sysDoc.doc.chineseNamePlaceholder"),trigger:["blur"]}]},{field:"companyNameEn",component:"NInput",label:e("sysDoc.doc.englishName"),componentProps:{placeholder:e("sysDoc.doc.englishNamePlaceholder")},rules:[{required:!0,message:e("sysDoc.doc.englishNamePlaceholder"),trigger:["blur"]}]},{field:"companyNameShort",component:"NInput",label:e("sysDoc.doc.shortName"),componentProps:{placeholder:e("sysDoc.doc.shortNamePlaceholder")},rules:[{required:!0,message:e("sysDoc.doc.shortNamePlaceholder"),trigger:["blur"]}]}];function K(){return c.Get("/doc/list")}function E(o){return c.Post("/doc",o)}function G(o){return c.Put("/doc",o)}function Q(o){return c.Delete(`/doc/${o}`)}const U=F({__name:"CreateModal",props:{title:{type:String,default:""},isEdit:{type:Boolean,default:!1}},emits:["success"],setup(o,{expose:f,emit:g}){const{t:s}=p(),n=M(),h=o,y=g,l=d(null),N=d(h.title),[P,{submit:D,setFieldsValue:r,getFieldsValue:i}]=k({gridProps:{cols:1},collapsed:!1,collapsedRows:12,labelWidth:120,layout:"horizontal",submitButtonText:s("common.okText"),showActionButtonGroup:!1,schemas:A}),[b,{openModal:x,closeModal:m,setSubLoading:u,setProps:_}]=v({title:N,subBtuText:s("common.okText"),cancelText:s("common.cancelText"),width:650});async function w(t){l.value=t?.id,await z(),t&&r(t)}async function B(){await D()?(l.value==null?(await E(i()),n.success(s("common.addPop.success"))):(await G({id:l.value,...i()}),n.success(s("common.editPop.success"))),y("success"),u(!1),m()):(n.error(s("common.editPop.validateFail")),u(!1))}return f({openModal:x,closeModal:m,setFieldsValue:r,setProps:_,getData:w}),(t,L)=>(V(),I(a(T),{onRegister:a(b),ref:"modalRef",onOnOk:B},{default:C(()=>[q("div",null,[S(a(R),{onRegister:a(P)},null,8,["onRegister"])])]),_:1},8,["onRegister"]))}});export{U as _,Q as d,K as g};
