import { V as M, bk as q, r as g, Z as k, ae as $, gK as U, d as X, e as j, a as G, gW as d, gX as u, cZ as Z, d9 as z, c as f, o as _, w as r, j as p, W as H, l as n, H as J, aI as Q, p as Y, A as ee, aE as te, B as oe, ca as se, X as ae, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as ie } from "./BasicForm-dL_oCSPM.js";
import { u as ne } from "./useForm-CKmgcynv.js";
import { G as re } from "./template-rpthWlT9.js";
import { f as w } from "./workpermit-ycq2YJDA.js";
import { d as le } from "./download-CIBdrxiA.js";
import { B as ce } from "./Table-0PViRYCf.js";
import { _ as pe } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { d as me, e as de, a as ue } from "./nearMiss-mcPBHzBN.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 "./base64Conver-4Xd-Hzyx.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 it;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const C = q(), { t: l } = M(), N = g([]);
    async function he() {
        const t = await re("NearMiss_Sire_Category");
        N.value = t.map((o)=>{
            const { children: s, ...c } = o;
            return {
                ...c,
                children: o.children.map((m)=>({
                        label: m.label,
                        labelEn: m.labelEn,
                        value: m.value
                    }))
            };
        });
    }
    he();
    let ye, a, b, fe, _e, be;
    ye = [
        {
            field: "nearMissType",
            component: "BasicSelect",
            label: l("hsqe.nearMiss.NearMissType"),
            componentProps: {
                cacheKey: "nm_miss_type",
                block: !0,
                cache: !1,
                labelField: C.getLocale === "en" ? "labelEn" : "label"
            }
        },
        {
            field: "nearMissCategory",
            component: "NCascader",
            label: l("hsqe.nearMiss.NearMissCategory"),
            componentProps: ()=>({
                    options: N.value,
                    showPath: !1,
                    checkStrategy: "child"
                })
        },
        {
            label: l("hsqe.nearMiss.NearMissPosition"),
            field: "nearMissPosition",
            component: "NSelect",
            componentProps: ()=>({
                    options: [
                        {
                            label: l("hsqe.nearMiss.AtSea"),
                            value: "At Sea"
                        },
                        {
                            label: l("hsqe.nearMiss.AtPort"),
                            value: "At Port"
                        }
                    ]
                })
        },
        {
            field: "queryDateList",
            label: l("hsqe.nearMiss.ReportDate"),
            component: "NDatePicker",
            componentProps: {
                type: "daterange",
                valueFormat: "yyyy-MM-dd"
            }
        },
        {
            field: "status",
            component: "BasicSelect",
            label: l("hsqe.nearMiss.Status"),
            componentProps: {
                cacheKey: "nm_form_status",
                block: !0,
                cache: !1,
                labelField: C.getLocale === "en" ? "labelEn" : "label"
            }
        },
        {
            field: "nearMissTitle",
            component: "NInput",
            label: l("hsqe.nearMiss.Title"),
            defaultValue: ""
        }
    ];
    ({ t: a } = M());
    b = q();
    fe = await U();
    _e = [
        {
            label: a("hsqe.nearMiss.AtSea"),
            value: "At Sea"
        },
        {
            label: a("hsqe.nearMiss.AtPort"),
            value: "At Port"
        }
    ];
    be = [
        {
            title: a("hsqe.question.serialNo"),
            key: "index",
            width: 80,
            render (t, o) {
                return o + 1;
            }
        },
        {
            title: a("hsqe.deficiency.vessel"),
            key: b.getLocale === "en" ? "shipNameEn" : "shipName",
            width: 140
        },
        {
            title: a("hsqe.nearMiss.ReportNo"),
            key: "reportNo",
            width: 140
        },
        {
            title: a("hsqe.nearMiss.Title"),
            key: "nearMissTitle",
            width: 140
        },
        {
            title: a("hsqe.nearMiss.NearMissType"),
            key: b.getLocale === "en" ? "nearMissType" : "nearMissTypeName",
            width: 140
        },
        {
            title: a("hsqe.nearMiss.NearMissCategory"),
            key: "nearMissCategory",
            width: 140,
            ifShow: fe === "2"
        },
        {
            title: a("hsqe.nearMiss.NearMissPosition"),
            key: "positionType",
            width: 140,
            render (t) {
                const o = _e.find((s)=>s.value === t.positionType);
                return o ? o.label : t.positionType;
            }
        },
        {
            title: a("hsqe.nearMiss.Status"),
            key: "status",
            width: 140,
            render (t) {
                const o = t.dateToRectify ? w(new Date(t.dateToRectify)) : "", s = new Date(o).getTime() - new Date().getTime(), c = Math.ceil(s / (1e3 * 60 * 60 * 24));
                return k($, {
                    type: "success",
                    bordered: !0,
                    color: t.status !== "closed" && c < 0 ? {
                        color: "#FFF0F0",
                        textColor: "#E06C63",
                        borderColor: "rgba(255,170,171,0.5)"
                    } : t.status !== "closed" && c < 3 ? {
                        color: "#FCFFF0",
                        textColor: "#CF8F04",
                        borderColor: "rgba(228,175,100,0.5)"
                    } : {}
                }, {
                    default: ()=>b.getLocale === "en" ? t.status : t.statusName
                });
            }
        },
        {
            title: a("hsqe.nearMiss.ReportBy"),
            key: "createByName",
            width: 140
        },
        {
            title: a("hsqe.nearMiss.ReportDate"),
            key: "createTime",
            width: 140,
            render (t) {
                return t.createTime ? w(new Date(t.createTime)) : "";
            }
        }
    ];
    it = X({
        __name: "index",
        setup (t) {
            const o = j(), { t: s } = M(), c = g(), m = Z(), x = g([]), [S, { getFieldsValue: D }] = ne({
                schemas: ye,
                labelWidth: "150",
                gridProps: {
                    cols: 6,
                    xGap: 15
                }
            }), v = G({
                width: 120,
                title: s("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return k(pe, {
                        style: "text",
                        actions: [
                            {
                                label: s("hsqe.deficiency.view"),
                                labelShow: !1,
                                icon: d(u.view, "text-[#3F7AE9] text-[20px]"),
                                onClick: ()=>{
                                    o.push({
                                        name: "NearMiss_Edit",
                                        query: {
                                            id: e.id,
                                            type: "view"
                                        }
                                    });
                                }
                            },
                            {
                                label: s("common.optionsEditText"),
                                labelShow: !1,
                                icon: d(u.edit, "text-[20px]"),
                                ifShow: e.canEdit,
                                onClick: ()=>{
                                    o.push({
                                        name: "NearMiss_Edit",
                                        query: {
                                            id: e.id,
                                            type: "edit"
                                        }
                                    });
                                }
                            },
                            {
                                label: s("common.optionsExportText"),
                                labelShow: !1,
                                ifShow: e.canExport,
                                icon: d(u.export, "text-[20px]"),
                                onClick: E.bind(null, e)
                            },
                            {
                                label: s("common.optionsDelText"),
                                labelShow: !1,
                                icon: d(u.delete, "red text-[16px]"),
                                ifShow: e.canDel,
                                onPositiveClick: ()=>{
                                    F(e);
                                },
                                onNegativeClick: ()=>{},
                                isConfirm: !0,
                                confirmContent: s("common.delPop.contRole")
                            }
                        ]
                    });
                }
            });
            function R(e) {
                x.value = e;
            }
            async function P() {
                o.push({
                    name: "NearMiss_Edit",
                    query: {
                        type: "add"
                    }
                });
            }
            async function F(e) {
                await me(e.id), m.success(s("common.optionsDelSuccessText")), h();
            }
            async function E(e) {
                let i = await de(e.id);
                le({
                    url: i.url
                });
            }
            function h() {
                c.value.reload();
            }
            function B(e) {
                h();
            }
            function A(e) {
                h();
            }
            async function L(e, i) {
                return i.queryDateList && i.queryDateList.length > 0 && (i.reportDateStr = i.queryDateList.join(",")), delete i.queryDateList, ue({
                    ...e,
                    ...i
                });
            }
            return (e, i)=>{
                const T = H, I = oe, K = Q, O = J, V = ae, W = z("permission");
                return _(), f(V, null, {
                    default: r(()=>[
                            p(T, {
                                bordered: !1,
                                class: "mb-3 proCard"
                            }, {
                                default: r(()=>[
                                        p(n(ie), {
                                            onRegister: n(S),
                                            onSubmit: B,
                                            onReset: A
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            p(T, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: r(()=>[
                                        p(n(ce), {
                                            columns: n(be),
                                            request: (y)=>L(y, n(D)()),
                                            "row-key": (y)=>y.id,
                                            ref_key: "basicTableRef",
                                            ref: c,
                                            autoScrollX: !0,
                                            "virtual-scroll": "",
                                            actionColumn: n(v),
                                            "onUpdate:checkedRowKeys": R
                                        }, {
                                            tableTitle: r(()=>[
                                                    p(O, null, {
                                                        default: r(()=>[
                                                                p(K, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: r(()=>[
                                                                            te((_(), f(I, {
                                                                                type: "primary",
                                                                                strong: "",
                                                                                bordered: "",
                                                                                secondary: "",
                                                                                class: "size-7",
                                                                                onClick: P
                                                                            }, {
                                                                                icon: r(()=>[
                                                                                        (_(), f(se(n(d)(n(u).add))))
                                                                                    ]),
                                                                                _: 1
                                                                            })), [
                                                                                [
                                                                                    W,
                                                                                    {
                                                                                        action: [
                                                                                            "hsqe:nearMiss:add"
                                                                                        ]
                                                                                    }
                                                                                ]
                                                                            ])
                                                                        ]),
                                                                    default: r(()=>[
                                                                            Y(" " + ee(n(s)("common.addText")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "request",
                                            "row-key",
                                            "actionColumn"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { it as default, __tla };
