import { d as k, V as C, r as a, aw as R, c as h, o as x, w as y, i as L, j as f, l as i, X as S, cZ as D, __tla as __tla_0 } from "./index-9PRMimni.js";
import W from "./CrewList-C9AIJdXs.js";
import { _ as V, g as P, a as B, s as F, u as N, __tla as __tla_1 } from "./CrewSettingForm.vue_vue_type_script_setup_true_lang-Bmjiv3QH.js";
import "./VirtualList-CyTw9HCK.js";
import "./BasicForm-dL_oCSPM.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./componentSetting-DVhNDBTO.js";
import "./ImageUpload-DUsnro3W.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js";
import "./tabsView-BXskTdVh.js";
import "./BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js";
import "./propTypes-CebMRUpe.js";
import "./BasicSelect-C_uwzMkE.js";
import "./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";
import "./dictionary-BRse4lkf.js";
import "./index-DkvzUEqh.js";
import "./index-kKnqLkWM.js";
import "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
import "./isEmpty-BUg1OsQj.js";
import "./useForm-CKmgcynv.js";
import "./usePageCache-DluHn7Yy.js";
let ne;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    let M;
    M = {
        class: "flex flex-row h-full"
    };
    ne = k({
        __name: "index",
        setup (j) {
            const { t: d } = C(), m = D(), w = a(), c = a(), p = a(), n = a(), r = a(), t = a(), o = a(!1), s = a();
            async function _({ item: e, index: u }) {
                v(), s.value = e, t.value = e.crewId, o.value = !0, n.value = await P({
                    vesselId: r.value,
                    crewId: e.crewId,
                    crewRecordId: s.value.id
                }), o.value = !1;
            }
            async function l() {
                v(), o.value = !0;
                const e = w.value?.getSerachParams(), u = c.value?.getQueryFieldsValue();
                p.value = await B({
                    crewName: e,
                    vesselId: r.value,
                    vesselIdList: r.value ? [
                        r.value
                    ] : void 0,
                    ...u
                }), o.value = !1;
            }
            async function I({ data: e }) {
                if (!t.value) {
                    m.warning(d("operation.crewSettings.selectCrew"));
                    return;
                }
                e.id ? await N({
                    ...e,
                    vesselId: r.value,
                    crewId: t.value,
                    crewRecordId: s.value.id
                }) : await F({
                    ...e,
                    vesselId: r.value,
                    crewId: t.value,
                    crewRecordId: s.value.id
                }), m.success(d("common.optionsSuccessText"));
            }
            function v() {
                s.value = void 0, t.value = void 0, n.value = void 0;
            }
            return R(async ()=>{
                r.value = c.value?.initShipValue, await l();
            }), (e, u)=>{
                const g = S;
                return x(), h(g, null, {
                    default: y(()=>[
                            L("div", M, [
                                f(W, {
                                    ref_key: "crewListRef",
                                    ref: w,
                                    onReload: l,
                                    onSelectCrewItem: _,
                                    crewList: i(p),
                                    loading: i(o)
                                }, null, 8, [
                                    "crewList",
                                    "loading"
                                ]),
                                f(V, {
                                    ref_key: "crewSettingFormRef",
                                    ref: c,
                                    onReload: l,
                                    onSave: I,
                                    crewWorkDate: i(n),
                                    loading: i(o),
                                    crewId: i(t)
                                }, null, 8, [
                                    "crewWorkDate",
                                    "loading",
                                    "crewId"
                                ])
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { ne as default, __tla };
