import { d as Y, bk as Z, r as R, V as ee, f as oe, e as te, u as se, a4 as T, aw as ne, c as i, o as l, w as t, j as n, W as ae, l as e, H as re, D as y, aI as ie, p as _, A as v, B as le, ca as b, gW as x, gX as C, aH as ce, ds as pe, cO as ue, fm as me, cq as de, X as fe, bR as ge, R as _e, __tla as __tla_0 } from "./index-9PRMimni.js";
import { _ as ve } from "./index.vue_vue_type_script_setup_true_lang-BMMlvbwp.js";
import { B as he } from "./BasicForm-dL_oCSPM.js";
import { _ as ye } from "./BackButtonText.vue_vue_type_script_setup_true_lang-Dtx94mZF.js";
import { s as be, a as xe } from "./index-CKrxNOjs.js";
import { s as Ce, b as Se, __tla as __tla_1 } from "./schemas-DzvLPsci.js";
import { N as we } from "./template-rpthWlT9.js";
import { c as Re } from "./componentSetting-DVhNDBTO.js";
import { u as Te } from "./useTags-C1thGhjF.js";
import { u as N } from "./useForm-CKmgcynv.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 "./isEmpty-BUg1OsQj.js";
import "./usePageCache-DluHn7Yy.js";
let ro;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    ro = Y({
        __name: "Handover",
        setup (Ae) {
            const { closeCurrentTabToBack: L } = Te(), A = Z(), c = R([]), [V] = N({
                schemas: Ce,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 4,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), { t: r } = ee(), H = oe(), $ = te(), F = se(), p = R(), k = R(), { addHandoverSchemas: U, setType: S } = Se(), d = H.query, m = T(()=>d.type === "view" || !p.value?.editFlag && !p.value?.submitFlag), z = T(()=>A.getLocale === "en" ? "Approve Tip" : "审核提示"), D = T(()=>A.getLocale != "en" ? `请确认船员[${p.value?.seafarerNameOff}]交接班报告的审核结果` : `Please confirm the approval result of the crew [${p.value?.seafarerNameEnOff}]'s handover report.`), [E, { setFieldsValue: q, getFieldsValue: O }] = N({
                gridProps: {
                    cols: 6
                },
                schemas: U,
                layout: "horizontal",
                labelPlacement: "top",
                showActionButtonGroup: !1
            });
            function P() {
                k.value?.handleOpenModal({
                    busId: p.value.id,
                    moduleCode: p.value.moduleCode
                });
            }
            async function W(u) {
                try {
                    const o = await xe(u);
                    console.log("计划详情", o), p.value = o, S(m.value), q(o), o.crewChangeShiftsInfoFileVoList && o?.crewChangeShiftsInfoFileVoList.length > 0 && (c.value = [], o?.crewChangeShiftsInfoFileVoList.forEach((s)=>{
                        c.value.push({
                            id: s.fileName || "",
                            url: s.fileUrl || "",
                            name: s.fileName?.split("/").pop() || "",
                            thumbnailUrl: s.fileName || "",
                            fileType: s.fileType,
                            status: "finished"
                        });
                    }));
                } catch (o) {
                    throw console.error("获取计划详情失败:", o), o;
                }
            }
            async function I(u) {
                if (!d.id) return;
                let o = [];
                c.value && c.value.length > 0 && (o = c.value.map((f)=>({
                        fileName: f.thumbnailUrl
                    })));
                const s = {
                    status: u,
                    id: d.id,
                    ...O(),
                    crewChangeShiftsInfoFileDtoList: o
                };
                let a = await be(s);
                u === 2 && (await we({
                    shipId: a.vesselId,
                    busId: a.id,
                    moduleCode: a.moduleCode
                }), G()), F.success(r(u === 1 ? "common.saveSuccessText" : "common.submitSuccessText"));
            }
            function G() {
                $.back();
            }
            function M() {
                S(e(m)), d.id ? W(d.id) : S(m.value);
            }
            function X({ file: u, event: o }) {
                try {
                    const s = ge("(" + o.target.response + ")"), { infoField: a } = Re.upload.apiSetting, { code: f } = s, w = s.msg || s.message || "上传失败", h = s[a];
                    f === _e.SUCCESS ? u.thumbnailUrl = h.name : F.error(w);
                } catch  {}
            }
            return ne(()=>{
                M();
            }), (u, o)=>{
                const s = le, a = ie, f = ye, w = re, h = he, B = ae, j = ce, K = ve, J = fe;
                return l(), i(J, null, {
                    default: t(()=>[
                            n(B, {
                                bordered: !1,
                                class: "mb-3 proCard",
                                title: e(r)("common.basicInformation"),
                                segmented: {
                                    content: !0,
                                    footer: "soft"
                                }
                            }, {
                                "header-extra": t(()=>[
                                        n(w, null, {
                                            default: t(()=>[
                                                    e(m) ? y("", !0) : (l(), i(a, {
                                                        key: 0,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: t(()=>[
                                                                n(s, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: o[0] || (o[0] = (g)=>I(1))
                                                                }, {
                                                                    icon: t(()=>[
                                                                            (l(), i(b(e(x)(e(C).save))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: t(()=>[
                                                                _(" " + v(e(r)("common.saveText")), 1)
                                                            ]),
                                                        _: 1
                                                    })),
                                                    e(m) ? y("", !0) : (l(), i(a, {
                                                        key: 1,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: t(()=>[
                                                                n(s, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: o[1] || (o[1] = (g)=>I(2))
                                                                }, {
                                                                    icon: t(()=>[
                                                                            (l(), i(b(e(x)(e(C).submit))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: t(()=>[
                                                                _(" " + v(e(r)("common.optionsSubmitText")), 1)
                                                            ]),
                                                        _: 1
                                                    })),
                                                    e(p)?.approveFlag ? (l(), i(a, {
                                                        key: 2,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: t(()=>[
                                                                n(s, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: P
                                                                }, {
                                                                    icon: t(()=>[
                                                                            (l(), i(b(e(x)(e(C).approve, "text-[#xe628] text-[14px]"))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: t(()=>[
                                                                _(" " + v(e(r)("common.examineAndApprove")), 1)
                                                            ]),
                                                        _: 1
                                                    })) : y("", !0),
                                                    n(a, {
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: t(()=>[
                                                                n(f)
                                                            ]),
                                                        default: t(()=>[
                                                                _(" " + v(e(r)("common.back")), 1)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                default: t(()=>[
                                        n(h, {
                                            onRegister: e(E)
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "title"
                            ]),
                            n(B, {
                                class: "mb-3 proCard",
                                title: e(r)("crew.handoverContent")
                            }, {
                                default: t(()=>[
                                        n(h, {
                                            onRegister: e(V)
                                        }, {
                                            attachment: t(({})=>[
                                                    n(j, {
                                                        action: `${e(de)().urlPrefix}/files`,
                                                        accept: ".doc,.docx,.pdf,.xls,.xlsx",
                                                        headers: {
                                                            timestamp: new Date().getTime(),
                                                            authorization: `${e(ue).get(e(me))}`
                                                        },
                                                        max: 15,
                                                        "file-list": e(c),
                                                        "onUpdate:fileList": o[2] || (o[2] = (g)=>pe(c) ? c.value = g : null),
                                                        "show-remove-button": !e(m),
                                                        onFinish: o[3] || (o[3] = ({ file: g, event: Q })=>X({
                                                                file: g,
                                                                event: Q
                                                            })),
                                                        class: "uploadStyle",
                                                        "file-list-style": {
                                                            margin: 0,
                                                            flex: 1
                                                        }
                                                    }, {
                                                        default: t(()=>[
                                                                e(m) ? y("", !0) : (l(), i(a, {
                                                                    key: 0,
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: t(()=>[
                                                                            n(s, {
                                                                                strong: "",
                                                                                secondary: "",
                                                                                class: "size-7"
                                                                            }, {
                                                                                icon: t(()=>[
                                                                                        (l(), i(b(e(x)(e(C).upload))))
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: t(()=>[
                                                                            _(" " + v(e(r)("hsqe.rs.uploadText")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }))
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "action",
                                                        "headers",
                                                        "file-list",
                                                        "show-remove-button"
                                                    ])
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "title"
                            ]),
                            n(K, {
                                ref_key: "examineAndApproveRef",
                                ref: k,
                                title: e(z),
                                content: e(D),
                                onSuccess: e(L)
                            }, null, 8, [
                                "title",
                                "content",
                                "onSuccess"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { ro as default, __tla };
