import { r as c, V as T, bk as C, cO as D, cq as I, fm as L, d as w, f as E, aw as B, c as F, o as M, w as O, j as A, l as k, X as V, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as G } from "./BasicForm-dL_oCSPM.js";
import { i as W, M as j, e as z, j as J, t as U } from "./template-rpthWlT9.js";
import { u as $ } 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 ge;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const a = C(), { t: e } = T(), b = c([]), y = await W(), h = await z({
        roleType: 2,
        roleCategory: 1
    }), K = await j(), g = await J();
    function X() {
        const o = c(!1), l = c(null), m = [
            {
                field: "reportNo",
                component: "NInput",
                label: e("hsqe.psc.relatedReportNo"),
                componentProps: {
                    disabled: !0
                }
            },
            {
                field: "severity",
                component: "NSelect",
                label: e("hsqe.psc.servity"),
                componentProps: {
                    options: y,
                    disabled: o,
                    "label-field": a.getLocale === "en" ? "labelEn" : "label"
                }
            },
            {
                field: "defectCode",
                component: "NSelect",
                label: e("hsqe.psc.mouDeficiencyCode"),
                componentProps: {
                    options: b,
                    disabled: o,
                    filterable: !0,
                    "label-field": "item",
                    "value-field": "code"
                }
            },
            {
                field: "actionCode",
                component: "NSelect",
                label: e("hsqe.psc.pSCActionCode"),
                componentProps: {
                    options: K,
                    disabled: o
                }
            },
            {
                field: "equipmentId",
                component: "NInput",
                label: e("hsqe.psc.equipment"),
                componentProps: {
                    disabled: o
                }
            },
            {
                field: "expirationTime",
                component: "NDatePicker",
                label: e("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.basicInfo.expiryDate"),
                componentProps: {
                    valueFormat: "yyyy-MM-dd",
                    type: "date",
                    disabled: o
                }
            },
            {
                field: "vesselPositionCode",
                component: "NSelect",
                label: e("hsqe.psc.vesselResponsible"),
                componentProps: {
                    options: h,
                    "label-field": a.getLocale === "en" ? "nameEn" : "name",
                    "value-field": "code",
                    disabled: o
                }
            },
            {
                field: "officePositionId",
                component: "NSelect",
                label: e("hsqe.psc.officeResponsible"),
                componentProps: {
                    options: g,
                    "label-field": a.getLocale === "en" ? "nameEn" : "name",
                    "value-field": "id",
                    disabled: o
                }
            },
            {
                field: "criticalEquipment",
                component: "NSwitch",
                label: e("hsqe.psc.criticalEquipment"),
                componentProps: {
                    disabled: o
                }
            },
            {
                field: "basicDescription",
                component: "NInput",
                label: e("hsqe.psc.description"),
                componentProps: {
                    type: "textarea",
                    disabled: o
                },
                giProps: {
                    span: 2
                }
            },
            {
                field: "deficiency",
                label: e("hsqe.deficiency.deficiencyPhotos"),
                component: "ImageUpload",
                componentProps: (s)=>({
                        disabled: !1,
                        action: `${I().urlPrefix}/files`,
                        maxNumber: 1,
                        headers: {
                            timestamp: new Date().getTime(),
                            authorization: `${D.get(L)}`
                        },
                        onUploadChange: (r)=>{
                            console.log("file", r);
                        }
                    }),
                giProps: {
                    span: 1
                }
            }
        ], p = [
            {
                field: "reportNo",
                component: "NInput",
                label: e("hsqe.psc.relatedReportNo"),
                componentProps: {
                    disabled: !0
                }
            },
            {
                field: "severity",
                component: "NSelect",
                label: e("hsqe.psc.servity"),
                componentProps: {
                    options: y,
                    disabled: o,
                    "label-field": a.getLocale === "en" ? "labelEn" : "label"
                }
            },
            {
                field: "expirationTime",
                component: "NDatePicker",
                label: e("hsqe.psc.dateToRectify"),
                componentProps: {
                    valueFormat: "yyyy-MM-dd",
                    type: "date",
                    disabled: o
                }
            },
            {
                field: "vesselPositionCode",
                component: "NSelect",
                label: e("hsqe.psc.vesselResponsible"),
                componentProps: {
                    options: h,
                    "label-field": a.getLocale === "en" ? "nameEn" : "name",
                    "value-field": "code",
                    disabled: o
                }
            },
            {
                field: "officePositionId",
                component: "NSelect",
                label: e("hsqe.psc.officeResponsible"),
                componentProps: {
                    options: g,
                    "label-field": a.getLocale === "en" ? "nameEn" : "name",
                    "value-field": "id",
                    disabled: o
                }
            }
        ];
        return {
            schemas: m,
            methods: {
                setReadOnly: (s)=>{
                    o.value = s;
                },
                setReportType: (s)=>{
                    l.value = s;
                },
                setDefectList: (s)=>{
                    b.value = s.list;
                },
                getSchemas: ()=>l.value == "psc" || l.value == "fsc" ? p : m
            }
        };
    }
    ge = w({
        __name: "index",
        emits: [
            "saveCallBack"
        ],
        setup (o, { expose: l, emit: m }) {
            const p = E(), d = c([]), { methods: s } = X(), { setReadOnly: r, setReportType: v, getSchemas: P } = s, [N, { setFieldsValue: q, getFieldsValue: u }] = $({
                schemas: d,
                labelWidth: "auto",
                layout: "horizontal",
                gridProps: {
                    cols: 3,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), f = c({});
            async function S() {
                if (p.query.id) {
                    const i = await U(Number(p.query.id));
                    let t = JSON.parse(JSON.stringify(i));
                    t.isMemo = t.isMemo === "yes", t.officePositionId = Number(t.officePositionId) || 0, t.expirationTime && typeof t.expirationTime == "string" && (t.expirationTime = t.expirationTime.split(/T| /)[0]), f.value = t, q(t), v(i.reportType);
                }
                p.query.type === "view" ? r(!0) : r(!1);
                const n = P();
                d.value = n;
            }
            function _() {
                let n = u();
                const i = {
                    ...f.value,
                    ...n
                };
                return i.expirationTime && (i.expirationTime += " 00:00:00"), i;
            }
            function x() {
                let n = u();
                const i = {
                    ...f.value,
                    ...n
                };
                return i.expirationTime && (i.expirationTime += " 00:00:00"), i;
            }
            return B(()=>{
                S();
            }), l({
                submit: _,
                getData: x
            }), (n, i)=>{
                const t = G, R = V;
                return M(), F(R, null, {
                    default: O(()=>[
                            A(t, {
                                class: "mt-3",
                                onRegister: k(N)
                            }, null, 8, [
                                "onRegister"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { ge as default, __tla };
