import { B as ee } from "./Table-0PViRYCf.js";
import { _ as oe } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { g as ne, d as te, a as le, b as ae, c as se, e as ie, f as ce } from "./role-DXhO1zOz.js";
import { V as S, bk as ue, d as re, r as l, u as pe, a as de, Z as v, aw as me, fq as fe, h as ve, o as ye, j as n, w as t, l as p, W as _e, H as he, aI as ge, p as y, B as be, i as x, cB as ke, cr as we, __tla as __tla_0 } from "./index-9PRMimni.js";
import { c as Ce, _ as Me, __tla as __tla_1 } from "./CreateDrawer.vue_vue_type_script_setup_true_lang-BKL8dbKK.js";
import { B as xe } from "./BasicForm-dL_oCSPM.js";
import { u as Te } from "./useForm-CKmgcynv.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 "./Flex-CTSf12gq.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 "./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 "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
let ho;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    let k, Re, Pe, Ae, Ke, Be;
    ({ t: k } = S());
    Re = ue();
    Pe = await ne();
    Ae = [
        {
            field: "roleType",
            component: "NSelect",
            label: k("common.editPop.roleType"),
            componentProps: {
                placeholder: k("common.editPop.roleType"),
                options: Pe,
                clearable: !0,
                labelField: Re.getLocale === "en" ? "labelEn" : "label"
            }
        },
        {
            field: "keyword",
            component: "NInput",
            label: k("common.editPop.keyword"),
            componentProps: {
                placeholder: k("common.editPop.keyword")
            }
        }
    ];
    Ke = {
        class: "py-3 menu-list"
    };
    Be = {
        class: "py-3 menu-list"
    };
    ho = re({
        __name: "role",
        setup (De) {
            const { t: a } = S(), u = l(null), w = pe(), T = l(), d = l(!1), r = l(!1), L = l("Menu Authority"), _ = l([]), C = l([]), h = l([]), g = l(), R = l(a("common.addPop.titleRole")), b = l([]), P = l([]), A = l([]), m = l(!1), [F, { getFieldsValue: I, resetFields: Se }] = Te({
                gridProps: {
                    cols: 4,
                    xGap: 15
                },
                schemas: Ae,
                labelWidth: "auto",
                labelPlacement: "top",
                showAdvancedButton: !1
            }), E = de({
                width: 160,
                title: a("common.optionsText"),
                key: "action",
                fixed: "right",
                render (e) {
                    return v(oe, {
                        style: "text",
                        actions: [
                            {
                                label: a("common.optionsCompetenceText"),
                                labelShow: !1,
                                icon: v("i", {
                                    class: "iconfont icon-a-shezhi11"
                                }),
                                onClick: H.bind(null, e)
                            },
                            {
                                label: a("common.optionsAppMenuAuthority"),
                                labelShow: !1,
                                icon: v("i", {
                                    class: "iconfont icon-a-shezhi11"
                                }),
                                onClick: G.bind(null, e)
                            },
                            {
                                label: a("common.optionsEditText"),
                                labelShow: !1,
                                icon: v("i", {
                                    class: "iconfont icon-a-Frame28"
                                }),
                                onClick: z.bind(null, e)
                            },
                            {
                                label: a("common.optionsDelText"),
                                labelShow: !1,
                                icon: v("i", {
                                    class: "iconfont icon-Delete red"
                                }),
                                onPositiveClick: ()=>{
                                    q(e);
                                },
                                onNegativeClick: ()=>{},
                                isConfirm: !0,
                                confirmContent: a("common.delPop.cont")
                            }
                        ]
                    });
                }
            }), U = async (e, o)=>se({
                    ...e,
                    ...o
                });
            function N() {
                g.value.openModal();
            }
            function V(e) {
                console.log(e);
            }
            function c(e) {
                T.value[e ? "restReload" : "reload"]();
            }
            async function $(e) {
                try {
                    e.preventDefault(), r.value = !0, await ie(u.value, h.value), w.success(a("common.disablePop.success")), c(), d.value = !1;
                } finally{
                    u.value = null, r.value = !1;
                }
            }
            function z(e) {
                R.value = a("common.editPop.titleRole"), g.value.openModal(), g.value.getInfo(e.id);
            }
            async function q(e) {
                await te(e.id), w.success(a("common.delPop.success")), c();
            }
            async function H(e) {
                const o = await le(e.id);
                h.value = o || [], u.value = e.id, d.value = !0;
            }
            function W(e) {
                h.value = e;
            }
            function O(e) {
                C.value = e;
            }
            function j() {
                d.value = !1;
            }
            async function G(e) {
                u.value = e.id;
                const o = await ae(e.id);
                b.value = o?.assignedMenus || [], P.value = o?.allMenus || [], m.value = !0;
            }
            function X(e) {
                b.value = e;
            }
            function Z(e) {
                A.value = e;
            }
            function J() {
                m.value = !1;
            }
            async function Q(e) {
                try {
                    e.preventDefault(), r.value = !0, await ce(u.value, b.value), w.success(a("common.disablePop.success")), c(), m.value = !1;
                } finally{
                    u.value = null, r.value = !1;
                }
            }
            function K(e) {
                return e.map((o)=>{
                    const s = {
                        ...o
                    };
                    return s.title = a(`common.menu.${o.label}`), s.children && s.children.length > 0 && (s.children = K(s.children)), s;
                });
            }
            return me(async ()=>{
                const e = await fe(!1);
                C.value = e.map((o)=>o.value), e && e.length > 0 ? _.value = K(e) : _.value = e;
            }), (e, o)=>{
                const s = _e, f = be, Y = ge, M = he, B = ke, D = we;
                return ye(), ve("div", null, [
                    n(s, {
                        bordered: !1,
                        class: "mb-3 proCard"
                    }, {
                        default: t(()=>[
                                n(p(xe), {
                                    onRegister: p(F),
                                    onSubmit: o[0] || (o[0] = (i)=>c(!0)),
                                    onReset: o[1] || (o[1] = (i)=>c(!0))
                                }, null, 8, [
                                    "onRegister"
                                ])
                            ]),
                        _: 1
                    }),
                    n(s, {
                        bordered: !1,
                        class: "proCard"
                    }, {
                        default: t(()=>[
                                n(p(ee), {
                                    ref_key: "actionRef",
                                    ref: T,
                                    columns: p(Ce),
                                    request: (i)=>U(i, p(I)()),
                                    "row-key": (i)=>i.id,
                                    actionColumn: E,
                                    autoScrollX: !0,
                                    "onUpdate:checkedRowKeys": V
                                }, {
                                    tableTitle: t(()=>[
                                            n(M, null, {
                                                default: t(()=>[
                                                        n(Y, {
                                                            trigger: "hover"
                                                        }, {
                                                            trigger: t(()=>[
                                                                    n(f, {
                                                                        type: "primary",
                                                                        strong: "",
                                                                        bordered: "",
                                                                        secondary: "",
                                                                        class: "size-8",
                                                                        onClick: N
                                                                    }, {
                                                                        icon: t(()=>o[4] || (o[4] = [
                                                                                x("i", {
                                                                                    class: "iconfont icon-ADD"
                                                                                }, null, -1)
                                                                            ])),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: t(()=>[
                                                                    o[5] || (o[5] = y(" Add "))
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                _: 1
                                            })
                                        ]),
                                    _: 1
                                }, 8, [
                                    "columns",
                                    "request",
                                    "row-key",
                                    "actionColumn"
                                ])
                            ]),
                        _: 1
                    }),
                    n(D, {
                        show: d.value,
                        "onUpdate:show": o[2] || (o[2] = (i)=>d.value = i),
                        "show-icon": !1,
                        preset: "dialog",
                        title: L.value,
                        draggable: ""
                    }, {
                        action: t(()=>[
                                n(M, null, {
                                    default: t(()=>[
                                            n(f, {
                                                "icon-placement": "left",
                                                onClick: j
                                            }, {
                                                default: t(()=>o[6] || (o[6] = [
                                                        y("Close")
                                                    ])),
                                                _: 1
                                            }),
                                            n(f, {
                                                type: "primary",
                                                loading: r.value,
                                                onClick: $
                                            }, {
                                                default: t(()=>o[7] || (o[7] = [
                                                        y("Submit")
                                                    ])),
                                                _: 1
                                            }, 8, [
                                                "loading"
                                            ])
                                        ]),
                                    _: 1
                                })
                            ]),
                        default: t(()=>[
                                x("div", Ke, [
                                    n(B, {
                                        "block-line": "",
                                        checkable: "",
                                        "virtual-scroll": !0,
                                        data: _.value,
                                        expandedKeys: C.value,
                                        "checked-keys": h.value,
                                        "label-field": "title",
                                        "key-field": "key",
                                        style: {
                                            "max-height": "950px",
                                            overflow: "hidden"
                                        },
                                        "onUpdate:checkedKeys": W,
                                        "onUpdate:expandedKeys": O
                                    }, null, 8, [
                                        "data",
                                        "expandedKeys",
                                        "checked-keys"
                                    ])
                                ])
                            ]),
                        _: 1
                    }, 8, [
                        "show",
                        "title"
                    ]),
                    n(D, {
                        show: m.value,
                        "onUpdate:show": o[3] || (o[3] = (i)=>m.value = i),
                        "show-icon": !1,
                        preset: "dialog",
                        title: p(a)("common.optionsAppMenuAuthority"),
                        draggable: ""
                    }, {
                        action: t(()=>[
                                n(M, null, {
                                    default: t(()=>[
                                            n(f, {
                                                "icon-placement": "left",
                                                onClick: J
                                            }, {
                                                default: t(()=>o[8] || (o[8] = [
                                                        y("Close")
                                                    ])),
                                                _: 1
                                            }),
                                            n(f, {
                                                type: "primary",
                                                loading: r.value,
                                                onClick: Q
                                            }, {
                                                default: t(()=>o[9] || (o[9] = [
                                                        y("Submit")
                                                    ])),
                                                _: 1
                                            }, 8, [
                                                "loading"
                                            ])
                                        ]),
                                    _: 1
                                })
                            ]),
                        default: t(()=>[
                                x("div", Be, [
                                    n(B, {
                                        "block-line": "",
                                        checkable: "",
                                        "virtual-scroll": !0,
                                        data: P.value,
                                        expandedKeys: A.value,
                                        "checked-keys": b.value,
                                        "label-field": "label",
                                        "key-field": "key",
                                        style: {
                                            "max-height": "950px",
                                            overflow: "hidden"
                                        },
                                        "onUpdate:checkedKeys": X,
                                        "onUpdate:expandedKeys": Z
                                    }, null, 8, [
                                        "data",
                                        "expandedKeys",
                                        "checked-keys"
                                    ])
                                ])
                            ]),
                        _: 1
                    }, 8, [
                        "show",
                        "title"
                    ]),
                    n(Me, {
                        ref_key: "createDrawerRef",
                        ref: g,
                        title: R.value,
                        permissionList: _.value,
                        onChange: c,
                        onSuccess: c
                    }, null, 8, [
                        "title",
                        "permissionList"
                    ])
                ]);
            };
        }
    });
});
export { ho as default, __tla };
