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{B as D}from"./Table-0PViRYCf.js";import{V as C,bk as L,d as W,e as q,r as i,h as U,o as X,j as c,w as f,W as $,l as n,ac as z,d8 as G,gK as H}from"./index-9PRMimni.js";import{r as J,t as Q}from"./jobOrder-CGbsc7bp.js";import{B as Y}from"./BasicForm-dL_oCSPM.js";import{u as Z}from"./useForm-CKmgcynv.js";import{u as ee}from"./useModal-CO65vga3.js";import{i as se}from"./isEmpty-BUg1OsQj.js";const te=L(),{t:r}=C();function oe(){return{riskAssessmentColumns:[{key:"isSelect",type:"selection",width:60,multiple:!1},{title:r("common.messagedefine.Num"),key:"num",width:60,render:(u,a)=>a+1},{title:r("jobOrder.riskAssessmentCode"),key:"projectNo",width:120},{title:r("jobOrder.riskAssessmentProjectName"),key:te.getLocale==="en"?"operationEnglish":"operationChinese",width:120}]}}function ne(){return{workPermitColumns:[{key:"isSelect",type:"selection",width:60,multiple:!1},{title:r("common.messagedefine.Num"),key:"num",width:60,render:(u,a)=>a+1},{title:r("jobOrder.smsFileCode"),key:"code",width:120},{title:r("jobOrder.smsFileNameEn"),key:"nameEn",width:120},{title:r("jobOrder.smsFileNameCn"),key:"nameCn",width:120}]}}const fe=W({__name:"Modal",emits:["success"],setup(k,{expose:u,emit:a}){const b=a,{t:g}=C(),R=q(),{riskAssessmentColumns:T}=oe(),{workPermitColumns:A}=ne(),d=i(),t=i(""),o=i({}),l=i([]),h=i(!1),[I,{openModal:P,closeModal:j,setProps:O}]=ee({subBtuText:g("common.confirmText"),width:650}),[B,{getFieldsValue:S,setSchema:M}]=Z({gridProps:{cols:3},showAdvancedButton:!1});async function N(e,s){t.value=s,o.value=e,console.log(e),P(),w()}function w(){h.value=!1,z(()=>{t.value==="workPermit"?v(o.value.workPermitId):t.value==="riskAssessment"&&v(o.value.riskAssessmentId),h.value=!0})}function v(e){!G(e)&&se(e)||d.value?.setCheckedRowKeys([e])}function x(e,s){console.log("行选中",e.value,s),l.value=s}function y(e,s){R.push({name:e,query:s})}async function F(e,s){if(w(),t.value=="workPermit")return await J({...e,...s,busType:7});if(t.value=="riskAssessment"){const m=await H();return await Q({...e,...s,vesselType:m,status:2})}}function E(){t.value=="workPermit"?(console.log(o.value),y("smsDetail",{shipId:o.value.shipId,templateId:l.value[0].templateId,workPermitId:o.value.workPermitId,type:"add"})):t.value=="riskAssessment"&&y("RiskAssessment_View",{riskAssessmentId:o.value.riskAssessmentId,projectId:l.value[0].projectId,type:"add",baseId:l.value[0].id,projectType:"company",description:o.value.description}),j(),b("success",l.value,t.value)}function _(){d.value?.restReload()}return u({handleOpenModal:N,setProps:O,setSchema:M}),(e,s)=>{const m=$,K=V;return X(),U("template",null,[c(K,{ref:"modalRef",onRegister:n(I),onOnOk:E},{default:f(()=>[c(m,{bordered:!1,class:"proCard","content-class":"p-0"},{default:f(()=>[c(n(Y),{onRegister:n(B),onSubmit:_,onReset:_},null,8,["onRegister"])]),_:1}),c(m,{bordered:!1,class:"proCard mt-2","content-class":"p-0"},{default:f(()=>[c(n(D),{ref_key:"basicTableRef",ref:d,columns:n(t)==="riskAssessment"?n(T):n(A),request:p=>F(p,n(S)()),"row-key":p=>p.id,autoScrollX:!0,showTableSetting:!1,"virtual-scroll":"",onCheckedRowChange:x},null,8,["columns","request","row-key"])]),_:1})]),_:1},8,["onRegister"])])}}});export{fe as _};
