import { d as B, V as E, r as m, a as D, Z as c, gE as d, ay as $, ac as F, cZ as O, c as q, o as A, w as T, j as s, l as n, G as W, c6 as X, X as Z, __tla as __tla_0 } from "./index-9PRMimni.js";
import { _ as j } from "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import { c as z, _ as G, __tla as __tla_1 } from "./FormModal.vue_vue_type_script_setup_true_lang-D2nKDzTn.js";
import { B as Q } from "./Table-0PViRYCf.js";
import { _ as U } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { B as H } from "./BasicForm-dL_oCSPM.js";
import { u as J } from "./useForm-CKmgcynv.js";
import { Q as K, D as L } from "./vesselEquipmentDetails-CJeqdW1Z.js";
import { c as Y } from "./columns-BK5KZ8kW.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 "./schemas-Cam1kIsU.js";
import "./material-Fe1jAspV.js";
import "./useModal-CO65vga3.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 "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./tabsView-BXskTdVh.js";
import "./Flex-CTSf12gq.js";
import "./SingleImageUpload-CNx4b9eC.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 "./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";
let Ae;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    Ae = B({
        __name: "index",
        props: {
            selectedTreeItem: {},
            isEditable: {
                type: Boolean
            }
        },
        setup (b) {
            const o = b, { t } = E(), _ = O(), { columns: h } = Y({
                handlePreviewImage: N
            }), { searchSchemas: g } = z(), p = m(), r = m(), u = m(""), f = m(), [v, { getFieldsValue: I, setFieldsValue: w }] = J({
                gridProps: {
                    cols: 12
                },
                schemas: g,
                labelWidth: "auto",
                labelPlacement: "top",
                showAdvancedButton: !1
            }), C = D({
                width: 160,
                title: t("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return c(U, {
                        style: "text",
                        actions: [
                            {
                                label: t("common.optionsViewText"),
                                labelShow: !1,
                                icon: c(d, {
                                    iconName: "view",
                                    iconType: "lineIcon"
                                }),
                                onClick: x.bind(null, e)
                            },
                            {
                                label: t("common.optionsEditText"),
                                labelShow: !1,
                                icon: c(d, {
                                    iconName: "edit",
                                    iconType: "lineIcon"
                                }),
                                onClick: y.bind(null, e),
                                ifShow: ()=>o.isEditable
                            },
                            {
                                label: t("common.optionsDelText"),
                                labelShow: !1,
                                icon: c(d, {
                                    iconName: "delete",
                                    iconType: "lineIcon"
                                }),
                                isConfirm: !0,
                                confirmContent: t("common.dialogContentDeleteText"),
                                onPositiveClick: ()=>{
                                    P(e);
                                },
                                ifShow: ()=>o.isEditable
                            }
                        ]
                    });
                }
            });
            $(()=>o.selectedTreeItem, ()=>{
                F(()=>{
                    w({
                        productCode: o.selectedTreeItem?.code,
                        productName: o.selectedTreeItem?.name
                    }), l(!0);
                });
            }, {
                immediate: !0,
                deep: !0
            });
            function S(e, a) {
                return L({
                    ...e,
                    ...a,
                    productCode: o.selectedTreeItem?.code,
                    model: o.selectedTreeItem?.model,
                    belongToModel: o.selectedTreeItem?.belongToModel,
                    serialNumber: o.selectedTreeItem?.serialNumber,
                    shipId: o.selectedTreeItem?.shipId,
                    productName: ""
                });
            }
            function k() {
                r.value?.handleOpenModal(t("common.addText"), {}, "add");
            }
            function x(e) {
                r.value?.handleOpenModal(t("common.optionsViewText"), e, "view");
            }
            function y(e) {
                r.value?.handleOpenModal(t("common.optionsEditText"), e, "edit");
            }
            async function P(e) {
                await K({
                    partNumber: e.partNumber,
                    productCode: e.productCode,
                    model: e.model,
                    shipId: e.shipId
                }), _.success(t("common.optionsDelSuccessText")), l(!1);
            }
            function l(e) {
                p.value[e ? "restReload" : "reload"]();
            }
            function N(e) {
                f.value.openModal(), u.value = e;
            }
            return (e, a)=>{
                const R = W, V = j, M = Z;
                return A(), q(M, null, {
                    default: T(()=>[
                            s(n(H), {
                                onRegister: n(v),
                                onSubmit: a[0] || (a[0] = (i)=>l(!0)),
                                onReset: a[1] || (a[1] = (i)=>l(!0))
                            }, null, 8, [
                                "onRegister"
                            ]),
                            s(R, {
                                class: "mt-3 mb-4"
                            }),
                            s(n(Q), {
                                ref_key: "basicTableRef",
                                ref: p,
                                columns: n(h),
                                request: (i)=>S(i, n(I)()),
                                "row-key": (i)=>i.id,
                                autoScrollX: !0,
                                actionColumn: n(C),
                                immediate: !1,
                                pagination: {
                                    pageSize: 80
                                },
                                "virtual-scroll": ""
                            }, X({
                                _: 2
                            }, [
                                e.isEditable ? {
                                    name: "toolbar",
                                    fn: T(()=>[
                                            s(n(d), {
                                                iconName: "add",
                                                onClick: k
                                            })
                                        ]),
                                    key: "0"
                                } : void 0
                            ]), 1032, [
                                "columns",
                                "request",
                                "row-key",
                                "actionColumn"
                            ]),
                            s(G, {
                                ref_key: "formModelRef",
                                ref: r,
                                selectedTreeItem: e.selectedTreeItem,
                                onSuccess: a[2] || (a[2] = (i)=>l(!1))
                            }, null, 8, [
                                "selectedTreeItem"
                            ]),
                            s(V, {
                                ref_key: "imagePreviewRef",
                                ref: f,
                                url: n(u)
                            }, null, 8, [
                                "url"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Ae as default, __tla };
