import { V as m, bk as g, d as q, f as _, u as x, r as p, aw as N, c as O, o as P, w as V, j as w, l as D, X as S, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as T } from "./BasicForm-dL_oCSPM.js";
import { i as B, aj as C, e as F, j as L, t as M, w as E } from "./template-rpthWlT9.js";
import { u as k } from "./useForm-CKmgcynv.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 "./usePageCache-DluHn7Yy.js";
let me;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const r = g(), j = await C(), A = await B(), W = await F({
        roleType: 2,
        roleCategory: 1
    }), G = await L(), { t: o } = m();
    function d(i) {
        return {
            schemas: [
                {
                    field: "reportNo",
                    component: "NInput",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.basicInfo.relatedReportNo"),
                    componentProps: {
                        disabled: i?.readOnly
                    }
                },
                {
                    field: "severity",
                    component: "NSelect",
                    label: o("hsqe.deficiency.servity"),
                    componentProps: {
                        options: A,
                        disabled: i?.readOnly,
                        "label-field": r.getLocale === "en" ? "labelEn" : "label"
                    }
                },
                {
                    field: "isMemo",
                    component: "NRadio",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.basicInfo.isMemo"),
                    componentProps: {
                        disabled: i?.readOnly
                    }
                },
                {
                    field: "deficiencyCode",
                    component: "NSelect",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.basicInfo.deficiencyCode"),
                    componentProps: {
                        options: j,
                        disabled: i?.readOnly,
                        labelField: r.getLocale === "en" ? "labelEn" : "label"
                    }
                },
                {
                    field: "equipmentId",
                    component: "NInput",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.basicInfo.equipment"),
                    componentProps: {
                        disabled: i?.readOnly
                    }
                },
                {
                    field: "criticalEquipment",
                    component: "NRadio",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.basicInfo.criticalEquipment"),
                    componentProps: {
                        disabled: i?.readOnly
                    }
                },
                {
                    field: "expirationTime",
                    component: "NDatePicker",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.basicInfo.expiryDate"),
                    componentProps: {
                        valueFormat: "yyyy-MM-dd",
                        type: "date",
                        disabled: i?.readOnly
                    }
                },
                {
                    field: "vesselResponsibleId",
                    component: "NSelect",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.basicInfo.vesselResponsible"),
                    componentProps: {
                        options: W,
                        "label-field": "name",
                        "value-field": "code",
                        disabled: i?.readOnly
                    }
                },
                {
                    field: "officeResponsibleId",
                    component: "NSelect",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.basicInfo.officeResponsible"),
                    componentProps: {
                        options: G,
                        "label-field": "name",
                        "value-field": "code",
                        disabled: i?.readOnly
                    }
                },
                {
                    field: "basicDescription",
                    component: "NInput",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.basicInfo.description"),
                    componentProps: {
                        type: "textarea",
                        disabled: i?.readOnly
                    }
                }
            ]
        };
    }
    me = q({
        __name: "index",
        setup (i, { expose: a }) {
            const { t: f } = m(), s = _(), u = x(), n = p([]), [y, { setFieldsValue: b, getFieldsValue: I }] = k({
                schemas: n,
                labelWidth: "auto",
                layout: "horizontal",
                gridProps: {
                    cols: 3,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), c = p({});
            async function h() {
                if (s.query.id) {
                    const e = await M(Number(s.query.id));
                    console.log(e), e?.expirationTime && (e.expirationTime = e.expirationTime.split("T")[0]), c.value = e, b(e);
                }
                if (s.query.isEdit) {
                    const e = d({
                        readOnly: !1
                    });
                    n.value = e.schemas;
                } else {
                    const e = d({
                        readOnly: !0
                    });
                    n.value = e.schemas;
                }
            }
            async function R() {
                let e = I();
                console.log(e);
                const t = {
                    ...c.value,
                    ...e
                };
                console.log(t), t.expirationTime && (t.expirationTime += " 00:00:00"), await E(t) && u.success(f("common.saveSuccessText"));
            }
            return N(()=>{
                h();
            }), a({
                submit: R
            }), (e, t)=>{
                const l = T, v = S;
                return P(), O(v, null, {
                    default: V(()=>[
                            w(l, {
                                class: "mt-3",
                                onRegister: D(y)
                            }, null, 8, [
                                "onRegister"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { me as default, __tla };
