import { V as _, gL as S, bk as T, hc as D, d as F, f as C, r as u, aw as V, c as O, o as B, w as v, j as y, W as E, l as c, X as j, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as $ } from "./BasicForm-dL_oCSPM.js";
import { u as A } from "./useForm-CKmgcynv.js";
import { B as M } from "./Table-0PViRYCf.js";
import { g as W, a as I } from "./requisitionOrder-D0IG9N7e.js";
import { i as J } from "./inventoryHistorySparePart-DDex5AJN.js";
import { h as L } from "./has-CjqcrIOV.js";
import { r as X } from "./dictUtils-D8jA3mBt.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 $e;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    let h, s, g, z, G, w, K, Q, U, Y, Z, ee, te, t, oe;
    h = await W().then((e)=>e.map((n)=>({
                label: n.shipName,
                labelEn: n.shipNameEn,
                value: n.id
            }))).catch((e)=>(console.error("Error fetching vessel options:", e), []));
    ({ t: s } = _());
    g = T();
    z = await S("outInventory_Type");
    G = [
        ...z
    ];
    w = await D();
    K = w && w.length > 0 ? w[0].id : "";
    Q = async ({ shipId: e, code: n = "0", model: l = "0", serialNumber: a = "0" })=>(await I({
            shipId: e,
            code: n,
            model: l,
            serialNumber: a
        })).map((i)=>({
                label: i.name,
                value: i.code + "-" + i.model + "-" + i.serialNumber,
                isLeaf: i.ifLeaf,
                raw: i
            }));
    U = (e)=>({
            schemas: [
                {
                    field: "shipId",
                    component: "NSelect",
                    label: s("sparePartsStock.vessel"),
                    componentProps: {
                        style: {
                            width: "100%"
                        },
                        placeholder: s("sparePartsStock.vessel"),
                        labelField: g.getLocale === "en" ? "labelEn" : "label",
                        options: h
                    }
                },
                {
                    field: "equipmentType",
                    component: "NCascader",
                    label: s("pms.unplannedJobList.equipmentType"),
                    componentProps: ({ formAction: l })=>{
                        const { getFieldsValue: a, setFieldsValue: m } = l;
                        return {
                            checkStrategy: "parent",
                            showPath: !1,
                            allowCheckingNotLoaded: !0,
                            options: e.codePrefixOptions.value,
                            remote: !0,
                            onLoad: async (i)=>{
                                L(a(), "shipId") && (e.shipId.value = a().shipId), i.children = await Q({
                                    shipId: e.shipId.value,
                                    code: i.raw.code,
                                    model: i.raw.model,
                                    serialNumber: i.raw.serialNumber
                                });
                            }
                        };
                    }
                },
                {
                    field: "equipmentName",
                    component: "NInput",
                    label: s("pms.unplannedJobList.equipmentName"),
                    componentProps: {}
                },
                {
                    field: "partNumber",
                    component: "NInput",
                    label: s("jobOrder.partNumber"),
                    componentProps: {}
                },
                {
                    field: "itemDescription",
                    component: "NInput",
                    label: s("inventoryHistoryStores.itemDescription"),
                    componentProps: {}
                },
                {
                    field: "operationTypeList",
                    component: "NSelect",
                    label: s("inventoryHistorySparePart.operationType"),
                    componentProps: {
                        options: G,
                        multiple: !0,
                        "label-field": g.getLocale === "en" ? "labelEn" : "label"
                    }
                },
                {
                    field: "startTime",
                    label: s("pms.requisition.ApplicationDate"),
                    component: "NDatePicker",
                    componentProps: {
                        type: "daterange",
                        valueFormat: "yyyy-MM-dd"
                    }
                }
            ],
            initShipValue: K
        });
    Y = await S("storage_type");
    Z = await S("outInventory_Type");
    ee = [
        ...Y,
        ...Z
    ];
    te = T();
    ({ t } = _());
    oe = [
        {
            title: "No.",
            key: "num",
            width: 60,
            render: (e, n)=>n + 1
        },
        {
            title: t("inventoryHistorySparePart.vessel"),
            key: te.getLocale === "en" ? "shipNameEn" : "shipName",
            width: 120
        },
        {
            title: t("inventoryHistorySparePart.equipmentName"),
            key: "equipmentName",
            width: 180
        },
        {
            title: t("inventoryHistorySparePart.partNumber"),
            key: "partNumber",
            width: 180
        },
        {
            title: t("inventoryHistorySparePart.itemDescription"),
            key: "itemDescription",
            width: 160
        },
        {
            title: t("inventoryHistorySparePart.quality"),
            key: "quality",
            width: 120
        },
        {
            title: t("inventoryHistorySparePart.uom"),
            key: "uom",
            width: 100
        },
        {
            title: t("inventoryHistorySparePart.initialRob"),
            key: "initialRob",
            width: 100,
            render: (e)=>e.initialRob ? Number(e.initialRob).toFixed(0) : 0
        },
        {
            title: t("inventoryHistorySparePart.quantity"),
            key: "quantity",
            width: 100,
            render: (e)=>e.quantity ? Number(e.quantity).toFixed(0) : 0
        },
        {
            title: t("inventoryHistorySparePart.afterRob"),
            key: "afterRob",
            width: 100,
            render: (e)=>e.afterRob ? Number(e.afterRob).toFixed(0) : 0
        },
        {
            title: t("inventoryHistorySparePart.operationType"),
            key: "operationType",
            width: 140,
            render: (e)=>X(ee, e.operationType)
        },
        {
            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("inventoryHistorySparePart.actionDate"),
            key: "createTime",
            width: 120
        },
        {
            title: t("inventoryHistorySparePart.operator"),
            key: "createName",
            width: 140
        },
        {
            title: t("inventoryHistorySparePart.requisitionNo"),
            key: "requisitionNo",
            width: 140
        },
        {
            title: t("inventoryHistorySparePart.poNo"),
            key: "poNo",
            width: 140
        },
        {
            title: t("inventoryHistoryStores.inventoryHistoryStores"),
            key: "taskNumber",
            width: 140
        },
        {
            title: t("inventoryHistorySparePart.remark"),
            key: "remarks",
            width: 180
        }
    ];
    $e = F({
        __name: "index",
        setup (e) {
            const n = C(), l = u(), a = u(!1), m = u(), i = u();
            async function H(p, o) {
                try {
                    o.startTime && o.startTime.length !== 0 && (o.startTime = o.startTime.join(",")), o.operationTypeList && o.operationTypeList.length !== 0 && (o.operationTypeList = o.operationTypeList.join(",")), !L(N(), "shipId") && !a.value && (P({
                        shipId: d
                    }), o.shipId = d, a.value = !0), i.value = o.shipId, P({
                        shipId: o.shipId
                    });
                    let r = "";
                    return o.shipId ? r = o.shipId : h && h.length && (r = h.map((f)=>f.value).join(",")), await J({
                        ...p,
                        ...o,
                        shipId: r,
                        itemId: n.query?.itemId ?? void 0
                    });
                } catch (r) {
                    return console.error("加载表格数据失败:", r), {
                        list: [],
                        total: 0
                    };
                }
            }
            async function q(p) {
                if (!p) return;
                const o = await I({
                    shipId: p.toString() || d.toString(),
                    code: "0",
                    model: "0",
                    serialNumber: "0"
                });
                m.value = o.map((r)=>({
                        label: r.name,
                        value: r.code,
                        isLeaf: r.ifLeaf,
                        raw: r
                    }));
            }
            const { schemas: R, initShipValue: d } = U({
                codePrefixOptions: m,
                shipId: i
            }), [x, { getFieldsValue: N, setFieldsValue: P }] = A({
                gridProps: {
                    cols: 6
                },
                schemas: R
            });
            function k() {
                a.value = !1, l.value?.restReload();
            }
            return V(async ()=>{
                await q(d);
            }), (p, o)=>{
                const r = E, f = j;
                return B(), O(f, null, {
                    default: v(()=>[
                            y(r, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: v(()=>[
                                        y(c($), {
                                            onRegister: c(x),
                                            onSubmit: k,
                                            onReset: k
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            y(r, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: v(()=>[
                                        y(c(M), {
                                            ref_key: "basicTableRef",
                                            ref: l,
                                            columns: c(oe),
                                            request: (b)=>H(b, c(N)()),
                                            "row-key": (b)=>b.id,
                                            autoScrollX: !0,
                                            "virtual-scroll": ""
                                        }, null, 8, [
                                            "columns",
                                            "request",
                                            "row-key"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { $e as default, __tla };
