import { r, V as j, bk as te, d as ae, f as se, e as le, ar as oe, u as ie, a4 as ne, a as re, aw as ue, c as V, o as v, w as o, j as l, W as pe, D as y, l as e, H as ce, B as me, p as P, A as T, h as de, aE as D, ds as g, cC as ve, i as k, aF as w, cr as ge, k as fe, X as _e, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as xe } from "./BasicForm-dL_oCSPM.js";
import { g as be, u as Se, a as he, i as Ve } from "./plan-n8bSdRD5.js";
import { f as ye } from "./group-DxznlajQ.js";
import { _ as Pe, __tla as __tla_1 } from "./index.vue_vue_type_script_setup_true_lang-QIlh4M8d.js";
import { _ as Te, __tla as __tla_2 } from "./index.vue_vue_type_script_setup_true_lang-CmulsQxj.js";
import { _ as De } from "./index.vue_vue_type_script_setup_true_lang-BWl7IgM1.js";
import { _ as ke } from "./index.vue_vue_type_script_setup_true_lang-D0QHvPG-.js";
import { T as we } from "./tabsView-BuQA2jOW.js";
import { u as Ce } from "./useForm-CKmgcynv.js";
import { _ as Ie } from "./Flex-CTSf12gq.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 "./template-rpthWlT9.js";
import "./element-resize-detector-D6t9qRKJ.js";
import "./usePageCache-DluHn7Yy.js";
let vt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    const Ne = te(), { t: Le } = j(), Re = await ye(), Ae = await be(2025);
    function Be() {
        const R = r(!1);
        return {
            schemas: [
                {
                    label: Le("Name Of Ship"),
                    field: "vesselId",
                    component: "NSelect",
                    componentProps: ()=>({
                            options: Ae,
                            "label-field": Ne.getLocale === "en" ? "shipNameEn" : "shipName",
                            "value-field": "id",
                            disabled: !1
                        })
                },
                {
                    label: "Drill Scheduled Month/Year",
                    field: "exercisePlanTime",
                    component: "NDatePicker",
                    componentProps: ()=>({
                            type: "month",
                            valueFormat: "yyyy-MM",
                            disabled: !0
                        })
                },
                {
                    label: "Item of Drill",
                    field: "drillItem",
                    component: "NSelect",
                    componentProps: ()=>({
                            options: Re,
                            "label-field": "projectEnglish",
                            "value-field": "id",
                            disabled: !0
                        }),
                    giProps: {
                        span: 1
                    }
                }
            ],
            methods: {
                setReadOnly: (s)=>{
                    R.value = s;
                }
            }
        };
    }
    let Fe;
    Fe = {
        key: 0
    };
    vt = ae({
        __name: "index",
        setup (R) {
            const C = se(), A = le(), { t: s } = j(), B = oe(), { schemas: U } = Be(), I = ie(), [O, { setFieldsValue: F, getFieldsValue: E }] = Ce({
                schemas: U,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !1,
                gridProps: {
                    cols: 3,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), M = r({}), u = r({
                approve: 0,
                export: 0,
                reject: 0,
                submit: 0
            }), c = r([]), f = r(null), m = r("details"), _ = r(!1), x = r(""), b = r([]), d = r({
                drillEvaluation: "",
                evaluation: ""
            }), W = ne(()=>[
                    {
                        label: "Details",
                        value: "details",
                        compPage: "details"
                    },
                    {
                        label: "Attachments",
                        value: "attachments",
                        compPage: "attachments"
                    },
                    {
                        label: "Participants",
                        value: "participants",
                        compPage: "participants"
                    },
                    {
                        label: "Evaluation",
                        value: "evaluation",
                        compPage: "evaluation"
                    }
                ]), N = re({
                tabsList: W.value,
                collapsed: !1,
                activeKey: "details"
            });
            function z(i) {
                m.value = i.value, F({}), E();
            }
            function G() {
                B.warning({
                    title: s("common.optionsApproveText"),
                    content: s("drill.addPlan.approvedSure"),
                    positiveText: s("common.saveText"),
                    negativeText: s("common.closeText"),
                    draggable: !0,
                    onPositiveClick: ()=>{
                        $(1);
                    },
                    onNegativeClick: ()=>{}
                });
            }
            function H() {
                _.value = !0;
            }
            function q() {
                if (x.value === "") {
                    _.value = !0, I.error(s("退回时退回原因不能为空"));
                    return;
                } else B.warning({
                    title: s("退回"),
                    content: s("是否确认退回"),
                    positiveText: s("common.saveText"),
                    negativeText: s("common.closeText"),
                    draggable: !0,
                    onPositiveClick: ()=>{
                        $(2);
                    },
                    onNegativeClick: ()=>{}
                });
            }
            async function $(i) {
                try {
                    await Se({
                        id: M.value.id,
                        approvalStatus: i,
                        operationMemo: i === 2 ? x.value : ""
                    }), I.success("Approval Success");
                } catch  {
                    return;
                }
            }
            async function J() {
                const i = JSON.parse(sessionStorage.getItem("secretData") || "{}"), { params: a } = C, t = await he(a.id);
                if (t && t.exerciseSingleVessel && (M.value = t.exerciseSingleVessel, u.value = t.buttonPermissions, F({
                    vesselId: Number(i.vesselId) || Number(t.exerciseSingleVessel.vesselId),
                    exercisePlanTime: i.exercisePlanTime || t.exerciseSingleVessel.exercisePlanTime,
                    drillItem: i.drillItem || t.exerciseSingleVessel.drillItem
                }), sessionStorage.removeItem("secretData"), f.value)) {
                    const { exerciseStartTime: p, exerciseStopTime: S } = t.exerciseSingleVessel;
                    f.value.setFormData({
                        shipLocation: t.exerciseSingleVessel.shipLocation,
                        exerciseStartTime: p,
                        exerciseStopTime: S,
                        drillLocation: t.exerciseSingleVessel.drillLocation,
                        weatherSeaCondition: t.exerciseSingleVessel.weatherSeaCondition,
                        relatedTrainingReport: t.exerciseSingleVessel.relatedTrainingReport,
                        cargo: t.exerciseSingleVessel.cargo,
                        exerciseDetails: t.exerciseSingleVessel.exerciseDetails
                    }), d.value.drillEvaluation = t.exerciseSingleVessel.drillEvaluation || "", d.value.evaluation = t.exerciseSingleVessel.evaluation || "", b.value = t.exerciseSingleVessel.vesselParticipants ? t.exerciseSingleVessel.vesselParticipants.split(",") : [];
                }
            }
            function K() {
                const i = E(), a = f.value ? f.value.getFormData() : {}, t = d.value;
                let p = [];
                c.value && c.value.length > 0 && c.value.forEach((h)=>{
                    p.push({
                        attachmentType: "singleVessel",
                        name: h.resultName || "",
                        originalName: h.name || ""
                    });
                });
                const { params: S } = C;
                let L = {
                    exerciseSingleVessel: {
                        vesselParticipants: b.value.join(","),
                        exerciseId: S.id,
                        ...i,
                        ...a,
                        ...t
                    },
                    exerciseAttachment: p
                };
                X(L);
            }
            async function X(i) {
                await Ve(i), I.success("提交成功"), A.push({
                    path: "/hsqe/drill/exerciseApplication/singleShipApply"
                });
            }
            return ue(()=>{
                J();
            }), (i, a)=>{
                const t = me, p = ce, S = Ie, L = xe, h = pe, Y = ve, Q = fe, Z = ge, ee = _e;
                return v(), V(ee, null, {
                    default: o(()=>[
                            l(h, null, {
                                default: o(()=>[
                                        l(S, {
                                            justify: "end"
                                        }, {
                                            default: o(()=>[
                                                    e(u).export !== 0 ? (v(), V(p, {
                                                        key: 0
                                                    }, {
                                                        default: o(()=>[
                                                                l(t, {
                                                                    type: "primary",
                                                                    disabled: e(u).export === 2,
                                                                    onClick: a[0] || (a[0] = ()=>{})
                                                                }, {
                                                                    default: o(()=>[
                                                                            P(T(e(s)("drill.singleShip.export")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }, 8, [
                                                                    "disabled"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    })) : y("", !0),
                                                    e(u).approve !== 0 ? (v(), V(p, {
                                                        key: 1
                                                    }, {
                                                        default: o(()=>[
                                                                l(t, {
                                                                    disabled: e(u).approve === 2,
                                                                    type: "primary",
                                                                    onClick: G
                                                                }, {
                                                                    default: o(()=>[
                                                                            P(T(e(s)("drill.singleShip.approval")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }, 8, [
                                                                    "disabled"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    })) : y("", !0),
                                                    e(u).reject !== 0 ? (v(), V(p, {
                                                        key: 2
                                                    }, {
                                                        default: o(()=>[
                                                                l(t, {
                                                                    disabled: e(u).reject === 2,
                                                                    type: "primary",
                                                                    onClick: H
                                                                }, {
                                                                    default: o(()=>[
                                                                            P(T(e(s)("drill.singleShip.return")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }, 8, [
                                                                    "disabled"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    })) : y("", !0),
                                                    e(u).submit !== 0 ? (v(), V(p, {
                                                        key: 3
                                                    }, {
                                                        default: o(()=>[
                                                                l(t, {
                                                                    disabled: e(u).submit === 2,
                                                                    type: "primary",
                                                                    onClick: K
                                                                }, {
                                                                    default: o(()=>[
                                                                            P(T(e(s)("drill.singleShip.submit")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }, 8, [
                                                                    "disabled"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    })) : y("", !0)
                                                ]),
                                            _: 1
                                        }),
                                        l(L, {
                                            onRegister: e(O),
                                            "label-placement": "top",
                                            showTitleBorder: !0,
                                            class: "tableStyle"
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            l(h, {
                                bordered: !1,
                                class: "mt-3 py-3 proCard",
                                size: "small",
                                segmented: {
                                    content: !0
                                },
                                "content-style": "padding: 20px 15px 0 15px;"
                            }, {
                                default: o(()=>[
                                        l(we, {
                                            modelValue: e(N),
                                            "onUpdate:modelValue": a[1] || (a[1] = (n)=>g(N) ? N.value = n : null),
                                            onChangeTab: z
                                        }, null, 8, [
                                            "modelValue"
                                        ]),
                                        e(m) ? y("", !0) : (v(), de("div", Fe, [
                                            l(Y, {
                                                description: "Please select module"
                                            }, {
                                                extra: o(()=>[
                                                        l(t, {
                                                            size: "small"
                                                        }, {
                                                            default: o(()=>a[7] || (a[7] = [
                                                                    P(" Module not yet selected ")
                                                                ])),
                                                            _: 1
                                                        })
                                                    ]),
                                                _: 1
                                            })
                                        ])),
                                        D(k("div", null, [
                                            l(Te, {
                                                ref_key: "detailsItemRef",
                                                ref: f
                                            }, null, 512)
                                        ], 512), [
                                            [
                                                w,
                                                e(m) === "details"
                                            ]
                                        ]),
                                        D(k("div", null, [
                                            l(Pe, {
                                                modelValue: e(c),
                                                "onUpdate:modelValue": a[2] || (a[2] = (n)=>g(c) ? c.value = n : null)
                                            }, null, 8, [
                                                "modelValue"
                                            ])
                                        ], 512), [
                                            [
                                                w,
                                                e(m) === "attachments"
                                            ]
                                        ]),
                                        D(k("div", null, [
                                            l(De, {
                                                modelValue: e(b),
                                                "onUpdate:modelValue": a[3] || (a[3] = (n)=>g(b) ? b.value = n : null)
                                            }, null, 8, [
                                                "modelValue"
                                            ])
                                        ], 512), [
                                            [
                                                w,
                                                e(m) === "participants"
                                            ]
                                        ]),
                                        D(k("div", null, [
                                            l(ke, {
                                                modelValue: e(d),
                                                "onUpdate:modelValue": a[4] || (a[4] = (n)=>g(d) ? d.value = n : null)
                                            }, null, 8, [
                                                "modelValue"
                                            ])
                                        ], 512), [
                                            [
                                                w,
                                                e(m) === "evaluation"
                                            ]
                                        ])
                                    ]),
                                _: 1
                            }),
                            l(Z, {
                                show: e(_),
                                "onUpdate:show": a[6] || (a[6] = (n)=>g(_) ? _.value = n : null),
                                preset: "dialog",
                                title: e(s)("return"),
                                "positive-text": e(s)("common.saveText"),
                                "negative-text": e(s)("common.closeText"),
                                onPositiveClick: q
                            }, {
                                default: o(()=>[
                                        l(Q, {
                                            value: e(x),
                                            "onUpdate:value": a[5] || (a[5] = (n)=>g(x) ? x.value = n : null),
                                            type: "text",
                                            placeholder: "请填写原因"
                                        }, null, 8, [
                                            "value"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "show",
                                "title",
                                "positive-text",
                                "negative-text"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { vt as default, __tla };
