import { r as i, V as g, bk as x, d as P, f as v, aw as q, c as B, o as T, w, j as C, l as M, X as F, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as R } from "./BasicForm-dL_oCSPM.js";
import { j as k, al as I, w as S } from "./template-rpthWlT9.js";
import { u as O } 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 pe;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    x();
    const { t: a } = g(), j = i([]);
    await k();
    const L = [
        {
            label: "NC",
            value: "NC"
        },
        {
            label: "Major NC",
            value: "MajorNC"
        }
    ];
    function V() {
        const t = i(!1), c = i(null), n = [
            {
                field: "shipName",
                component: "NInput",
                label: a("hsqe.nc.name"),
                componentProps: {
                    disabled: t
                }
            },
            {
                field: "captainName",
                component: "NInput",
                label: a("hsqe.nc.reportedBy"),
                componentProps: {
                    disabled: t
                }
            },
            {
                field: "reportDate",
                component: "NDatePicker",
                label: a("hsqe.nc.Date"),
                componentProps: {
                    valueFormat: "yyyy-MM-dd",
                    type: "date",
                    disabled: t
                }
            },
            {
                field: "natureNonComformity",
                component: "NSelect",
                label: a("hsqe.nc.nature"),
                componentProps: {
                    options: L,
                    disabled: t
                }
            },
            {
                field: "expirationTime",
                component: "NDatePicker",
                label: a("hsqe.nc.RectifyData"),
                componentProps: {
                    valueFormat: "yyyy-MM-dd",
                    type: "date",
                    disabled: t
                }
            },
            {
                field: "basicDescription",
                component: "NInput",
                label: a("hsqe.nc.describe"),
                componentProps: {
                    type: "textarea",
                    disabled: t
                },
                giProps: {
                    span: 3
                }
            },
            {
                field: "basicDescription",
                component: "NInput",
                label: a("hsqe.nc.require"),
                componentProps: {
                    type: "textarea",
                    disabled: t
                },
                giProps: {
                    span: 3
                }
            }
        ];
        return {
            schemas: n,
            methods: {
                setReadOnly: (o)=>{
                    t.value = o;
                },
                setReportType: (o)=>{
                    c.value = o;
                },
                setDefectList: (o)=>{
                    j.value = o.list;
                },
                getSchemas: ()=>n
            }
        };
    }
    pe = P({
        __name: "index",
        emits: [
            "saveCallBack"
        ],
        setup (t, { expose: c, emit: n }) {
            const r = v(), o = n, m = i([]), { methods: d } = V(), { setReadOnly: l, getSchemas: f } = d, [y, { setFieldsValue: b, getFieldsValue: h }] = O({
                schemas: m,
                labelWidth: "auto",
                layout: "horizontal",
                gridProps: {
                    cols: 3,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), u = i({});
            async function N() {
                if (r.query.id) {
                    const s = await I(Number(r.query.id));
                    let e = JSON.parse(JSON.stringify(s));
                    e.isMemo = e.isMemo === "yes", e.officePositionId = Number(e.officePositionId) || 0, e.expirationTime && typeof e.expirationTime == "string" && (e.expirationTime = e.expirationTime.split(/T| /)[0]), u.value = e, b(e);
                }
                r.query.type === "view" ? l(!0) : l(!1);
                const p = f();
                m.value = p, l(!0);
            }
            async function D() {
                let p = h();
                const s = {
                    ...u.value,
                    ...p
                };
                s.expirationTime && (s.expirationTime += " 00:00:00"), await S(s), o("saveCallBack");
            }
            return q(()=>{
                N();
            }), c({
                submit: D
            }), (p, s)=>{
                const e = R, _ = F;
                return T(), B(_, null, {
                    default: w(()=>[
                            C(e, {
                                class: "mt-3",
                                onRegister: M(y)
                            }, null, 8, [
                                "onRegister"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { pe as default, __tla };
