import { V as D, bk as U, Z as p, N as b, iB as de, B as R, hs as me, iA as fe, hc as _e, d as he, r as f, a as ge, iC as ye, a4 as ve, aw as we, c as E, o as w, w as s, j as n, W as xe, U as be, h as Re, F as ke, a9 as Ce, l, M as Ie, E as B, i as W, A as T, H as Ne, aI as Se, p as qe, ca as Ee, gW as Be, gX as Te, X as De, d8 as X, cZ as Le, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as Me } from "./Table-0PViRYCf.js";
import { B as Oe } from "./BasicForm-dL_oCSPM.js";
import { u as Pe } from "./useForm-CKmgcynv.js";
import { j as Ve, k as Ae } from "./modalSchemas-DN-MflMO.js";
import { a as Z } from "./requisitionOrder-D0IG9N7e.js";
import { h as k } from "./has-CjqcrIOV.js";
import { _ as He } from "./HistoryModal.vue_vue_type_script_setup_true_lang-diG4aMDp.js";
import { _ as $e } from "./NewReadModal.vue_vue_type_script_setup_true_lang-Da00E3ab.js";
import { _ as Fe } from "./SubEquipment.vue_vue_type_script_setup_true_lang-DboDq93V.js";
import { _ as je } from "./ResetModal.vue_vue_type_script_setup_true_lang-C-Ed895s.js";
import { i as We } from "./includes-DdMWPj0t.js";
import { _ as Xe } from "./Flex-CTSf12gq.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 "./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 "./componentSetting-DVhNDBTO.js";
import "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./tabsView-BXskTdVh.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./ImageUpload-DUsnro3W.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-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 "./dictUtils-D8jA3mBt.js";
import "./isNumber-D5aBrEhN.js";
import "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import "./toInteger-DQeH-nF-.js";
let Xt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    let ze, a, Ue, x, Ze, C, z, Ke, Ge, Je;
    ze = U();
    ({ t: a } = D());
    Ue = (r)=>({
            columns: [
                {
                    key: "isSelect",
                    type: "selection",
                    width: 60,
                    multiple: !1
                },
                {
                    title: a("common.messagedefine.Num"),
                    key: "num",
                    width: 60,
                    render: (t, u)=>u + 1
                },
                {
                    title: a("counter.vessel"),
                    key: "shipName",
                    width: 100,
                    render: (t)=>t.shipName ? ze.getLocale === "en" ? t?.shipNameEn : t?.shipName : ""
                },
                {
                    title: a("counter.equipmentCode"),
                    key: "equipmentCode",
                    width: 140
                },
                {
                    title: a("counter.equipmentName"),
                    key: "equipmentName",
                    width: 140
                },
                {
                    title: a("counter.presentReading"),
                    key: "presentReading",
                    width: 140
                },
                {
                    title: a("counter.previousReading"),
                    key: "previousReading",
                    width: 140
                },
                {
                    title: a("counter.rHrsLastOverhaul"),
                    key: "previousOverhaulRHrs",
                    width: 180
                },
                {
                    title: a("counter.additional"),
                    key: "additional",
                    width: 140
                },
                {
                    title: a("counter.readingDate"),
                    key: "readingDate",
                    width: 120
                },
                {
                    title: a("counter.associatedSubEquipment"),
                    key: "readingDate",
                    width: 160,
                    render (t) {
                        return p(R, {
                            type: "primary",
                            text: !0,
                            class: "w-[24px] h-[24px]",
                            onClick: ()=>{
                                r.openSubEquipment(t);
                            }
                        }, {
                            icon: ()=>p(b, {
                                    class: "text-[24px]"
                                }, p(de))
                        });
                    }
                },
                {
                    title: a("counter.history"),
                    key: "readingDate",
                    width: 90,
                    render (t) {
                        return p(R, {
                            type: "primary",
                            text: !0,
                            class: "w-[22px] h-[22px]",
                            onClick: ()=>{
                                r.openHistory(t, "history");
                            }
                        }, {
                            icon: ()=>p(b, {
                                    class: "text-[22px]"
                                }, p(me))
                        });
                    }
                },
                {
                    title: a("counter.reset"),
                    key: "readingDate",
                    width: 90,
                    render (t) {
                        return p(R, {
                            type: "primary",
                            text: !0,
                            class: "w-[22px] h-[22px]",
                            onClick: ()=>{
                                r.openReset(t, "reset");
                            }
                        }, {
                            icon: ()=>p(b, {
                                    class: "text-[22px]"
                                }, p(fe))
                        });
                    }
                }
            ]
        });
    ({ t: x } = D());
    Ze = U();
    C = await _e();
    z = C && C.length > 0 ? C[0].id : "";
    Ke = async ({ shipId: r, code: c = "0", model: t = "0", serialNumber: u = "0" })=>(await Z({
            shipId: r,
            code: c,
            model: t,
            serialNumber: u
        })).map((d)=>({
                label: d.name,
                value: d.code,
                isLeaf: d.ifLeaf,
                raw: d
            }));
    Ge = (r)=>({
            schemas: [
                {
                    field: "shipId",
                    component: "NSelect",
                    label: x("counter.vessel"),
                    componentProps: {
                        options: C,
                        defaultValue: z,
                        clearable: !1,
                        filterable: !0,
                        "label-field": Ze.getLocale === "en" ? "shipNameEn" : "shipName",
                        "value-field": "id",
                        onUpdateValue: (t)=>{
                            r.initCodePrefixOptions(t), r.shipId.value = t;
                        }
                    }
                },
                {
                    field: "equipmentType",
                    component: "NCascader",
                    label: x("counter.equipmentType"),
                    componentProps: ({ formAction: t })=>{
                        const { getFieldsValue: u } = t;
                        return {
                            checkStrategy: "parent",
                            showPath: !1,
                            allowCheckingNotLoaded: !0,
                            options: r.codePrefixOptions.value,
                            remote: !0,
                            onLoad: async (_)=>{
                                k(u(), "shipId") && (r.shipId.value = u().shipId), _.children = await Ke({
                                    shipId: r.shipId.value,
                                    code: _.raw.code,
                                    model: _.raw.model,
                                    serialNumber: _.raw.serialNumber
                                });
                            }
                        };
                    }
                },
                {
                    field: "equipmentCode",
                    component: "NInput",
                    label: x("counter.equipmentCode")
                },
                {
                    field: "equipmentName",
                    component: "NInput",
                    label: x("counter.equipmentName")
                }
            ],
            initShipValue: z
        });
    Je = {
        class: "text-lg"
    };
    Xt = he({
        __name: "index",
        setup (r) {
            const { t: c } = D(), t = Le(), u = f(), _ = f(), d = f(), L = f(), M = f(), h = f(), I = f(!1), N = f(0), O = f(), S = ge({
                alert: {
                    isActive: !1,
                    i18nStr: c("counter.expiredReading"),
                    icon: p(ye),
                    iconBgClass: [
                        "bg-[#ffc55e]"
                    ],
                    field: "ifExpire",
                    count: "N/A"
                }
            }), P = ve(()=>S.alert.isActive);
            function K(e) {
                e.isActive = !e.isActive, y();
            }
            function G() {
                y();
            }
            function J() {
                y();
            }
            function Q({ type: e }) {
                y(e);
            }
            function y(e) {
                d.value && e === "subEquipment" && (d.value.reloadTable(), h.value = void 0), I.value = !1, M.value?.restReload();
            }
            function V({ record: e, type: o }) {
                if (!k(e, "equipmentId") && !X(h.value)) {
                    t.warning(c("counter.unSelect"));
                    return;
                }
                if (k(e, "equipmentId")) h.value = e.equipmentId;
                else if (!X(h.value)) {
                    t.warning(c("counter.noEquipmentId"));
                    return;
                }
                _.value?.showModal(h.value, o);
            }
            function A(e, o) {
                u.value?.showModal(e, o);
                const g = c(o === "resetHistory" ? "counter.counterResetHistory" : "counter.counterReadingHistory");
                u.value?.setProps({
                    title: g
                });
            }
            function Y(e) {
                d.value?.showModal(e);
            }
            function H(e, o) {
                L.value?.showModal(e, o);
            }
            async function ee(e, o) {
                !k(F(), "shipId") && !I.value && (j({
                    shipId: q
                }), o.shipId = q, I.value = !0), o.equipmentType && (o.equipmentType = o.equipmentType.split("-")[0]), N.value = o.shipId, j({
                    shipId: o.shipId
                });
                const g = await Ve({
                    shipId: o.shipId
                });
                return S.alert.count = g.expiredReading.toString(), await Ae({
                    ...e,
                    ...o,
                    ifExpire: P.value
                });
            }
            async function $(e) {
                const o = e.toString() || q.toString(), g = await Z({
                    shipId: o,
                    code: "0",
                    model: "0",
                    serialNumber: "0"
                });
                O.value = g.map((m)=>({
                        label: m.name,
                        value: m.code + "-" + m.model + "-" + m.serialNumber,
                        isLeaf: m.ifLeaf,
                        raw: m
                    }));
            }
            function te(e) {
                console.log("行选中", e.value), h.value = e.value[0];
            }
            function oe(e) {
                e || (h.value = void 0);
            }
            const { columns: ne } = Ue({
                openHistory: A,
                openSubEquipment: Y,
                openReset: H
            }), { schemas: ie, initShipValue: q } = Ge({
                codePrefixOptions: O,
                shipId: N,
                initCodePrefixOptions: $
            }), [se, { getFieldsValue: F, setFieldsValue: j }] = Pe({
                gridProps: {
                    cols: 6
                },
                schemas: ie
            });
            return we(()=>{
                $(N.value);
            }), (e, o)=>{
                const g = b, m = Xe, v = xe, re = Ie, ae = be, le = R, ce = Se, ue = Ne, pe = De;
                return w(), E(pe, null, {
                    default: s(()=>[
                            n(v, {
                                bordered: !1,
                                class: "proCard mb-[8px]"
                            }, {
                                default: s(()=>[
                                        n(ae, {
                                            "x-gap": "60",
                                            "y-gap": "20",
                                            cols: 6
                                        }, {
                                            default: s(()=>[
                                                    (w(!0), Re(ke, null, Ce(l(S), (i)=>(w(), E(re, {
                                                            key: i.field
                                                        }, {
                                                            default: s(()=>[
                                                                    n(v, {
                                                                        bordered: "",
                                                                        class: B([
                                                                            "group",
                                                                            "proCard",
                                                                            "transition-transform",
                                                                            "duration-300",
                                                                            "ease-in-out",
                                                                            "hover:bg-[#66d99c]",
                                                                            "hover:text-white",
                                                                            "hover:translate-y-[-10px]",
                                                                            {
                                                                                "bg-[#66d99c]": i.isActive
                                                                            },
                                                                            {
                                                                                "text-white": i.isActive
                                                                            }
                                                                        ]),
                                                                        "content-class": "px-4 py-2 cursor-pointer select-none",
                                                                        onClick: (Qe)=>K(i)
                                                                    }, {
                                                                        default: s(()=>[
                                                                                W("div", Je, T(i.i18nStr), 1),
                                                                                n(m, {
                                                                                    align: "center",
                                                                                    justify: "space-between"
                                                                                }, {
                                                                                    default: s(()=>[
                                                                                            n(m, {
                                                                                                class: B([
                                                                                                    "p-[4px]",
                                                                                                    "rounded-full",
                                                                                                    "group-hover:bg-white",
                                                                                                    ...i.iconBgClass
                                                                                                ]),
                                                                                                align: "center",
                                                                                                justify: "center"
                                                                                            }, {
                                                                                                default: s(()=>[
                                                                                                        n(g, {
                                                                                                            class: "text-white group-hover:text-[#66d99c]",
                                                                                                            component: i.icon,
                                                                                                            size: "20"
                                                                                                        }, null, 8, [
                                                                                                            "component"
                                                                                                        ])
                                                                                                    ]),
                                                                                                _: 2
                                                                                            }, 1032, [
                                                                                                "class"
                                                                                            ]),
                                                                                            W("div", {
                                                                                                class: B([
                                                                                                    "text-2xl",
                                                                                                    "font-bold",
                                                                                                    "group-hover:text-white",
                                                                                                    {
                                                                                                        "text-red-500": l(We)(i.field, "overdue")
                                                                                                    }
                                                                                                ])
                                                                                            }, T(i.count), 3)
                                                                                        ]),
                                                                                    _: 2
                                                                                }, 1024)
                                                                            ]),
                                                                        _: 2
                                                                    }, 1032, [
                                                                        "class",
                                                                        "onClick"
                                                                    ])
                                                                ]),
                                                            _: 2
                                                        }, 1024))), 128))
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            }),
                            n(v, {
                                bordered: !1,
                                class: "proCard mb-[8px]"
                            }, {
                                default: s(()=>[
                                        n(l(Oe), {
                                            onRegister: l(se),
                                            onSubmit: G,
                                            onReset: J
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            n(v, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: s(()=>[
                                        n(l(Me), {
                                            columns: l(ne),
                                            onCheckedRowChange: te,
                                            request: (i)=>ee(i, l(F)()),
                                            "row-key": (i)=>i.equipmentId,
                                            ref_key: "basicTableRef",
                                            ref: M,
                                            autoScrollX: !0,
                                            "virtual-scroll": ""
                                        }, {
                                            toolbar: s(()=>[
                                                    n(ue, null, {
                                                        default: s(()=>[
                                                                n(ce, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: s(()=>[
                                                                            n(le, {
                                                                                strong: "",
                                                                                secondary: "",
                                                                                type: "primary",
                                                                                class: "pl-[5px] pr-[5px] h-[28px] rounded-md",
                                                                                onClick: o[0] || (o[0] = (i)=>V({
                                                                                        record: null,
                                                                                        type: "newRead"
                                                                                    }))
                                                                            }, {
                                                                                icon: s(()=>[
                                                                                        (w(), E(Ee(l(Be)(l(Te).updateRead))))
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: s(()=>[
                                                                            qe(T(l(c)("counter.updateReading")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "request",
                                            "row-key"
                                        ])
                                    ]),
                                _: 1
                            }),
                            n(He, {
                                ref_key: "historyModalRef",
                                ref: u
                            }, null, 512),
                            n($e, {
                                ref_key: "newReadModalRef",
                                ref: _,
                                onSuccess: Q,
                                onClearData: oe
                            }, null, 512),
                            n(Fe, {
                                ref_key: "subEquipmentRef",
                                ref: d,
                                onNewSubCounter: V,
                                onOpenHistory: A,
                                onOpenReset: H,
                                ifExpire: l(P)
                            }, null, 8, [
                                "ifExpire"
                            ]),
                            n(je, {
                                ref_key: "resetModalRef",
                                ref: L,
                                onSuccess: y
                            }, null, 512)
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Xt as default, __tla };
