import { r as m, V as T, bk as K, l as n, d as X, f as Z, e as Y, a4 as ee, aw as te, c as ae, o as ne, w as l, j as r, W as oe, ds as se, H as re, gE as ie, i as le, A as me, X as pe, cZ as ue, cO as ce, gJ as de, aj as _e, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as fe } from "./BasicForm-dL_oCSPM.js";
import { _ as ge } from "./TableSelect.vue_vue_type_script_setup_true_lang-BAU5mgvB.js";
import { _ as he, __tla as __tla_1 } from "./Modal.vue_vue_type_script_setup_true_lang-Ub1dgidI.js";
import { c as ye, u as be, y as ve, g as qe, s as Ie } from "./template-rpthWlT9.js";
import { g as Pe } from "./planner-BebmniHR.js";
import { u as x } 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 "./props-CLtNejQT.js";
import "./Table-0PViRYCf.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./print-CT_2hrjP.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./useModal-CO65vga3.js";
import "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./Flex-CTSf12gq.js";
import { __tla as __tla_2 } from "./index.vue_vue_type_style_index_0_scoped_b974e5ec_lang-_0QwzFKM.js";
import "./jobOrder-CGbsc7bp.js";
import "./has-CjqcrIOV.js";
import { __tla as __tla_3 } from "./index-8tHZJCCW.js";
import "./TimelineItem-Bkds7ZW8.js";
import "./schemas-BmKi-UM9.js";
let ft;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_3;
        } catch  {}
    })()
]).then(async ()=>{
    const d = K(), { t: e } = T();
    function L(_ = {}) {
        const o = m(!1), f = [
            {
                field: d.getLocale === "en" ? "shipNameEn" : "shipName",
                label: e("hsqe.auditInspection.vesselInspection.vessel"),
                component: "NInput",
                componentProps: {
                    disabled: !0
                }
            },
            {
                field: "visit_date",
                label: e("hsqe.auditInspection.qualitySafetyInspection.visitDate"),
                component: "NDatePicker",
                componentProps: ()=>({
                        type: "date",
                        valueFormat: "yyyy-MM-dd",
                        disabled: n(_.readOnly)
                    }),
                rules: [
                    {
                        required: !0,
                        message: `${e("hsqe.auditInspection.qualitySafetyInspection.visitDate")} ${e("common.required")}`,
                        trigger: [
                            "blur",
                            "change"
                        ]
                    }
                ]
            },
            {
                field: "visitPlace",
                label: e("hsqe.management.port"),
                slot: "visitPlace",
                rules: [
                    {
                        required: !0,
                        message: `${e("hsqe.management.port")} ${e("common.required")}`,
                        trigger: [
                            "blur"
                        ]
                    }
                ]
            },
            {
                field: "reportDate",
                label: e("hsqe.auditInspection.vesselInspection.shipVisitReport.reportDate"),
                component: "NDatePicker",
                defaultValue: new Date().toISOString().split("T")[0],
                componentProps: {
                    type: "date",
                    valueFormat: "yyyy-MM-dd",
                    disabled: !0
                },
                rules: [
                    {
                        required: !0,
                        message: `${e("hsqe.auditInspection.vesselInspection.shipVisitReport.reportDate")} ${e("common.required")}`,
                        trigger: [
                            "blur",
                            "change"
                        ]
                    }
                ]
            },
            {
                field: "management",
                label: e("hsqe.management.senior"),
                component: "NSelect",
                componentProps: ()=>({
                        disabled: n(_.readOnly),
                        multiple: !0,
                        options: n(_?.optManagementList),
                        labelField: "label",
                        valueField: "value"
                    }),
                rules: [
                    {
                        required: !0,
                        message: `${e("hsqe.management.senior")} ${e("common.required")}`,
                        trigger: [
                            "blur",
                            "change"
                        ],
                        type: "array"
                    }
                ]
            }
        ], s = [
            {
                field: d.getLocale === "en" ? "master_name_en" : "master_name_cn",
                label: e("hsqe.management.master_name"),
                component: "NInput",
                componentProps: ()=>({
                        disabled: !0
                    })
            },
            {
                field: "master_date",
                label: e("hsqe.management.master_date"),
                component: "NInput",
                componentProps: ()=>({
                        disabled: !0
                    })
            },
            {
                field: d.getLocale === "en" ? "chief_engineer_name_en" : "chief_engineer_name_cn",
                label: e("hsqe.management.chief_mate_name"),
                component: "NInput",
                componentProps: ()=>({
                        disabled: !0
                    })
            },
            {
                field: "chief_engineer_date",
                label: e("hsqe.management.chief_mate_date"),
                component: "NInput",
                componentProps: ()=>({
                        disabled: !0
                    })
            },
            {
                field: d.getLocale === "en" ? "second_engineer_name_en" : "second_engineer_name_cn",
                label: e("hsqe.management.second_engineer_name"),
                component: "NInput",
                componentProps: ()=>({
                        disabled: !0
                    })
            },
            {
                field: "second_engineer_date",
                label: e("hsqe.management.second_engineer_date"),
                component: "NInput",
                componentProps: ()=>({
                        disabled: !0
                    })
            },
            {
                field: d.getLocale === "en" ? "chief_mate_name_en" : "chief_mate_name_cn",
                label: e("hsqe.management.chief_engineer_name"),
                component: "NInput",
                componentProps: ()=>({
                        disabled: !0
                    })
            },
            {
                field: "chief_engineer_date",
                label: e("hsqe.management.chief_engineer_date"),
                component: "NInput",
                componentProps: ()=>({
                        disabled: !0
                    })
            }
        ];
        return {
            addSchemas: f,
            schemas2: s,
            methods: {
                setReadOnly: (p)=>{
                    o.value = p;
                }
            }
        };
    }
    ft = X({
        __name: "addManagement",
        setup (_) {
            const { t: o } = T(), f = ue(), s = Z(), y = Y(), p = m(""), i = m(), P = m(), u = m(), b = m([]), g = m(!1), v = ee(()=>s.query.type == "view" || i.value && u.value?.updateEnable !== 1), { addSchemas: B } = L({
                readOnly: v,
                optManagementList: b
            }), [F, { submit: E, setFieldsValue: N }] = x({
                schemas: B,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 5,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), { schemas2: M } = L(), [O, { setFieldsValue: $ }] = x({
                schemas: M,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 5,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), h = m({}), A = {
                gridProps: {
                    cols: "2"
                },
                labelWidth: 80,
                submitButtonText: o("common.searchText"),
                showAdvancedButton: !1,
                schemas: [
                    {
                        field: "namePrefix",
                        component: "NInput",
                        label: o("hsqe.planner.modal.planPort")
                    }
                ]
            }, C = [
                {
                    title: o("hsqe.planner.modal.port"),
                    key: "port"
                },
                {
                    title: o("hsqe.planner.modal.country"),
                    key: "country"
                }
            ];
            function U(t) {
                return Pe({
                    ...t,
                    ...n(h)
                });
            }
            function W() {
                P.value?.showModal(i.value, "seniorVisit");
            }
            function q() {
                y.push({
                    name: "Add_HSQE_AuditInspection_ReportList_VesselInspection_AddManagementDetail",
                    query: {
                        type: s.query.type,
                        uuid: i.value,
                        sourcePath: s.query.sourcePath,
                        shipId: s.query.shipId
                    }
                });
            }
            async function H() {
                if (v.value) {
                    q();
                    return;
                }
                const t = await E();
                if (!t) return !1;
                if (t.reportDate < t.visit_date) {
                    f.error(o("hsqe.auditInspection.vesselInspection.shipVisitReport.dataRuleHint"));
                    return;
                }
                try {
                    if (g.value = !0, i.value) {
                        const a = _e(u.value);
                        delete a.inputDone, delete a.updateEnable, delete a.submitEnable, delete a.approveStatus, delete a.reportNum, delete a.create_time, delete a.is_deleted, delete a.deficiencyList, await be({
                            template_code: "seniorVisit",
                            ...a,
                            ...t
                        }), q();
                    } else {
                        const a = {
                            template_code: "seniorVisit",
                            plannerId: p.value,
                            reportBy: ce.get(de, ""),
                            ...t
                        };
                        i.value = await ye(a), q();
                    }
                    g.value = !1;
                } catch  {
                    g.value = !1;
                }
            }
            function G() {
                y.push({
                    name: s.query.sourcePath || "HSQE_AuditInspection_ReportList"
                });
            }
            async function j() {
                const t = await qe({
                    templateCode: "seniorVisit",
                    plannerId: p.value
                });
                i.value = t.list[0]?.uuid || null, i.value && await w();
            }
            async function w() {
                const t = await Ie({
                    templateCode: "seniorVisit",
                    uuid: i.value
                });
                if (!t) {
                    f.error("No data found");
                    return;
                }
                u.value = t || {}, N(u.value), $(u.value);
            }
            async function z() {
                i.value = s.query.uuid || void 0, p.value = s.query.id, b.value = await ve(), b.value.forEach((t)=>{
                    t.value = Number(t.value);
                }), i.value ? await w() : (N({
                    shipName: s.query.shipName,
                    shipNameEn: s.query.shipNameEn,
                    visitPlace: s.query.portName
                }), await j());
            }
            return te(()=>{
                z();
            }), (t, a)=>{
                const I = ie, R = re, Q = ge, S = fe, V = oe, J = pe;
                return ne(), ae(J, null, {
                    default: l(()=>[
                            r(V, {
                                bordered: !1,
                                segmented: {
                                    content: !0
                                },
                                class: "ui-card"
                            }, {
                                header: l(()=>[
                                        r(R, {
                                            align: "center"
                                        }, {
                                            default: l(()=>[
                                                    r(I, {
                                                        tooltip: n(o)("common.backToList"),
                                                        secondary: !1,
                                                        type: "text",
                                                        iconName: "back",
                                                        onClick: G
                                                    }, null, 8, [
                                                        "tooltip"
                                                    ]),
                                                    le("h1", null, me(n(o)("hsqe.management.visitReport")), 1)
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                "header-extra": l(()=>[
                                        r(R, {
                                            align: "center"
                                        }, {
                                            default: l(()=>[
                                                    r(I, {
                                                        key: "log",
                                                        tooltip: n(o)("common.reviewHistory"),
                                                        iconName: "log",
                                                        onClick: W
                                                    }, null, 8, [
                                                        "tooltip"
                                                    ]),
                                                    r(I, {
                                                        key: "nextStep",
                                                        tooltip: n(o)("hsqe.auditInspection.vesselInspection.next"),
                                                        loading: n(g),
                                                        secondary: !1,
                                                        type: "text",
                                                        iconName: "nextStep",
                                                        onClick: H
                                                    }, null, 8, [
                                                        "tooltip",
                                                        "loading"
                                                    ])
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                default: l(()=>[
                                        r(S, {
                                            onRegister: n(F),
                                            "label-placement": "top"
                                        }, {
                                            visitPlace: l(({ model: D, field: k })=>[
                                                    r(Q, {
                                                        ref: "portTableSelectRef",
                                                        labelField: "port",
                                                        valueField: "id",
                                                        value: D[k],
                                                        "onUpdate:value": (c)=>D[k] = c,
                                                        formValues: n(h),
                                                        "onUpdate:formValues": a[0] || (a[0] = (c)=>se(h) ? h.value = c : null),
                                                        multiple: !1,
                                                        formProps: A,
                                                        disabled: n(v),
                                                        class: "w-full",
                                                        selectTitle: n(o)("hsqe.planner.modal.selectPort"),
                                                        tableProps: {
                                                            rowKey: (c)=>c.id,
                                                            request: U,
                                                            columns: C,
                                                            pagination: {
                                                                simple: !0
                                                            }
                                                        }
                                                    }, null, 8, [
                                                        "value",
                                                        "onUpdate:value",
                                                        "formValues",
                                                        "disabled",
                                                        "selectTitle",
                                                        "tableProps"
                                                    ])
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            r(V, {
                                bordered: !1,
                                title: n(o)("hsqe.management.seniorOfficers"),
                                segmented: {
                                    content: !0
                                },
                                class: "ui-card mt-3"
                            }, {
                                default: l(()=>[
                                        r(S, {
                                            onRegister: n(O),
                                            "label-placement": "top"
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "title"
                            ]),
                            r(he, {
                                ref_key: "modalRef",
                                ref: P
                            }, null, 512)
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { ft as default, __tla };
