import { _ as j, __tla as __tla_0 } from "./CustomCard.vue_vue_type_script_setup_true_lang-374ERk20.js";
import { _ as F } from "./CustomTable.vue_vue_type_script_setup_true_lang-CVzOsXR0.js";
import { u as J } from "./useECharts-XZ1IwN24.js";
import { c as N } from "./columns-1dSLzo5A.js";
import { w as W, x as z } from "./workbench-DEgqNpqd.js";
import { d as M, dW as O, bk as $, e as G, r as n, ay as b, ac as w, c as P, o as u, w as H, D as I, h as Z, l as a, __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 Be;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    Be = M({
        __name: "VesselCriticalEquipmentJobPlan",
        props: {
            componentItem: {},
            isEditable: {
                type: Boolean
            },
            searchParams: {},
            refreshComponent: {
                type: Boolean
            },
            defaultCurrentComponent: {
                default: "chart"
            },
            defaultShowTransition: {
                type: Boolean,
                default: !0
            }
        },
        setup (g) {
            const r = g, x = O(), T = $(), i = G(), d = n(), h = n(), { setOptions: S, getInstance: f, disposeInstance: k, resizeFn: _ } = J(h), s = n({
                daysLeft: 60
            }), o = n(r.defaultCurrentComponent), v = n(r.defaultShowTransition), { vesselCriticalEquipmentJobPlanColumns: E } = N();
            b(()=>r.refreshComponent, (e)=>{
                e && l();
            }, {
                immediate: !0
            }), b(()=>r.isEditable, ()=>{
                o.value === "chart" && _();
            });
            function l() {
                o.value === "table" ? q(!0) : o.value === "chart" && R();
            }
            async function R() {
                let e = null, c = [], C = [], y = !0, m = null;
                const p = async (A)=>{
                    e = await z({
                        ...r.searchParams || {},
                        ...s.value || {},
                        parentCode: A
                    }), y = e?.hasSub, m = e?.grandParentCode, c = (e?.productInfos || []).map((t)=>t?.productName), C = (e?.seriesList || []).map((t)=>({
                            type: "bar",
                            stack: "total",
                            emphasis: {
                                focus: "series"
                            },
                            showBackground: !0,
                            barMaxWidth: 30,
                            name: t?.[T.getLocale === "en" ? "stateNameEn" : "stateName"],
                            data: t?.countList || []
                        })), await w(), await S({
                        tooltip: {
                            trigger: "axis",
                            axisPointer: {
                                type: "shadow"
                            }
                        },
                        title: {
                            show: !!m,
                            text: "<Back",
                            left: "10",
                            top: "0",
                            triggerEvent: !0,
                            textStyle: {
                                color: a(x)?.textColor3,
                                fontSize: 14,
                                fontWeight: 400
                            }
                        },
                        xAxis: {
                            type: "category",
                            data: c
                        },
                        yAxis: {
                            type: "value",
                            minInterval: 1
                        },
                        grid: {
                            top: 30,
                            right: "6%"
                        },
                        dataZoom: [
                            {
                                type: "slider",
                                start: 10,
                                end: 90,
                                moveHandleSize: 10,
                                height: 20
                            }
                        ],
                        series: C
                    }), f()?.off("click"), f()?.on("click", function(t) {
                        t.componentType === "series" ? y ? p((e?.productInfos || [])[t.dataIndex]?.productCode) : i.push({
                            name: "PMS_jobPlan",
                            query: {
                                shipId: r.searchParams?.shipId,
                                productCode: (e?.productInfos || [])[t.dataIndex]?.productCode,
                                jobStatus: (e?.seriesList || [])[t.seriesIndex || 0]?.statusId
                            }
                        }) : t.componentType === "title" && p(m);
                    });
                };
                await p(0);
            }
            function q(e) {
                w(()=>{
                    d.value?.handleGetData(e);
                });
            }
            function B(e) {
                s.value = e, l();
            }
            function D(e) {
                o.value = e, o.value === "chart" && k(), l();
            }
            function L(e) {
                return {
                    style: "cursor: pointer",
                    onClick: ()=>{
                        i.push({
                            name: "jobPlanDetails",
                            query: {
                                id: e.planId
                            }
                        });
                    }
                };
            }
            function V() {
                i.push({
                    name: "PMS_jobPlan",
                    query: {
                        shipId: r.searchParams?.shipId
                    }
                });
            }
            return (e, c)=>(u(), P(j, {
                    componentItem: e.componentItem,
                    currentComponent: a(o),
                    showTransition: a(v),
                    cardParams: a(s),
                    onFilter: B,
                    onShowAll: V,
                    onTransition: D
                }, {
                    default: H(()=>[
                            a(o) === "table" ? (u(), P(F, {
                                key: 0,
                                ref_key: "basicTableRef",
                                ref: d,
                                columns: a(E),
                                request: a(W),
                                params: {
                                    ...a(s) || {},
                                    ...e.searchParams || {},
                                    criticalToSafety: 1
                                },
                                "row-props": L
                            }, null, 8, [
                                "columns",
                                "request",
                                "params"
                            ])) : I("", !0),
                            a(o) === "chart" ? (u(), Z("div", {
                                key: 1,
                                ref_key: "chartRef",
                                ref: h,
                                class: "w-full h-full"
                            }, null, 512)) : I("", !0)
                        ]),
                    _: 1
                }, 8, [
                    "componentItem",
                    "currentComponent",
                    "showTransition",
                    "cardParams"
                ]));
        }
    });
});
export { Be as default, __tla };
