import { d as fe, V as ve, bk as _e, f as ye, r as p, ay as ge, aw as Ie, c as v, o as u, w as n, j as c, W as we, l as s, H as he, D as x, aI as Te, p as D, A as R, B as Ce, ca as B, gW as U, gX as E, h as S, aE as A, x as Fe, F as H, a9 as z, y as Le, aF as K, h6 as be, h7 as ke, X as je, ac as $, hc as xe, cZ as De, __tla as __tla_0 } from "./index-9PRMimni.js";
import { _ as Re } from "./BackButtonText.vue_vue_type_script_setup_true_lang-Dtx94mZF.js";
import { B as Be } from "./BasicForm-dL_oCSPM.js";
import { u as Se } from "./useForm-CKmgcynv.js";
import { c as $e, __tla as __tla_1 } from "./schemas-h8fDbkdf.js";
import { v as Ve, __tla as __tla_2 } from "./schemas-DzvLPsci.js";
import { _ as qe, __tla as __tla_3 } from "./CrewMedicalReport.vue_vue_type_script_setup_true_lang-B2CdLsEk.js";
import { b as Ue, u as Ee, c as Ne } from "./template-rpthWlT9.js";
import { u as Oe } from "./useTags-C1thGhjF.js";
import { _ as W, __tla as __tla_4 } from "./CrewHospitalizingReport.vue_vue_type_style_index_0_lang-Cw91tbcD.js";
import { _ as Me, __tla as __tla_5 } from "./ShipsIdentityAndNavigationalStatus.vue_vue_type_script_setup_true_lang-Dv9-woX7.js";
import { _ as Ae, __tla as __tla_6 } from "./PatientHealthStatus.vue_vue_type_script_setup_true_lang-Bitp9iej.js";
import { _ as He, __tla as __tla_7 } from "./PrimaryPhysicianReport.vue_vue_type_script_setup_true_lang-Cb0bcEwU.js";
import { _ as ze, __tla as __tla_8 } from "./CrewInjuryReport.vue_vue_type_script_setup_true_lang-DS50FA11.js";
import { g as Ke, s as N, u as We, c as Pe } from "./illnessInjury-CN3bQPcI.js";
import { d as Xe } from "./download-CIBdrxiA.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 "./usePageCache-DluHn7Yy.js";
import "./isEmpty-BUg1OsQj.js";
import { __tla as __tla_9 } from "./columns-CcSTU2Qa.js";
import "./Table-0PViRYCf.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./print-CT_2hrjP.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./useModal-CO65vga3.js";
import "./useTimeout-BxFilWvD.js";
import "./Flex-CTSf12gq.js";
import "./base64Conver-4Xd-Hzyx.js";
let Pt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_3;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_4;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_5;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_6;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_7;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_8;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_9;
        } catch  {}
    })()
]).then(async ()=>{
    let Ge;
    Ge = {
        key: 1
    };
    Pt = fe({
        __name: "addIllnessInjury",
        setup (Ze) {
            const { t: r } = ve(), P = _e(), I = De(), d = ye(), { closeCurrentTabToBack: X } = Oe(), L = new Map([
                [
                    "1",
                    [
                        {
                            name: "1",
                            i18nKey: "illnessInjury.crewHospitalizingReport",
                            component: W
                        },
                        {
                            name: "2",
                            i18nKey: "illnessInjury.shipsIdentityAndNavigationalStatus",
                            component: Me
                        },
                        {
                            name: "3",
                            i18nKey: "illnessInjury.patientHealthStatus",
                            component: Ae
                        },
                        {
                            name: "4",
                            i18nKey: "illnessInjury.primaryPhysicianReport",
                            component: He
                        }
                    ]
                ],
                [
                    "2",
                    [
                        {
                            name: "1",
                            i18nKey: "illnessInjury.crewHospitalizingReport",
                            component: W
                        },
                        {
                            name: "5",
                            i18nKey: "illnessInjury.crewInjuryReport",
                            component: ze
                        }
                    ]
                ]
            ]), T = p("1"), b = p(!1), _ = p(), y = p(""), k = p(""), a = p(), V = p(), C = p(), w = p([]), f = p(new Map), { contentSchemas: G, methods: F } = $e(Q, ee, Y), [Z, { setFieldsValue: j, submit: O }] = Se({
                gridProps: {
                    cols: 12
                },
                schemas: G,
                showActionButtonGroup: !1,
                showAdvancedButton: !1
            });
            function J(e) {
                _.value = Ve.find((t)=>t.id === e);
            }
            async function Q(e) {
                j({
                    crewIdis: ""
                }), await F.updateCrewNameList(_.value?.id, e);
            }
            function Y(e, t) {
                V.value = t, j({
                    crewId: e
                }), q();
            }
            function ee(e) {
                y.value = e, T.value = "1", w.value = L.get(e) || [], $(()=>{
                    q();
                });
            }
            function te(e, t) {
                t && !f.value.has(e) && f.value.set(e, {
                    instance: t,
                    data: {},
                    fileList: []
                });
            }
            function q() {
                !y.value || !V.value || f.value.forEach(({ instance: e }, t)=>{
                    e.handleOpen && (t !== "2" ? e.handleOpen(V.value) : e.handleOpen());
                });
            }
            async function ae(e, t) {
                if (T.value = e, console.log("切换Tab:", e, t), !t) return;
                const o = f.value.get(t);
                o && (o.data = o.instance.voList?.() || {}, o.fileList = o.instance.getFileList?.() || []), await $();
                const i = f.value.get(e);
                if (i) {
                    const { instance: m, data: g } = i;
                    Object.keys(g).length > 0 && m.setFormData && m.setFormData(g);
                }
            }
            async function ne() {
                const e = await xe();
                if (j({
                    vesselId: e[0].id
                }), await J(e[0].id), d.query.id) {
                    if (a.value = await Ke(Number(d.query.id)), await F.updateCrewNameList(a.value?.vesselId, a.value?.rankId), j({
                        ...a.value,
                        crewIdis: P.getLocale === "en" ? a.value?.crewNameEn : a.value?.crewName
                    }), a.value?.templateUid) {
                        const t = await Ue({
                            templateCode: a.value?.templateCode,
                            uuid: a.value?.templateUid
                        });
                        _.value?.shipTypeId === 1 ? C.value?.listInfo(t.list, a.value?.crewInjuryIllnessInfoFileVoList) : (y.value = a.value?.injuriesType, w.value = L.get(y.value) || [], await $(), f.value.forEach(({ instance: o }, i)=>{
                            const m = `list${i}`, g = t[m] || [], h = a.value?.crewInjuryIllnessInfoFileVoList || [];
                            o.listInfo?.(g, h), f.value.get(i).data = o.voList?.() || {}, f.value.get(i).fileList = o.getFileList?.() || [];
                        }));
                    }
                } else _.value?.shipTypeId === 1 ? C.value?.handleOpen() : (w.value = L.get(y.value) || [], $(()=>q()));
            }
            function M() {
                const e = {}, t = [];
                return _.value?.shipTypeId === 1 ? (e.list = C.value?.voList() || [], t.push(...C.value?.getFileList() || [])) : f.value.forEach(({ instance: o, data: i }, m)=>{
                    const g = o.voList?.() || i, h = o.getFileList?.() || [];
                    e[`list${m}`] = g, t.push(...h);
                }), {
                    allData: e,
                    allFileList: t
                };
            }
            async function oe() {
                const e = await O();
                if (!e) {
                    I.warning(r("configureForm.pleaseCheckIfTheContentHasBeenFilledInCompletely"));
                    return;
                }
                const { allData: t, allFileList: o } = M();
                if (!d.query.id) {
                    const i = await N({
                        ...e,
                        statusFlag: "1",
                        crewInjuryIllnessInfoFileDtoList: o
                    });
                    a.value = i;
                }
                a.value?.templateUid ? (await Ee({
                    template_code: a.value?.templateCode,
                    uuid: a.value?.templateUid,
                    ...t
                }), k.value = a.value?.templateUid) : k.value = await Ne({
                    template_code: a.value?.templateCode,
                    ...t
                }), await We({
                    templateUid: k.value,
                    id: a.value?.id
                }), d.query.id && await N({
                    ...e,
                    statusFlag: "1",
                    id: Number(d.query.id),
                    uuid: k.value,
                    crewInjuryIllnessInfoFileDtoList: o
                }), I.success(r("common.saveSuccessText"));
            }
            async function se() {
                const e = await O();
                if (!e) {
                    I.warning(r("configureForm.pleaseCheckIfTheContentHasBeenFilledInCompletely"));
                    return;
                }
                const { allFileList: t } = M();
                await N({
                    ...e,
                    ...a.value,
                    statusFlag: "2",
                    crewInjuryIllnessInfoFileDtoList: t
                }), I.success(r("common.submitSuccessText")), ie();
            }
            function ie() {
                X();
            }
            async function re() {
                try {
                    const e = await Pe(Number(a.value?.id));
                    Xe({
                        url: e
                    }), I.success(r("common.exportSuccess"));
                } catch (e) {
                    console.error("导出失败", e), I.error(r("common.exportFail"));
                }
            }
            return ge(y, (e)=>{
                e && (w.value = L.get(e) || []);
            }, {
                immediate: !0
            }), Ie(()=>{
                d.query.type === "view" ? (F.updateReadOnly(!0), b.value = !0) : (F.updateReadOnly(!1), b.value = !1), d.query.type !== "add" && F.updateType(!0), ne();
            }), (e, t)=>{
                const o = Re, i = Te, m = Ce, g = he, h = we, le = Le, ue = Fe, ce = ke, me = be, pe = je;
                return u(), v(pe, null, {
                    default: n(()=>[
                            c(h, {
                                bordered: !1,
                                class: "mb-3 proCard",
                                title: s(r)("common.basicInformation"),
                                segmented: {
                                    content: !0,
                                    footer: "soft"
                                }
                            }, {
                                "header-extra": n(()=>[
                                        c(g, {
                                            reverse: ""
                                        }, {
                                            default: n(()=>[
                                                    c(i, {
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: n(()=>[
                                                                c(o)
                                                            ]),
                                                        default: n(()=>[
                                                                D(" " + R(s(r)("common.back")), 1)
                                                            ]),
                                                        _: 1
                                                    }),
                                                    c(i, {
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: n(()=>[
                                                                c(m, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: t[0] || (t[0] = (l)=>re())
                                                                }, {
                                                                    icon: n(()=>[
                                                                            (u(), v(B(s(U)(s(E).export))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: n(()=>[
                                                                D(" " + R(s(r)("common.exportText")), 1)
                                                            ]),
                                                        _: 1
                                                    }),
                                                    s(d).query.type !== "view" ? (u(), v(i, {
                                                        key: 0,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: n(()=>[
                                                                c(m, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: t[1] || (t[1] = (l)=>se())
                                                                }, {
                                                                    icon: n(()=>[
                                                                            (u(), v(B(s(U)(s(E).submit))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: n(()=>[
                                                                D(" " + R(s(r)("common.optionsSubmitText")), 1)
                                                            ]),
                                                        _: 1
                                                    })) : x("", !0),
                                                    s(d).query.type !== "view" ? (u(), v(i, {
                                                        key: 1,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: n(()=>[
                                                                c(m, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: t[2] || (t[2] = (l)=>oe())
                                                                }, {
                                                                    icon: n(()=>[
                                                                            (u(), v(B(s(U)(s(E).save))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: n(()=>[
                                                                D(" " + R(s(r)("common.saveText")), 1)
                                                            ]),
                                                        _: 1
                                                    })) : x("", !0)
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                default: n(()=>[
                                        c(s(Be), {
                                            onRegister: s(Z)
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "title"
                            ]),
                            c(h, {
                                bordered: !1,
                                class: "mb-3 proCard",
                                title: s(r)("illnessInjury.illnessInjuryInformation"),
                                segmented: {
                                    content: !0,
                                    footer: "soft"
                                }
                            }, {
                                default: n(()=>[
                                        _.value?.shipTypeId !== 1 && y.value ? (u(), v(ue, {
                                            key: 0,
                                            value: T.value,
                                            "onUpdate:value": [
                                                t[3] || (t[3] = (l)=>T.value = l),
                                                ae
                                            ]
                                        }, {
                                            default: n(()=>[
                                                    (u(!0), S(H, null, z(w.value, (l)=>(u(), v(le, {
                                                            key: l.name,
                                                            name: l.name,
                                                            tab: s(r)(l.i18nKey)
                                                        }, null, 8, [
                                                            "name",
                                                            "tab"
                                                        ]))), 128))
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "value"
                                        ])) : x("", !0),
                                        _.value?.shipTypeId !== 1 && y.value ? (u(), S("div", Ge, [
                                            (u(!0), S(H, null, z(w.value, (l)=>A((u(), S("div", {
                                                    key: l.name
                                                }, [
                                                    (u(), v(B(l.component), {
                                                        ref_for: !0,
                                                        ref: (de)=>te(l.name, de),
                                                        readonly: b.value
                                                    }, null, 8, [
                                                        "readonly"
                                                    ]))
                                                ], 512)), [
                                                    [
                                                        K,
                                                        T.value === l.name
                                                    ]
                                                ])), 128))
                                        ])) : x("", !0),
                                        A(c(me, null, {
                                            default: n(()=>[
                                                    c(ce, {
                                                        span: 24
                                                    }, {
                                                        default: n(()=>[
                                                                c(qe, {
                                                                    ref_key: "crewMedicalReportRef",
                                                                    ref: C,
                                                                    readonly: b.value
                                                                }, null, 8, [
                                                                    "readonly"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 512), [
                                            [
                                                K,
                                                _.value?.shipTypeId === 1
                                            ]
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "title"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Pt as default, __tla };
