import { B as A } from "./Table-0PViRYCf.js";
import { V as N, Z as r, bk as K, aA as p, k as D, r as u, d as X, f as Y, aw as ee, h as ae, o as se, j as _, l as n, ao as te, c6 as T, w as y, i as b, A as V, cZ as ie, v as ne, __tla as __tla_0 } from "./index-9PRMimni.js";
import { ao as k, ap as le, aq as ce, ar as oe, as as re, at as de, J as ue } from "./template-rpthWlT9.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./componentMap-CElCaWis.js";
import "./propTypes-CebMRUpe.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 "./componentSetting-DVhNDBTO.js";
import "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./tabsView-BXskTdVh.js";
import "./Flex-CTSf12gq.js";
import "./index-kKnqLkWM.js";
let Ne;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: d } = N(), h = K(), q = (t)=>t.map((m)=>({
                label: m.label,
                value: m.value,
                labelEn: m.labelEn
            })), fe = q(await le()), pe = q(await ce()), ye = q(await oe()), be = q(await re()), F = u(), U = u(), P = u();
    function J(t) {
        const m = [
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
                key: "cause",
                width: 150,
                editable: !0,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (e, l)=>(k(e.cause).then((a)=>{
                        e.deficiencyChangeList = a;
                    }), r(p, {
                        value: e.cause,
                        disabled: t?.readOnly,
                        onUpdateValue: async (a)=>{
                            e.cause = a, e.subCause = null, e.deficiencyChangeList = await k(a);
                        },
                        style: {
                            width: "100%"
                        },
                        options: fe,
                        "label-field": h.getLocale === "en" ? "labelEn" : "label"
                    }))
            },
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
                key: "subCause",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (e, l)=>r(p, {
                        value: e.subCause,
                        disabled: t?.readOnly,
                        onUpdateValue: (a)=>{
                            e.subCause = a;
                        },
                        style: {
                            width: "100%"
                        },
                        options: e.deficiencyChangeList,
                        "label-field": h.getLocale === "en" ? "labelEn" : "label"
                    })
            },
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
                key: "remark",
                align: "left",
                ellipsis: !1,
                resizable: !1,
                width: 150,
                render: (e, l)=>r(D, {
                        value: e.remark,
                        disabled: t?.readOnly,
                        onUpdateValue: (a)=>{
                            e.remark = a;
                        },
                        type: "textarea",
                        style: {
                            width: "100%"
                        },
                        autosize: {
                            minRows: 1,
                            maxRows: 3
                        },
                        maxlength: 50,
                        "show-count": !0
                    })
            }
        ], x = [
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
                key: "cause",
                width: 150,
                editable: !0,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (e, l)=>r(p, {
                        value: e.cause,
                        disabled: t?.readOnly,
                        onUpdateValue: async (a)=>{
                            e.cause = a, F.value = await k(a);
                        },
                        style: {
                            width: "100%"
                        },
                        options: pe,
                        "label-field": h.getLocale === "en" ? "labelEn" : "label"
                    })
            },
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
                key: "subCause",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (e, l)=>r(p, {
                        value: e.subCause,
                        disabled: t?.readOnly,
                        onUpdateValue: (a)=>{
                            e.subCause = a;
                        },
                        style: {
                            width: "100%"
                        },
                        options: F.value,
                        "label-field": h.getLocale === "en" ? "labelEn" : "label"
                    })
            },
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
                key: "remark",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (e, l)=>r(D, {
                        value: e.remark,
                        disabled: t?.readOnly,
                        onUpdateValue: (a)=>{
                            e.remark = a;
                        },
                        type: "textarea",
                        style: {
                            width: "100%"
                        },
                        autosize: {
                            minRows: 1,
                            maxRows: 3
                        },
                        maxlength: 50,
                        "show-count": !0
                    })
            }
        ], f = [
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
                key: "cause",
                width: 150,
                editable: !0,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (e, l)=>r(p, {
                        value: e.cause,
                        disabled: t?.readOnly,
                        onUpdateValue: async (a)=>{
                            e.cause = a, U.value = await k(a);
                        },
                        style: {
                            width: "100%"
                        },
                        options: ye,
                        "label-field": h.getLocale === "en" ? "labelEn" : "label"
                    })
            },
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
                key: "subCause",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (e, l)=>r(p, {
                        value: e.subCause,
                        disabled: t?.readOnly,
                        onUpdateValue: (a)=>{
                            e.subCause = a;
                        },
                        style: {
                            width: "100%"
                        },
                        options: U.value,
                        "label-field": h.getLocale === "en" ? "labelEn" : "label"
                    })
            },
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
                key: "remark",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (e, l)=>r(D, {
                        value: e.remark,
                        disabled: t?.readOnly,
                        onUpdateValue: (a)=>{
                            e.remark = a;
                        },
                        type: "textarea",
                        style: {
                            width: "100%"
                        },
                        autosize: {
                            minRows: 1,
                            maxRows: 3
                        },
                        maxlength: 50,
                        "show-count": !0
                    })
            }
        ], c = [
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
                key: "cause",
                width: 150,
                editable: !0,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (e, l)=>r(p, {
                        value: e.cause,
                        disabled: t?.readOnly,
                        onUpdateValue: async (a)=>{
                            e.cause = a, P.value = await k(a);
                        },
                        style: {
                            width: "100%"
                        },
                        options: be,
                        "label-field": h.getLocale === "en" ? "labelEn" : "label"
                    })
            },
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
                key: "subCause",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (e, l)=>r(p, {
                        value: e.subCause,
                        disabled: t?.readOnly,
                        onUpdateValue: (a)=>{
                            e.subCause = a;
                        },
                        style: {
                            width: "100%"
                        },
                        options: P.value,
                        "label-field": h.getLocale === "en" ? "labelEn" : "label"
                    })
            },
            {
                title: d("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
                key: "remark",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (e, l)=>r(D, {
                        value: e.remark,
                        disabled: t?.readOnly,
                        onUpdateValue: (a)=>{
                            e.remark = a;
                        },
                        type: "textarea",
                        style: {
                            width: "100%"
                        },
                        autosize: {
                            minRows: 1,
                            maxRows: 3
                        },
                        maxlength: 50,
                        "show-count": !0
                    })
            }
        ];
        return {
            columns: m,
            columns2: x,
            columns3: f,
            columns4: c
        };
    }
    let he, me, _e, ge, ve;
    he = {
        class: "table_title"
    };
    me = {
        class: "table_title"
    };
    _e = {
        class: "table_title"
    };
    ge = {
        class: "table_title"
    };
    ve = X({
        __name: "index",
        props: {
            btnsDisabled: {
                type: Object,
                default: ()=>({
                        hasCaptainReject: "0",
                        hasOfficerCommit: "0",
                        hasCaptainPass: "0",
                        hasDeficiencyCommit: "0",
                        hasBasicInfoEdit: "0"
                    })
            }
        },
        emits: [
            "saveCallBack"
        ],
        setup (t, { expose: m, emit: x }) {
            const { t: f } = N(), c = Y(), e = ie(), l = x, a = t, L = u(), S = u(), E = u(), O = u(), w = J({
                readOnly: !1
            });
            L.value = w.columns, S.value = w.columns2, E.value = w.columns3, O.value = w.columns4;
            const g = u(), v = u(), C = u(), R = u();
            async function M() {
                if (c.query.id) {
                    const o = await de(Number(c.query.id));
                    o.deficiency_substandard_acts && g.value?.setTableData([
                        ...o.deficiency_substandard_acts
                    ]), o.deficiency_substandard_conditions && v.value?.setTableData([
                        ...o.deficiency_substandard_conditions
                    ]), o.deficiency_personal_factors && C.value?.setTableData([
                        ...o.deficiency_personal_factors
                    ]), o.deficiency_job_factor && R.value?.setTableData([
                        ...o.deficiency_job_factor
                    ]);
                }
                const i = J({
                    readOnly: !0
                });
                L.value = i.columns, S.value = i.columns2, E.value = i.columns3, O.value = i.columns4;
            }
            function Z() {
                const i = g.value?.getDataSource();
                g.value?.setTableData([
                    ...i,
                    {}
                ]);
            }
            function Q() {
                const i = v.value?.getDataSource();
                v.value?.setTableData([
                    ...i,
                    {}
                ]);
            }
            function W() {
                const i = C.value?.getDataSource();
                C.value?.setTableData([
                    ...i,
                    {}
                ]);
            }
            function $() {
                const i = R.value?.getDataSource();
                R.value?.setTableData([
                    ...i,
                    {}
                ]);
            }
            async function G() {
                let i = [
                    ...g.value?.getDataSource()
                ];
                i.forEach((s)=>{
                    s.causeType = "deficiency_substandard_acts", s.reportId = c.query.reportId, s.deficiencyId = c.query.id, s.deficiencyChangeList = s.deficiencyChangeList || [];
                });
                let o = [
                    ...v.value?.getDataSource()
                ];
                o.forEach((s)=>{
                    s.causeType = "deficiency_substandard_conditions", s.reportId = c.query.reportId, s.deficiencyId = c.query.id, s.deficiencyChangeList = s.deficiencyChangeList || [];
                });
                let I = [
                    ...C.value?.getDataSource()
                ];
                I.forEach((s)=>{
                    s.causeType = "deficiency_personal_factors", s.reportId = c.query.reportId, s.deficiencyId = c.query.id, s.deficiencyChangeList = s.deficiencyChangeList || [];
                });
                let z = [
                    ...R.value?.getDataSource()
                ];
                z.forEach((s)=>{
                    s.causeType = "deficiency_job_factor", s.reportId = c.query.reportId, s.deficiencyId = c.query.id, s.deficiencyChangeList = s.deficiencyChangeList || [];
                });
                let j = [
                    ...i,
                    ...o,
                    ...I,
                    ...z
                ];
                console.log(j, 123123123);
                const H = j.map((s)=>{
                    const B = s;
                    return delete B.id, B;
                });
                await ue(H), e.success(f("hsqe.deficiency.operationSuccessful")), l("saveCallBack");
            }
            return ee(()=>{
                M();
            }), m({
                submit: G
            }), (i, o)=>{
                const I = te;
                return se(), ae("div", null, [
                    _(I, {
                        class: "desStyle",
                        title: n(f)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.immediateCause")
                    }, null, 8, [
                        "title"
                    ]),
                    _(n(A), {
                        ref_key: "actsPracticesTableRef",
                        ref: g,
                        columns: n(L),
                        pagination: !1,
                        showTableSetting: !1,
                        class: "tableStyle",
                        showTitleBorder: !0
                    }, T({
                        tableTitle: y(()=>[
                                b("h2", he, V(n(f)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.substandardActsPractices")), 1)
                            ]),
                        _: 2
                    }, [
                        a.btnsDisabled.hasDeficiencyCommit == 1 ? {
                            name: "toolbar",
                            fn: y(()=>[
                                    b("i", {
                                        class: "iconfont icon-a-Add-onetianjia text-[1.7rem] text-[#0EC06A]",
                                        onClick: Z
                                    })
                                ]),
                            key: "0"
                        } : void 0
                    ]), 1032, [
                        "columns"
                    ]),
                    _(n(A), {
                        ref_key: "conditionsTableRef",
                        ref: v,
                        columns: n(S),
                        pagination: !1,
                        showTableSetting: !1,
                        class: "tableStyle",
                        showTitleBorder: !0
                    }, T({
                        tableTitle: y(()=>[
                                b("h2", me, V(n(f)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.substandardConditions")), 1)
                            ]),
                        _: 2
                    }, [
                        a.btnsDisabled.hasDeficiencyCommit == 1 ? {
                            name: "toolbar",
                            fn: y(()=>[
                                    b("i", {
                                        class: "iconfont icon-a-Add-onetianjia text-[1.7rem] text-[#0EC06A]",
                                        onClick: Q
                                    })
                                ]),
                            key: "0"
                        } : void 0
                    ]), 1032, [
                        "columns"
                    ]),
                    _(I, {
                        class: "mt-3 desStyle",
                        title: n(f)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.basicRootCause")
                    }, null, 8, [
                        "title"
                    ]),
                    _(n(A), {
                        ref_key: "personalFactorsTableRef",
                        ref: C,
                        columns: n(E),
                        pagination: !1,
                        showTableSetting: !1,
                        class: "tableStyle",
                        showTitleBorder: !0
                    }, T({
                        tableTitle: y(()=>[
                                b("h2", _e, V(n(f)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.personalFactors")), 1)
                            ]),
                        _: 2
                    }, [
                        a.btnsDisabled.hasDeficiencyCommit == 1 ? {
                            name: "toolbar",
                            fn: y(()=>[
                                    b("i", {
                                        class: "iconfont icon-a-Add-onetianjia text-[1.7rem] text-[#0EC06A]",
                                        onClick: W
                                    })
                                ]),
                            key: "0"
                        } : void 0
                    ]), 1032, [
                        "columns"
                    ]),
                    _(n(A), {
                        ref_key: "jobFactorsTableRef",
                        ref: R,
                        columns: n(O),
                        pagination: !1,
                        showTableSetting: !1,
                        class: "tableStyle",
                        showTitleBorder: !0
                    }, T({
                        tableTitle: y(()=>[
                                b("h2", ge, V(n(f)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.jobFactors")), 1)
                            ]),
                        _: 2
                    }, [
                        a.btnsDisabled.hasDeficiencyCommit == 1 ? {
                            name: "toolbar",
                            fn: y(()=>[
                                    b("i", {
                                        class: "iconfont icon-a-Add-onetianjia text-[1.7rem] text-[#0EC06A]",
                                        onClick: $
                                    })
                                ]),
                            key: "0"
                        } : void 0
                    ]), 1032, [
                        "columns"
                    ])
                ]);
            };
        }
    });
    Ne = ne(ve, [
        [
            "__scopeId",
            "data-v-ae7fe228"
        ]
    ]);
});
export { Ne as default, __tla };
