import { V as Z, Z as z, cS as me, d as ce, r as u, a as F, gW as N, gX as D, cZ as de, ac as V, aw as pe, c as k, o as x, w as n, j as r, W as fe, D as O, l as e, aI as be, p as h, A as P, i as A, B as ye, N as _e, iD as W, hj as ge, S as we, G as ve, X as Se, c_ as ke, v as xe, __tla as __tla_0 } from "./index-9PRMimni.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./vuedraggable.umd-Co2xEC3p.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.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";
import "./index-DkvzUEqh.js";
import { b as he, d as Pe, __tla as __tla_1 } from "./index.vue_vue_type_style_index_0_scoped_b974e5ec_lang-_0QwzFKM.js";
import { _ as Ce, __tla as __tla_2 } from "./index.vue_vue_type_script_setup_true_lang-CiThekrH.js";
import { _ as Oe, __tla as __tla_3 } from "./index.vue_vue_type_script_setup_true_lang-BaiGZfx5.js";
import "./schemas-BmKi-UM9.js";
import { B as M } from "./Table-0PViRYCf.js";
import "./props-CLtNejQT.js";
import { _ as G } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { B as Ie, C as je, D as Te, E as Ne, F as De, G as Me, j as Re, H as qe, I as Le, J as Be, K as Qe, L as Ve, M as ze, N as H, O as Xe } from "./jobOrder-CGbsc7bp.js";
import "./componentSetting-DVhNDBTO.js";
import "./propTypes-CebMRUpe.js";
import "./index-kKnqLkWM.js";
import "./has-CjqcrIOV.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./BasicForm-dL_oCSPM.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload-DUsnro3W.js";
import "./tabsView-BXskTdVh.js";
import "./BasicSelect-C_uwzMkE.js";
import "./dictionary-BRse4lkf.js";
import "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
import "./useForm-CKmgcynv.js";
import "./usePageCache-DluHn7Yy.js";
import "./useModal-CO65vga3.js";
import "./isEmpty-BUg1OsQj.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";
let Lt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_3;
        } catch  {}
    })()
]).then(async ()=>{
    let i, $e, Ee, Fe, Ae, We;
    ({ t: i } = Z());
    $e = ()=>({
            columnsM: [
                {
                    title: i("common.messagedefine.Num"),
                    key: "num",
                    width: 60,
                    render: (c, o)=>o + 1
                },
                {
                    title: i("jobOrder.itemCode"),
                    key: "itemCode"
                },
                {
                    title: i("jobOrder.itemDesription"),
                    key: "itemDescription"
                },
                {
                    title: i("jobOrder.specification"),
                    key: "specification"
                },
                {
                    title: i("jobOrder.brandManuFacturer"),
                    key: "brand"
                },
                {
                    title: i("jobOrder.qty"),
                    key: "quantity"
                },
                {
                    title: i("jobOrder.units"),
                    key: "unitName"
                }
            ]
        });
    Ee = ()=>({
            columnsS: [
                {
                    title: i("common.messagedefine.Num"),
                    key: "num",
                    width: 60,
                    render: (c, o)=>o + 1
                },
                {
                    title: i("jobOrder.partNumber"),
                    key: "sparePartNumber"
                },
                {
                    title: i("jobOrder.itemDesription"),
                    key: "itemDescription"
                },
                {
                    title: i("jobOrder.specification"),
                    key: "specification"
                },
                {
                    title: i("jobOrder.plateDrawingNumber"),
                    key: "plateDrawingNumber"
                },
                {
                    title: i("jobOrder.qty"),
                    key: "quantity"
                },
                {
                    title: i("jobOrder.units"),
                    key: "unitName"
                }
            ]
        });
    Fe = ()=>({
            columns: [
                {
                    title: i("common.messagedefine.Num"),
                    key: "num",
                    width: 60,
                    render: (c, o)=>o + 1
                },
                {
                    title: i("jobOrder.partNumber"),
                    key: "sparePartNumber"
                },
                {
                    title: i("jobOrder.itemDesription"),
                    key: "itemDescription"
                },
                {
                    title: i("jobOrder.specification"),
                    key: "specification"
                },
                {
                    title: i("jobOrder.plateDrawingNumber"),
                    key: "drawingNumber"
                },
                {
                    title: i("jobOrder.plannedQty"),
                    key: "plannedQuantity"
                },
                {
                    title: i("jobOrder.units"),
                    key: "unit"
                },
                {
                    title: i("jobOrder.drawing"),
                    key: "drawing",
                    render (c) {
                        return c.drawing ? z(me, {
                            src: c.drawing,
                            width: "50",
                            height: "50"
                        }) : i("jobOrder.noDrawing");
                    }
                }
            ]
        });
    Ae = ()=>({
            lastConsumptionColumns: [
                {
                    title: i("common.messagedefine.Num"),
                    key: "num",
                    width: 60,
                    render: (c, o)=>o + 1
                },
                {
                    title: i("jobOrder.partNumber"),
                    key: "sparePartNumber"
                },
                {
                    title: i("jobOrder.itemDesription"),
                    key: "itemDescription"
                },
                {
                    title: i("jobOrder.specification"),
                    key: "specification"
                },
                {
                    title: i("jobOrder.plateDrawingNumber"),
                    key: "plateDrawingNumber"
                },
                {
                    title: i("jobOrder.qty"),
                    key: "quantity"
                },
                {
                    title: i("jobOrder.units"),
                    key: "unitName"
                }
            ]
        });
    We = ce({
        __name: "index",
        props: {
            itemParams: {},
            edit: {
                type: Boolean
            },
            basicDetail: {}
        },
        setup (C, { expose: c }) {
            const o = C, { t: l } = Z(), I = de(), J = ke(), { columnsM: K } = $e(), { columnsS: U } = Ee(), { columns: Y } = Fe(), { lastConsumptionColumns: ee } = Ae(), d = u(), b = u(), j = u(), X = u(), y = u(), _ = u(), R = u(), q = u(), g = u(), L = u(), te = F({
                width: 130,
                title: l("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (a) {
                    return z(G, {
                        style: "text",
                        actions: [
                            {
                                label: l("common.optionsEditText"),
                                labelShow: !1,
                                disabled: !o.edit,
                                icon: N(D.edit, "text[18px]"),
                                onClick: ()=>$(a)
                            },
                            {
                                label: l("common.optionsDelText"),
                                labelShow: !1,
                                disabled: !o.edit,
                                icon: N(D.delete, "red"),
                                onClick: async ()=>{
                                    a.id && (await Ie(a.id), await B(), I.success(l("common.optionsDelSuccessText")));
                                }
                            }
                        ]
                    });
                }
            }), ae = F({
                width: 130,
                title: l("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (a) {
                    return z(G, {
                        style: "text",
                        actions: [
                            {
                                label: l("common.optionsEditText"),
                                labelShow: !1,
                                disabled: !o.edit,
                                icon: N(D.edit, "text[18px]"),
                                onClick: ()=>E(a)
                            },
                            {
                                label: l("common.optionsDelText"),
                                labelShow: !1,
                                disabled: !o.edit,
                                icon: N(D.delete, "red"),
                                onClick: async ()=>{
                                    a.id && (await je(a.id), await Q(), I.success(l("common.optionsDelSuccessText")));
                                }
                            }
                        ]
                    });
                }
            });
            async function ie() {
                const a = await Re(o.itemParams);
                j.value = a.list;
                const t = await qe(o.itemParams.id);
                X.value = t, await B(), await Q();
            }
            async function B() {
                return y.value = await Te(o.itemParams.id), y.value;
            }
            async function Q() {
                return _.value = await Ne(o.itemParams.id), _.value;
            }
            async function oe({ isEdit: a, resData: t }) {
                try {
                    if (t.jobOrderId = o.itemParams.id, a) await Le(t);
                    else {
                        const { itemId: s } = t.raw;
                        t.id = g.value, await Be({
                            ...t,
                            itemId: s
                        });
                    }
                    await B(), d.value?.closeModal();
                } catch (s) {
                    console.log(s), d.value?.setSubLoading(!1), I.warning(s);
                }
            }
            async function ne({ isEdit: a, resData: t }) {
                try {
                    t.jobOrderId = Number(o.itemParams.id), t.quantity = Number(t.quantity), t.outboundType = Number(t.outboundType), t.materialItemId = Number(t.materialItemId), a ? await Qe(t) : await Ve(t), await Q(), b.value?.closeModal();
                } catch (s) {
                    console.log(s), b.value?.setSubLoading(!1), I.warning(s);
                }
            }
            async function $(a) {
                if (a) R.value = await De(a.id), await d.value?.handleOpenModal(R.value);
                else {
                    const s = {
                        equipmentCode: o.basicDetail?.equipmentCode,
                        model: o.basicDetail.model
                    };
                    d.value?.handleOpenModal({}, s);
                }
                const { formSchemas: t } = await he({
                    shipId: o.itemParams.shipId
                });
                if (d.value?.setProps({
                    schemas: t
                }), a) await V(()=>{
                    d.value?.setSparePartsFormData(R.value);
                });
                else {
                    const s = {
                        equipmentName: o.basicDetail?.equipmentName,
                        task: o.basicDetail.jobCode
                    };
                    await V(()=>{
                        d.value?.setSparePartsDetail(s);
                    });
                }
            }
            async function E(a) {
                a ? (q.value = await Me(a.id), b.value?.handleOpenModal(q.value)) : b.value?.handleOpenModal({}, o.basicDetail?.jobCode);
                const { formSchemas: t } = await Pe({
                    shipId: o.itemParams.shipId
                });
                b.value?.setProps({
                    schemas: t
                }), a && await V(()=>{
                    b.value?.setMaterialFormData(q.value);
                });
            }
            async function re({ record: a, index: t, setInventoryDetailTableData: s, done: p }) {
                const v = {
                    id: a.id,
                    jobPlanOrderSparePartId: a.jobPlanOrderSparePartId,
                    normalQuantity: e(a.editValueRefs.normalQuantity),
                    reconditionedQuantity: e(a.editValueRefs.reconditionedQuantity),
                    inventoryId: a.inventoryId
                };
                await ze(v);
                const S = {
                    sparePartId: g.value,
                    shipId: o.itemParams.shipId,
                    itemId: L.value
                }, f = (await H(S)).map((w)=>({
                        ...w,
                        editable: !1
                    }));
                s(f), await p();
            }
            async function se({ isEdit: a, setInventoryDetailTableData: t, mainData: s, setSparePartId: p, setSparePartsDetail: v }) {
                a ? g.value = s.id : g.value = await Xe(), p(g.value), L.value = s.itemId;
                const S = {
                    sparePartId: g.value ? g.value : s.id,
                    shipId: o.itemParams.shipId,
                    itemId: L.value
                }, f = (await H(S)).map((w)=>({
                        ...w,
                        editable: !1
                    }));
                t(f), v(s);
            }
            async function le() {
                return y.value && y.value.length === 0 && _.value && _.value.length === 0 ? await new Promise((t)=>{
                    J.warning({
                        title: l("common.confirmText"),
                        content: l("jobOrder.sparePartConsumeText"),
                        positiveText: l("common.dialogPositiveText"),
                        negativeText: l("common.dialogNegativeText"),
                        onPositiveClick: ()=>{
                            t(!0);
                        },
                        onNegativeClick: ()=>{
                            t(!1);
                        }
                    });
                }) : !0;
            }
            return pe(()=>{
                ie();
            }), c({
                validate: le
            }), (a, t)=>{
                const s = we, p = ge, v = _e, S = ye, T = be, f = fe, w = ve, ue = Se;
                return x(), k(ue, null, {
                    default: n(()=>[
                            r(f, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: n(()=>[
                                        r(f, {
                                            bordered: !1,
                                            class: "mb-[8px]",
                                            "content-class": "p-0"
                                        }, {
                                            default: n(()=>[
                                                    r(e(M), {
                                                        ref: "spareTableRef",
                                                        columns: e(U),
                                                        dataSource: e(y),
                                                        pagination: !1,
                                                        "row-key": (m)=>m.id,
                                                        autoScrollX: !0,
                                                        "virtual-scroll": "",
                                                        showTableSetting: !1,
                                                        actionColumn: e(te),
                                                        canResize: !1
                                                    }, {
                                                        tableTitle: n(()=>[
                                                                r(p, {
                                                                    prefix: "bar",
                                                                    "align-text": ""
                                                                }, {
                                                                    default: n(()=>[
                                                                            r(s, null, {
                                                                                default: n(()=>[
                                                                                        h(P(e(l)("jobOrder.sparePartsActualConsumption")), 1)
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        toolbar: n(()=>[
                                                                r(T, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: n(()=>[
                                                                            A("section", null, [
                                                                                o.edit ? (x(), k(S, {
                                                                                    key: 0,
                                                                                    strong: "",
                                                                                    secondary: "",
                                                                                    type: "primary",
                                                                                    class: "pl-[5px] pr-[5px] h-[28px]",
                                                                                    onClick: t[0] || (t[0] = (m)=>$())
                                                                                }, {
                                                                                    icon: n(()=>[
                                                                                            r(v, {
                                                                                                size: "18"
                                                                                            }, {
                                                                                                default: n(()=>[
                                                                                                        r(e(W))
                                                                                                    ]),
                                                                                                _: 1
                                                                                            })
                                                                                        ]),
                                                                                    _: 1
                                                                                })) : O("", !0)
                                                                            ])
                                                                        ]),
                                                                    default: n(()=>[
                                                                            h(P(e(l)("jobOrder.outboundSpareParts")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "columns",
                                                        "dataSource",
                                                        "row-key",
                                                        "actionColumn"
                                                    ])
                                                ]),
                                            _: 1
                                        }),
                                        e(y) && e(y).length === 0 ? (x(), k(w, {
                                            key: 0,
                                            class: "my-[4px]"
                                        })) : O("", !0),
                                        r(f, {
                                            bordered: !1,
                                            class: "mb-[8px]",
                                            "content-class": "p-0"
                                        }, {
                                            default: n(()=>[
                                                    r(e(M), {
                                                        ref: "materialsTableRef",
                                                        columns: e(K),
                                                        pagination: !1,
                                                        dataSource: e(_),
                                                        "row-key": (m)=>m.id,
                                                        autoScrollX: !0,
                                                        immediate: !1,
                                                        "virtual-scroll": "",
                                                        showTableSetting: !1,
                                                        actionColumn: e(ae),
                                                        canResize: !1
                                                    }, {
                                                        tableTitle: n(()=>[
                                                                r(p, {
                                                                    prefix: "bar",
                                                                    "align-text": ""
                                                                }, {
                                                                    default: n(()=>[
                                                                            r(s, null, {
                                                                                default: n(()=>[
                                                                                        h(P(e(l)("jobOrder.materialsActualConsumption")), 1)
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        toolbar: n(()=>[
                                                                r(T, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: n(()=>[
                                                                            A("section", null, [
                                                                                o.edit ? (x(), k(S, {
                                                                                    key: 0,
                                                                                    strong: "",
                                                                                    secondary: "",
                                                                                    type: "primary",
                                                                                    class: "pl-[5px] pr-[5px] h-[28px]",
                                                                                    onClick: t[1] || (t[1] = (m)=>E())
                                                                                }, {
                                                                                    icon: n(()=>[
                                                                                            r(v, {
                                                                                                size: "18"
                                                                                            }, {
                                                                                                default: n(()=>[
                                                                                                        r(e(W))
                                                                                                    ]),
                                                                                                _: 1
                                                                                            })
                                                                                        ]),
                                                                                    _: 1
                                                                                })) : O("", !0)
                                                                            ])
                                                                        ]),
                                                                    default: n(()=>[
                                                                            h(P(e(l)("jobOrder.outboundMaterials")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "columns",
                                                        "dataSource",
                                                        "row-key",
                                                        "actionColumn"
                                                    ])
                                                ]),
                                            _: 1
                                        }),
                                        e(_) && e(_).length === 0 ? (x(), k(w, {
                                            key: 1,
                                            class: "my-[4px]"
                                        })) : O("", !0),
                                        r(f, {
                                            bordered: !1,
                                            class: "mb-[8px]",
                                            "content-class": "p-0"
                                        }, {
                                            default: n(()=>[
                                                    r(e(M), {
                                                        ref: "spareTableRef",
                                                        columns: e(Y),
                                                        dataSource: e(j),
                                                        pagination: !1,
                                                        "row-key": (m)=>m.id,
                                                        autoScrollX: !0,
                                                        "virtual-scroll": "",
                                                        showTableSetting: !1,
                                                        canResize: !1
                                                    }, {
                                                        tableTitle: n(()=>[
                                                                r(p, {
                                                                    prefix: "bar",
                                                                    "align-text": ""
                                                                }, {
                                                                    default: n(()=>[
                                                                            r(s, null, {
                                                                                default: n(()=>[
                                                                                        h(P(e(l)("jobOrder.estimatedConsumption")), 1)
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "columns",
                                                        "dataSource",
                                                        "row-key"
                                                    ]),
                                                    e(j) && e(j).length === 0 ? (x(), k(w, {
                                                        key: 0,
                                                        class: "my-[4px]"
                                                    })) : O("", !0),
                                                    r(e(M), {
                                                        ref: "spareTableRef",
                                                        columns: e(ee),
                                                        dataSource: e(X),
                                                        pagination: !1,
                                                        "row-key": (m)=>m.id,
                                                        autoScrollX: !0,
                                                        "virtual-scroll": "",
                                                        showTableSetting: !1,
                                                        canResize: !1
                                                    }, {
                                                        tableTitle: n(()=>[
                                                                r(p, {
                                                                    prefix: "bar",
                                                                    "align-text": ""
                                                                }, {
                                                                    default: n(()=>[
                                                                            r(s, null, {
                                                                                default: n(()=>[
                                                                                        h(P(e(l)("jobOrder.lastConsumption")), 1)
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "columns",
                                                        "dataSource",
                                                        "row-key"
                                                    ])
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            }),
                            r(e(Oe), {
                                ref_key: "addModalSRef",
                                ref: d,
                                title: e(l)("jobOrder.sparePartsRequired"),
                                onSuccess: oe,
                                onRowEditSuccess: re,
                                onTableDataInit: se
                            }, null, 8, [
                                "title"
                            ]),
                            r(e(Ce), {
                                ref_key: "addModalMRef",
                                ref: b,
                                title: e(l)("jobOrder.materialsRequired"),
                                onSuccess: ne
                            }, null, 8, [
                                "title"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
    Lt = xe(We, [
        [
            "__scopeId",
            "data-v-a995074b"
        ]
    ]);
});
export { Lt as default, __tla };
