import { d as Y, r as S, V as Z, f as ee, e as te, u as oe, bk as se, a4 as x, aw as ae, c as _, o as v, w as o, j as r, W as ne, l as t, i as C, H as re, D as L, aI as ie, p as y, A as h, B as le, aH as ue, cO as ce, fm as pe, cq as me, ca as de, gW as fe, gX as ge, X as _e, gD as A, hl as ve, bR as ye, R as he, __tla as __tla_0 } from "./index-9PRMimni.js";
import { _ as we } from "./index.vue_vue_type_script_setup_true_lang-BMMlvbwp.js";
import { _ as Re } from "./BackButtonText.vue_vue_type_script_setup_true_lang-Dtx94mZF.js";
import { B as I } from "./BasicForm-dL_oCSPM.js";
import { u as N } from "./useForm-CKmgcynv.js";
import { c as be, f as Se, g as xe, a as Ce, r as Le, __tla as __tla_1 } from "./requestRelief-CcHzVBoD.js";
import { N as qe } from "./template-rpthWlT9.js";
import { u as Te } from "./useTags-C1thGhjF.js";
import { c as ke } from "./componentSetting-DVhNDBTO.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./schemas-BmKi-UM9.js";
import "./useModal-CO65vga3.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 "./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 "./illnessInjury-CN3bQPcI.js";
let lt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    lt = Y({
        __name: "Add",
        setup (Ae) {
            const { schemasUpload: B } = be(), c = S([]), [O] = N({
                schemas: B,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 3,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), { t: a } = Z(), l = ee(), $ = te(), m = oe(), n = S({}), { closeCurrent: D } = Te(), w = se(), q = x(()=>l.query.type === "view"), F = S(), V = x(()=>w.getLocale === "en" ? "Approve Tip" : "审核提示"), P = x(()=>w.getLocale != "en" ? `请确认船员[${n.value?.seafarerName}]请假申请的审批结果` : `Please confirm the approval result of the crew [${n.value?.seafarerNameEn}]'s request relief.`);
            async function U() {
                if (l.query.id) {
                    let i = JSON.parse(JSON.stringify(l.query.id));
                    n.value = await xe(i), l.query.type === "view" ? d.updateReadOnly(!0) : d.updateReadOnly(!1), b(n.value), d.getCrewList(n.value.vesselId), n.value.fileRelationList && n.value?.fileRelationList.length > 0 && (c.value = [], n.value?.fileRelationList.forEach((e)=>{
                        c.value.push({
                            id: e.fileName || "",
                            url: e.fileUrl || "",
                            name: e.fileName?.split("/").pop() || "",
                            thumbnailUrl: e.fileName || "",
                            fileType: e.fileType,
                            status: "finished"
                        });
                    }));
                } else {
                    d.updateReadOnly(!1);
                    const e = JSON.parse(localStorage.getItem("SHIP-LIST") || "")?.value?.[0]?.id;
                    b({
                        vesselId: e
                    }), d.getCrewList(e);
                }
            }
            const { formSchema: E, methods: d } = Se(H), [z, { submit: W, setFieldsValue: b, getFieldsValue: G }] = N({
                gridProps: {
                    cols: 13
                },
                schemas: E,
                labelPlacement: "top",
                showActionButtonGroup: !1,
                showAdvancedButton: !1
            });
            function H(i) {
                b({
                    rankId: i.rankId
                });
            }
            async function T(i) {
                if (!await W()) {
                    m.warning(a("configureForm.pleaseCheckIfTheContentHasBeenFilledInCompletely"));
                    return;
                }
                const s = G();
                if (s.startOnLeaveDate && s.startOnLeaveDate && A(s.startOnLeaveDate).isAfter(A(s.endOnLeaveDate))) {
                    m.warning(w.getLocale === "en" ? `${a("requestRelief.onLeavePeroid")} cannot be later than ${a("requestRelief.to")}` : `${a("requestRelief.onLeavePeroid")} 不能晚于 ${a("requestRelief.to")}`);
                    return;
                }
                let u = [];
                c.value && c.value.length > 0 && (u = c.value.map((f)=>({
                        fileName: f.thumbnailUrl
                    })));
                let p = {
                    id: l.query.id || null,
                    ...s,
                    fileRelationList: u
                };
                n.value.id && (p.id = n.value.id), n.value = await Ce(p), i !== "submit" && m.success(a("common.saveSuccessText")), i === "submit" && (await qe({
                    shipId: n.value.vesselId,
                    busId: n.value.id,
                    moduleCode: n.value.moduleCode
                }), m.success(a("common.submitSuccessText")), k());
            }
            function M() {
                Le(w.getLocale === "en" ? "crew_request_relief_template_EN" : "crew_request_relief_template_CN").then((i)=>{
                    ve(i, "船员休假模板.xlsx");
                });
            }
            function J({ file: i, event: e }) {
                try {
                    const s = ye("(" + e.target.response + ")"), { infoField: u } = ke.upload.apiSetting, { code: p } = s, f = s.msg || s.message || "上传失败", R = s[u];
                    p === he.SUCCESS ? i.thumbnailUrl = R.name : m.error(f);
                } catch  {}
            }
            function k() {
                $.back(), D();
            }
            return ae(()=>{
                U();
            }), (i, e)=>{
                const s = le, u = ie, p = Re, f = re, R = ne, j = ue, X = we, K = _e;
                return v(), _(K, null, {
                    default: o(()=>[
                            r(R, {
                                bordered: !1,
                                class: "proCard",
                                segmented: {
                                    content: !0,
                                    footer: "soft"
                                },
                                title: t(a)("common.basicInformation")
                            }, {
                                "header-extra": o(()=>[
                                        C("div", null, [
                                            r(f, null, {
                                                default: o(()=>[
                                                        t(l).query.type !== "view" && t(l).query.type !== "approve" ? (v(), _(u, {
                                                            key: 0,
                                                            trigger: "hover"
                                                        }, {
                                                            trigger: o(()=>[
                                                                    r(s, {
                                                                        type: "primary",
                                                                        strong: "",
                                                                        bordered: "",
                                                                        secondary: "",
                                                                        class: "size-7",
                                                                        onClick: e[0] || (e[0] = (g)=>T())
                                                                    }, {
                                                                        icon: o(()=>e[4] || (e[4] = [
                                                                                C("i", {
                                                                                    class: "iconfont icon-Save"
                                                                                }, null, -1)
                                                                            ])),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: o(()=>[
                                                                    y(" " + h(t(a)("common.saveText")), 1)
                                                                ]),
                                                            _: 1
                                                        })) : L("", !0),
                                                        t(l).query.type !== "view" && t(l).query.type !== "approve" ? (v(), _(u, {
                                                            key: 1,
                                                            trigger: "hover"
                                                        }, {
                                                            trigger: o(()=>[
                                                                    r(s, {
                                                                        type: "primary",
                                                                        strong: "",
                                                                        bordered: "",
                                                                        secondary: "",
                                                                        class: "size-7",
                                                                        onClick: e[1] || (e[1] = (g)=>T("submit"))
                                                                    }, {
                                                                        icon: o(()=>e[5] || (e[5] = [
                                                                                C("i", {
                                                                                    class: "iconfont icon-Submit"
                                                                                }, null, -1)
                                                                            ])),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: o(()=>[
                                                                    y(" " + h(t(a)("common.optionsSubmitText")), 1)
                                                                ]),
                                                            _: 1
                                                        })) : L("", !0),
                                                        r(u, {
                                                            trigger: "hover"
                                                        }, {
                                                            trigger: o(()=>[
                                                                    r(p)
                                                                ]),
                                                            default: o(()=>[
                                                                    y(" " + h(t(a)("common.back")), 1)
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                _: 1
                                            })
                                        ])
                                    ]),
                                default: o(()=>[
                                        r(t(I), {
                                            onRegister: t(z)
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "title"
                            ]),
                            r(R, {
                                bordered: !1,
                                class: "proCard mt-3",
                                segmented: {
                                    content: !0,
                                    footer: "soft"
                                },
                                title: t(a)("crew.crewList.attachment")
                            }, {
                                default: o(()=>[
                                        r(t(I), {
                                            onRegister: t(O)
                                        }, {
                                            attachment: o(({})=>[
                                                    r(j, {
                                                        action: `${t(me)().urlPrefix}/files`,
                                                        accept: ".doc,.docx,.pdf,.xls,.xlsx",
                                                        headers: {
                                                            timestamp: new Date().getTime(),
                                                            authorization: `${t(ce).get(t(pe))}`
                                                        },
                                                        max: 15,
                                                        "file-list": c.value,
                                                        "onUpdate:fileList": e[2] || (e[2] = (g)=>c.value = g),
                                                        onFinish: e[3] || (e[3] = ({ file: g, event: Q })=>J({
                                                                file: g,
                                                                event: Q
                                                            })),
                                                        class: "uploadStyle",
                                                        "file-list-style": {
                                                            margin: 0,
                                                            flex: 1
                                                        },
                                                        "show-remove-button": !t(q)
                                                    }, {
                                                        default: o(()=>[
                                                                t(q) ? L("", !0) : (v(), _(u, {
                                                                    key: 0,
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: o(()=>[
                                                                            r(s, {
                                                                                strong: "",
                                                                                secondary: "",
                                                                                class: "size-7"
                                                                            }, {
                                                                                icon: o(()=>[
                                                                                        (v(), _(de(t(fe)(t(ge).upload))))
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: o(()=>[
                                                                            y(" " + h(t(a)("hsqe.rs.uploadText")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }))
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "action",
                                                        "headers",
                                                        "file-list",
                                                        "show-remove-button"
                                                    ]),
                                                    r(s, {
                                                        text: "",
                                                        onClick: M,
                                                        class: "ml-5",
                                                        color: "#0ec06a"
                                                    }, {
                                                        default: o(()=>[
                                                                y(h(t(a)("crew.downloadTemplate")), 1)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "title"
                            ]),
                            r(X, {
                                ref_key: "examineAndApproveRef",
                                ref: F,
                                title: t(V),
                                content: t(P),
                                onSuccess: k
                            }, null, 8, [
                                "title",
                                "content"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { lt as default, __tla };
