import { d as ve, e as ye, f as ge, V as be, r, a as he, a4 as X, aw as De, d9 as Ie, c as l, o as c, w as t, i as m, j as s, W as Re, eW as we, l as e, h as ke, F as Ce, a9 as xe, eX as Be, T as qe, aE as I, aF as V, H as Ae, aI as Ee, p as B, A as R, B as Te, ca as q, gW as A, gX as E, D as N, t as Me, ds as Pe, _ as je, k as Ve, X as Se, cZ as Ne, __tla as __tla_0 } from "./index-9PRMimni.js";
import { _ as Fe } from "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import { E as $e, N as ze } from "./template-rpthWlT9.js";
import { g as He, a as Le, n as Ue, b as We, s as Oe } from "./nc-DCEmAT0Y.js";
import { B as Xe } from "./Table-0PViRYCf.js";
import { _ as Ze, __tla as __tla_1 } from "./historyModal.vue_vue_type_script_setup_true_lang-CBdlcMxI.js";
import { _ as Ge, __tla as __tla_2 } from "./index.vue_vue_type_script_setup_true_lang-CRVZYRSS.js";
import Je from "./index-Munjm6Dl.js";
import { _ as Ke, __tla as __tla_3 } from "./index.vue_vue_type_script_setup_true_lang-B1l3Q49t.js";
import { _ as Qe } from "./index.vue_vue_type_script_setup_true_lang-BtexhrA-.js";
import { _ as Ye } from "./index.vue_vue_type_script_setup_true_lang-ETeLwMph.js";
import { u as Z } from "./useModal-CO65vga3.js";
import "./index-kKnqLkWM.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./componentMap-CElCaWis.js";
import "./propTypes-CebMRUpe.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./print-CT_2hrjP.js";
import "./componentSetting-DVhNDBTO.js";
import "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./tabsView-BXskTdVh.js";
import "./Flex-CTSf12gq.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js";
import "./BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js";
import "./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";
import "./index-DkvzUEqh.js";
import { __tla as __tla_4 } from "./index.vue_vue_type_style_index_0_scoped_b974e5ec_lang-_0QwzFKM.js";
import "./jobOrder-CGbsc7bp.js";
import "./has-CjqcrIOV.js";
import { __tla as __tla_5 } from "./index-8tHZJCCW.js";
import "./TimelineItem-Bkds7ZW8.js";
import "./schemas-BmKi-UM9.js";
import "./props-CLtNejQT.js";
import "./BasicForm-dL_oCSPM.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload-DUsnro3W.js";
import "./BasicSelect-C_uwzMkE.js";
import "./dictionary-BRse4lkf.js";
import "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
import "./hook-C9rOLWu_.js";
import "./account-C850CBTF.js";
import "./useForm-CKmgcynv.js";
import "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
let sa;
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  {}
    })()
]).then(async ()=>{
    let et, tt, at;
    et = {
        style: {
            height: "84vh"
        }
    };
    tt = {
        class: "ml-2"
    };
    at = {
        class: "max-h-[calc(100vh-200px)] overflow-y-auto p-2.5 hidden-scrollbar"
    };
    sa = ve({
        __name: "index",
        setup (st) {
            const z = ye(), w = ge(), { t: n } = be(), F = Ne(), k = r(!1);
            let _ = he({
                comment: ""
            });
            const T = r(), M = r(), P = r(), j = r(), H = r(), d = r(w.query.id || null), S = r(!1), [G] = Z({
                title: n("hsqe.deficiency.historicalRecords"),
                closable: !1,
                maskClosable: !0,
                width: 680,
                subBtuText: n("common.okText"),
                cancelText: n("common.cancelText")
            }), C = X(()=>[
                    {
                        label: n("hsqe.nc.general"),
                        value: "basicInfo",
                        compPage: "basicInfo"
                    },
                    {
                        label: n("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.tabCauseAnalysis"),
                        value: "causeAnalysis",
                        compPage: "causeAnalysis"
                    },
                    {
                        label: n("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.tabAction"),
                        value: "action",
                        compPage: "action"
                    },
                    {
                        label: n("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.rabAttachments"),
                        value: "attachments",
                        compPage: "attachments"
                    },
                    {
                        label: n("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.tableReview"),
                        value: "review",
                        compPage: "review"
                    }
                ]), J = r("process"), K = X(()=>C.value.findIndex((a)=>a.value === f.value) + 1), Q = [
                {
                    title: "Reviewed By",
                    key: "username"
                },
                {
                    title: "Reviewed Date",
                    key: "operateTime"
                },
                {
                    title: "Status",
                    key: "displayStatus"
                },
                {
                    title: "Review Comments",
                    key: "comment"
                }
            ], [Y, { openModal: ee, closeModal: te, setSubLoading: ae }] = Z({
                title: n("hsqe.deficiency.captainReject"),
                closable: !1,
                maskClosable: !0,
                width: 680,
                subBtuText: n("common.okText"),
                cancelText: n("common.cancelText")
            }), se = {
                comment: [
                    {
                        required: !0,
                        message: n("hsqe.planner.modal.reasonHint"),
                        trigger: [
                            "change",
                            "blur"
                        ]
                    }
                ]
            }, i = r(), L = r("basicInfo"), f = r("basicInfo"), U = r(), h = r();
            async function ne() {
                if (w.query.type === "view" ? k.value = !0 : k.value = !1, d.value) {
                    i.value = await He(d.value);
                    let a = await Le(d.value);
                    a && (T.value.initData(a.ncDeficiencyBasicDto), M.value.initData(a.ncDeficiencyCauseDtos), P.value.initData(a.ncDeficiencyActionDto), j.value.initData(a.ncDeficiencyPhotoDtos), H.value.initData(a), h.value = a);
                }
            }
            function oe() {
                z.back();
            }
            async function ie(a) {
                const v = C.value.findIndex((o)=>o.value === f.value);
                if (a <= v) {
                    f.value = C.value[a].value, L.value = C.value[a].compPage || "basicInfo";
                    return;
                }
                if (w.query.type !== "view") {
                    const o = f.value;
                    let p = !0;
                    if (o === "basicInfo" && T.value ? p = !!await T.value.getData(!0) : o === "causeAnalysis" && M.value ? p = !!await M.value.getData(!0) : o === "action" && P.value ? p = !!await P.value.getData(!0) : o === "attachments" && j.value && (p = !!await j.value.getData(!0)), !p) return;
                }
                const u = C.value[a];
                u && (f.value = u.value, L.value = u.compPage || "basicInfo");
            }
            async function ce() {
                await Ue({
                    shipId: h.value.ncDeficiencyBasicDto.shipId,
                    busId: h.value.id,
                    moduleCode: "NonConformity",
                    subModuleCode: h.value.ncDeficiencyBasicDto.subModuleCode
                }), $();
            }
            async function re() {
                if (!_.comment || _.comment == "") {
                    F.error(n("hsqe.planner.modal.reasonHint")), ae(!1);
                    return;
                }
                await We({
                    shipId: h.value.ncDeficiencyBasicDto.shipId,
                    busId: h.value.id,
                    moduleCode: "NonConformity",
                    subModuleCode: h.value.ncDeficiencyBasicDto.subModuleCode,
                    comment: _.comment
                }), te(), $();
            }
            const le = async ()=>{
                const a = await $e({
                    busId: d.value,
                    moduleCode: "approveDeficiency"
                });
                return {
                    list: a,
                    total: a.length
                };
            };
            function ue() {
                U.value?.showModal(h.value);
            }
            function $() {
                F.success(n("hsqe.deficiency.operationSuccessful")), z.go(-1);
            }
            async function W(a) {
                S.value = !0;
                let v = await T.value.getData(a), u = await M.value.getData(a), o = await P.value.getData(a), p = await j.value.getData(a);
                if (console.log(d.value), a && (!v || !u || !o || !p)) return S.value = !1, !1;
                let y = null;
                d.value && typeof d.value == "string" ? y = d.value : Array.isArray(d.value) && d.value.length > 0 && (y = d.value[0]);
                let D = {
                    id: y,
                    stepId: 1
                };
                D.ncDeficiencyBasicDto = v.params, D.ncDeficiencyCauseDtos = u.params, D.ncDeficiencyActionDto = o.params, D.ncDeficiencyPhotoDtos = p.params;
                const g = await Oe(D);
                if (g && g.id && w.query.type === "add") {
                    d.value = g.id;
                    const x = new URL(window.location.href);
                    x.searchParams.set("id", g.id.toString()), x.searchParams.set("type", "edit"), window.history.replaceState({
                        ...window.history.state
                    }, "", x.toString());
                }
                a ? (await ze({
                    shipId: g.ncDeficiencyBasicDto.shipId,
                    busId: g.id,
                    moduleCode: "NonConformity",
                    subModuleCode: g.ncDeficiencyBasicDto.subModuleCode
                }), $()) : F.success(n("common.saveSuccessText")), S.value = !1;
            }
            return De(()=>{
                ne();
            }), (a, v)=>{
                const u = Te, o = Ee, p = Ae, y = Be, D = we, g = Re, x = Fe, de = Ve, pe = je, me = Me, fe = Se, O = Ie("debounce");
                return c(), l(fe, null, {
                    default: t(()=>[
                            m("div", et, [
                                s(g, {
                                    bordered: !1,
                                    class: "py-3 proCard",
                                    size: "small",
                                    segmented: {
                                        content: !0
                                    },
                                    "content-style": "padding: 20px 15px 0 15px;"
                                }, {
                                    header: t(()=>[
                                            m("div", null, [
                                                s(p, {
                                                    justify: "space-between",
                                                    align: "center"
                                                }, {
                                                    default: t(()=>[
                                                            s(p, {
                                                                justify: "start",
                                                                align: "center"
                                                            }, {
                                                                default: t(()=>[
                                                                        s(o, {
                                                                            trigger: "hover"
                                                                        }, {
                                                                            trigger: t(()=>[
                                                                                    s(u, {
                                                                                        border: !1,
                                                                                        type: "text",
                                                                                        class: "size-8",
                                                                                        onClick: oe
                                                                                    }, {
                                                                                        icon: t(()=>[
                                                                                                (c(), l(q(e(A)(e(E).back, "text-[16px]"))))
                                                                                            ]),
                                                                                        _: 1
                                                                                    })
                                                                                ]),
                                                                            default: t(()=>[
                                                                                    B(" " + R(e(n)("hsqe.noticeCircular.back")), 1)
                                                                                ]),
                                                                            _: 1
                                                                        }),
                                                                        s(o, {
                                                                            trigger: "click"
                                                                        }, {
                                                                            trigger: t(()=>[
                                                                                    m("span", null, R(e(n)("hsqe.nc.ncReport")), 1)
                                                                                ]),
                                                                            _: 1
                                                                        })
                                                                    ]),
                                                                _: 1
                                                            }),
                                                            s(p, {
                                                                justify: "end"
                                                            }, {
                                                                default: t(()=>[
                                                                        (e(i)?.formSave || e(w).query.type === "add") && !e(k) ? (c(), l(o, {
                                                                            key: 0,
                                                                            trigger: "hover"
                                                                        }, {
                                                                            trigger: t(()=>[
                                                                                    I((c(), l(u, {
                                                                                        type: "primary",
                                                                                        strong: "",
                                                                                        secondary: "",
                                                                                        bordered: "",
                                                                                        class: "size-8"
                                                                                    }, {
                                                                                        icon: t(()=>[
                                                                                                (c(), l(q(e(A)(e(E).save, "text-[16px]"))))
                                                                                            ]),
                                                                                        _: 1
                                                                                    })), [
                                                                                        [
                                                                                            O,
                                                                                            ()=>W(!1),
                                                                                            "1000"
                                                                                        ]
                                                                                    ])
                                                                                ]),
                                                                            default: t(()=>[
                                                                                    B(" " + R(e(n)("hsqe.deficiency.deficiencySave")), 1)
                                                                                ]),
                                                                            _: 1
                                                                        })) : N("", !0),
                                                                        (e(i)?.formSubmit || e(w).query.type === "add") && !e(k) ? (c(), l(o, {
                                                                            key: 1,
                                                                            trigger: "hover"
                                                                        }, {
                                                                            trigger: t(()=>[
                                                                                    I((c(), l(u, {
                                                                                        type: "primary",
                                                                                        strong: "",
                                                                                        secondary: "",
                                                                                        bordered: "",
                                                                                        class: "size-8",
                                                                                        loading: e(S)
                                                                                    }, {
                                                                                        icon: t(()=>[
                                                                                                (c(), l(q(e(A)(e(E).submit, "text-[16px]"))))
                                                                                            ]),
                                                                                        _: 1
                                                                                    }, 8, [
                                                                                        "loading"
                                                                                    ])), [
                                                                                        [
                                                                                            O,
                                                                                            ()=>W(!0),
                                                                                            "1000"
                                                                                        ]
                                                                                    ])
                                                                                ]),
                                                                            default: t(()=>[
                                                                                    B(" " + R(e(n)("hsqe.deficiency.deficiencyCommit")), 1)
                                                                                ]),
                                                                            _: 1
                                                                        })) : N("", !0),
                                                                        e(i)?.formApproval && !e(k) ? (c(), l(o, {
                                                                            key: 2,
                                                                            trigger: "hover"
                                                                        }, {
                                                                            trigger: t(()=>[
                                                                                    s(u, {
                                                                                        type: "primary",
                                                                                        strong: "",
                                                                                        secondary: "",
                                                                                        bordered: "",
                                                                                        class: "size-8",
                                                                                        onClick: ce
                                                                                    }, {
                                                                                        icon: t(()=>[
                                                                                                (c(), l(q(e(A)(e(E).approve, "text-[16px]"))))
                                                                                            ]),
                                                                                        _: 1
                                                                                    })
                                                                                ]),
                                                                            default: t(()=>[
                                                                                    B(" " + R(e(n)("hsqe.deficiency.captainPass")), 1)
                                                                                ]),
                                                                            _: 1
                                                                        })) : N("", !0),
                                                                        e(i)?.formReject && !e(k) ? (c(), l(o, {
                                                                            key: 3,
                                                                            trigger: "hover"
                                                                        }, {
                                                                            trigger: t(()=>[
                                                                                    s(u, {
                                                                                        type: "primary",
                                                                                        strong: "",
                                                                                        secondary: "",
                                                                                        bordered: "",
                                                                                        class: "size-8",
                                                                                        onClick: e(ee)
                                                                                    }, {
                                                                                        icon: t(()=>[
                                                                                                (c(), l(q(e(A)(e(E).returned, "text-[16px]"))))
                                                                                            ]),
                                                                                        _: 1
                                                                                    }, 8, [
                                                                                        "onClick"
                                                                                    ])
                                                                                ]),
                                                                            default: t(()=>[
                                                                                    B(" " + R(e(n)("hsqe.deficiency.captainReject")), 1)
                                                                                ]),
                                                                            _: 1
                                                                        })) : N("", !0),
                                                                        s(o, {
                                                                            trigger: "hover"
                                                                        }, {
                                                                            trigger: t(()=>[
                                                                                    s(u, {
                                                                                        type: "primary",
                                                                                        strong: "",
                                                                                        secondary: "",
                                                                                        bordered: "",
                                                                                        class: "size-8",
                                                                                        onClick: ue
                                                                                    }, {
                                                                                        icon: t(()=>[
                                                                                                (c(), l(q(e(A)(e(E).log, "text-[16px]"))))
                                                                                            ]),
                                                                                        _: 1
                                                                                    })
                                                                                ]),
                                                                            default: t(()=>[
                                                                                    B(" " + R(e(n)("hsqe.deficiency.historicalRecords")), 1)
                                                                                ]),
                                                                            _: 1
                                                                        })
                                                                    ]),
                                                                _: 1
                                                            })
                                                        ]),
                                                    _: 1
                                                })
                                            ])
                                        ]),
                                    default: t(()=>[
                                            m("div", tt, [
                                                s(D, {
                                                    current: e(K),
                                                    status: e(J),
                                                    class: "mb-4"
                                                }, {
                                                    default: t(()=>[
                                                            (c(!0), ke(Ce, null, xe(e(C), (b, _e)=>(c(), l(y, {
                                                                    key: b.value,
                                                                    title: b.label,
                                                                    onClick: (nt)=>ie(_e),
                                                                    class: "cursor-pointer"
                                                                }, null, 8, [
                                                                    "title",
                                                                    "onClick"
                                                                ]))), 128))
                                                        ]),
                                                    _: 1
                                                }, 8, [
                                                    "current",
                                                    "status"
                                                ])
                                            ]),
                                            m("div", at, [
                                                s(qe, {
                                                    name: "slide-fade",
                                                    mode: "out-in"
                                                }, {
                                                    default: t(()=>[
                                                            m("div", null, [
                                                                I(m("div", null, [
                                                                    s(Ge, {
                                                                        ref_key: "basicInfoRef",
                                                                        ref: T,
                                                                        basicInfoEdit: e(i)?.hasBasicInfoEditFlag ?? !1,
                                                                        btnsDisabled: e(i)
                                                                    }, null, 8, [
                                                                        "basicInfoEdit",
                                                                        "btnsDisabled"
                                                                    ])
                                                                ], 512), [
                                                                    [
                                                                        V,
                                                                        e(f) === "basicInfo"
                                                                    ]
                                                                ]),
                                                                I(m("div", null, [
                                                                    s(Je, {
                                                                        ref_key: "causeAnalysisRef",
                                                                        ref: M,
                                                                        basicInfoEdit: e(i)?.hasBasicInfoEditFlag ?? !1,
                                                                        btnsDisabled: e(i)
                                                                    }, null, 8, [
                                                                        "basicInfoEdit",
                                                                        "btnsDisabled"
                                                                    ])
                                                                ], 512), [
                                                                    [
                                                                        V,
                                                                        e(f) === "causeAnalysis"
                                                                    ]
                                                                ]),
                                                                I(m("div", null, [
                                                                    s(Ke, {
                                                                        ref_key: "actionRef",
                                                                        ref: P,
                                                                        basicInfoEdit: e(i)?.hasBasicInfoEditFlag ?? !1,
                                                                        btnsDisabled: e(i)
                                                                    }, null, 8, [
                                                                        "basicInfoEdit",
                                                                        "btnsDisabled"
                                                                    ])
                                                                ], 512), [
                                                                    [
                                                                        V,
                                                                        e(f) === "action"
                                                                    ]
                                                                ]),
                                                                I(m("div", null, [
                                                                    s(Qe, {
                                                                        ref_key: "attachmentsRef",
                                                                        ref: j,
                                                                        basicInfoEdit: e(i)?.hasBasicInfoEditFlag ?? !1,
                                                                        btnsDisabled: e(i)
                                                                    }, null, 8, [
                                                                        "basicInfoEdit",
                                                                        "btnsDisabled"
                                                                    ])
                                                                ], 512), [
                                                                    [
                                                                        V,
                                                                        e(f) === "attachments"
                                                                    ]
                                                                ]),
                                                                I(m("div", null, [
                                                                    s(Ye, {
                                                                        ref_key: "reviewRef",
                                                                        ref: H,
                                                                        basicInfoEdit: e(i)?.hasBasicInfoEditFlag ?? !1,
                                                                        btnsDisabled: e(i)
                                                                    }, null, 8, [
                                                                        "basicInfoEdit",
                                                                        "btnsDisabled"
                                                                    ])
                                                                ], 512), [
                                                                    [
                                                                        V,
                                                                        e(f) === "review"
                                                                    ]
                                                                ])
                                                            ])
                                                        ]),
                                                    _: 1
                                                })
                                            ])
                                        ]),
                                    _: 1
                                })
                            ]),
                            s(x, {
                                onRegister: e(G),
                                ref: "modalRef"
                            }, {
                                default: t(()=>[
                                        s(e(Xe), {
                                            columns: Q,
                                            request: ()=>le(),
                                            "row-key": (b)=>b.id,
                                            ref: "basicTableRef"
                                        }, null, 8, [
                                            "request",
                                            "row-key"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "onRegister"
                            ]),
                            s(x, {
                                onRegister: e(Y),
                                ref: "rejectModalRef",
                                onOnOk: re
                            }, {
                                default: t(()=>[
                                        s(me, {
                                            modelValue: e(_),
                                            "onUpdate:modelValue": v[1] || (v[1] = (b)=>Pe(_) ? _.value = b : _ = b),
                                            rules: se
                                        }, {
                                            default: t(()=>[
                                                    s(pe, {
                                                        label: e(n)("hsqe.planner.modal.reason"),
                                                        path: "comment"
                                                    }, {
                                                        default: t(()=>[
                                                                s(de, {
                                                                    type: "textarea",
                                                                    value: e(_).comment,
                                                                    "onUpdate:value": v[0] || (v[0] = (b)=>e(_).comment = b),
                                                                    class: "h-[200px]"
                                                                }, null, 8, [
                                                                    "value"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "label"
                                                    ])
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "modelValue"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "onRegister"
                            ]),
                            s(Ze, {
                                ref_key: "historyModalRef",
                                ref: U
                            }, null, 512)
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { sa as default, __tla };
