import { V as F, bk as G, d as J, f as K, r as Q, bl as M, a4 as U, ay as Y, a as I, Z as g, cZ as tt, aw as et, c as k, o as d, w as n, j as m, l as a, D as R, H as ot, aI as at, p as w, A as u, B as nt, i as B, W as rt, h as L, F as st, a9 as it, X as lt, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as mt } from "./Table-0PViRYCf.js";
import { _ as ct } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { d as dt, I as N, f as A, g as ut, i as pt, __tla as __tla_1 } from "./helper-Ba6EWhr_.js";
import { _ as ft, __tla as __tla_2 } from "./index.vue_vue_type_script_setup_true_lang-jEFBIquH.js";
import { i as E } from "./includes-DdMWPj0t.js";
import { _ as ht } from "./Flex-CTSf12gq.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./componentMap-CElCaWis.js";
import "./propTypes-CebMRUpe.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 "./componentSetting-DVhNDBTO.js";
import "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./tabsView-BXskTdVh.js";
import "./requisitionOrder-D0IG9N7e.js";
import "./BasicForm-dL_oCSPM.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./ImageUpload-DUsnro3W.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-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 "./useForm-CKmgcynv.js";
import "./isNumber-D5aBrEhN.js";
import "./toInteger-DQeH-nF-.js";
let se;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    G();
    let r, _t, yt, Dt;
    ({ t: r } = F());
    _t = ()=>[
            {
                title: r("common.management.Num"),
                key: "num",
                width: 60,
                render: (c, i)=>i + 1
            },
            {
                title: r("bondStoreDetail.bondStoreDetails.date"),
                key: "date",
                width: 120
            },
            {
                title: r("bondStoreDetail.bondStoreDetails.details"),
                key: "details",
                width: 140
            },
            {
                title: r("bondStoreDetail.bondStoreDetails.invoiceNum"),
                key: "invoiceNo",
                width: 140
            },
            {
                title: r("bondStoreDetail.bondStoreDetails.consumed"),
                key: "consumed",
                width: 140,
                render: (c)=>{
                    const { consumed: i } = c;
                    return E([
                        0,
                        "0",
                        "0.00"
                    ], i) ? "-" : i;
                }
            },
            {
                title: r("bondStoreDetail.bondStoreDetails.purchased"),
                key: "purchased",
                width: 140,
                render: (c)=>{
                    const { purchased: i } = c;
                    return E([
                        0,
                        "0",
                        "0.00"
                    ], i) ? "-" : i;
                }
            },
            {
                title: r("bondStoreDetail.bondStoreDetails.balance"),
                key: "balance",
                width: 140
            },
            {
                title: r("bondStoreDetail.bondStoreDetails.approval"),
                key: "approver",
                width: 140
            },
            {
                title: r("bondStoreDetail.bondStoreDetails.remark"),
                key: "remark",
                width: 140
            },
            {
                title: r("bondStoreDetail.bondStoreDetails.createBy"),
                key: "createBy",
                width: 120
            },
            {
                title: r("bondStoreDetail.bondStoreDetails.createDate"),
                key: "createTime",
                width: 120
            }
        ];
    yt = {
        class: "text-[16px] text-gray-600"
    };
    Dt = {
        class: "text-[16px] font-medium text-[#0EC06A]"
    };
    se = J({
        __name: "index",
        props: {
            summaryData: {}
        },
        emits: [
            "refreshSummary"
        ],
        setup (c, { emit: i }) {
            const p = c, h = i, { t: o } = F(), v = tt(), _ = K(), y = Q(!1), C = M("tableRef"), x = M("DetailsModal"), T = U(()=>_.query?.type !== "edit");
            Y(()=>p.summaryData, (t)=>{
                Object.keys(D).forEach((e)=>{
                    t && Reflect.has(t, e) && (D[e].count = t[e] ?? "N/A");
                });
            }, {
                deep: !0
            });
            const D = I({
                consumed: {
                    title: o("bondStoreDetail.summary.consumptionInThisMonth"),
                    count: p.summaryData?.consumed ?? "N/A"
                },
                purchased: {
                    title: o("bondStoreDetail.summary.purchaseProvisionInThisMonth"),
                    count: p.summaryData?.purchased ?? "N/A"
                },
                availableBalance: {
                    title: o("bondStoreDetail.summary.bondedStoreInTTLAtEndOfThisMonth"),
                    count: p.summaryData?.availableBalance ?? "N/A"
                }
            }), O = I({
                width: 120,
                title: o("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (t) {
                    return g(ct, {
                        style: "text",
                        actions: [
                            {
                                label: o("common.optionsEditText"),
                                labelShow: !1,
                                ifShow: t.isLastMonthBalance !== 1 && t.isLast === 1,
                                icon: g("i", {
                                    class: "iconfont icon-a-Frame28"
                                }),
                                onClick: j.bind(null, {
                                    type: "edit",
                                    record: t
                                })
                            },
                            {
                                label: o("common.delText"),
                                labelShow: !1,
                                ifShow: t.isLastMonthBalance !== 1 && t.isLast === 1,
                                icon: g("i", {
                                    class: "iconfont icon-Delete red"
                                }),
                                onPositiveClick: W.bind(null, t),
                                isConfirm: !0,
                                confirmContent: o("common.delPop.contRole")
                            }
                        ]
                    });
                }
            });
            function q() {
                const { shipId: t, year: e, month: s, startDate: f, endDate: S } = _.query;
                return {
                    shipId: t,
                    year: e,
                    month: s,
                    startDate: A(f),
                    endDate: A(S)
                };
            }
            async function P(t, e) {
                try {
                    return await ut({
                        ...e,
                        ...t
                    });
                } catch  {
                    return {
                        list: [],
                        total: 0
                    };
                }
            }
            function b() {
                C.value?.restReload();
            }
            function V() {
                y.value = !0;
                const { shipId: t, year: e, month: s } = _.query;
                pt({
                    shipId: t,
                    year: e,
                    month: s
                }).then(()=>{
                    v.success(o("common.importSuccess"));
                }).finally(()=>{
                    y.value = !1, h("refreshSummary"), b();
                });
            }
            function $() {
                x.value?.handleOpenModal();
            }
            function j({ type: t, record: e }) {
                const s = {
                    ...e
                };
                x.value?.handleOpenModal(t, s);
            }
            function W({ id: t }) {
                dt(t).then(()=>{
                    v.success(o("common.optionsDelSuccessText")), b(), h("refreshSummary");
                });
            }
            return et(()=>{}), (t, e)=>{
                const s = nt, f = at, S = ot, z = ht, X = rt, Z = lt;
                return d(), k(Z, null, {
                    default: n(()=>[
                            m(a(mt), {
                                ref_key: "tableRef",
                                ref: C,
                                columns: a(_t)(),
                                request: (l)=>P(l, q()),
                                "row-key": (l)=>l.id,
                                autoScrollX: !0,
                                actionColumn: !a(T) && !a(N) ? a(O) : void 0,
                                "virtual-scroll": ""
                            }, {
                                toolbar: n(()=>[
                                        !a(T) && !a(N) ? (d(), k(S, {
                                            key: 0
                                        }, {
                                            default: n(()=>[
                                                    t.summaryData.importLastMonthBalanceEnable === 1 ? (d(), k(f, {
                                                        key: 0,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: n(()=>[
                                                                m(s, {
                                                                    type: "primary",
                                                                    size: "small",
                                                                    onClick: V,
                                                                    loading: a(y)
                                                                }, {
                                                                    default: n(()=>[
                                                                            w(u(a(o)("bondStoreDetail.importBalance")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }, 8, [
                                                                    "loading"
                                                                ])
                                                            ]),
                                                        default: n(()=>[
                                                                w(" " + u(a(o)("bondStoreDetail.importLastMonthCashBalance")), 1)
                                                            ]),
                                                        _: 1
                                                    })) : R("", !0),
                                                    m(f, {
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: n(()=>[
                                                                m(s, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: $
                                                                }, {
                                                                    icon: n(()=>e[1] || (e[1] = [
                                                                            B("i", {
                                                                                class: "iconfont icon-ADD"
                                                                            }, null, -1)
                                                                        ])),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: n(()=>[
                                                                w(" " + u(a(o)("bondStoreDetail.addBtn")), 1)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        })) : R("", !0)
                                    ]),
                                _: 1
                            }, 8, [
                                "columns",
                                "request",
                                "row-key",
                                "actionColumn"
                            ]),
                            m(X, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: n(()=>[
                                        m(z, {
                                            justify: "space-around"
                                        }, {
                                            default: n(()=>[
                                                    (d(!0), L(st, null, it(a(D), (l, H)=>(d(), L("div", {
                                                            key: H,
                                                            class: "text-[16px]"
                                                        }, [
                                                            B("span", yt, u(l.title) + ": ", 1),
                                                            B("span", Dt, u(l.count), 1)
                                                        ]))), 128))
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            }),
                            m(ft, {
                                ref: "DetailsModal",
                                summaryData: t.summaryData,
                                onRefresh: b,
                                onRefreshSummary: e[0] || (e[0] = (l)=>h("refreshSummary"))
                            }, null, 8, [
                                "summaryData"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { se as default, __tla };
