import { V as R, bk as K, d as X, dc as Z, bl as x, r as j, a as H, Z as f, fc as G, e6 as J, cZ as Q, c as E, o as D, w as o, j as a, W as Y, l as i, D as A, H as ee, df as te, p as g, A as v, aI as se, B as ie, i1 as oe, i as ae, X as ne, gI as le, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as re } from "./BasicForm-dL_oCSPM.js";
import { u as ce } from "./useForm-CKmgcynv.js";
import { B as pe } from "./Table-0PViRYCf.js";
import { _ as me } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { c as de, M as b, a as ue, _ as fe, i as ye, g as _e, __tla as __tla_1 } from "./index.vue_vue_type_script_setup_true_lang-_kR3e0IY.js";
import { a as Ce } from "./helper-D9DF1oLX.js";
import { f as he } from "./find-D_h_aJYR.js";
import { i as w } from "./includes-DdMWPj0t.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";
import "./equipmentMainLibrary-bJTzj5mC.js";
import "./findIndex-BgUIH3i1.js";
import "./toInteger-DQeH-nF-.js";
let ct;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    var p = ((s)=>(s[s.UNISSUED = 0] = "UNISSUED", s[s.ISSUED = 1] = "ISSUED", s[s.CANCELLED = 2] = "CANCELLED", s))(p || {});
    const ge = [
        {
            label: "未下发",
            labelEn: "Unissued",
            value: 0
        },
        {
            label: "已下发",
            labelEn: "Issued",
            value: 1
        },
        {
            label: "已废除",
            labelEn: "Cancelled",
            value: 2
        }
    ], T = !1, { t: l } = R(), y = K();
    function ve() {
        return [
            {
                type: "selection",
                key: "_select",
                width: 40,
                disabled (s) {
                    return s.status !== 0;
                }
            },
            {
                title: "No.",
                key: "num",
                width: 60,
                render: (s, e)=>e + 1
            },
            {
                title: l("vesselsCertificateType.certificateCategory"),
                key: y.getLocale === "en" ? "categoryNameEn" : "categoryName",
                width: 150
            },
            {
                title: l("vesselsCertificateType.certificateTypeNo"),
                key: "no",
                width: 160
            },
            {
                title: l("vesselsCertificateType.certificateType"),
                key: y.getLocale === "en" ? "typeNameEn" : "typeName",
                width: 150
            },
            {
                title: l("vesselsCertificateType.certificateNameEn"),
                key: "englishName",
                width: 170
            },
            {
                title: l("vesselsCertificateType.certificateNameCn"),
                key: "chineseName",
                width: 170
            },
            {
                title: l("vesselsCertificateType.validityType"),
                key: y.getLocale === "en" ? "termTypeNameEn" : "termTypeName",
                width: 120
            },
            {
                title: l("vesselsCertificateType.validity"),
                key: "validity",
                width: 100,
                render (s) {
                    const { validity: e, validityUnit: n } = s, m = Ce(n);
                    return e ? `${e} ${m}` : "";
                }
            },
            {
                title: l("vesselsCertificateType.status"),
                key: "status",
                width: 160,
                render (s) {
                    const { status: e } = s, n = he(ge, {
                        value: e
                    });
                    return n ? n[y.getLocale === "en" ? "labelEn" : "label"] : "";
                }
            }
        ];
    }
    ct = X({
        __name: "index",
        setup (s) {
            const { t: e } = R(), { hasPermission: n } = Z(), m = Q(), _ = x("tableRef"), d = x("infoModalRef"), C = j([]);
            function I(t, r) {
                C.value = r;
            }
            const S = H({
                width: 160,
                title: e("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (t) {
                    return f(me, {
                        style: "text",
                        actions: [
                            {
                                label: e("common.optionsViewText"),
                                labelShow: !1,
                                ifShow: w([
                                    p.UNISSUED,
                                    p.ISSUED
                                ], t.status),
                                icon: f(G, {
                                    class: "text-[#2180F1] text-[14px]"
                                }),
                                onClick: P.bind(null, t)
                            },
                            {
                                label: e("common.optionsEditText"),
                                labelShow: !1,
                                ifShow: n([
                                    "vessel:certificateType:handle"
                                ]) && w([
                                    p.UNISSUED
                                ], t.status) && T,
                                icon: f("i", {
                                    class: "iconfont icon-a-Frame28"
                                }),
                                onClick: L.bind(null, t)
                            },
                            {
                                label: e("vesselsCertificateType.cancel"),
                                labelShow: !1,
                                ifShow: n([
                                    "vessel:certificateType:handle"
                                ]) && w([
                                    p.ISSUED
                                ], t.status) && T,
                                icon: f(J, {
                                    class: "text-red-500 text-[14px]"
                                }),
                                onPositiveClick: U.bind(null, t),
                                isConfirm: !0,
                                confirmContent: e("vesselsCertificateType.cancelConfirmText")
                            }
                        ]
                    });
                }
            }), [B, { getFieldsValue: M }] = ce({
                gridProps: {
                    cols: 6
                },
                schemas: de(),
                showAdvancedButton: !1
            });
            function O() {
                ye({
                    configIds: le(i(C), "id")
                }).then(()=>{
                    m.success(e("vesselsCertificateType.issuedSuccessText")), $(), c();
                });
            }
            function F() {
                d.value?.handleOpenModal({
                    mode: b.ADD
                });
            }
            function P(t) {
                d.value?.handleOpenModal({
                    mode: b.VIEW,
                    record: t
                });
            }
            function L(t) {
                d.value?.handleOpenModal({
                    mode: b.EDIT,
                    record: t
                });
            }
            function U(t) {
                ue({
                    id: t.id
                }).then(()=>{
                    m.success(e("vesselsCertificateType.cancelSuccessText")), c();
                });
            }
            async function V(t, r) {
                try {
                    return await _e({
                        ...r,
                        ...t
                    });
                } catch  {
                    return {
                        list: [],
                        total: 0
                    };
                }
            }
            function c() {
                _.value?.restReload();
            }
            function $() {
                _.value?.setCheckedRowKeys([]);
            }
            return (t, r)=>{
                const u = Y, k = ie, N = se, W = te, q = ee, z = ne;
                return D(), E(z, null, {
                    default: o(()=>[
                            a(u, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: o(()=>[
                                        a(i(re), {
                                            onRegister: i(B),
                                            onSubmit: c,
                                            onReset: c
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            a(u, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: o(()=>[
                                        a(i(pe), {
                                            ref_key: "tableRef",
                                            ref: _,
                                            columns: i(ve)(),
                                            request: (h)=>V(h, i(M)()),
                                            "row-key": (h)=>h.id,
                                            autoScrollX: !0,
                                            actionColumn: i(S),
                                            onCheckedRowChange: I,
                                            "virtual-scroll": ""
                                        }, {
                                            toolbar: o(()=>[
                                                    i(T) && i(n)([
                                                        "vessel:certificateType:handle"
                                                    ]) ? (D(), E(q, {
                                                        key: 0
                                                    }, {
                                                        default: o(()=>[
                                                                a(W, {
                                                                    onPositiveClick: O
                                                                }, {
                                                                    trigger: o(()=>[
                                                                            a(N, {
                                                                                trigger: "hover"
                                                                            }, {
                                                                                trigger: o(()=>[
                                                                                        a(k, {
                                                                                            type: "primary",
                                                                                            strong: "",
                                                                                            bordered: "",
                                                                                            secondary: "",
                                                                                            class: "size-7",
                                                                                            disabled: !i(C)?.length
                                                                                        }, {
                                                                                            icon: o(()=>[
                                                                                                    a(i(oe))
                                                                                                ]),
                                                                                            _: 1
                                                                                        }, 8, [
                                                                                            "disabled"
                                                                                        ])
                                                                                    ]),
                                                                                default: o(()=>[
                                                                                        g(" " + v(i(e)("vesselsCertificateType.issuedBtn")), 1)
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: o(()=>[
                                                                            g(" " + v(i(e)("vesselsCertificateType.issuedConfirmText")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }),
                                                                a(N, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: o(()=>[
                                                                            a(k, {
                                                                                type: "primary",
                                                                                strong: "",
                                                                                bordered: "",
                                                                                secondary: "",
                                                                                class: "size-7",
                                                                                onClick: F
                                                                            }, {
                                                                                icon: o(()=>r[0] || (r[0] = [
                                                                                        ae("i", {
                                                                                            class: "iconfont icon-ADD"
                                                                                        }, null, -1)
                                                                                    ])),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: o(()=>[
                                                                            g(" " + v(i(e)("vesselsCertificateType.addBtn")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    })) : A("", !0)
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "request",
                                            "row-key",
                                            "actionColumn"
                                        ])
                                    ]),
                                _: 1
                            }),
                            a(fe, {
                                ref_key: "infoModalRef",
                                ref: d,
                                onRefresh: c
                            }, null, 512)
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { ct as default, __tla };
