import { gI as k, V as _, gL as h, bk as H, hc as I, d as C, r as w, f as E, aw as R, c as D, o as q, w as b, j as c, W as B, l, X as F, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as x } from "./BasicForm-dL_oCSPM.js";
import { u as O } from "./useForm-CKmgcynv.js";
import { g as f } from "./equipmentMainLibrary-bJTzj5mC.js";
import { f as M } from "./material-Fe1jAspV.js";
import { g as $ } from "./requisitionOrder-D0IG9N7e.js";
import { r as j } from "./dictUtils-D8jA3mBt.js";
import { B as A } from "./Table-0PViRYCf.js";
import { a as V } from "./inventoryHistorySparePart-DDex5AJN.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./componentSetting-DVhNDBTO.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 "./usePageCache-DluHn7Yy.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 "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./useModal-CO65vga3.js";
import "./useTimeout-BxFilWvD.js";
import "./Flex-CTSf12gq.js";
let Ot;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const m = await $().then((e)=>e.map((o)=>({
                label: o.shipName,
                labelEn: o.shipNameEn,
                value: o.id
            }))).catch((e)=>(console.error("Error fetching vessel options:", e), []));
    await f("material_category").then((e)=>k(e, (o)=>({
                ...o
            })) ?? []).catch((e)=>(console.error("Error fetching category options:", e), []));
    await f("rob_condition");
    const v = !1, W = await M(), X = await h("outInventory_Type"), K = [
        ...X
    ], { t: r } = _(), p = H();
    await I();
    let z, G, J, Q, U, y, t, Y;
    z = await f("material_category").then((e)=>k(e, (o)=>({
                ...o
            })) ?? []).catch((e)=>(console.error("Error fetching category options:", e), []));
    G = [
        {
            field: "shipId",
            component: "NSelect",
            label: r("sparePartsStock.vessel"),
            componentProps: {
                style: {
                    width: "100%"
                },
                placeholder: r("sparePartsStock.vessel"),
                labelField: p.getLocale === "en" ? "labelEn" : "label",
                options: m
            }
        },
        {
            field: "category",
            component: "NSelect",
            label: r("pms.material.category"),
            componentProps: {
                options: z,
                filterable: !0,
                "label-field": p.getLocale === "en" ? "labelEn" : "label"
            }
        },
        {
            field: "subCategory",
            component: "NSelect",
            label: r("inventoryHistoryStores.subCategory"),
            componentProps: {
                options: W,
                "label-field": p.getLocale === "en" ? "labelEn" : "label"
            }
        },
        {
            field: "sectionCode",
            component: "BasicSelect",
            label: r("inventoryHistoryStores.section"),
            componentProps: {
                block: !0,
                cacheKey: "material_items"
            }
        },
        {
            field: "itemCode",
            component: "NInput",
            label: r("inventoryHistoryStores.itemCode"),
            componentProps: {}
        },
        {
            field: "operationType",
            component: "NSelect",
            label: r("inventoryHistorySparePart.operationType"),
            componentProps: {
                options: K,
                "label-field": p.getLocale === "en" ? "labelEn" : "label"
            }
        },
        {
            field: "startTime",
            label: r("pms.requisition.ApplicationDate"),
            component: "NDatePicker",
            componentProps: {
                type: "daterange",
                valueFormat: "yyyy-MM-dd"
            }
        }
    ];
    J = await h("storage_type");
    Q = await h("outInventory_Type");
    U = [
        ...J,
        ...Q
    ];
    y = H();
    ({ t } = _());
    Y = [
        {
            title: "No.",
            key: "num",
            width: 60,
            render: (e, o)=>o + 1
        },
        {
            title: t("inventoryHistoryStores.vessel"),
            key: y.getLocale === "en" ? "shipNameEn" : "shipName",
            width: 120
        },
        {
            title: t("inventoryHistoryStores.category"),
            key: y.getLocale === "en" ? "categoryLabelEn" : "categoryLabel",
            width: 180
        },
        {
            title: t("inventoryHistoryStores.itemCode"),
            key: "itemCode",
            width: 100
        },
        {
            title: t("inventoryHistoryStores.itemDescription"),
            key: "description",
            width: 180
        },
        {
            title: t("inventoryHistoryStores.brand"),
            key: "brandManufacturer",
            width: 160
        },
        {
            title: t("inventoryHistoryStores.specification"),
            key: "specification",
            width: 120
        },
        {
            title: t("inventoryHistoryStores.uom"),
            key: "uom",
            width: 80
        },
        {
            title: t("inventoryHistoryStores.price"),
            ifShow: v,
            key: "unitPrice",
            width: 100
        },
        {
            title: t("inventoryHistoryStores.initialRob"),
            key: "initialRob",
            width: 100
        },
        {
            title: t("inventoryHistoryStores.quantity"),
            key: "quantity",
            width: 100
        },
        {
            title: t("inventoryHistoryStores.afterRob"),
            key: "afterRob",
            width: 100
        },
        {
            title: t("inventoryHistoryStores.operationType"),
            key: "operationType",
            width: 140,
            render: (e)=>j(U, e.operationType)
        },
        {
            title: t("inventoryHistoryStores.actionEntryDate"),
            key: "dates",
            width: 140
        },
        {
            title: t("inventoryHistoryStores.operator"),
            key: "userName",
            width: 120
        },
        {
            title: t("inventoryHistorySparePart.storageLocationRoom"),
            key: "roomName",
            width: 180
        },
        {
            title: t("inventoryHistorySparePart.storageLocationShelf"),
            key: "shelfName",
            width: 180
        },
        {
            title: t("inventoryHistorySparePart.storageLocationBoxNo"),
            key: "boxName",
            width: 180
        },
        {
            title: t("inventoryHistoryStores.subCategory"),
            key: y.getLocale === "en" ? "subLabelEn" : "subLabel",
            width: 180
        },
        {
            title: t("inventoryHistoryStores.section"),
            key: y.getLocale === "en" ? "sectionLabelEn" : "sectionLabel",
            width: 180
        },
        {
            title: t("inventoryHistoryStores.requisitionNo"),
            key: "requisitionNo",
            width: 180
        },
        {
            title: t("inventoryHistoryStores.poNo"),
            ifShow: v,
            key: "poNo",
            width: 180
        },
        {
            title: t("inventoryHistoryStores.inventoryHistoryStores"),
            key: "taskNumber",
            width: 120
        },
        {
            title: t("inventoryHistoryStores.remark"),
            key: "remarks",
            width: 180
        }
    ];
    Ot = C({
        __name: "index",
        setup (e) {
            const o = w(), g = w(), d = E(), [N, { getFieldsValue: L }] = O({
                gridProps: {
                    cols: 6
                },
                schemas: G
            });
            async function T(S, i) {
                i.startTime && i.startTime.length !== 0 && (i.startTime = i.startTime.join(","));
                let n = "";
                i.shipId ? n = i.shipId : m && m.length && (n = m.map((a)=>a.value).join(",")), d.query.shipId && (i.shipId = Number(d.query.shipId), i.materialId = Number(d.query.materialId));
                const s = await V({
                    ...S,
                    ...i,
                    shipId: n
                });
                try {
                    return s && (o.value = s.list), s;
                } catch  {
                    return {
                        list: [],
                        total: 0
                    };
                }
            }
            function u() {
                g.value?.restReload();
            }
            function P() {
                u();
            }
            return R(()=>{
                P();
            }), (S, i)=>{
                const n = B, s = F;
                return q(), D(s, null, {
                    default: b(()=>[
                            c(n, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: b(()=>[
                                        c(l(x), {
                                            onRegister: l(N),
                                            onSubmit: u,
                                            onReset: u
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            c(n, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: b(()=>[
                                        c(l(A), {
                                            ref_key: "basicTableRef",
                                            ref: g,
                                            columns: l(Y),
                                            request: (a)=>T(a, l(L)()),
                                            "row-key": (a)=>a.id,
                                            autoScrollX: !0,
                                            immediate: !1,
                                            "virtual-scroll": ""
                                        }, null, 8, [
                                            "columns",
                                            "request",
                                            "row-key"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Ot as default, __tla };
