import { V as P, bk as R, Z as y, B, gD as $, d as z, e as G, f as K, r as c, a as Q, gW as C, gX as H, iI as U, aw as ee, c as T, o as q, w as s, j as p, W as te, l as a, H as oe, aI as re, p as ie, A as ae, ca as ne, X as se, cZ as le, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as pe } from "./BasicForm-dL_oCSPM.js";
import { u as de } from "./useForm-CKmgcynv.js";
import { B as ce } from "./Table-0PViRYCf.js";
import { _ as ue } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { a as me } from "./requisitionOrder-D0IG9N7e.js";
import { b as be, S as ye } from "./jobOrder-CGbsc7bp.js";
import { a as fe } from "./download-CIBdrxiA.js";
import { u as he } from "./useSearchParam-B08ob60x.js";
import { c as _e, __tla as __tla_1 } from "./schemas-Co_OnTzv.js";
import { h as b } from "./has-CjqcrIOV.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";
import "./base64Conver-4Xd-Hzyx.js";
import "./dictUtils-D8jA3mBt.js";
let pt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    let v, i, ge;
    v = R();
    ({ t: i } = P());
    ge = (I)=>({
            columns: [
                {
                    title: i("common.messagedefine.Num"),
                    key: "num",
                    width: 60,
                    render: (t, l)=>l + 1
                },
                {
                    title: i("jobOrderHistory.vessel"),
                    key: v.getLocale === "en" ? "shipNameEn" : "shipName",
                    width: 100
                },
                {
                    title: i("jobOrderHistory.equipmentName"),
                    key: "equipmentName",
                    width: 140
                },
                {
                    title: i("jobOrderHistory.jobOrderNo"),
                    key: "jobOrderNo",
                    width: 140,
                    render (t) {
                        return t.jobOrderNo && t.showDetail ? y(B, {
                            text: !0,
                            type: "primary",
                            class: "truncate",
                            onClick () {
                                const l = {
                                    shipId: t.shipId,
                                    id: t.id,
                                    planId: t.planId,
                                    type: "detail"
                                };
                                I.viewJobOrder(l);
                            }
                        }, ()=>y("span", {
                                class: "truncate max-w-[120px]"
                            }, t.jobOrderNo)) : t.jobOrderNo;
                    }
                },
                {
                    title: i("jobOrderHistory.jobCode"),
                    key: "jobCode",
                    width: 140
                },
                {
                    title: i("jobOrderHistory.jobTitle"),
                    key: "jobTitle",
                    width: 140
                },
                {
                    title: i("jobOrderHistory.department"),
                    key: v.getLocale === "en" ? "departmentNameEn" : "departmentName",
                    width: 120
                },
                {
                    title: i("jobOrderHistory.completedWork"),
                    key: "completeContent",
                    width: 180
                },
                {
                    title: i("jobOrderHistory.doneBy"),
                    key: v.getLocale === "en" ? "picNameEn" : "picName",
                    width: 140
                },
                {
                    title: i("jobOrderHistory.jobDoneDate"),
                    key: "jobEndDateTime",
                    width: 140,
                    render (t) {
                        return t.jobEndDateTime ? $(t.jobEndDateTime).format("YYYY-MM-DD") : "";
                    }
                },
                {
                    title: i("jobOrderHistory.jobApproveBy"),
                    key: "approveName",
                    width: 140
                },
                {
                    title: i("jobOrderHistory.jobApproveDate"),
                    key: "approveDate",
                    width: 100
                }
            ]
        });
    pt = z({
        __name: "index",
        setup (I) {
            const O = R(), { t } = P(), l = G(), E = K(), w = le(), u = c(), d = c(E.query), f = c(!1), h = c(0), x = c(), k = c(), L = Q({
                width: 100,
                title: t("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return y(ue, {
                        style: "text",
                        ifShow: e.showDetail,
                        actions: [
                            {
                                label: t("common.optionsViewText"),
                                labelShow: !1,
                                icon: C(H.view, "blue"),
                                onClick: ()=>S({
                                        shipId: e.shipId,
                                        id: e.id,
                                        planId: e.planId,
                                        type: "view"
                                    }),
                                ifShow: ()=>e.showDetail
                            },
                            {
                                label: t("common.print"),
                                labelShow: !1,
                                icon: y(U),
                                onClick: ()=>l.push({
                                        name: "component_pdfPrint",
                                        query: {
                                            pageName: "JobOrderReport",
                                            id: e.id
                                        }
                                    }),
                                ifShow: ()=>e.showDetail
                            }
                        ]
                    });
                }
            });
            function S(e) {
                l.push({
                    name: "jobOrder",
                    query: {
                        ...e
                    }
                });
            }
            async function V(e, o) {
                if (!b(g(), "shipId") && !f.value) {
                    if (b(d.value, "shipId") && b(d.value, "planId")) {
                        const r = {
                            shipId: Number(d.value.shipId),
                            planId: Number(d.value.planId)
                        };
                        m(r), o.shipId = r.shipId, o.planId = r.planId;
                    } else m({
                        shipId: _
                    }), o.shipId = _;
                    f.value = !0;
                }
                o.equipmentType && (o.equipmentType = o.equipmentType.split("-")[0]);
                const n = Y();
                return n && (m(n), o = n), h.value = o.shipId, m({
                    shipId: o.shipId
                }), k.value = {
                    ...e,
                    ...o
                }, await be({
                    ...e,
                    ...o
                });
            }
            function N() {
                f.value = !1, u.value?.restReload(), !(!b(d.value, "shipId") && !b(d.value, "planId")) && l.replace({
                    name: "jobOrderHistory"
                });
            }
            async function W() {
                try {
                    const e = u.value && typeof u.value.getDataSource == "function" ? u.value.getDataSource() : [];
                    if (e && e.length === 0) {
                        w.error(t("jobOrderHistory.noData"));
                        return;
                    }
                    const o = await ye({
                        ...k.value,
                        language: O.locale.split("_")[0]
                    });
                    fe(o.data, "job-order-history.xlsx"), w.success(t("jobOrderHistory.exportSuccess"));
                } catch (e) {
                    console.error(e);
                }
            }
            async function D(e) {
                const o = e.toString() || _.toString(), n = await me({
                    shipId: o,
                    code: "0",
                    model: "0",
                    serialNumber: "0"
                });
                x.value = n.map((r)=>({
                        label: r.name,
                        value: r.code + "-" + r.model + "-" + r.serialNumber,
                        isLeaf: r.ifLeaf,
                        raw: r
                    }));
            }
            const { schemas: F, initShipValue: _ } = _e({
                codePrefixOptions: x,
                shipId: h,
                initCodePrefixOptions: D
            }), [J, { getFieldsValue: g, setFieldsValue: m }] = de({
                gridProps: {
                    cols: 6
                },
                schemas: F
            }), { columns: M } = ge({
                viewJobOrder: S
            }), { restoreSearchParams: Y } = he(g, m);
            return ee(()=>{
                D(h.value);
            }), (e, o)=>{
                const n = te, r = B, A = re, X = oe, Z = se;
                return q(), T(Z, null, {
                    default: s(()=>[
                            p(n, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: s(()=>[
                                        p(a(pe), {
                                            onRegister: a(J),
                                            onSubmit: N,
                                            onReset: N
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            p(n, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: s(()=>[
                                        p(a(ce), {
                                            ref_key: "basicTableRef",
                                            ref: u,
                                            columns: a(M),
                                            request: (j)=>V(j, a(g)()),
                                            actionColumn: a(L),
                                            "row-key": (j)=>j.id,
                                            autoScrollX: !0,
                                            "virtual-scroll": "",
                                            printConfig: {
                                                header: a(t)("jobOrderHistory.jobOrderHistory")
                                            },
                                            tableSetting: {
                                                redo: !0,
                                                size: !0,
                                                setting: !0,
                                                fullscreen: !0,
                                                striped: !0,
                                                print: !0,
                                                query: !1,
                                                export: !1,
                                                bordered: !0
                                            }
                                        }, {
                                            toolbar: s(()=>[
                                                    p(X, null, {
                                                        default: s(()=>[
                                                                p(A, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: s(()=>[
                                                                            p(r, {
                                                                                strong: "",
                                                                                secondary: "",
                                                                                type: "primary",
                                                                                class: "px-[5px] h-[28px] rounded-md",
                                                                                onClick: W
                                                                            }, {
                                                                                icon: s(()=>[
                                                                                        (q(), T(ne(a(C)(a(H).import, "text-[18px]"))))
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: s(()=>[
                                                                            ie(" " + ae(a(t)("jobOrderHistory.export")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "request",
                                            "actionColumn",
                                            "row-key",
                                            "printConfig"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { pt as default, __tla };
