import { _ as I } from "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import { B as M } from "./BasicForm-dL_oCSPM.js";
import { u as N } from "./useForm-CKmgcynv.js";
import { V as m, r as V, gK as S, R as g, bk as q, d as F, e as O, c as j, o as P, w as A, j as L, l as u, __tla as __tla_0 } from "./index-9PRMimni.js";
import { A as U } from "./template-rpthWlT9.js";
import { u as G } from "./useModal-CO65vga3.js";
let Z;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: b } = m();
    function H() {
        return {
            schemas: [
                {
                    field: "comment",
                    component: "NInput",
                    giProps: {
                        span: 2
                    },
                    label: b("hsqe.planner.modal.reason"),
                    componentProps: {
                        type: "textarea",
                        maxlength: 300,
                        showCount: !0
                    },
                    rules: [
                        {
                            required: !0,
                            message: b("hsqe.planner.modal.reasonHint"),
                            trigger: [
                                "input",
                                "blur"
                            ]
                        }
                    ]
                }
            ]
        };
    }
    const { t: i } = m(), W = q(), o = V([]);
    let t = "";
    try {
        const e = await S({
            meta: {
                isReturnNativeResponse: !0
            }
        });
        if (e && typeof e == "object" && e.data?.code === g.SUCCESS) switch(t = e.data?.data, t){
            case "1":
                o.value = [
                    {
                        value: "SSB0705  ",
                        label: "散货",
                        labelEn: "Bulk"
                    }
                ];
                break;
            case "2":
                o.value = [
                    {
                        value: "SSB0705Tank",
                        label: "油液",
                        labelEn: "Tanker"
                    }
                ];
                break;
            case "3":
                o.value = [
                    {
                        value: "SSB0705  ",
                        label: "散货",
                        labelEn: "Bulk"
                    },
                    {
                        value: "SSB0705Tank  ",
                        label: "油液",
                        labelEn: "Tanker"
                    }
                ];
        }
    } catch  {
        t = "";
    }
    i("hsqe.certificate.VesselType"), i("hsqe.auditInspection.vesselInspection.formCategoryHint"), o.value, o.value[0].value, W.getLocale, i("hsqe.auditInspection.vesselInspection.year");
    function $() {
        const e = {
            1: "SSB0705",
            2: "SSB0705Tank"
        }, n = function(a) {
            switch(a){
                case "SSB0705":
                    o.value = [
                        {
                            value: "SSB0705  ",
                            label: "散货",
                            labelEn: "Bulk"
                        }
                    ];
                    break;
                case "SSB0705Tank":
                    o.value = [
                        {
                            value: "SSB0705Tank",
                            label: "油液",
                            labelEn: "Tanker"
                        }
                    ];
                    break;
                case "3":
                    o.value = [
                        {
                            value: "SSB0705  ",
                            label: "散货",
                            labelEn: "Bulk"
                        },
                        {
                            value: "SSB0705Tank  ",
                            label: "油液",
                            labelEn: "Tanker"
                        }
                    ];
            }
        }, l = function() {
            return +t == 2;
        }, s = function() {
            return +t == 1;
        };
        return {
            refreshVisitingType: async function() {
                try {
                    const a = await S({
                        meta: {
                            isReturnNativeResponse: !0
                        }
                    });
                    a && typeof a == "object" && "data" in a && a.data?.code === g.SUCCESS && (t = a.data?.data);
                } catch  {
                    t = "";
                }
            },
            setOptsCategory: n,
            templateCode: e[t],
            isTankerFunc: l,
            isCargoFunc: s
        };
    }
    Z = F({
        __name: "rejectModal",
        props: {
            busId: {},
            subModuleCode: {},
            defectNo: {}
        },
        emits: [
            "success"
        ],
        setup (e, { expose: n, emit: l }) {
            const s = e, p = l, a = O(), { t: r } = m(), { schemas: h } = H(), { templateCode: v, isTankerFunc: k } = $(), [B, { openModal: y, closeModal: T, setSubLoading: c }] = G({
                title: r("common.optionsReturnText"),
                subBtuText: r("common.confirmText"),
                cancelText: r("common.cancelText"),
                width: 650
            }), [C, { submit: R, getFieldsValue: _ }] = N({
                schemas: h,
                labelWidth: "auto",
                layout: "horizontal",
                gridProps: {
                    cols: 2,
                    xGap: 15
                },
                showActionButtonGroup: !1
            });
            async function w() {
                y();
            }
            async function x() {
                if (console.log(s), !await R()) return c(!1), !1;
                const d = _();
                try {
                    await U({
                        busId: Number(s.busId),
                        moduleCode: k() ? v : "voyageRepair",
                        busNo: s.defectNo,
                        subModuleCode: s.subModuleCode,
                        ...d
                    }), a.go(-2), T(), c(!1), p("success");
                } catch  {
                    c(!1);
                }
            }
            return n({
                showModal: w
            }), (E, d)=>{
                const f = I;
                return P(), j(f, {
                    ref: "modalRef",
                    onRegister: u(B),
                    onOnOk: x
                }, {
                    default: A(()=>[
                            L(u(M), {
                                onRegister: u(C),
                                "label-placement": "top"
                            }, null, 8, [
                                "onRegister"
                            ])
                        ]),
                    _: 1
                }, 8, [
                    "onRegister"
                ]);
            };
        }
    });
});
export { Z as _, __tla };
