import { _ as E, __tla as __tla_0 } from "./CustomCard.vue_vue_type_script_setup_true_lang-374ERk20.js";
import { _ as q } from "./CustomTable.vue_vue_type_script_setup_true_lang-CVzOsXR0.js";
import { u as B } from "./useECharts-XZ1IwN24.js";
import { c as O } from "./columns-1dSLzo5A.js";
import { n as M, o as N } from "./workbench-DEgqNpqd.js";
import { d as D, e as F, bk as j, r as p, ay as h, l as r, ac as f, c as y, o as c, w as z, D as P, h as W, __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 xe;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    xe = D({
        __name: "PurchaseOrderStatus",
        props: {
            componentItem: {},
            isEditable: {
                type: Boolean
            },
            searchParams: {},
            refreshComponent: {
                type: Boolean
            }
        },
        setup (g) {
            const o = g, i = F(), l = j(), u = p(), d = p(), { setOptions: _, disposeInstance: I, resizeFn: v, getInstance: C } = B(d), n = p({
                statusList: "2,3,4"
            }), t = p("chart"), { purchaseOrderStatusColumns: S } = O();
            h(()=>o.refreshComponent, (e)=>{
                e && m();
            }, {
                immediate: !0
            }), h(()=>o.isEditable, ()=>{
                t.value === "chart" && v();
            });
            function m() {
                t.value === "table" ? k(!0) : t.value === "chart" && b();
            }
            async function b() {
                const e = await M({
                    ...o.searchParams || {},
                    ...r(n) || {}
                }), s = (e.shipList || []).map((a)=>a?.[l.getLocale === "en" ? "shipNameEn" : "shipName"]), R = (e.seriesList || []).map((a)=>({
                        type: "bar",
                        stack: "total",
                        emphasis: {
                            focus: "series"
                        },
                        showBackground: !0,
                        barMaxWidth: 30,
                        name: a?.[l.getLocale === "en" ? "stateNameEn" : "stateName"],
                        data: a?.countList || []
                    })), T = {
                    tooltip: {
                        trigger: "axis",
                        axisPointer: {
                            type: "shadow"
                        }
                    },
                    xAxis: {
                        type: "category",
                        data: s
                    },
                    yAxis: {
                        type: "value",
                        minInterval: 1
                    },
                    grid: {
                        top: 30,
                        right: "6%"
                    },
                    dataZoom: [
                        {
                            type: "slider",
                            start: 10,
                            end: 90,
                            moveHandleSize: 10,
                            height: 20
                        }
                    ],
                    series: R
                };
                f(()=>{
                    _(T), C()?.on("click", function(a) {
                        a.componentType === "series" && i.push({
                            name: "PMS_poListPage",
                            query: {
                                shipId: (e.shipList || [])[a.dataIndex]?.shipId,
                                approveStatus: (e.seriesList || [])[a.seriesIndex || 0]?.statusId
                            }
                        });
                    });
                });
            }
            function k(e) {
                f(()=>{
                    u.value?.handleGetData(e);
                });
            }
            function x(e) {
                return {
                    style: "cursor: pointer",
                    onClick: ()=>{
                        +e.isChanged == 1 ? i.push({
                            name: "Adjust_PMS_AdjustPoPage",
                            query: {
                                type: "view",
                                poId: e.id,
                                canApprove: e.canApprove,
                                canEdit: e.canEdit
                            }
                        }) : i.push({
                            name: "Add_PMS_PolistPage",
                            query: {
                                poId: e.id,
                                type: "view"
                            }
                        });
                    }
                };
            }
            function L() {
                const e = o.searchParams?.shipIds?.toString()?.split(",");
                let s = "";
                e?.length === 1 && (s = e[0]), i.push({
                    name: "PMS_poListPage",
                    query: {
                        shipId: s
                    }
                });
            }
            function A(e) {
                n.value = e, m();
            }
            function w(e) {
                t.value = e, t.value === "chart" && I(), m();
            }
            return (e, s)=>(c(), y(E, {
                    componentItem: e.componentItem,
                    currentComponent: r(t),
                    cardParams: r(n),
                    onFilter: A,
                    onShowAll: L,
                    onTransition: w
                }, {
                    default: z(()=>[
                            r(t) === "table" ? (c(), y(q, {
                                key: 0,
                                ref_key: "basicTableRef",
                                ref: u,
                                columns: r(S),
                                request: r(N),
                                params: {
                                    ...e.searchParams || {},
                                    ...r(n) || {}
                                },
                                "row-props": x
                            }, null, 8, [
                                "columns",
                                "request",
                                "params"
                            ])) : P("", !0),
                            r(t) === "chart" ? (c(), W("div", {
                                key: 1,
                                ref_key: "chartRef",
                                ref: d,
                                class: "w-full h-full"
                            }, null, 512)) : P("", !0)
                        ]),
                    _: 1
                }, 8, [
                    "componentItem",
                    "currentComponent",
                    "cardParams"
                ]));
        }
    });
});
export { xe as default, __tla };
