import { _ as W } from "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import { O as Z, aw as j, b as G } from "./template-rpthWlT9.js";
import { B as K } from "./BasicForm-dL_oCSPM.js";
import { u as Q } from "./useForm-CKmgcynv.js";
import { B as U } from "./Table-0PViRYCf.js";
import { V as f, bk as I, Z as z, ae as J, d as X, e as Y, r as n, c as ee, o as oe, l as a, w as te, j as b, ac as k, cZ as se, __tla as __tla_0 } from "./index-9PRMimni.js";
import { u as ne } from "./useModal-CO65vga3.js";
let he;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const y = I(), { t: c } = f(), m = [
        {
            key: 0,
            value: "Open",
            valueCn: "待访船",
            color: {
                color: "#F8F0FF",
                textColor: "#7A42C4",
                borderColor: "#9089D8"
            }
        },
        {
            key: 1,
            value: "Due in 15 days",
            valueCn: "15天内到期",
            color: {
                color: "#F8F7EC",
                textColor: "#DDD12A",
                borderColor: "#E8DC38"
            }
        },
        {
            key: 2,
            value: "Due in 15 days",
            valueCn: "15天内到期",
            color: {
                color: "#F8F7EC",
                textColor: "#DDD12A",
                borderColor: "#E8DC38"
            }
        },
        {
            key: 3,
            value: "Pending Extension",
            valueCn: "延期审批中",
            color: {
                color: "#F8F2EC",
                textColor: "#CF8522",
                borderColor: "#E09B41"
            }
        },
        {
            key: 4,
            value: "Extension",
            valueCn: "延期已批准",
            color: {
                color: "#ECF1F8",
                textColor: "#2482CB",
                borderColor: "#2495EE"
            }
        },
        {
            key: 5,
            value: "Assigned Report",
            valueCn: "已创建报告",
            color: {
                color: "#F8ECF8",
                textColor: "#AC42B5",
                borderColor: "#CE81D4"
            }
        },
        {
            key: 6,
            value: "Completed",
            valueCn: "已完成",
            color: {
                color: "#ECF8F0",
                textColor: "#4C9062",
                borderColor: "#6DB484"
            }
        },
        {
            key: 7,
            value: "Overdue",
            valueCn: "已逾期",
            color: {
                color: "#F8ECEC",
                textColor: "#D3392D",
                borderColor: "#E06C63"
            }
        },
        {
            key: 8,
            value: "Canceled",
            valueCn: "已取消",
            color: {
                color: "#EFEDF4",
                textColor: "#6B6A79",
                borderColor: "#A19FB0"
            }
        }
    ];
    function ae() {
        return {
            columns: [
                {
                    type: "selection",
                    multiple: !1,
                    key: "selection"
                },
                {
                    title: c("hsqe.auditInspection.vesselInspection.planDate"),
                    key: "planDate"
                },
                {
                    title: c("hsqe.auditInspection.vesselInspection.portName"),
                    key: "portName"
                },
                {
                    title: c("hsqe.auditInspection.vesselInspection.vessel"),
                    key: y.getLocale === "en" ? "shipNameEn" : "shipName"
                },
                {
                    title: c("hsqe.auditInspection.vesselInspection.inspector"),
                    key: "inspectorNames"
                },
                {
                    title: c("hsqe.auditInspection.vesselInspection.currentStatus"),
                    key: "currentStatus",
                    render (l) {
                        return z(J, {
                            bordered: !1,
                            color: m.find((t)=>t.key === l.currentStatus)?.color
                        }, {
                            default: ()=>y.getLocale === "en" ? m.find((t)=>t.key === l.currentStatus)?.value : m.find((t)=>t.key === l.currentStatus)?.valueCn
                        });
                    }
                }
            ]
        };
    }
    const le = I(), { t: F } = f(), re = await Z();
    function ce() {
        return {
            schemas: [
                {
                    field: "shipId",
                    component: "NSelect",
                    label: F("hsqe.auditInspection.vesselInspection.formVessel"),
                    componentProps: {
                        placeholder: F("hsqe.auditInspection.vesselInspection.formVesselHint"),
                        options: re,
                        "value-field": "id",
                        "label-field": le.getLocale === "en" ? "shipNameEn" : "shipName"
                    }
                }
            ]
        };
    }
    he = X({
        __name: "Modal",
        emits: [
            "success"
        ],
        setup (C, { expose: l }) {
            const t = Y(), g = se(), { t: i } = f(), D = n(), v = n(), _ = n(), d = n(), x = n(""), h = n(""), o = n(null), { columns: E } = ae(), { schemas: S } = ce(), [R, { getFieldsValue: T }] = Q({
                schemas: S,
                showAdvancedButton: !1,
                labelWidth: "auto",
                gridProps: {
                    cols: 2,
                    xGap: 15
                }
            }), [N, { openModal: B, setProps: w, setSubLoading: A }] = ne({
                title: i("common.addText"),
                subBtuText: i("common.okText"),
                cancelText: i("common.cancelText"),
                width: 1e3
            });
            function q(e, s) {
                return j({
                    currentStatus: [
                        0,
                        2,
                        4
                    ],
                    ...e,
                    ...s,
                    subTypeIds: M(d.value)
                });
            }
            function M(e) {
                if (e == 1) return [
                    34
                ];
                if (e == 2) return [
                    36
                ];
                if (e == 0) return [
                    35
                ];
                if (e == 3) return [
                    37
                ];
                if (e == 4) return [
                    38
                ];
            }
            function p() {
                v.value.reload();
            }
            async function O(e, s, u) {
                if (d.value = e, x.value = s, B(), u) {
                    h.value = u;
                    const r = await G({
                        templateCode: s,
                        uuid: a(h)
                    });
                    await k(), _.value?.setFieldsValue(r);
                }
            }
            async function V() {
                await k(), p();
            }
            async function L() {
                if (!o.value || !o.value.id) {
                    g.error(i("hsqe.auditInspection.vesselInspection.plannerHint")), A(!1);
                    return;
                }
                t.push({
                    name: "Add_HSQE_AuditInspection_ReportList_VesselInspection_AddNavigationAudit",
                    query: {
                        plannerId: o.value.id,
                        planDate: o.value.planDate,
                        shipName: o.value.shipName,
                        portName: o.value.portName,
                        shipId: o.value.shipId,
                        portId: o.value.portId,
                        currentType: d.value
                    }
                });
            }
            function P() {
                p();
            }
            function H() {
                p();
            }
            function $(e, s) {
                o.value = s[0];
            }
            return l({
                showModal: O,
                setProps: w,
                getData: V
            }), (e, s)=>{
                const u = W;
                return oe(), ee(u, {
                    ref: "modalRef",
                    onRegister: a(N),
                    class: "basicModal basicFormModal",
                    onOnOk: L
                }, {
                    default: te(()=>[
                            b(a(K), {
                                ref_key: "contentFromRef",
                                ref: D,
                                onRegister: a(R),
                                onSubmit: P,
                                onReset: H,
                                class: "mb-3"
                            }, null, 8, [
                                "onRegister"
                            ]),
                            b(a(U), {
                                ref_key: "basicTableRef",
                                ref: v,
                                columns: a(E),
                                request: (r)=>q(r, a(T)()),
                                immediate: !1,
                                "row-key": (r)=>r.id,
                                "onUpdate:checkedRowKeys": $,
                                showTableSetting: !1
                            }, null, 8, [
                                "columns",
                                "request",
                                "row-key"
                            ])
                        ]),
                    _: 1
                }, 8, [
                    "onRegister"
                ]);
            };
        }
    });
});
export { he as _, __tla };
