import { _ as B, __tla as __tla_0 } from "./CustomCard.vue_vue_type_script_setup_true_lang-374ERk20.js";
import { _ as N } from "./CustomTable.vue_vue_type_script_setup_true_lang-CVzOsXR0.js";
import { u as V } from "./useECharts-XZ1IwN24.js";
import { c as A } from "./columns-1dSLzo5A.js";
import { h as H, i as z } from "./workbench-DEgqNpqd.js";
import { d as Q, dW as W, bk as O, V as $, r as m, e as F, ay as b, l as a, ac as y, c as _, o as p, w as G, D as C, h as M, __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 Dt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    Dt = Q({
        __name: "DeficiencyStatus",
        props: {
            componentItem: {},
            isEditable: {
                type: Boolean
            },
            searchParams: {},
            refreshComponent: {
                type: Boolean
            }
        },
        setup (S) {
            const s = S, c = W(), I = O(), { t: R } = $(), u = m(), f = m(), l = F(), { setOptions: w, getInstance: h, disposeInstance: g, resizeFn: k } = V(f), o = m("chart"), { deficiencyStatusColumns: x } = A();
            b(()=>s.refreshComponent, (t)=>{
                t && d();
            }, {
                immediate: !0
            }), b(()=>s.isEditable, ()=>{
                o.value === "chart" && k();
            });
            function d() {
                o.value === "table" ? v(!0) : o.value === "chart" && L();
            }
            async function L() {
                const t = await H(s.searchParams || {});
                let n = 0;
                const P = (t || []).map((e)=>(n = n + Number(e?.amount || 0), {
                        value: Number(e?.amount || 0),
                        status: e?.status,
                        name: I.getLocale === "en" ? e?.statusNameEn : e?.statusName
                    })), q = {
                    legend: {
                        bottom: 0,
                        left: "center"
                    },
                    title: {
                        text: n,
                        subtext: R("dashboard.workbench.totalDeficiency"),
                        left: "center",
                        top: "40%",
                        textStyle: {
                            color: a(c)?.textColor1,
                            fontSize: 26
                        },
                        subtextStyle: {
                            color: a(c)?.textColor3,
                            fontSize: 14
                        }
                    },
                    series: [
                        {
                            type: "pie",
                            radius: [
                                "45%",
                                "60%"
                            ],
                            top: "-8%",
                            label: {
                                formatter: `{name|{b}： {c}}
{percent|{d}%}`,
                                minMargin: 5,
                                lineHeight: 25,
                                rich: {
                                    percent: {
                                        color: a(c)?.textColor3
                                    }
                                }
                            },
                            labelLayout: function(e) {
                                const i = e.labelRect.x < (h()?.getWidth() || 0) / 2, r = e.labelLinePoints;
                                return r && (r[2][0] = i ? e.labelRect.x : e.labelRect.x + e.labelRect.width), {
                                    labelLinePoints: r
                                };
                            },
                            data: P
                        }
                    ]
                };
                await y(), w(q), h()?.on("click", function(e) {
                    const i = s.searchParams?.shipIds?.toString()?.split(",");
                    let r = "";
                    i?.length === 1 && (r = i[0]), l.push({
                        name: "HSQE_deficiencyList",
                        query: {
                            status: e?.data?.status,
                            shipId: r
                        }
                    });
                });
            }
            function v(t) {
                y(()=>{
                    u.value?.handleGetData(t);
                });
            }
            function T(t) {
                o.value = t, o.value === "chart" && g(), d();
            }
            function D(t) {
                return {
                    style: "cursor: pointer",
                    onClick: ()=>{
                        l.push({
                            name: "Add_HSQE_AuditInspection_ReportList_VesselInspection_DeficiencyReport",
                            query: {
                                id: t.id,
                                type: "view"
                            }
                        });
                    }
                };
            }
            function E() {
                const t = s.searchParams?.shipIds?.toString()?.split(",");
                let n = "";
                t?.length === 1 && (n = t[0]), l.push({
                    name: "HSQE_deficiencyList",
                    query: {
                        shipId: n
                    }
                });
            }
            return (t, n)=>(p(), _(B, {
                    componentItem: t.componentItem,
                    currentComponent: a(o),
                    "show-filter": !1,
                    onShowAll: E,
                    onTransition: T
                }, {
                    default: G(()=>[
                            a(o) === "table" ? (p(), _(N, {
                                key: 0,
                                ref_key: "basicTableRef",
                                ref: u,
                                columns: a(x),
                                request: a(z),
                                params: {
                                    ...t.searchParams || {}
                                },
                                "row-props": D
                            }, null, 8, [
                                "columns",
                                "request",
                                "params"
                            ])) : C("", !0),
                            a(o) === "chart" ? (p(), M("div", {
                                key: 1,
                                ref_key: "chartRef",
                                ref: f,
                                class: "w-full h-full"
                            }, null, 512)) : C("", !0)
                        ]),
                    _: 1
                }, 8, [
                    "componentItem",
                    "currentComponent"
                ]));
        }
    });
});
export { Dt as default, __tla };
