import { _ as O } from "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import { B as P } from "./BasicForm-dL_oCSPM.js";
import { aV as S, aQ as B, aW as F, aX as M } from "./template-rpthWlT9.js";
import { r as s, V as N, d as V, c as q, o as z, l as m, w as G, j as W, ac as j, __tla as __tla_0 } from "./index-9PRMimni.js";
import { u as L } from "./useModal-CO65vga3.js";
import { u as Q } from "./useForm-CKmgcynv.js";
let Z;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: e } = N();
    await B();
    const X = await S(0);
    function $() {
        const o = s(!1);
        return {
            modalSchemas: [
                {
                    field: "content",
                    component: "NInput",
                    label: e("mdm.smsInspectionTypeConfig.inspectionType"),
                    rules: [
                        {
                            required: !0,
                            message: e("common.chooseText") + " " + e("mdm.smsInspectionTypeConfig.inspectionType"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "contentCn",
                    component: "NInput",
                    label: e("mdm.inspection.chinese"),
                    componentProps: {
                        disabled: o
                    },
                    rules: [
                        {
                            required: !0,
                            message: e("common.inputText") + " " + e("mdm.inspection.chinese"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "auditCode",
                    component: "NInput",
                    label: e("mdm.inspection.code"),
                    componentProps: {
                        disabled: o
                    },
                    rules: [
                        {
                            required: !0,
                            message: e("common.inputText") + " " + e("mdm.inspection.code"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "auditGroup",
                    component: "NInput",
                    label: e("mdm.inspection.group"),
                    componentProps: {
                        disabled: o
                    },
                    rules: [
                        {
                            required: !0,
                            message: e("common.inputText") + " " + e("mdm.inspection.group"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "parentId",
                    component: "NSelect",
                    label: e("mdm.inspection.parentType"),
                    componentProps: {
                        options: X,
                        "label-field": "content",
                        "value-field": "id",
                        disabled: o
                    }
                }
            ],
            methods: {
                updataReadOnly: (n)=>{
                    o.value = n;
                }
            }
        };
    }
    Z = V({
        __name: "Modal",
        emits: [
            "success"
        ],
        setup (o, { expose: d, emit: u }) {
            const n = u, [h, { openModal: b, closeModal: p, setSubLoading: c, setProps: _ }] = L({
                title: "",
                width: 600
            }), { modalSchemas: y, methods: T } = $(), { updataReadOnly: f } = T, [R, { submit: v, setFieldsValue: w, getFieldsValue: g }] = Q({
                gridProps: {
                    cols: 1
                },
                layout: "horizontal",
                labelWidth: "auto",
                schemas: y,
                showActionButtonGroup: !1
            }), x = s(), I = s(), a = s(null), l = s(!1);
            function k(r, i, t) {
                _({
                    title: r
                }), b(), f(!1), l.value = !1, i ? (a.value = i.id, j(()=>{
                    w(i);
                }), t && (l.value = t, f(t))) : a.value = null;
            }
            async function A() {
                if (!await v()) return c(!1);
                a.value ? (await M({
                    id: a.value,
                    ...g()
                }), c(!1), p(), n("success")) : (await F({
                    ...g()
                }), c(!1), p(), n("success"));
            }
            return d({
                showModal: k
            }), (r, i)=>{
                const t = P, C = O;
                return z(), q(C, {
                    ref_key: "modalRef",
                    ref: x,
                    onRegister: m(h),
                    onOnOk: A,
                    showAction: !m(l)
                }, {
                    default: G(()=>[
                            W(t, {
                                ref_key: "formRef",
                                ref: I,
                                onRegister: m(R)
                            }, null, 8, [
                                "onRegister"
                            ])
                        ]),
                    _: 1
                }, 8, [
                    "onRegister",
                    "showAction"
                ]);
            };
        }
    });
});
export { Z as _, __tla };
