import { V as N, bk as I, gL as k, r as O, aD as E, l as P, __tla as __tla_0 } from "./index-9PRMimni.js";
import { g as D, a as w } from "./jobOrder-CGbsc7bp.js";
import { h } from "./has-CjqcrIOV.js";
let g, F, M, x, Q, B, q, T, U, _;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    let R, b, s, S, L, C, y, m, p, c;
    ({ t: R } = N());
    Q = ()=>({
            approvalSchemas: [
                {
                    field: "busId",
                    hidden: !0
                },
                {
                    field: "moduleCode",
                    hidden: !0
                },
                {
                    field: "subModuleCode",
                    hidden: !0
                },
                {
                    field: "comment",
                    component: "NInput",
                    label: R("pms.compareQuotation.reason"),
                    componentProps: {
                        placeholder: R("pms.compareQuotation.reasonPlaceholder"),
                        type: "textarea"
                    },
                    rules: [
                        {
                            required: !0,
                            message: R("pms.compareQuotation.reasonPlaceholder"),
                            trigger: [
                                "blur"
                            ]
                        }
                    ]
                }
            ]
        });
    b = I();
    ({ t: s } = N());
    S = {
        category: "material_category",
        subCategory: "material_sub_category",
        section: "material_items"
    };
    L = Object.values(S).map((n)=>k(n));
    C = await Promise.all(L);
    y = Object.fromEntries(Object.keys(S).map((n, l)=>[
            n,
            C[l]
        ]));
    T = (n)=>{
        const l = O(!1), o = O([]), a = E(async (r, i, e)=>{
            console.log(r), i.value = !0;
            try {
                const t = await D({
                    shipId: n.shipId,
                    ...r
                });
                if (i.value = !1, t) {
                    console.log(t);
                    const d = t && t.length > 0 ? t.map((f)=>({
                            label: f.code + "---" + f.description,
                            value: f
                        })) : [];
                    return e && e(d), d;
                }
            } catch (t) {
                i.value = !1, console.error(t);
            }
        }, 1e3);
        return {
            schemas: [
                {
                    field: "category",
                    component: "NSelect",
                    label: s("jobOrder.category"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        options: y.category,
                        "label-field": b.getLocale === "en" ? "labelEn" : "label"
                    }
                },
                {
                    field: "subCategory",
                    component: "NSelect",
                    label: s("jobOrder.subCategory"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        options: y.subCategory,
                        "label-field": b.getLocale === "en" ? "labelEn" : "label"
                    }
                },
                {
                    field: "section",
                    component: "NSelect",
                    label: s("jobOrder.section"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        options: y.section,
                        "label-field": b.getLocale === "en" ? "labelEn" : "label"
                    }
                },
                {
                    field: "search",
                    component: "NSelect",
                    label: s("jobOrder.itemDescriptionCode"),
                    giProps: {
                        span: 4
                    },
                    componentProps: ({ formAction: r })=>{
                        const { getFieldsValue: i } = r;
                        return {
                            placeholder: s("jobOrder.itemDescriptionCode"),
                            filterable: !0,
                            options: o.value,
                            remote: !0,
                            loading: l.value,
                            clearable: !1,
                            onSearch: async (e)=>{
                                console.log(e);
                                const t = i();
                                if (t.search = void 0, !e.length) {
                                    l.value = !1;
                                    return;
                                }
                                a({
                                    keyword: e,
                                    ...t
                                }, l, (d)=>{
                                    console.log(d), d && (o.value = d);
                                });
                            },
                            onUpdateValue: (e)=>{
                                let t = {
                                    ...e
                                };
                                t.materialItemId = e.id, t.itemCode = e.code, t.itemDescription = e.description, t.ROB = e.rob, t.raw = e, t.materialItemId = e.id, t.id = void 0, t.tableData = void 0, n.setMaterialFormData(t);
                            }
                        };
                    }
                }
            ]
        };
    };
    B = async (n)=>({
            formSchemas: [
                {
                    field: "materialItemId",
                    hidden: !0
                },
                {
                    field: "tableData",
                    hidden: !0
                },
                {
                    field: "raw",
                    hidden: !0
                },
                {
                    field: "id",
                    hidden: !0
                },
                {
                    field: "materialItemId",
                    hidden: !0
                },
                {
                    field: "category",
                    component: "NSelect",
                    label: s("jobOrder.category"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        options: y.category,
                        "label-field": b.getLocale === "en" ? "labelEn" : "label",
                        disabled: !0
                    }
                },
                {
                    field: "subCategory",
                    component: "NSelect",
                    label: s("jobOrder.subCategory"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        options: y.subCategory,
                        "label-field": b.getLocale === "en" ? "labelEn" : "label",
                        disabled: !0
                    }
                },
                {
                    field: "section",
                    component: "NSelect",
                    label: s("jobOrder.section"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        options: y.section,
                        "label-field": b.getLocale === "en" ? "labelEn" : "label",
                        disabled: !0
                    }
                },
                {
                    field: "itemCode",
                    component: "NInput",
                    label: s("jobOrder.itemCode"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        placeholder: s("jobOrder.itemCode"),
                        disabled: !0
                    }
                },
                {
                    field: "ROB",
                    component: "NInput",
                    label: s("jobOrder.ROB"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        placeholder: s("jobOrder.ROB"),
                        disabled: !0
                    }
                },
                {
                    field: "task",
                    component: "NInput",
                    label: s("jobOrder.task"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        placeholder: s("jobOrder.task"),
                        disabled: !0
                    }
                },
                {
                    field: b.getLocale === "en" ? "outboundTypeNameEn" : "outboundTypeName",
                    component: "BasicSelect",
                    label: s("jobOrder.outbound"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        placeholder: s("jobOrder.outbound"),
                        disabled: !0,
                        block: !0,
                        value: "1",
                        cacheKey: "outbound_type"
                    }
                },
                {
                    field: "itemDescription",
                    component: "NInput",
                    label: s("jobOrder.itemDescription"),
                    giProps: {
                        span: 8
                    },
                    componentProps: {
                        placeholder: s("jobOrder.itemDescription"),
                        type: "textarea",
                        disabled: !0
                    }
                },
                {
                    field: "remarks",
                    component: "NInput",
                    label: s("jobOrder.remark"),
                    giProps: {
                        span: 8
                    },
                    componentProps: {
                        placeholder: s("jobOrder.remark"),
                        type: "textarea"
                    }
                }
            ]
        });
    ({ t: m } = N());
    q = ()=>({
            columns: [
                {
                    title: "No.",
                    key: "num",
                    width: 60,
                    render: (l, o)=>o + 1
                },
                {
                    title: m("jobOrder.storageLocationRoom"),
                    key: "roomName",
                    width: 180
                },
                {
                    title: m("jobOrder.storageLocationShelf"),
                    key: "shelfName",
                    width: 180
                },
                {
                    title: m("jobOrder.storageLocationBox"),
                    key: "boxName",
                    width: 180
                },
                {
                    title: m("jobOrder.stock"),
                    key: "quantity",
                    width: 120
                },
                {
                    title: m("jobOrder.quantity"),
                    key: "useQuantity",
                    width: 90,
                    editCellRender: (l)=>l ? l.toFixed(2) : 0,
                    editComponent: "NInputNumber",
                    editComponentProps: {
                        min: 0,
                        precision: 2,
                        keyboard: {
                            ArrowUp: !1,
                            ArrowDown: !1
                        },
                        showButton: !1
                    },
                    editRow: !0,
                    editRule: (l, o)=>{
                        if (console.log(o), h(o.editValueRefs, "useQuantity")) {
                            if (((r)=>r == null || r === "" || r === 0)(o.editValueRefs.useQuantity)) return Promise.resolve(m("jobOrder.useQuantityRequired"));
                        } else return Promise.resolve(m("jobOrder.useQuantityRequired"));
                        return Number(l) > Number(o.quantity) ? Promise.resolve(m("jobOrder.reconditionedQuantityExceedStock")) : Promise.resolve("");
                    },
                    edit: !0
                }
            ]
        });
    ({ t: p } = N());
    _ = (n)=>{
        const l = O(!1), o = O([]), a = E(async (r, i, e)=>{
            i.value = !0;
            const t = P(n.equipmentInfo);
            try {
                const d = await w({
                    shipId: n.shipId,
                    equipmentCode: t ? t.equipmentCode : void 0,
                    model: t ? t.model : void 0,
                    ...r
                });
                if (i.value = !1, d) {
                    console.log(d);
                    const f = d.list && d.list.length > 0 ? d.list.map((j)=>({
                            label: j.partNumber + "---" + j.itemDescription,
                            value: j
                        })) : [];
                    return e && e(f), f;
                }
            } catch (d) {
                i.value = !1, console.error(d);
            }
        }, 1e3);
        return {
            schemas: [
                {
                    field: "partNumber",
                    component: "NSelect",
                    label: p("jobOrder.partNumberItem"),
                    giProps: {
                        span: 1
                    },
                    componentProps: {
                        placeholder: p("jobOrder.partNumberItem"),
                        filterable: !0,
                        options: o,
                        remote: !0,
                        loading: l,
                        clearable: !1,
                        onSearch: async (r)=>{
                            if (!r.length) {
                                l.value = !1;
                                return;
                            }
                            a({
                                NumOrDes: r
                            }, l, (i)=>{
                                i && (o.value = i);
                            });
                        },
                        onUpdateValue: (r)=>{
                            const i = r;
                            i.sparePartNumber = r.partNumber, i.equipmentName = r.productName, n.setSparePartsFormData({
                                ...i,
                                raw: r,
                                tableData: void 0
                            });
                        }
                    }
                }
            ]
        };
    };
    x = async (n)=>({
            formSchemas: [
                {
                    field: "itemId",
                    hidden: !0
                },
                {
                    field: "tableData",
                    hidden: !0
                },
                {
                    field: "raw",
                    hidden: !0
                },
                {
                    field: "id",
                    hidden: !0
                },
                {
                    field: "equipmentName",
                    component: "NInput",
                    label: p("jobOrder.equipmentName"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        disabled: !0
                    }
                },
                {
                    field: "sparePartNumber",
                    component: "NInput",
                    label: p("jobOrder.partNumber"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        disabled: !0
                    }
                },
                {
                    field: "ROB",
                    component: "NInput",
                    label: p("jobOrder.ROB"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        disabled: !0
                    }
                },
                {
                    field: "task",
                    component: "NInput",
                    label: p("jobOrder.task"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        disabled: !0
                    }
                },
                {
                    field: "outboundType",
                    component: "BasicSelect",
                    label: p("jobOrder.outboundType"),
                    giProps: {
                        span: 4
                    },
                    componentProps: {
                        disabled: !0,
                        block: !0,
                        value: "1",
                        cacheKey: "outbound_type"
                    }
                },
                {
                    field: "itemDescription",
                    component: "NInput",
                    label: p("jobOrder.itemDescription"),
                    giProps: {
                        span: 16
                    },
                    componentProps: {
                        type: "textarea",
                        disabled: !0
                    }
                },
                {
                    field: "remarks",
                    component: "NInput",
                    label: p("jobOrder.remark"),
                    giProps: {
                        span: 16
                    },
                    componentProps: {
                        type: "textarea"
                    }
                }
            ]
        });
    ({ t: c } = N());
    U = (n)=>({
            columns: [
                {
                    title: "No.",
                    key: "num",
                    width: 60,
                    render: (o, a)=>a + 1
                },
                {
                    title: c("jobOrder.storageLocationRoom"),
                    key: "roomName",
                    width: 180
                },
                {
                    title: c("jobOrder.storageLocationShelf"),
                    key: "shelfName",
                    width: 180
                },
                {
                    title: c("jobOrder.storageLocationBox"),
                    key: "boxName",
                    width: 180
                },
                {
                    title: c("jobOrder.normalStock"),
                    key: "normalStock",
                    width: 110
                },
                {
                    title: c("jobOrder.reconditionedStock"),
                    key: "reconditionedStock",
                    width: 120
                },
                {
                    title: c("jobOrder.quantityNormalStock"),
                    key: "normalQuantity",
                    width: 200,
                    editCellRender: (o)=>o && o.toFixed(2),
                    editComponent: "NInputNumber",
                    editComponentProps: {
                        min: 0,
                        precision: 0,
                        keyboard: {
                            ArrowUp: !1,
                            ArrowDown: !1
                        },
                        showButton: !1
                    },
                    editRule: (o, a)=>{
                        if (console.log(a), h(a.editValueRefs, "normalQuantity") || h(a.editValueRefs, "reconditionedQuantity")) {
                            const u = (e)=>e == null || e === "" || e === 0, r = u(P(a.editValueRefs.normalQuantity)), i = u(P(a.editValueRefs.reconditionedQuantity));
                            if (r && i) return Promise.resolve(c("jobOrder.normalorReconditionedRequired"));
                        } else return Promise.resolve(c("jobOrder.normalorReconditionedRequired"));
                        return Number(o) > Number(a.normalStock) ? Promise.resolve(c("jobOrder.normalQuantityExceedsStock")) : Promise.resolve("");
                    },
                    editRow: !0,
                    edit: !0
                },
                {
                    title: c("jobOrder.quantityReconditionedStock"),
                    key: "reconditionedQuantity",
                    width: 240,
                    editCellRender: (o)=>o && o.toFixed(2),
                    editComponent: "NInputNumber",
                    editComponentProps: {
                        min: 0,
                        precision: 0,
                        keyboard: {
                            ArrowUp: !1,
                            ArrowDown: !1
                        },
                        showButton: !1
                    },
                    editRow: !0,
                    editRule: (o, a)=>{
                        if (console.log(a), h(a.editValueRefs, "normalQuantity") || h(a.editValueRefs, "reconditionedQuantity")) {
                            const u = (e)=>e == null || e === "" || e === 0, r = u(P(a.editValueRefs.normalQuantity)), i = u(P(a.editValueRefs.reconditionedQuantity));
                            if (r && i) return Promise.resolve(c("jobOrder.normalorReconditionedRequired"));
                        } else return Promise.resolve(c("jobOrder.normalorReconditionedRequired"));
                        return Number(o) > Number(a.reconditionedStock) ? Promise.resolve(c("jobOrder.reconditionedQuantityExceedStock")) : Promise.resolve("");
                    },
                    edit: !0
                }
            ]
        });
    F = {
        LABEL: "已完成",
        LABEL_EN: "DONE",
        VALUE: 1,
        TYPE: "success"
    };
    g = {
        PENDING_APPROVAL: 0,
        APPROVED: 1,
        RETURNED: 2,
        SUBMITTED: 3
    };
    M = [
        {
            label: "待审批",
            labelEn: "PENDING APPROVAL",
            value: g.PENDING_APPROVAL,
            type (n) {
                return n.isActive === 1 ? "info" : "default";
            }
        },
        {
            label: "审批通过",
            labelEn: "APPROVED",
            value: g.APPROVED,
            type (n) {
                return "success";
            }
        },
        {
            label: "审批退回",
            labelEn: "RETURNED",
            value: g.RETURNED,
            type (n) {
                return "error";
            }
        },
        {
            label: "已提交",
            labelEn: "SUBMITTED",
            value: g.SUBMITTED,
            type (n) {
                return "success";
            }
        }
    ];
});
export { g as A, F as D, M as a, x as b, Q as c, B as d, q as e, T as f, U as g, _ as h, __tla };
