import { _ as B } from "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import { aj as K, aC as F, aB as O } from "./template-rpthWlT9.js";
import { V as y, d as S, u as V, r as j, c as q, o as A, l as n, w as l, j as a, t as D, _ as W, k as $, c8 as z, H as G, c9 as H, ch as L, aj as Y, __tla as __tla_0 } from "./index-9PRMimni.js";
import { p as J, u as Q } from "./tree-Doz7tklw.js";
import { u as X } from "./useModal-CO65vga3.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./vuedraggable.umd-Co2xEC3p.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.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";
import "./index-DkvzUEqh.js";
import { u as Z } from "./useForm-CKmgcynv.js";
let ve;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: c } = y();
    await K();
    await F();
    await O();
    let ee;
    ee = [
        {
            field: "id",
            hidden: !0
        },
        {
            field: "groupName",
            component: "NInput",
            labelWidth: 110,
            label: c("drill.manage.groupTitle"),
            componentProps: {
                placeholder: c("drill.manage.groupPlaceholder")
            },
            rules: [
                {
                    required: !0,
                    message: c("drill.manage.groupRulesMessage"),
                    trigger: [
                        "blur"
                    ]
                }
            ]
        }
    ];
    ve = S({
        __name: "modal",
        props: {
            addType: {
                type: String,
                default: ""
            }
        },
        emits: [
            "success"
        ],
        setup (P, { expose: h, emit: w }) {
            const _ = w, { t: i } = y(), f = V(), v = ()=>({
                    id: null,
                    name: "",
                    nameEn: "",
                    parentId: 0,
                    isParent: 1,
                    orderNum: null,
                    businessKey: "",
                    description: "",
                    type: ""
                });
            i("permission.dept.namePlaceholder");
            const e = j(v()), [x, { openModal: R, setSubLoading: p, closeModal: d, setProps: T }] = X({
                title: i("common.addText"),
                subBtuText: i("common.saveText"),
                cancelText: i("common.cancelText"),
                width: 650
            }), [ae, { getFieldsValue: ne }] = Z({
                schemas: ee,
                labelWidth: "auto",
                gridProps: {
                    cols: 4,
                    xGap: 15
                },
                showAdvancedButton: !1
            }), N = (u)=>{
                e.value = Y(u);
            }, M = (u)=>{
                e.value.parentId = u.id, e.value.type = u.type, e.value.name = "", e.value.nameEn = "", e.value.businessKey = "", e.value.description = "", e.value.isParent = 0;
            };
            async function C() {
                try {
                    e.value.id ? (await Q(e.value), f.success("Edit Success"), _("success"), p(!1), d(), m()) : (await J(e.value), f.success("Add Success"), _("success"), p(!1), d(), m());
                } catch  {
                    p(!1);
                }
            }
            function m() {
                e.value = v();
            }
            return h({
                openModal: R,
                closeModal: d,
                setFormParams: N,
                setChildrenInfo: M,
                setProps: T
            }), (u, t)=>{
                const r = $, o = W, g = H, b = G, I = z, E = L, U = D, k = B;
                return A(), q(k, {
                    onRegister: n(x),
                    ref: "modalRef",
                    class: "basicModal basicFormModal",
                    onOnClose: m,
                    onOnOk: C
                }, {
                    default: l(()=>[
                            a(b, {
                                vertical: ""
                            }, {
                                default: l(()=>[
                                        a(U, {
                                            model: n(e),
                                            ref: "formRef",
                                            "label-placement": "left",
                                            "label-width": 150
                                        }, {
                                            default: l(()=>[
                                                    a(o, {
                                                        label: "Name",
                                                        path: "name"
                                                    }, {
                                                        default: l(()=>[
                                                                a(r, {
                                                                    value: n(e).name,
                                                                    "onUpdate:value": t[0] || (t[0] = (s)=>n(e).name = s)
                                                                }, null, 8, [
                                                                    "value"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    }),
                                                    a(o, {
                                                        label: "NameEn",
                                                        path: "nameEn"
                                                    }, {
                                                        default: l(()=>[
                                                                a(r, {
                                                                    value: n(e).nameEn,
                                                                    "onUpdate:value": t[1] || (t[1] = (s)=>n(e).nameEn = s)
                                                                }, null, 8, [
                                                                    "value"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    }),
                                                    a(o, {
                                                        label: "Type",
                                                        path: "type"
                                                    }, {
                                                        default: l(()=>[
                                                                a(r, {
                                                                    value: n(e).type,
                                                                    "onUpdate:value": t[2] || (t[2] = (s)=>n(e).type = s),
                                                                    disabled: P.addType === "addChildren"
                                                                }, null, 8, [
                                                                    "value",
                                                                    "disabled"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    }),
                                                    a(o, {
                                                        label: "BusinessKey",
                                                        path: "businessKey"
                                                    }, {
                                                        default: l(()=>[
                                                                a(r, {
                                                                    value: n(e).businessKey,
                                                                    "onUpdate:value": t[3] || (t[3] = (s)=>n(e).businessKey = s)
                                                                }, null, 8, [
                                                                    "value"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    }),
                                                    a(o, {
                                                        label: "IsParent",
                                                        path: "isParent"
                                                    }, {
                                                        default: l(()=>[
                                                                a(I, {
                                                                    disabled: "",
                                                                    value: n(e).isParent,
                                                                    "onUpdate:value": t[4] || (t[4] = (s)=>n(e).isParent = s)
                                                                }, {
                                                                    default: l(()=>[
                                                                            a(b, null, {
                                                                                default: l(()=>[
                                                                                        a(g, {
                                                                                            label: "Yes",
                                                                                            value: 1
                                                                                        }),
                                                                                        a(g, {
                                                                                            label: "No",
                                                                                            value: 0
                                                                                        })
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    _: 1
                                                                }, 8, [
                                                                    "value"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    }),
                                                    a(o, {
                                                        label: "Order",
                                                        path: "orderNum"
                                                    }, {
                                                        default: l(()=>[
                                                                a(E, {
                                                                    value: n(e).orderNum,
                                                                    "onUpdate:value": t[5] || (t[5] = (s)=>n(e).orderNum = s)
                                                                }, null, 8, [
                                                                    "value"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    }),
                                                    a(o, {
                                                        label: "Description",
                                                        path: "description"
                                                    }, {
                                                        default: l(()=>[
                                                                a(r, {
                                                                    value: n(e).description,
                                                                    "onUpdate:value": t[6] || (t[6] = (s)=>n(e).description = s),
                                                                    type: "textarea",
                                                                    autosize: {
                                                                        minRows: 3,
                                                                        maxRows: 5
                                                                    }
                                                                }, null, 8, [
                                                                    "value"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "model"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                }, 8, [
                    "onRegister"
                ]);
            };
        }
    });
});
export { ve as _, __tla };
