import{B}from"./BasicForm-dL_oCSPM.js";import{u as F}from"./useForm-CKmgcynv.js";import{_ as N}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{g as I,u as O}from"./survey-50B41bWV.js";import{c as A}from"./hook-C9rOLWu_.js";import{V as S,r as o,bk as C,d as L,u as z,c as j,o as G,l as a,w as $,i as n,j as H,A as b,ac as J}from"./index-9PRMimni.js";const K=C(),{t:e}=S(),r=o(!1),Q=[{field:"vessel",label:e("hsqe.certificate.Vessel"),component:"NInput",componentProps:{disabled:!0}},{field:K.getLocale==="en"?"surveyTypeEnglish":"surveyTypeChinese",label:e("hsqe.Survey.SurveyType"),component:"NInput",componentProps:{disabled:!0}},{field:"surveyDate",component:"NDatePicker",label:e("hsqe.Survey.SurveyDate"),labelWidth:100,giProps:{span:2},componentProps:{placeholder:e("hsqe.Survey.SurveyDate"),type:"date",valueFormat:"yyyy-MM-dd",disabled:r},rules:[{required:!0,message:e("hsqe.Survey.SurveyDate"),trigger:["blur","change"]}]},{field:"windowEnd",component:"NDatePicker",label:e("hsqe.Survey.WindowEnd"),labelWidth:100,giProps:{span:2},componentProps:{placeholder:e("hsqe.Survey.WindowEnd"),type:"date",valueFormat:"yyyy-MM-dd",disabled:r},rules:[{required:!0,message:e("hsqe.Survey.WindowEnd"),trigger:["blur","change"]}]},{field:"windowStart",component:"NDatePicker",label:e("hsqe.Survey.WindowStart"),labelWidth:100,giProps:{span:2},componentProps:{placeholder:e("hsqe.Survey.WindowStart"),type:"date",valueFormat:"yyyy-MM-dd",disabled:r},rules:[{required:!0,message:e("hsqe.Survey.WindowStart"),trigger:["blur","change"]}]},{field:"remark",component:"NInput",label:e("hsqe.certificate.remark"),giProps:{span:2},componentProps:{placeholder:e("hsqe.certificate.remark"),type:"textarea",disabled:r},rules:[{required:!1,message:e("hsqe.certificate.remark"),trigger:["blur"]}]}],U={setReadOnly:l=>{r.value=l}},X={class:"mt-5 text-red-500"},ie=L({__name:"CreateModal",props:{title:{},isEdit:{}},emits:["success"],setup(l,{expose:w,emit:q}){const{t:s}=S(),c=z(),{setReadOnly:f}=U,h=l,k=q,x=o(),P=o(h.title),u=o(),d=o(!1),[D,{submit:_,setFieldsValue:y,getFieldsValue:g}]=F({gridProps:{cols:2},collapsed:!1,collapsedRows:12,labelWidth:80,layout:"horizontal",submitButtonText:s("common.okText"),showActionButtonGroup:!1,schemas:Q}),[M,{openModal:T,closeModal:v,setSubLoading:p,setProps:R}]=V({title:P,subBtuText:s("common.okText"),cancelText:s("common.cancelText"),width:650});async function W(t,m){if(x.value=t,await J(),t){const i=await I(t);u.value=i,y({...i})}m?(f(!0),d.value=!1):(f(!1),d.value=!0)}async function E(){const t={...g()};if(!A(t.issueDate,t.lastEndorse)){c.error(s("hsqe.certificate.IssueDateorExpireDate")),p(!1);return}if(await _()){const{isEdit:i}=h;await O({...g(),id:u.value?.id}),c.success(s(i?"hsqe.certificate.editsuccess":"hsqe.certificate.addsuccess")),k("success"),p(!1),v()}else c.error(s("hsqe.certificate.Verificationfailed")),p(!1)}return w({openModal:T,closeModal:v,setFieldsValue:y,setProps:R,getData:W}),(t,m)=>(G(),j(a(N),{onRegister:a(M),ref:"modalRef",onOnOk:E,showAction:d.value},{default:$(()=>[n("div",null,[H(a(B),{onRegister:a(D)},null,8,["onRegister"])]),n("div",X,[n("span",null,b(a(s)("common.tipsText"))+"：",1),n("span",null,b(u.value?.fillingExplanation),1)])]),_:1},8,["onRegister","showAction"]))}});export{ie as _};
