import { d as xe, cq as ve, b as be, V as we, r as c, a4 as g, a as Te, Z as s, N as x, hs as ke, cZ as Se, ay as Ce, aw as Ie, c as V, o as z, w as i, i as f, j as a, W as De, k as Me, l as n, ds as Pe, dA as Re, cB as Ae, H as Ee, B as K, p as $, A as D, eG as Ue, D as Be, aI as Le, X as Ne, ht as Oe, hu as Fe, dz as Ve, c_ as ze, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as Ke } from "./BasicForm-dL_oCSPM.js";
import { u as $e } from "./useForm-CKmgcynv.js";
import { B as Ge } from "./Table-0PViRYCf.js";
import { _ as je } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { s as qe, _ as He, __tla as __tla_1 } from "./FormModal.vue_vue_type_script_setup_true_lang-Bw3CDemd.js";
import { c as We, _ as Xe, __tla as __tla_2 } from "./HistoryModal.vue_vue_type_script_setup_true_lang-CTjn79FP.js";
import { d as G, f as Ze, s as Je, e as Qe, g as Ye, i as et, j as tt, k as nt } from "./documentManagement-CH33LgfO.js";
import { d as lt } from "./download-CIBdrxiA.js";
import { g as ot } from "./base64-BbY-I90a.js";
import { _ as at } from "./TreeModal.vue_vue_type_script_setup_true_lang-C5lGNZAO.js";
import { _ as it } from "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload-DUsnro3W.js";
import "./componentSetting-DVhNDBTO.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 "./template-rpthWlT9.js";
import "./account-C850CBTF.js";
import "./base64Conver-4Xd-Hzyx.js";
let on;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    let st, ct, rt, dt, ut, mt;
    st = {
        class: "flex w-100% h-100%"
    };
    ct = {
        class: "w-[310px] min-w-[310px] h-100%"
    };
    rt = {
        class: "flex items-center"
    };
    dt = {
        class: "w-full menu"
    };
    ut = {
        class: "py-3 menu-list"
    };
    mt = {
        class: "flex-1 ml-[8px] min-w-0 h-100% overflow-auto"
    };
    on = xe({
        __name: "index",
        setup (ft) {
            const j = ve(), h = Se(), q = ze(), M = be(), { t } = we(), v = c(""), b = c(), P = c(), w = c(), R = c(), A = c(), p = c([]), d = c([]), E = c([]), _ = c({}), T = c(), U = c(""), H = c(0), B = g(()=>[
                    "captain",
                    "chief_officer",
                    "chief_engineer",
                    "ADMIN"
                ].findIndex((e)=>(M.getUserInfo.roles || []).includes(e)) > -1), W = g(()=>[
                    "ism_general_manager",
                    "doc_quality_manager",
                    "ADMIN"
                ].findIndex((e)=>(M.getUserInfo.roles || []).includes(e)) > -1), k = g(()=>B.value && +_.value?.type == 1 || W.value && +_.value?.type == 0), X = Te({
                width: 280,
                title: t("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return s(je, {
                        style: "text",
                        actions: [
                            {
                                label: t("common.optionsViewText"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-View text-[#3F7AE9] text-[20px]"
                                }),
                                onClick: ae.bind(null, e)
                            },
                            {
                                label: t("document.documentManagement.ExportDocument"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-Export text-[15px]"
                                }),
                                onClick: ie.bind(null, e)
                            },
                            {
                                label: t("common.optionsEditText"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-a-Frame28 text-[20px]"
                                }),
                                onClick: se.bind(null, e),
                                ifShow: ()=>k.value && e.status !== 2
                            },
                            {
                                label: t("document.documentManagement.expire"),
                                labelShow: !1,
                                icon: s(x, {}, {
                                    default: ()=>s(ke)
                                }),
                                onPositiveClick: ()=>{
                                    ue(e);
                                },
                                onNegativeClick: ()=>{},
                                isConfirm: !0,
                                confirmContent: t("document.documentManagement.expireTip"),
                                ifShow: ()=>e.isEffective
                            },
                            {
                                label: t("common.optionsSendText"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-Send1 text-[21px]"
                                }),
                                onClick: re.bind(null, e),
                                ifShow: ()=>e.isSync
                            },
                            {
                                label: t("document.documentManagement.history"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-Log text-[14px]"
                                }),
                                onClick: de.bind(null, e)
                            },
                            {
                                label: t("common.optionsDelText"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-Delete text-[17px]"
                                }),
                                color: "red",
                                isConfirm: !0,
                                confirmContent: t("common.dialogContentDeleteText"),
                                ifShow: ()=>k.value,
                                onPositiveClick: ()=>{
                                    ce(e);
                                }
                            }
                        ]
                    });
                }
            }), [Z, { getFieldsValue: J, resetFields: Q }] = $e({
                gridProps: {
                    cols: 4,
                    xGap: 15
                },
                schemas: qe,
                labelWidth: "auto",
                labelPlacement: "top",
                showAdvancedButton: !1
            });
            function Y({ option: e }) {
                return +e.level == 0 ? "" : s(x, {
                    size: 18,
                    color: "#0ec06a"
                }, {
                    default: ()=>s(Oe)
                });
            }
            const S = g(()=>N(d.value)), L = g(()=>p.value.length === S.value.length && S.value.length > 0), ee = ()=>{
                L.value ? p.value = [] : p.value = S.value;
            }, N = (e)=>{
                const l = [], r = (o)=>{
                    !o || !Array.isArray(o) || o.forEach((m)=>{
                        m.id && l.push(m.id), m.childList && m.childList.length > 0 && r(m.childList);
                    });
                };
                return r(e), l;
            };
            function te(e) {
                p.value = e;
            }
            function ne({ option: e }) {
                let l = [
                    {
                        title: t("common.addText"),
                        key: "add"
                    },
                    {
                        title: t("common.optionsEditText"),
                        key: "edit",
                        hide: [
                            0
                        ]
                    },
                    {
                        title: t("common.optionsDelText"),
                        key: "delete",
                        hide: [
                            0
                        ]
                    }
                ];
                if (+e.type == 1 ? (!B.value || +e.level == 0 && e.childList.length !== 0) && (l = []) : +e.type == 0 && (l = []), !l.length) return "";
                const r = l.filter((o)=>!o.hide || !o.hide.includes(+e.level)).map((o)=>({
                        label: o.title,
                        value: o.key
                    }));
                return s(Ve, {
                    trigger: "click",
                    placement: "right-start",
                    options: r,
                    "on-update:value": (o)=>{
                        o === "add" && me(e), o === "edit" && fe(e), o === "delete" && pe(e);
                    }
                }, {
                    default: ()=>s(x, {
                            size: 20,
                            color: "#c2c2c2",
                            onClick: (o)=>o.stopPropagation()
                        }, {
                            default: ()=>s(Fe)
                        })
                });
            }
            async function C() {
                try {
                    let e = await Ye({});
                    d.value = O(e), F([
                        d.value[0]?.id
                    ], [
                        d.value[0]
                    ]);
                } catch  {
                    d.value = [];
                }
            }
            function O(e) {
                return !e || !Array.isArray(e) ? [] : e.filter((l)=>l.isShow === !0).map((l)=>{
                    const r = {
                        ...l
                    };
                    return l.childList && l.childList.length > 0 && (r.childList = O(l.childList)), r;
                });
            }
            function F(e, l) {
                H.value = l[0].type, E.value = e, _.value = l?.[0], Q(), u();
            }
            function u() {
                P.value.reload();
            }
            async function le(e, l) {
                return et({
                    ...e,
                    ...l,
                    folderId: _.value?.id
                });
            }
            function oe() {
                w.value?.handleOpenModal(t("common.addText"), {});
            }
            async function ae(e) {
                if (e.fileUrl) {
                    await G({
                        type: 0,
                        documentId: e.id
                    });
                    const l = e.fileUrl.slice(e.fileUrl.lastIndexOf(".")).toLowerCase();
                    if ([
                        ".jpg",
                        ".png",
                        ".jpeg",
                        ".svg",
                        ".gif"
                    ].includes(l)) A.value.openModal(), U.value = e.fileUrl;
                    else {
                        const { previewUrl: o } = j;
                        window.open(o + encodeURIComponent(ot.encode(e.fileUrl)), "_blank");
                    }
                } else h.error("View failed");
            }
            async function ie(e) {
                await G({
                    type: 1,
                    documentId: e.id
                }), lt({
                    url: e.fileUrl
                });
            }
            function se(e) {
                w.value?.handleOpenModal(t("common.optionsEditText"), e, !1);
            }
            async function ce(e) {
                await Ze({
                    id: e.id
                }), h.success(t("common.optionsDelSuccessText")), u();
            }
            async function re(e) {
                await Je({
                    id: e.id
                }), h.success(t("noticeCircular.general.sendsuccess")), u();
            }
            async function de(e) {
                R.value?.handleOpenModal(e);
            }
            async function ue(e) {
                await Qe({
                    id: e.id,
                    status: 2
                }), h.success(t("common.disablePop.success")), u();
            }
            function me(e) {
                b.value?.handleOpenModal(t("common.addText"), {
                    level: e.level,
                    pid: e.id,
                    type: e.type,
                    name: +e.type == 1 && +e.level == 0 ? n(T)?.shipName : void 0,
                    shipId: +e.type == 1 ? n(T)?.shipId : void 0
                }, !1);
            }
            function fe(e) {
                b.value?.handleOpenModal(t("common.optionsEditText"), e, !0);
            }
            function pe(e) {
                q.info({
                    title: t("common.delPop.title"),
                    content: t("common.dialogContentDeleteText"),
                    positiveText: t("common.okText"),
                    negativeText: t("common.cancelText"),
                    onPositiveClick: async ()=>{
                        await tt({
                            id: e.id
                        }), h.success(t("common.optionsDelSuccessText")), await C();
                    }
                });
            }
            async function he() {
                const e = await nt({});
                T.value = e[0] || {};
            }
            function _e() {
                C(), he();
            }
            return Ce(()=>d.value, (e)=>{
                e && e.length > 0 && (p.value = N(e));
            }, {
                immediate: !0
            }), Ie(()=>{
                _e();
            }), (e, l)=>{
                const r = Ee, o = Me, m = Ae, I = De, ye = Le, ge = Ne;
                return z(), V(ge, null, {
                    default: i(()=>[
                            f("div", st, [
                                f("div", ct, [
                                    a(I, {
                                        segmented: {
                                            content: "hard"
                                        },
                                        bordered: !1,
                                        size: "small"
                                    }, {
                                        header: i(()=>[
                                                a(r, null, {
                                                    default: i(()=>[
                                                            a(n(K), {
                                                                type: "primary",
                                                                ghost: "",
                                                                "icon-placement": "left",
                                                                onClick: ee
                                                            }, {
                                                                icon: i(()=>[
                                                                        f("div", rt, [
                                                                            a(n(x), {
                                                                                size: "14"
                                                                            }, {
                                                                                default: i(()=>[
                                                                                        a(n(Ue))
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ])
                                                                    ]),
                                                                default: i(()=>[
                                                                        $(D(n(t)("system.menu.all")) + " " + D(n(L) ? n(t)("system.menu.retract") : n(t)("system.menu.expand")) + " ", 1)
                                                                    ]),
                                                                _: 1
                                                            })
                                                        ]),
                                                    _: 1
                                                })
                                            ]),
                                        default: i(()=>[
                                                f("div", dt, [
                                                    a(o, {
                                                        type: "input",
                                                        value: n(v),
                                                        "onUpdate:value": l[0] || (l[0] = (y)=>Pe(v) ? v.value = y : null),
                                                        placeholder: n(t)("system.menu.namePla")
                                                    }, {
                                                        suffix: i(()=>[
                                                                a(n(x), {
                                                                    size: "18",
                                                                    class: "cursor-pointer"
                                                                }, {
                                                                    default: i(()=>[
                                                                            a(n(Re))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "value",
                                                        "placeholder"
                                                    ]),
                                                    f("div", ut, [
                                                        a(m, {
                                                            "block-line": "",
                                                            data: n(d),
                                                            "render-prefix": Y,
                                                            "render-suffix": ne,
                                                            "virtual-scroll": !0,
                                                            cancelable: !1,
                                                            "selected-keys": n(E),
                                                            style: {
                                                                "max-height": "650px"
                                                            },
                                                            "key-field": "id",
                                                            "label-field": "name",
                                                            "children-field": "childList",
                                                            class: "overflow-hidden",
                                                            pattern: n(v),
                                                            "expanded-keys": n(p),
                                                            "onUpdate:selectedKeys": F,
                                                            "onUpdate:expandedKeys": te,
                                                            "default-expand-all": ""
                                                        }, null, 8, [
                                                            "data",
                                                            "selected-keys",
                                                            "pattern",
                                                            "expanded-keys"
                                                        ])
                                                    ])
                                                ])
                                            ]),
                                        _: 1
                                    })
                                ]),
                                f("div", mt, [
                                    a(I, {
                                        bordered: !1,
                                        class: "mb-3 proCard"
                                    }, {
                                        default: i(()=>[
                                                a(n(Ke), {
                                                    onRegister: n(Z),
                                                    onSubmit: u,
                                                    onReset: u
                                                }, null, 8, [
                                                    "onRegister"
                                                ])
                                            ]),
                                        _: 1
                                    }),
                                    a(I, {
                                        bordered: !1,
                                        class: "proCard"
                                    }, {
                                        default: i(()=>[
                                                a(n(Ge), {
                                                    ref_key: "basicTableRef",
                                                    ref: P,
                                                    columns: n(We),
                                                    request: (y)=>le(y, n(J)()),
                                                    "row-key": (y)=>y.id,
                                                    autoScrollX: !0,
                                                    actionColumn: n(X),
                                                    immediate: !1,
                                                    "virtual-scroll": ""
                                                }, {
                                                    toolbar: i(()=>[
                                                            a(r, null, {
                                                                default: i(()=>[
                                                                        n(k) ? (z(), V(ye, {
                                                                            key: 0
                                                                        }, {
                                                                            trigger: i(()=>[
                                                                                    a(n(K), {
                                                                                        type: "primary",
                                                                                        strong: "",
                                                                                        bordered: "",
                                                                                        secondary: "",
                                                                                        class: "size-7",
                                                                                        onClick: oe
                                                                                    }, {
                                                                                        icon: i(()=>l[1] || (l[1] = [
                                                                                                f("i", {
                                                                                                    class: "iconfont icon-ADD"
                                                                                                }, null, -1)
                                                                                            ])),
                                                                                        _: 1
                                                                                    })
                                                                                ]),
                                                                            default: i(()=>[
                                                                                    $(" " + D(n(t)("common.addText")), 1)
                                                                                ]),
                                                                            _: 1
                                                                        })) : Be("", !0)
                                                                    ]),
                                                                _: 1
                                                            })
                                                        ]),
                                                    _: 1
                                                }, 8, [
                                                    "columns",
                                                    "request",
                                                    "row-key",
                                                    "actionColumn"
                                                ])
                                            ]),
                                        _: 1
                                    })
                                ])
                            ]),
                            a(He, {
                                ref_key: "formModalRef",
                                ref: w,
                                selectedTreeItem: n(_),
                                onSuccess: u
                            }, null, 8, [
                                "selectedTreeItem"
                            ]),
                            a(at, {
                                ref_key: "treeModalRef",
                                ref: b,
                                onSuccess: C
                            }, null, 512),
                            a(Xe, {
                                ref_key: "historyModalRef",
                                ref: R
                            }, null, 512),
                            a(it, {
                                ref_key: "imagePreviewRef",
                                ref: A,
                                url: n(U)
                            }, null, 8, [
                                "url"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { on as default, __tla };
