import { _ as D } 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 V } from "./BasicForm-dL_oCSPM.js";
import { u as O } from "./useForm-CKmgcynv.js";
import { c as P, __tla as __tla_0 } from "./modalSchemas-D9c32bW5.js";
import { H as S, v as L } from "./template-rpthWlT9.js";
import { d as z, V as G, r as c, c as j, o as A, l as n, w as H, j as U, ac as u, cZ as W, __tla as __tla_1 } from "./index-9PRMimni.js";
import { u as Y } from "./useModal-CO65vga3.js";
let se;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    se = z({
        __name: "Modal",
        emits: [
            "success",
            "changeResult"
        ],
        setup (Z, { expose: d, emit: p }) {
            const i = p, r = W(), { t: a } = G(), { schemasFsc: f, methodsFsc: h } = P(), { setDefectList: g } = h, [_, { openModal: x, closeModal: v, setProps: R, setSubLoading: l }] = Y({
                title: a("common.addText"),
                subBtuText: a("common.okText"),
                cancelText: a("common.cancelText"),
                width: 650
            }), [T, { submit: M, setFieldsValue: b, getFieldsValue: w }] = O({
                schemas: f,
                labelWidth: "auto",
                layout: "horizontal",
                gridProps: {
                    cols: 2,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), y = c(), t = c(), m = c();
            async function F(s, e) {
                t.value = s, m.value = e, y.value = s.reportNum;
                let o = await S({
                    mouId: s.mouCode,
                    item: "",
                    pageNum: 1,
                    pageSize: 1e4
                });
                g(o), x();
                const N = {
                    reportNo: s.reportNum
                };
                await u(), b(N);
            }
            async function I() {
                await u();
            }
            const C = c("");
            async function k() {
                if (!await M()) return l(!1), !1;
                const e = w();
                e.expirationTime && (e.expirationTime += " 00:00:00"), delete e.deficiencyPhotoUrl_Photo;
                const o = await L({
                    ...e,
                    reportId: m.value,
                    shipId: t.value.shipId,
                    auditTypeId: t.value.auditTypeId,
                    reportType: "fscReport",
                    mouCode: t.value.mouCode,
                    status: "new"
                });
                o.data.success ? (r.success(a("common.saveSuccessText")), v(), i("success")) : (r.error(o.data.msg), l(!1));
            }
            function B() {
                i("changeResult", t.value, C.value || "Yes");
            }
            return d({
                showModal: F,
                setProps: R,
                getData: I
            }), (s, e)=>{
                const o = D;
                return A(), j(o, {
                    ref: "modalRef",
                    onRegister: n(_),
                    class: "basicModal basicFormModal",
                    onOnOk: k,
                    onOnClose: B
                }, {
                    default: H(()=>[
                            U(n(V), {
                                onRegister: n(T),
                                "label-placement": "top"
                            }, null, 8, [
                                "onRegister"
                            ])
                        ]),
                    _: 1
                }, 8, [
                    "onRegister"
                ]);
            };
        }
    });
});
export { se as _, __tla };
