import { B as $ } from "./BasicForm-dL_oCSPM.js";
import { _ as O } from "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import { u as V } from "./useModal-CO65vga3.js";
import { ad as n, V as u, bk as f, d as q, r as d, c as k, o as B, l as r, w as D, j as A, cZ as L, ac as W, __tla as __tla_0 } from "./index-9PRMimni.js";
import { g as M } from "./equipmentMainLibrary-bJTzj5mC.js";
import { u as j } from "./useForm-CKmgcynv.js";
let o, ue, ae, le, re, ne;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const { HSQE_PREFIX: a } = Object.fromEntries([
        [
            "HSQE_PREFIX",
            "/tx"
        ]
    ].map(([e, v])=>[
            e,
            ""
        ]));
    re = function(e) {
        return n.Post(`${a}/surveyConfig/listPage`, e);
    };
    function z(e) {
        return n.Post(`${a}/surveyConfig/insert`, e);
    }
    function H(e) {
        return n.Post(`${a}/surveyConfig/update`, e);
    }
    ne = function(e) {
        return n.Post(`${a}/surveyConfig/issue`, e);
    };
    ae = function(e) {
        return n.Post(`${a}/surveyConfig/cancel`, e);
    };
    const { t: y } = u();
    o = ((e)=>(e.ADD = "add", e.VIEW = "view", e.EDIT = "edit", e))(o || {});
    function Q(e = "view") {
        switch(e){
            case "add":
                return y("vesselsSurveyType.addSurveyType");
            case "view":
                return y("vesselsSurveyType.viewSurveyType");
            case "edit":
                return y("vesselsSurveyType.editSurveyType");
            default:
                return "";
        }
    }
    function X(e) {
        return e ? {
            ...e,
            vesselType: e.hasOwnProperty("vesselType") ? e.vesselType + "" : void 0
        } : {};
    }
    const { t: T } = u(), G = f(), S = await M("sms_category");
    le = function() {
        return [
            {
                field: "vesselType",
                component: "NSelect",
                label: T("vesselsSurveyType.vesselType"),
                componentProps: {
                    placeholder: T("vesselsSurveyType.vesselType"),
                    labelField: G.getLocale === "en" ? "labelEn" : "label",
                    options: S
                }
            }
        ];
    };
    const { t: s } = u(), Z = f();
    function J() {
        return [
            {
                field: "id",
                hidden: !0
            },
            {
                field: "vesselType",
                component: "NSelect",
                label: s("vesselsSurveyType.vesselType"),
                componentProps: {
                    placeholder: s("vesselsSurveyType.vesselType"),
                    labelField: Z.getLocale === "en" ? "labelEn" : "label",
                    options: S
                },
                rules: [
                    {
                        required: !0,
                        message: s("vesselsSurveyType.vesselTypeRequired")
                    }
                ]
            },
            {
                field: "no",
                component: "NInput",
                label: s("vesselsSurveyType.surveyTypeNo"),
                componentProps: {
                    placeholder: s("vesselsSurveyType.surveyTypeNo")
                },
                rules: [
                    {
                        required: !0,
                        message: s("vesselsSurveyType.surveyTypeNoRequired")
                    }
                ]
            },
            {
                field: "englishName",
                component: "NInput",
                label: s("vesselsSurveyType.surveyTypeNameEn"),
                componentProps: {
                    placeholder: s("vesselsSurveyType.surveyTypeNameEn")
                },
                rules: [
                    {
                        required: !0,
                        message: s("vesselsSurveyType.surveyTypeNameEnRequired")
                    }
                ]
            },
            {
                field: "chineseName",
                component: "NInput",
                label: s("vesselsSurveyType.surveyTypeNameCn"),
                componentProps: {
                    placeholder: s("vesselsSurveyType.surveyTypeNameCn")
                },
                rules: [
                    {
                        required: !0,
                        message: s("vesselsSurveyType.surveyTypeNameCnRequired")
                    }
                ]
            },
            {
                field: "fillingExplanation",
                component: "NInput",
                label: s("vesselsSurveyType.fillingExplanation"),
                giProps: {
                    span: 3
                },
                showFeedback: !1,
                componentProps: {
                    placeholder: s("vesselsSurveyType.fillingExplanation"),
                    type: "textarea",
                    showCount: !0,
                    maxlength: 1e3,
                    autosize: {
                        minRows: 3,
                        maxRows: 3
                    }
                }
            }
        ];
    }
    ue = q({
        __name: "index",
        emits: [
            "refresh"
        ],
        setup (e, { expose: v, emit: g }) {
            const { t: i } = u(), h = L(), b = g, m = d(o.VIEW), c = d(!1), [w, { submit: E, setFieldsValue: P }] = j({
                schemas: J(),
                layout: "horizontal",
                gridProps: {
                    cols: 3
                }
            }), [x, { setProps: N, openModal: _, closeModal: R, setSubLoading: p }] = V({
                subBtuText: i("common.confirmText"),
                cancelText: i("common.cancelText"),
                width: 840
            });
            async function I() {
                try {
                    const t = await E();
                    if (!t) {
                        p(!1);
                        return;
                    }
                    const l = {
                        [o.ADD]: z,
                        [o.EDIT]: H
                    }[m.value];
                    await l(t), h.success(i("common.saveSuccessText")), p(!1), b("refresh"), R();
                } catch  {
                    p(!1);
                }
            }
            async function C({ mode: t, record: l }) {
                m.value = t || o.VIEW, c.value = t === o.VIEW, N({
                    title: Q(t)
                }), _(), await W(), P(X(l));
            }
            return v({
                handleOpenModal: C
            }), (t, l)=>{
                const F = $;
                return B(), k(r(O), {
                    onRegister: r(x),
                    onOnOk: I,
                    showAction: !r(c)
                }, {
                    default: D(()=>[
                            A(F, {
                                onRegister: r(w),
                                showActionButtonGroup: !1,
                                disabled: r(c)
                            }, null, 8, [
                                "onRegister",
                                "disabled"
                            ])
                        ]),
                    _: 1
                }, 8, [
                    "onRegister",
                    "showAction"
                ]);
            };
        }
    });
});
export { o as M, ue as _, ae as a, le as c, re as g, ne as i, __tla };
