import { V as P, Z as r, N as se, i2 as ae, bk as oe, ae as ne, d as le, dc as re, f as ce, bl as g, r as M, a as de, fc as fe, i3 as ue, hs as pe, e6 as me, aw as he, c as E, o as _, w as o, j as a, W as ye, l as i, D as V, H as ge, h as $, F as W, aI as _e, p as L, A as T, B as Ce, i as ve, i4 as we, i5 as ke, X as be, cZ as xe, gI as q, __tla as __tla_0 } from "./index-9PRMimni.js";
import { u as Re } from "./useOnceQuery-DP5CXD6A.js";
import { B as Se } from "./Table-0PViRYCf.js";
import { _ as Ne } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { B as Me } from "./BasicForm-dL_oCSPM.js";
import { u as Ee } from "./useForm-CKmgcynv.js";
import { b as Le, s as Te, d as Be } from "./vesselsCertificate-Hd_5oIk8.js";
import { _ as Oe, __tla as __tla_1 } from "./index.vue_vue_type_script_setup_true_lang-D_mjQLQA.js";
import { c as Ie, _ as Fe, __tla as __tla_2 } from "./index.vue_vue_type_script_setup_true_lang-iEGRsa4Z.js";
import { _ as De, __tla as __tla_3 } from "./index.vue_vue_type_script_setup_true_lang-uVND5VfJ.js";
import { _ as Ve } from "./index.vue_vue_type_script_setup_true_lang-Ds2SKiQ1.js";
import { a as $e, g as z, I as B } from "./helper-D9DF1oLX.js";
import { _ as We } from "./Flex-CTSf12gq.js";
import { i as b } from "./includes-DdMWPj0t.js";
import "./tabsView-BXskTdVh.js";
import "./findIndex-BgUIH3i1.js";
import "./toInteger-DQeH-nF-.js";
import "./filter-D9g65sdN.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 "./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 "./equipmentMainLibrary-bJTzj5mC.js";
import "./find-D_h_aJYR.js";
import "./requisitionOrder-D0IG9N7e.js";
import "./head-aneRfQQJ.js";
let Vt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_3;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: s } = P(), C = oe();
    function qe() {
        return [
            {
                type: "selection",
                width: 40
            },
            {
                title: s("vesselsCertificate.no"),
                key: "no",
                width: 60,
                render: (p, t)=>{
                    const { expiredFlag: c } = p;
                    return r(We, {
                        class: "overflow-hidden",
                        align: "center",
                        size: "small",
                        wrap: !1
                    }, [
                        c === 1 ? r(se, {
                            size: "14px",
                            color: "#EDB716"
                        }, {
                            default: ()=>r(ae)
                        }) : r("div", {
                            class: "w-[12px] h-[12px]"
                        }),
                        t + 1
                    ]);
                }
            },
            {
                title: s("vesselsCertificate.vessel"),
                key: C.getLocale === "en" ? "shipNameEn" : "shipName",
                width: 100
            },
            {
                title: s("vesselsCertificate.certificateCategory"),
                key: C.getLocale === "en" ? "categoryName" : "categoryChineseName",
                width: 90
            },
            {
                title: s("vesselsCertificate.certificateTypeNo"),
                key: "certificateConfigNo",
                width: 86
            },
            {
                title: s("vesselsCertificate.certificateType"),
                key: C.getLocale === "en" ? "typeName" : "typeChineseName",
                width: 110
            },
            {
                title: s("vesselsCertificate.certificateNameEn"),
                key: "certificateEnglishName",
                width: 170
            },
            {
                title: s("vesselsCertificate.certificateNameCn"),
                key: "certificateChineseName",
                width: 170
            },
            {
                title: s("vesselsCertificate.validityType"),
                key: C.getLocale === "en" ? "termTypeNameEn" : "termTypeName",
                width: 120
            },
            {
                title: s("vesselsCertificate.validity"),
                key: "validity",
                width: 90,
                render (p) {
                    const { validity: t, validityUnit: c } = p, h = $e(c);
                    return t ? `${t} ${h}` : "";
                }
            },
            {
                title: s("vesselsCertificate.status"),
                key: "status",
                width: 160,
                render (p) {
                    const { status: t, dispStatus: c, dispStatusEn: h } = p, m = C.getLocale === "en" ? h : c;
                    return z(t) ? r(ne, {
                        class: "rounded-[5px]",
                        color: z(t)
                    }, {
                        default: ()=>m
                    }) : m;
                }
            },
            {
                title: s("vesselsCertificate.issueDate"),
                key: "issueDate",
                width: 110
            },
            {
                title: s("vesselsCertificate.expireDate"),
                key: "expireDate",
                width: 110
            },
            {
                title: s("vesselsCertificate.validityDays"),
                key: "validDays",
                width: 110
            },
            {
                title: s("vesselsCertificate.lastEndorse"),
                key: "lastEndorse",
                width: 110
            },
            {
                title: s("vesselsCertificate.certificateNo"),
                key: "certificateNo",
                width: 120
            },
            {
                title: s("vesselsCertificate.authority"),
                key: "issueBy",
                width: 110
            }
        ];
    }
    Vt = le({
        __name: "index",
        setup (p) {
            const { t } = P(), { hasPermission: c } = re(), h = ce(), m = xe(), x = g("tableRef"), v = g("infoModalRef"), O = g("historyModalRef"), I = g("cancelModalRef"), F = g("getCertificateListModalRef"), w = M(!1), R = M(!1), k = M([]);
            function U(e, n) {
                k.value = n;
            }
            const H = de({
                width: 120,
                title: t("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return r(Ne, {
                        style: "text",
                        actions: [
                            {
                                label: t("common.optionsViewText"),
                                labelShow: !1,
                                ifShow: b([
                                    0,
                                    1,
                                    2,
                                    3,
                                    4,
                                    5
                                ], e.status),
                                icon: r(fe, {
                                    class: "text-[#2180F1] text-[14px]"
                                }),
                                onClick: j.bind(null, e)
                            },
                            {
                                label: t("common.optionsEditText"),
                                labelShow: !1,
                                ifShow: c([
                                    "vessel:certificate:handle"
                                ]) && b([
                                    0
                                ], e.status) && !0,
                                icon: r("i", {
                                    class: "iconfont icon-a-Frame28"
                                }),
                                onClick: Q.bind(null, e)
                            },
                            {
                                label: t("common.optionsUpdateText"),
                                labelShow: !1,
                                ifShow: c([
                                    "vessel:certificate:handle"
                                ]) && b([
                                    1,
                                    2,
                                    3,
                                    4,
                                    5
                                ], e.status) && !0,
                                icon: r(ue, {
                                    class: "text-[14px]"
                                }),
                                onClick: G.bind(null, e)
                            },
                            {
                                label: t("vesselsCertificate.history"),
                                labelShow: !1,
                                icon: r(pe, {
                                    class: "text-[14px]"
                                }),
                                onClick: J.bind(null, e)
                            },
                            {
                                label: t("vesselsCertificate.cancel"),
                                labelShow: !1,
                                ifShow: c([
                                    "vessel:certificate:handle"
                                ]) && b([
                                    0,
                                    1,
                                    2,
                                    3,
                                    4,
                                    5
                                ], e.status) && B,
                                icon: r(me, {
                                    class: "text-red-500 text-[14px]"
                                }),
                                onClick: Y.bind(null, e)
                            }
                        ]
                    });
                }
            }), [A, { getFieldsValue: S, setFieldsValue: D }] = Ee({
                gridProps: {
                    cols: 6
                },
                schemas: Ie(),
                showAdvancedButton: !1
            });
            function K() {
                const { shipId: e } = S();
                if (!e) {
                    m.warning(t("vesselsCertificate.selectShipWarning"));
                    return;
                }
                F.value?.handleOpenModal({
                    shipId: e
                });
            }
            function X() {
                w.value = !0;
                const { shipId: e, category: n, type: l, status: y } = S();
                if (!e) {
                    m.warning(t("vesselsCertificate.selectShipExportWarning")), w.value = !1;
                    return;
                }
                Le({
                    shipId: e,
                    category: n,
                    type: l,
                    status: y
                }).then((u)=>{
                    const d = document.createElement("a");
                    d.href = u, d.download = u.substring(u.lastIndexOf("/") + 1), d.style.display = "none", document.body.appendChild(d), d.click(), document.body.removeChild(d);
                }).finally(()=>{
                    w.value = !1;
                });
            }
            function Z() {
                R.value = !0, Te({
                    idList: q(i(k), "id"),
                    configList: q(i(k), "certificateConfigId")
                }).then(()=>{
                    m.success(t("vesselsCertificate.syncSuccessful")), te(), f();
                }).finally(()=>{
                    R.value = !1;
                });
            }
            function j(e) {
                v.value?.handleOpenModal({
                    mode: "view",
                    record: e
                });
            }
            function Q(e) {
                v.value?.handleOpenModal({
                    mode: "edit",
                    record: e
                });
            }
            function G(e) {
                v.value?.handleOpenModal({
                    mode: "update",
                    record: e
                });
            }
            function J(e) {
                O.value?.handleOpenModal({
                    record: e
                });
            }
            function Y(e) {
                I.value?.handleOpenModal({
                    record: e
                });
            }
            async function ee(e, n) {
                try {
                    const l = await Be({
                        ...n,
                        ...e
                    });
                    return D({
                        queryWarning: void 0
                    }), l;
                } catch  {
                    return {
                        list: [],
                        total: 0
                    };
                }
            }
            function f() {
                x.value?.restReload(), Re();
            }
            function te() {
                x.value?.setCheckedRowKeys([]);
            }
            return he(()=>{
                const { shipId: e, status: n, queryWarning: l } = h.query;
                !e && !n && !l || D({
                    ...e && {
                        shipId: Number(e)
                    },
                    ...n && {
                        status: n
                    },
                    ...l && {
                        queryWarning: l
                    }
                });
            }), (e, n)=>{
                const l = ye, y = Ce, u = _e, d = ge, ie = be;
                return _(), E(ie, null, {
                    default: o(()=>[
                            a(l, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: o(()=>[
                                        a(i(Me), {
                                            onRegister: i(A),
                                            onSubmit: f,
                                            onReset: f
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            a(l, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: o(()=>[
                                        a(i(Se), {
                                            ref_key: "tableRef",
                                            ref: x,
                                            columns: i(qe)(),
                                            request: (N)=>ee(N, i(S)()),
                                            "row-key": (N)=>N.id,
                                            autoScrollX: !0,
                                            actionColumn: i(H),
                                            onCheckedRowChange: U,
                                            "virtual-scroll": ""
                                        }, {
                                            toolbar: o(()=>[
                                                    i(c)([
                                                        "vessel:certificate:handle"
                                                    ]) ? (_(), E(d, {
                                                        key: 0
                                                    }, {
                                                        default: o(()=>[
                                                                i(B) ? (_(), $(W, {
                                                                    key: 0
                                                                }, [
                                                                    i(B) ? (_(), E(u, {
                                                                        key: 0,
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: o(()=>[
                                                                                a(y, {
                                                                                    type: "primary",
                                                                                    strong: "",
                                                                                    bordered: "",
                                                                                    secondary: "",
                                                                                    class: "size-7",
                                                                                    loading: i(w),
                                                                                    onClick: X
                                                                                }, {
                                                                                    icon: o(()=>n[0] || (n[0] = [
                                                                                            ve("i", {
                                                                                                class: "iconfont icon-Export"
                                                                                            }, null, -1)
                                                                                        ])),
                                                                                    _: 1
                                                                                }, 8, [
                                                                                    "loading"
                                                                                ])
                                                                            ]),
                                                                        default: o(()=>[
                                                                                L(" " + T(i(t)("vesselsCertificate.exportBtn")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })) : V("", !0)
                                                                ], 64)) : (_(), $(W, {
                                                                    key: 1
                                                                }, [
                                                                    a(u, {
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: o(()=>[
                                                                                a(y, {
                                                                                    type: "primary",
                                                                                    strong: "",
                                                                                    bordered: "",
                                                                                    secondary: "",
                                                                                    class: "size-7",
                                                                                    loading: i(R),
                                                                                    disabled: !i(k)?.length,
                                                                                    onClick: Z
                                                                                }, {
                                                                                    icon: o(()=>[
                                                                                            a(i(we))
                                                                                        ]),
                                                                                    _: 1
                                                                                }, 8, [
                                                                                    "loading",
                                                                                    "disabled"
                                                                                ])
                                                                            ]),
                                                                        default: o(()=>[
                                                                                L(" " + T(i(t)("vesselsCertificate.sync")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    }),
                                                                    a(u, {
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: o(()=>[
                                                                                a(y, {
                                                                                    type: "primary",
                                                                                    strong: "",
                                                                                    bordered: "",
                                                                                    secondary: "",
                                                                                    class: "size-7",
                                                                                    onClick: K
                                                                                }, {
                                                                                    icon: o(()=>[
                                                                                            a(i(ke))
                                                                                        ]),
                                                                                    _: 1
                                                                                })
                                                                            ]),
                                                                        default: o(()=>[
                                                                                L(" " + T(i(t)("vesselsCertificate.getCertificateList")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })
                                                                ], 64))
                                                            ]),
                                                        _: 1
                                                    })) : V("", !0)
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "request",
                                            "row-key",
                                            "actionColumn"
                                        ]),
                                        a(Oe, {
                                            ref_key: "getCertificateListModalRef",
                                            ref: F,
                                            onRefresh: f
                                        }, null, 512),
                                        a(Fe, {
                                            ref_key: "infoModalRef",
                                            ref: v,
                                            onRefresh: f
                                        }, null, 512),
                                        a(De, {
                                            ref_key: "historyModalRef",
                                            ref: O,
                                            onRefresh: f
                                        }, null, 512),
                                        a(Ve, {
                                            ref_key: "cancelModalRef",
                                            ref: I,
                                            onRefresh: f
                                        }, null, 512)
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Vt as default, __tla };
