import { V as m, bk as Y, d as N, u as P, bl as L, a4 as V, r as W, c as $, o as j, X as E, w as n, j as a, W as F, l as e, gD as y, bU as I, __tla as __tla_0 } from "./index-9PRMimni.js";
import { _ as U } from "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import { u as X } from "./useModal-CO65vga3.js";
import { B as A } from "./BasicForm-dL_oCSPM.js";
import { u as K } from "./useForm-CKmgcynv.js";
import { B as z } from "./Table-0PViRYCf.js";
import { g as G } from "./requisitionListPage-CxtdksCl.js";
import { d as H, __tla as __tla_1 } from "./helper-CNwA55dE.js";
import { f as J } from "./find-D_h_aJYR.js";
let pe;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    const Q = Y(), { t: l } = m();
    function Z() {
        return [
            {
                type: "selection",
                key: "selection",
                multiple: !1,
                width: 30
            },
            {
                title: l("requisitionOrder.copyModal.requisitionNo"),
                key: "reqNo",
                width: 140
            },
            {
                title: l("requisitionOrder.copyModal.applicationDate"),
                key: "applyDate",
                width: 140
            },
            {
                title: l("requisitionOrder.copyModal.department"),
                key: "department",
                width: 160,
                render (t) {
                    const r = J(H, (i)=>i.value === t?.department);
                    return Q.getLocale === "en" ? r?.labelEn : r?.label;
                }
            },
            {
                title: l("requisitionOrder.copyModal.title"),
                key: "title"
            }
        ];
    }
    const { t: g } = m(), ee = ()=>[
            {
                field: "reqNo",
                component: "NInput",
                label: g("requisitionOrder.copyModal.requisitionNo"),
                labelWidth: 120,
                giProps: {
                    span: 1
                },
                componentProps: {
                    placeholder: g("requisitionOrder.copyModal.requisitionNo")
                }
            }
        ];
    function te({ selected: t }) {
        return t ? {
            ...t
        } : {};
    }
    pe = N({
        __name: "index",
        props: {
            vesselValue: {},
            procurementCategory: {}
        },
        emits: [
            "selected"
        ],
        setup (t, { expose: r, emit: i }) {
            const { t: c } = m(), b = P(), h = t, w = i, M = L("tableRef"), O = V(()=>Z()), [k, { openModal: R, closeModal: q, setSubLoading: f }] = X({
                width: 800,
                title: c("requisitionOrder.copyModal.copyModalTitle")
            }), [D, { getFieldsValue: v }] = K({
                gridProps: {
                    cols: 2
                },
                schemas: ee(),
                labelPlacement: "left",
                showAdvancedButton: !1
            });
            async function S(d, p) {
                return await G({
                    ...d,
                    ...p,
                    category: h.procurementCategory,
                    applyDate: `${y().subtract(1, "year").startOf("year").format("YYYY-MM-DD")},${y().format("YYYY-MM-DD")}`,
                    approveStatus: 11
                }) ?? {
                    list: [],
                    total: 0
                };
            }
            const u = W({});
            function B(d, p, { row: o }) {
                u.value = o;
            }
            async function T() {
                if (Object.keys(u.value).length === 0) {
                    b.warning(c("common.pleaseSelectOneRow")), f(!1);
                    return;
                }
                q(), f(!1), w("selected", te({
                    selected: I(u.value)
                }));
            }
            function x() {
                R();
            }
            function _() {
                M.value?.restReload();
            }
            return r({
                handleOpenModal: x
            }), (d, p)=>{
                const o = F, C = E;
                return j(), $(C, null, {
                    default: n(()=>[
                            a(e(U), {
                                onRegister: e(k),
                                onOnOk: T,
                                subBtuText: e(c)("common.confirmText")
                            }, {
                                default: n(()=>[
                                        a(o, {
                                            bordered: !1,
                                            class: "proCard"
                                        }, {
                                            default: n(()=>[
                                                    a(e(A), {
                                                        onRegister: e(D),
                                                        onSubmit: _,
                                                        onReset: _
                                                    }, null, 8, [
                                                        "onRegister"
                                                    ])
                                                ]),
                                            _: 1
                                        }),
                                        a(o, {
                                            bordered: !1,
                                            class: "proCard mt-2"
                                        }, {
                                            default: n(()=>[
                                                    a(e(z), {
                                                        columns: O.value,
                                                        request: (s)=>S(s, e(v)()),
                                                        "row-key": (s)=>s.itemId ?? s.id,
                                                        ref: "tableRef",
                                                        "onUpdate:checkedRowKeys": B,
                                                        autoScrollX: !0,
                                                        "virtual-scroll": "",
                                                        showTableSetting: !1
                                                    }, null, 8, [
                                                        "columns",
                                                        "request",
                                                        "row-key"
                                                    ])
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            }, 8, [
                                "onRegister",
                                "subBtuText"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { pe as _, __tla };
