const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/color-CzkgGfmI.js","assets/index-9PRMimni.js","assets/index-CZ_CrH4_.css","assets/toPairs-DMqubSQo.js"])))=>i.map(i=>d[i]);
import { V, bk as M, Z as S, br as he, ae as L, d as fe, dc as _e, r as _, f as ye, a as ge, gW as q, gX as N, d2 as P, cZ as be, aw as ke, c as A, o as R, w as a, j as o, U as xe, M as ve, W as we, i as x, k as Te, l as t, ds as qe, N as $, dA as Ne, cB as Re, H as Ce, B as z, p as j, A as C, eG as Se, h as Ee, c6 as De, D as Ie, aI as Le, S as Pe, X as Ae, ac as je, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as Be } from "./BasicForm-dL_oCSPM.js";
import { u as Ve } from "./useForm-CKmgcynv.js";
import { B as Me } from "./Table-0PViRYCf.js";
import { _ as Ke } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { a as Fe, e as We, d as Oe, g as $e, b as ze } from "./riskAssessment-BQgT9XET.js";
import { X as He } from "./template-rpthWlT9.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./componentSetting-DVhNDBTO.js";
import "./ImageUpload-DUsnro3W.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js";
import "./tabsView-BXskTdVh.js";
import "./BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js";
import "./propTypes-CebMRUpe.js";
import "./BasicSelect-C_uwzMkE.js";
import "./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";
import "./dictionary-BRse4lkf.js";
import "./index-DkvzUEqh.js";
import "./index-kKnqLkWM.js";
import "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
import "./usePageCache-DluHn7Yy.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./print-CT_2hrjP.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./useModal-CO65vga3.js";
import "./useTimeout-BxFilWvD.js";
import "./Flex-CTSf12gq.js";
let Kt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    let d, H, Ue, Xe, Ge, Ze, B, r, U, X, Je, Qe, Ye, et, tt, st;
    ({ t: d } = V());
    H = M();
    Ue = await Fe({
        businessCode: "riskAssessmentShipReport"
    });
    Xe = await He();
    Ge = [
        {
            label: d("hsqe.ra.DeckDepartment"),
            value: 1
        },
        {
            label: d("hsqe.ra.EngineDepartment"),
            value: 2
        }
    ];
    Ze = [
        {
            field: "shipId",
            component: "NSelect",
            label: d("hsqe.deficiency.vessel"),
            componentProps: {
                placeholder: d("hsqe.auditInspection.vesselInspection.formVesselHint"),
                options: Xe,
                "label-field": H.getLocale === "en" ? "shipNameEn" : "shipName",
                "value-field": "id"
            }
        },
        {
            field: "status",
            component: "NSelect",
            label: d("hsqe.ra.status"),
            componentProps: {
                "label-field": H.getLocale === "en" ? "labelEn" : "label",
                placeholder: d("hsqe.ra.status"),
                options: Ue,
                clearable: !0
            }
        },
        {
            field: "dept",
            component: "NSelect",
            label: d("hsqe.ra.dept"),
            componentProps: {
                placeholder: d("hsqe.ra.dept"),
                options: Ge,
                clearable: !0
            }
        },
        {
            field: "reportNo",
            component: "NInput",
            label: d("hsqe.ra.ReportNo"),
            componentProps: {
                placeholder: d("hsqe.ra.ReportNo"),
                clearable: !0
            }
        }
    ];
    B = M();
    ({ t: r } = V());
    ({ getRiskColor: U, tagColorEnum: X } = await he(async ()=>{
        const { getRiskColor: n, tagColorEnum: b } = await import("./color-CzkgGfmI.js");
        return {
            getRiskColor: n,
            tagColorEnum: b
        };
    }, __vite__mapDeps([0,1,2,3])));
    Je = [
        {
            title: r("hsqe.ra.ReportNo"),
            key: "reportNo",
            width: 150
        },
        {
            title: r("hsqe.ra.Vessel"),
            key: "reportNo",
            width: 150,
            render: (n)=>B.getLocale === "en" ? n?.shipNameEn : n?.shipName
        },
        {
            title: r("hsqe.ra.deptType"),
            key: "deptType",
            width: 150,
            render: (n)=>{
                switch(n.deptType){
                    case 1:
                        return r("hsqe.ra.DeckDepartment");
                    case 2:
                        return r("hsqe.ra.EngineDepartment");
                    case 3:
                        return r("hsqe.ra.SecurityAndHealthSafety");
                    case 4:
                        return r("hsqe.ra.CyberSecurity");
                    default:
                        return "";
                }
            }
        },
        {
            title: r("hsqe.ra.workProjectType"),
            key: "workProjectType",
            width: 150,
            render: (n)=>{
                if (n.workType == 1) return r("hsqe.ra.nonroutinework");
                if (n.workType == 0) return r("hsqe.ra.routinework");
            }
        },
        {
            title: r("hsqe.ra.TimeofcompleteWork"),
            key: "estimatedTime",
            width: 150
        },
        {
            title: r("hsqe.ra.MaxInitialRisk"),
            key: "maxRisk",
            width: 150,
            render: (n)=>S(L, {
                    type: "success",
                    bordered: !1,
                    class: "w-[28px] h-[28px] inline-flex items-center justify-center",
                    color: U(n.vesselCategory, n.maxRisk)
                }, {
                    default: ()=>n.maxRisk
                })
        },
        {
            title: r("hsqe.ra.MaxResidualRisk"),
            key: "shipMaxRisk",
            width: 150,
            render: (n)=>{
                if (n.shipMaxRisk) return S(L, {
                    type: "success",
                    bordered: !1,
                    class: "w-[28px] h-[28px] inline-flex items-center justify-center",
                    color: U(n.vesselCategory, n.shipMaxRisk)
                }, {
                    default: ()=>n.shipMaxRisk
                });
            }
        },
        {
            title: r("hsqe.ra.status"),
            key: "effectiveDate",
            width: 280,
            render: (n)=>{
                const { statusNameEn: b, statusName: E, status: l } = n, h = B.getLocale === "en" ? b : E;
                return X[l] ? S(L, {
                    class: "rounded-[5px]",
                    color: X[l]
                }, {
                    default: ()=>h
                }) : h;
            }
        },
        {
            title: r("hsqe.ra.CreatedBy"),
            key: "CreatedBy",
            width: 150,
            render: (n)=>B.getLocale === "en" ? n?.roleNameEn : n?.roleName
        },
        {
            title: r("hsqe.ra.CreateTime"),
            key: "createTime",
            width: 150
        }
    ];
    Qe = {
        class: "flex items-center"
    };
    Ye = {
        class: "w-full menu"
    };
    et = {
        class: "py-3 menu-list"
    };
    tt = {
        key: 0
    };
    st = {
        class: "flex items-center justify-center py-4"
    };
    Kt = fe({
        __name: "index",
        setup (n) {
            const { hasPermission: b } = _e(), E = M(), { t: l } = V(), h = _(""), G = be(), Z = ye(), K = _(), u = _([]), f = _([]), c = _([]), D = _({}), v = _(""), J = ge({
                width: 140,
                title: l("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return S(Ke, {
                        style: "text",
                        actions: [
                            {
                                label: l("common.optionsViewText"),
                                labelShow: !1,
                                icon: q(N.view, "text-[#3F7AE9]"),
                                onClick: ce.bind(null, e)
                            },
                            {
                                label: l("common.optionsEditText"),
                                labelShow: !1,
                                ifShow: ()=>e.canEdit || e.canApprove,
                                icon: q(N.edit),
                                onClick: ie.bind(null, e)
                            },
                            {
                                label: l("common.optionsExportText"),
                                labelShow: !1,
                                icon: q(N.export, "text-[19px]"),
                                ifShow: ()=>e.statusNameEn === "Done",
                                onClick: le.bind(this, e)
                            },
                            {
                                label: l("common.optionsDelText"),
                                labelShow: !1,
                                ifShow: ()=>e.canEdit,
                                icon: q(N.delete, "red text-[16px]"),
                                onPositiveClick: ()=>{
                                    re(e);
                                },
                                onNegativeClick: ()=>{},
                                isConfirm: !0,
                                confirmContent: l("common.delPop.contRole")
                            }
                        ]
                    });
                }
            }), [Q, { getFieldsValue: F, resetFields: Y }] = Ve({
                gridProps: {
                    cols: 5,
                    xGap: 15
                },
                schemas: Ze,
                labelWidth: "auto",
                labelPlacement: "top",
                showAdvancedButton: !1
            });
            function ee() {
                u.value.length ? u.value = [] : u.value = t(f).map((e)=>e.id);
            }
            function te(e) {
                u.value = e;
            }
            async function se() {
                try {
                    const e = await ze();
                    Array.isArray(e) ? (e.forEach((s, i)=>{
                        s.id = "100" + i;
                    }), f.value = e) : f.value = [];
                } catch  {
                    f.value = [];
                }
            }
            function W(e) {
                return e.reduce((s, i)=>(s.push(i.id), i.childrenList && i.childrenList.length > 0 && (s = s.concat(W(i.childrenList))), s), []);
            }
            async function O(e, s) {
                if (s && s.length > 0) {
                    const i = s[0];
                    if (ne(i)) {
                        c.value = c.value;
                        return;
                    }
                }
                c.value = e, v.value = s?.[0].baseId, D.value = s?.[0], await je(), Y();
            }
            function ne(e) {
                return e.childrenList && e.childrenList.length >= 0;
            }
            function I() {
                K.value.reload();
            }
            async function ae(e, s) {
                return s.projectId = D.value?.id, await $e({
                    ...e,
                    ...s
                });
            }
            function oe() {
                let e = {};
                c.value[0] == "1001" ? e = {
                    projectId: 0,
                    type: "add",
                    projectType: "other"
                } : e = {
                    projectId: c.value[0],
                    type: "add",
                    baseId: v.value,
                    projectType: "company"
                }, P.push({
                    query: e,
                    name: "RiskAssessment_Edit"
                });
            }
            function ie(e) {
                P.push({
                    name: "RiskAssessment_Edit",
                    query: {
                        id: e.id,
                        type: "edit",
                        projectId: c.value[0]
                    }
                });
            }
            async function le(e) {
                const s = F();
                s.id = e.id;
                const i = await We(e.id);
                i && typeof i == "string" && window.open(i);
            }
            async function re(e) {
                await Oe({
                    reportId: e.id
                }), G.success(l("common.delPop.success")), I();
            }
            function ce(e) {
                P.push({
                    name: "RiskAssessment_Edit",
                    query: {
                        id: e.id,
                        type: "view",
                        projectId: c.value[0]
                    }
                });
            }
            function de(e) {
                const s = (m, y, g = [])=>{
                    for (const p of m){
                        const w = [
                            ...g,
                            p.id
                        ];
                        if (p.id == y) return {
                            node: p,
                            path: w
                        };
                        if (p.childrenList && p.childrenList.length > 0) {
                            const T = s(p.childrenList, y, w);
                            if (T) return T;
                        }
                    }
                    return null;
                }, i = s(t(f), e);
                if (i) {
                    const { node: m, path: y } = i;
                    u.value = y, c.value = [
                        m.id
                    ], D.value = m, O([
                        m.id
                    ], [
                        m
                    ]);
                }
            }
            function pe() {
                se().then(()=>{
                    u.value = W(t(f));
                    const e = Z.query.projectId;
                    e && setTimeout(()=>{
                        de(e);
                    }, 100);
                });
            }
            return ke(()=>{
                pe();
            }), (e, s)=>{
                const i = Ce, m = Te, y = Re, g = we, p = ve, w = Le, T = Pe, ue = xe, me = Ae;
                return R(), A(me, null, {
                    default: a(()=>[
                            o(ue, {
                                cols: "1 s:1 m:1 l:5 xl:5 2xl:5",
                                responsive: "screen",
                                "x-gap": 12
                            }, {
                                default: a(()=>[
                                        o(p, {
                                            span: "1"
                                        }, {
                                            default: a(()=>[
                                                    o(g, {
                                                        segmented: {
                                                            content: "hard"
                                                        },
                                                        bordered: !1,
                                                        size: "small"
                                                    }, {
                                                        header: a(()=>[
                                                                o(i, null, {
                                                                    default: a(()=>[
                                                                            o(t(z), {
                                                                                type: "primary",
                                                                                ghost: "",
                                                                                "icon-placement": "left",
                                                                                onClick: ee
                                                                            }, {
                                                                                icon: a(()=>[
                                                                                        x("div", Qe, [
                                                                                            o(t($), {
                                                                                                size: "14"
                                                                                            }, {
                                                                                                default: a(()=>[
                                                                                                        o(t(Se))
                                                                                                    ]),
                                                                                                _: 1
                                                                                            })
                                                                                        ])
                                                                                    ]),
                                                                                default: a(()=>[
                                                                                        j(C(t(l)("system.menu.all")) + " " + C(t(u).length ? t(l)("system.menu.retract") : t(l)("system.menu.expand")) + " ", 1)
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: a(()=>[
                                                                x("div", Ye, [
                                                                    o(m, {
                                                                        type: "input",
                                                                        value: t(h),
                                                                        "onUpdate:value": s[0] || (s[0] = (k)=>qe(h) ? h.value = k : null),
                                                                        placeholder: t(l)("system.menu.namePla")
                                                                    }, {
                                                                        suffix: a(()=>[
                                                                                o(t($), {
                                                                                    size: "18",
                                                                                    class: "cursor-pointer"
                                                                                }, {
                                                                                    default: a(()=>[
                                                                                            o(t(Ne))
                                                                                        ]),
                                                                                    _: 1
                                                                                })
                                                                            ]),
                                                                        _: 1
                                                                    }, 8, [
                                                                        "value",
                                                                        "placeholder"
                                                                    ]),
                                                                    x("div", et, [
                                                                        o(y, {
                                                                            "block-line": "",
                                                                            data: t(f),
                                                                            "virtual-scroll": !0,
                                                                            cancelable: !1,
                                                                            expandedKeys: t(u),
                                                                            "selected-keys": t(c),
                                                                            style: {
                                                                                "max-height": "450px"
                                                                            },
                                                                            "key-field": "id",
                                                                            "label-field": t(E).getLocale === "en" ? "operationEnglish" : "operationChinese",
                                                                            "children-field": "childrenList",
                                                                            class: "overflow-hidden",
                                                                            pattern: t(h),
                                                                            "onUpdate:selectedKeys": O,
                                                                            "onUpdate:expandedKeys": te
                                                                        }, null, 8, [
                                                                            "data",
                                                                            "expandedKeys",
                                                                            "selected-keys",
                                                                            "label-field",
                                                                            "pattern"
                                                                        ])
                                                                    ])
                                                                ])
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }),
                                        o(p, {
                                            span: "4"
                                        }, {
                                            default: a(()=>[
                                                    t(c) && t(c).length > 0 ? (R(), Ee("div", tt, [
                                                        o(g, {
                                                            bordered: !1,
                                                            class: "mb-3 proCard"
                                                        }, {
                                                            default: a(()=>[
                                                                    o(t(Be), {
                                                                        onRegister: t(Q),
                                                                        onSubmit: I,
                                                                        onReset: I
                                                                    }, null, 8, [
                                                                        "onRegister"
                                                                    ])
                                                                ]),
                                                            _: 1
                                                        }),
                                                        o(g, {
                                                            bordered: !1,
                                                            class: "proCard"
                                                        }, {
                                                            default: a(()=>[
                                                                    o(t(Me), {
                                                                        ref_key: "basicTableRef",
                                                                        ref: K,
                                                                        columns: t(Je),
                                                                        request: (k)=>ae(k, t(F)()),
                                                                        "row-key": (k)=>k.id,
                                                                        autoScrollX: !0,
                                                                        actionColumn: t(J),
                                                                        immediate: !0,
                                                                        "virtual-scroll": ""
                                                                    }, De({
                                                                        _: 2
                                                                    }, [
                                                                        t(v) && t(v) !== "" || t(c)[0] == "1001" ? {
                                                                            name: "tableTitle",
                                                                            fn: a(()=>[
                                                                                    t(b)([
                                                                                        "hsqe:raReport:add"
                                                                                    ]) ? (R(), A(w, {
                                                                                        key: 0,
                                                                                        trigger: "hover"
                                                                                    }, {
                                                                                        trigger: a(()=>[
                                                                                                o(t(z), {
                                                                                                    type: "primary",
                                                                                                    strong: "",
                                                                                                    bordered: "",
                                                                                                    secondary: "",
                                                                                                    class: "size-7",
                                                                                                    onClick: oe
                                                                                                }, {
                                                                                                    icon: a(()=>s[1] || (s[1] = [
                                                                                                            x("i", {
                                                                                                                class: "iconfont icon-ADD"
                                                                                                            }, null, -1)
                                                                                                        ])),
                                                                                                    _: 1
                                                                                                })
                                                                                            ]),
                                                                                        default: a(()=>[
                                                                                                j(" " + C(t(l)("common.addText")), 1)
                                                                                            ]),
                                                                                        _: 1
                                                                                    })) : Ie("", !0)
                                                                                ]),
                                                                            key: "0"
                                                                        } : void 0
                                                                    ]), 1032, [
                                                                        "columns",
                                                                        "request",
                                                                        "row-key",
                                                                        "actionColumn"
                                                                    ])
                                                                ]),
                                                            _: 1
                                                        })
                                                    ])) : (R(), A(g, {
                                                        key: 1,
                                                        class: "proCard",
                                                        bordered: !1
                                                    }, {
                                                        default: a(()=>[
                                                                x("div", st, [
                                                                    o(T, null, {
                                                                        default: a(()=>[
                                                                                j(C(t(l)("hsqe.auditInspection.selectText")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })
                                                                ])
                                                            ]),
                                                        _: 1
                                                    }))
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Kt as default, __tla };
