import { d as y, V as S, r, a as J, Z as u, gE as d, ay as R, ac as x, cZ as D, c as N, o as I, w as f, j as i, l as o, c6 as B, X as M, __tla as __tla_0 } from "./index-9PRMimni.js";
import { _ as E } from "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import { _ as $, __tla as __tla_1 } from "./SelectSparePartsModal.vue_vue_type_script_setup_true_lang-Cyl3bsMF.js";
import { F as j, G as q } from "./vesselEquipmentDetails-CJeqdW1Z.js";
import { B as V } from "./Table-0PViRYCf.js";
import { _ as X } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { c as Z } from "./columns-BV6QS8Hv.js";
import "./componentSetting-DVhNDBTO.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./BasicForm-dL_oCSPM.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload-DUsnro3W.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 "./useForm-CKmgcynv.js";
import "./usePageCache-DluHn7Yy.js";
import { __tla as __tla_2 } from "./schemas-Dz7LnyWK.js";
import "./schemas-Cam1kIsU.js";
import "./template-rpthWlT9.js";
import "./useModal-CO65vga3.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 "./useTimeout-BxFilWvD.js";
import "./Flex-CTSf12gq.js";
import "./index-DatBjkM3.js";
import "./columns-BK5KZ8kW.js";
import "./dateUtil-BtafrT1f.js";
let Be;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    Be = y({
        __name: "SpareParts",
        props: {
            selectedJobPlanParams: {},
            isEditable: {
                type: Boolean
            }
        },
        setup (b) {
            const s = b, { t: a } = S(), P = D(), m = r(), l = r(), p = r(), c = r(""), { sparePartsTableColumns: _ } = Z({
                handleReloadTable: t,
                handlePreviewImage: v,
                nodeProps: s
            }), C = J({
                width: 150,
                title: a("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return u(X, {
                        style: "text",
                        actions: [
                            {
                                label: a("common.optionsDelText"),
                                labelShow: !1,
                                icon: u(d, {
                                    iconName: "delete",
                                    iconType: "lineIcon"
                                }),
                                isConfirm: !0,
                                confirmContent: a("common.dialogContentDeleteText"),
                                onPositiveClick: ()=>{
                                    g(e);
                                }
                            }
                        ]
                    });
                }
            });
            R(()=>s.selectedJobPlanParams, (e)=>{
                e && t(!0);
            }, {
                immediate: !0,
                deep: !0
            });
            function T(e) {
                return q({
                    ...e,
                    ...s.selectedJobPlanParams || {}
                });
            }
            function t(e) {
                x(()=>{
                    m.value[e ? "restReload" : "reload"]();
                });
            }
            function h() {
                l.value?.handleOpenModal();
            }
            async function g(e) {
                await j({
                    sparePartNumber: e.sparePartNumber,
                    jobCode: e.jobCode,
                    productCode: e.productCode,
                    model: e.model,
                    serialNumber: e.serialNumber,
                    shipId: e.shipId
                }), P.success(a("common.optionsDelSuccessText")), t();
            }
            function v(e) {
                p.value.openModal(), c.value = e;
            }
            return (e, z)=>{
                const w = E, k = M;
                return I(), N(k, null, {
                    default: f(()=>[
                            i(o(V), {
                                ref_key: "basicTableRef",
                                ref: m,
                                columns: o(_),
                                request: (n)=>T(n),
                                "row-key": (n)=>n.id,
                                immediate: !1,
                                autoScrollX: !0,
                                actionColumn: e.isEditable ? o(C) : null,
                                canResize: !1,
                                "virtual-scroll": ""
                            }, B({
                                _: 2
                            }, [
                                e.isEditable ? {
                                    name: "toolbar",
                                    fn: f(()=>[
                                            i(o(d), {
                                                iconName: "add",
                                                onClick: h
                                            })
                                        ]),
                                    key: "0"
                                } : void 0
                            ]), 1032, [
                                "columns",
                                "request",
                                "row-key",
                                "actionColumn"
                            ]),
                            i($, {
                                ref_key: "selectSparePartsModalRef",
                                ref: l,
                                selectedJobPlanParams: e.selectedJobPlanParams,
                                onSuccess: t
                            }, null, 8, [
                                "selectedJobPlanParams"
                            ]),
                            i(w, {
                                ref_key: "imagePreviewRef",
                                ref: p,
                                url: o(c)
                            }, null, 8, [
                                "url"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Be as default, __tla };
