import{B as N}from"./BasicForm-dL_oCSPM.js";import{_ as M}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 A}from"./useModal-CO65vga3.js";import{B as F}from"./Table-0PViRYCf.js";import{V as p,bk as w,d as V,r as g,bl as q,c as E,o as W,l as e,w as f,j as a,W as $,cZ as j,gI as D}from"./index-9PRMimni.js";import{c as G}from"./helper-Cj34FCgW.js";import{f as P}from"./find-D_h_aJYR.js";import{i as X,g as Z}from"./vesselsSurvey-CV_Ys9Tu.js";import{u as z}from"./useForm-CKmgcynv.js";const{t:le}=p();w();function H(){return[{field:"status",hidden:!0,defaultValue:"0"}]}const{t:o}=p(),J=w();function K(){return[{type:"selection",width:40},{title:o("vesselsSurvey.no"),key:"no",width:60,render:(l,n)=>n+1},{title:o("vesselsSurvey.surveyTypeNo"),key:"no",width:160},{title:o("vesselsSurvey.surveyTypeNameEn"),key:"englishName",width:170},{title:o("vesselsSurvey.surveyTypeNameCn"),key:"chineseName",width:170},{title:o("vesselsSurvey.status"),key:"status",width:160,render(l){return P(G,{value:l.status})?.[J.getLocale==="en"?"labelEn":"label"]??""}}]}const ce=V({__name:"index",emits:["refresh"],setup(l,{expose:n,emit:S}){const{t:s}=p(),y=j(),b=S,c=g(0),h=q("tableRef"),[k,{openModal:R,closeModal:T,setSubLoading:i}]=A({title:s("vesselsSurvey.getSurveyList"),subBtuText:s("common.confirmText"),cancelText:s("common.cancelText"),width:1200}),[C,{getFieldsValue:x}]=z({schemas:H(),gridProps:{cols:4},showAdvancedButton:!1,showActionButtonGroup:!1}),u=g([]);function B(t,r){u.value=r}async function I(){try{if(e(u).length===0){y.warning(s("vesselsSurvey.selectAtLeastOneSurveyConfig")),i(!1);return}await X({shipId:e(c),configIds:D(u.value,"id")}),y.success(s("common.optionsAddSuccessText")),i(!1),b("refresh"),T()}catch{i(!1)}}async function O(t,r){try{return await Z({...r,...t,shipId:e(c)})}catch{return{list:[],total:0}}}function v(){h.value?.restReload()}function L(t){c.value=t.shipId,R()}return n({handleOpenModal:L}),(t,r)=>{const d=N,_=$;return W(),E(e(M),{onRegister:e(k),onOnOk:I},{default:f(()=>[a(_,{bordered:!1,class:"proCard","content-class":"py-0"},{default:f(()=>[a(d,{onRegister:e(C),onSubmit:v,onReset:v},null,8,["onRegister"])]),_:1}),a(_,{bordered:!1,class:"proCard mt-2"},{default:f(()=>[a(e(F),{ref_key:"tableRef",ref:h,columns:e(K)(),request:m=>O(m,e(x)()),"row-key":m=>m.id,autoScrollX:!0,onCheckedRowChange:B,"virtual-scroll":""},null,8,["columns","request","row-key"])]),_:1})]),_:1},8,["onRegister"])}}});export{ce as _};
