import { _ as A, __tla as __tla_0 } from "./CustomCard.vue_vue_type_script_setup_true_lang-374ERk20.js";
import { _ as M } from "./CustomTable.vue_vue_type_script_setup_true_lang-CVzOsXR0.js";
import { u as D } from "./useECharts-XZ1IwN24.js";
import { c as F } from "./columns-1dSLzo5A.js";
import { j as N, k as z } from "./workbench-DEgqNpqd.js";
import { d as L, bk as O, e as W, r as n, ay as h, l as e, ac as d, c as f, o as m, w as Z, D as y, h as $, __tla as __tla_1 } from "./index-9PRMimni.js";
import "./BasicForm-dL_oCSPM.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 "./useForm-CKmgcynv.js";
import "./usePageCache-DluHn7Yy.js";
import "./Flex-CTSf12gq.js";
import "./useTimeout-BxFilWvD.js";
import "./tslib.es6-CSJU3tT9.js";
import "./index-DatBjkM3.js";
import "./dateUtil-BtafrT1f.js";
import "./format-DgF6KtHk.js";
import "./helper-D9DF1oLX.js";
import "./find-D_h_aJYR.js";
import "./findIndex-BgUIH3i1.js";
import "./toInteger-DQeH-nF-.js";
import "./includes-DdMWPj0t.js";
let Pt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    Pt = L({
        __name: "MaterialsStockStatus",
        props: {
            componentItem: {},
            isEditable: {
                type: Boolean
            },
            searchParams: {},
            refreshComponent: {
                type: Boolean
            }
        },
        setup (k) {
            const o = k, g = O(), i = W(), p = n(), l = n(), { setOptions: I, getInstance: S, disposeInstance: b, resizeFn: C } = D(l), s = n(), a = n("chart"), w = n(), { materialsStockStatusColumns: v } = F();
            h(()=>o.refreshComponent, (t)=>{
                t && c();
            }, {
                immediate: !0
            }), h(()=>o.isEditable, ()=>{
                a.value === "chart" && C();
            });
            function c() {
                a.value === "table" ? T(!0) : a.value === "chart" && _();
            }
            async function _() {
                const t = await N({
                    ...o.searchParams || {},
                    categoryId: e(s)?.category ? [
                        e(s).category
                    ] : void 0
                }), u = (t || []).map((r)=>r?.[g.getLocale === "en" ? "categoryNameEn" : "categoryNameZn"]), q = (t || []).map((r)=>r?.rob), E = {
                    tooltip: {
                        trigger: "axis",
                        axisPointer: {
                            type: "shadow"
                        }
                    },
                    xAxis: {
                        type: "category",
                        data: u
                    },
                    yAxis: {
                        type: "value",
                        minInterval: 1
                    },
                    grid: {
                        top: 30,
                        right: "6%"
                    },
                    dataZoom: [
                        {
                            type: "slider",
                            start: 10,
                            end: 90,
                            moveHandleSize: 10,
                            height: 20
                        }
                    ],
                    series: [
                        {
                            data: q,
                            type: "bar",
                            showBackground: !0,
                            barMaxWidth: 30
                        }
                    ]
                };
                d(()=>{
                    I(E), S()?.on("click", function(r) {
                        r.componentType === "series" && i.push({
                            name: "materialsStock",
                            query: {
                                categoryId: (t || [])[r.dataIndex]?.categoryId,
                                shipId: o.searchParams?.shipId
                            }
                        });
                    });
                });
            }
            function T(t) {
                d(()=>{
                    p.value?.handleGetData(t);
                });
            }
            function P(t) {
                s.value = t, c();
            }
            function x(t) {
                a.value = t, a.value === "chart" && b(), c();
            }
            function R(t) {
                return {
                    style: "cursor: pointer",
                    onClick: ()=>{
                        i.push({
                            name: "materialsStock",
                            query: {
                                shipId: o.searchParams?.shipId,
                                sectionId: t.sectionCode
                            }
                        });
                    }
                };
            }
            function B() {
                i.push({
                    name: "materialsStock",
                    query: {
                        shipId: o.searchParams?.shipId
                    }
                });
            }
            return (t, u)=>(m(), f(A, {
                    componentItem: t.componentItem,
                    currentComponent: e(a),
                    showTransition: e(w),
                    cardParams: e(s),
                    onFilter: P,
                    onShowAll: B,
                    onTransition: x
                }, {
                    default: Z(()=>[
                            e(a) === "table" ? (m(), f(M, {
                                key: 0,
                                ref_key: "basicTableRef",
                                ref: p,
                                columns: e(v),
                                request: e(z),
                                params: {
                                    ...e(s) || {},
                                    ...t.searchParams || {}
                                },
                                "row-props": R
                            }, null, 8, [
                                "columns",
                                "request",
                                "params"
                            ])) : y("", !0),
                            e(a) === "chart" ? (m(), $("div", {
                                key: 1,
                                ref_key: "chartRef",
                                ref: l,
                                class: "w-full h-full"
                            }, null, 512)) : y("", !0)
                        ]),
                    _: 1
                }, 8, [
                    "componentItem",
                    "currentComponent",
                    "showTransition",
                    "cardParams"
                ]));
        }
    });
});
export { Pt as default, __tla };
