import { _ as q } 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 x } from "./Table-0PViRYCf.js";
import { d as J, V as L, r as u, c as O, o as D, l as e, w as K, j as d, ac as N, cZ as V, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as $ } from "./BasicForm-dL_oCSPM.js";
import { u as j } from "./useForm-CKmgcynv.js";
import { c as A } from "./columns-BV6QS8Hv.js";
import { c as F, __tla as __tla_1 } from "./schemas-Dz7LnyWK.js";
import { D as E, E as I } from "./vesselEquipmentDetails-CJeqdW1Z.js";
import { u as W } from "./useModal-CO65vga3.js";
let ae;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    ae = J({
        __name: "SelectSparePartsModal",
        props: {
            selectedJobPlanParams: {}
        },
        emits: [
            "success"
        ],
        setup (p, { expose: f, emit: b }) {
            const i = p, h = b, m = V(), { t } = L(), r = u(), n = u([]), { sparePartsModalColumns: P } = A(), { sparePartsModalSearchSchemas: R } = F(), [g, { openModal: S, closeModal: w, setSubLoading: l, setProps: y }] = W({
                title: "",
                width: 1200
            }), [k] = j({
                gridProps: {
                    cols: 5
                },
                schemas: R,
                labelWidth: "auto",
                labelPlacement: "top",
                showAdvancedButton: !1
            });
            function C(s, a) {
                return E({
                    showSub: !1,
                    ...s,
                    ...a,
                    ...i.selectedJobPlanParams || {}
                });
            }
            function M() {
                y({
                    title: t("equipmentLibrary.equipmentMainLibrary.selectTitle")
                }), S(), N(()=>{
                    c();
                });
            }
            function c(s) {
                r.value.restReload();
            }
            function T(s) {
                n.value = e(s);
            }
            async function _() {
                if (!n.value?.length) {
                    m.error(t("equipmentLibrary.equipmentMainLibrary.job.selectTips")), l(!1);
                    return;
                }
                try {
                    await I({
                        partNumberList: e(n),
                        ...i.selectedJobPlanParams || {}
                    }), m.success(t("common.optionsAddSuccessText")), w(), l(!1), h("success");
                } catch  {
                    l(!1);
                }
            }
            function v() {
                r.value?.restCheckedRowKeys();
            }
            return f({
                handleOpenModal: M
            }), (s, a)=>{
                const B = q;
                return D(), O(B, {
                    ref: "modalRef",
                    onRegister: e(g),
                    onOnOk: _,
                    onOnClose: v
                }, {
                    default: K(()=>[
                            d(e($), {
                                onRegister: e(k),
                                onSubmit: a[0] || (a[0] = (o)=>c(!0)),
                                onReset: a[1] || (a[1] = (o)=>c(!0))
                            }, null, 8, [
                                "onRegister"
                            ]),
                            d(e(x), {
                                ref_key: "basicTableRef",
                                ref: r,
                                columns: e(P),
                                request: (o)=>C(o, {}),
                                "row-key": (o)=>o.partNumber,
                                immediate: !1,
                                autoScrollX: "",
                                virtualScroll: "",
                                isKeepRowKeys: "",
                                onCheckedRowChange: T
                            }, null, 8, [
                                "columns",
                                "request",
                                "row-key"
                            ])
                        ]),
                    _: 1
                }, 8, [
                    "onRegister"
                ]);
            };
        }
    });
});
export { ae as _, __tla };
