import { B as R } from "./Table-0PViRYCf.js";
import { V as S, Z as r, r as d, aA as p, k as T, d as N, f as J, u as M, aw as $, h as H, o as O, j as s, l as a, ao as Q, w as i, H as W, B as Z, p as g, A as k, N as z, h3 as C, W as G, __tla as __tla_0 } from "./index-9PRMimni.js";
import { ap as K, ao as A, aq as X, ar as Y, as as ee, I as te, w as se } 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 Fe;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    let u, ae, ie, ne, ce, w, q, x, D, oe, re, ue, le;
    ({ t: u } = S());
    ae = await K();
    ie = await X();
    ne = await Y();
    ce = await ee();
    w = d();
    q = d();
    x = d();
    D = d();
    oe = [
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
            key: "cause",
            width: 150,
            editable: !0,
            render: (t, o)=>r(p, {
                    value: t.cause,
                    onUpdateValue: async (e)=>{
                        t.cause = e, w.value = await A(e);
                    },
                    style: {
                        width: "150px"
                    },
                    options: ae
                })
        },
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
            key: "subCause",
            width: 150,
            render: (t, o)=>r(p, {
                    value: t.subCause,
                    onUpdateValue: (e)=>{
                        t.subCause = e;
                    },
                    style: {
                        width: "150px"
                    },
                    options: w.value
                })
        },
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
            key: "remark",
            width: 150,
            render: (t, o)=>r(T, {
                    value: t.remark,
                    onUpdateValue: (e)=>{
                        t.remark = e;
                    },
                    type: "textarea",
                    maxlength: 50,
                    "show-count": !0
                })
        }
    ];
    re = [
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
            key: "cause",
            width: 150,
            editable: !0,
            render: (t, o)=>r(p, {
                    value: t.cause,
                    onUpdateValue: async (e)=>{
                        t.cause = e, q.value = await A(e);
                    },
                    style: {
                        width: "150px"
                    },
                    options: ie
                })
        },
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
            key: "subCause",
            width: 150,
            render: (t, o)=>r(p, {
                    value: t.subCause,
                    onUpdateValue: (e)=>{
                        t.subCause = e;
                    },
                    style: {
                        width: "150px"
                    },
                    options: q.value
                })
        },
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
            key: "remark",
            width: 150,
            render: (t, o)=>r(T, {
                    value: t.remark,
                    onUpdateValue: (e)=>{
                        t.remark = e;
                    },
                    type: "textarea",
                    maxlength: 50,
                    "show-count": !0
                })
        }
    ];
    ue = [
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
            key: "cause",
            width: 150,
            editable: !0,
            render: (t, o)=>r(p, {
                    value: t.cause,
                    onUpdateValue: async (e)=>{
                        t.cause = e, x.value = await A(e);
                    },
                    style: {
                        width: "150px"
                    },
                    options: ne
                })
        },
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
            key: "subCause",
            width: 150,
            render: (t, o)=>r(p, {
                    value: t.subCause,
                    onUpdateValue: (e)=>{
                        t.subCause = e;
                    },
                    style: {
                        width: "150px"
                    },
                    options: x.value
                })
        },
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
            key: "remark",
            width: 150,
            render: (t, o)=>r(T, {
                    value: t.remark,
                    onUpdateValue: (e)=>{
                        t.remark = e;
                    },
                    type: "textarea",
                    maxlength: 50,
                    "show-count": !0
                })
        }
    ];
    le = [
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
            key: "cause",
            width: 150,
            editable: !0,
            render: (t, o)=>r(p, {
                    value: t.cause,
                    onUpdateValue: async (e)=>{
                        t.cause = e, D.value = await A(e);
                    },
                    style: {
                        width: "150px"
                    },
                    options: ce
                })
        },
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
            key: "subCause",
            width: 150,
            render: (t, o)=>r(p, {
                    value: t.subCause,
                    onUpdateValue: (e)=>{
                        t.subCause = e;
                    },
                    style: {
                        width: "150px"
                    },
                    options: D.value
                })
        },
        {
            title: u("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
            key: "remark",
            width: 150,
            render: (t, o)=>r(T, {
                    value: t.remark,
                    onUpdateValue: (e)=>{
                        t.remark = e;
                    },
                    type: "textarea",
                    maxlength: 50,
                    "show-count": !0
                })
        }
    ];
    Fe = N({
        __name: "index",
        setup (t, { expose: o }) {
            const { t: e } = S(), l = J(), F = M(), _ = d(), h = d(), m = d(), b = d();
            async function U() {
                if (l.query.id) {
                    const n = await te(Number(l.query.id));
                    n.deficiency_substandard_acts && _.value?.setTableData([
                        ...n.deficiency_substandard_acts
                    ]), n.deficiency_job_factor && h.value?.setTableData([
                        ...n.deficiency_job_factor
                    ]), n.deficiency_personal_factors && m.value?.setTableData([
                        ...n.deficiency_personal_factors
                    ]), n.deficiency_substandard_conditions && b.value?.setTableData([
                        ...n.deficiency_substandard_conditions
                    ]);
                }
            }
            function j() {
                const n = _.value?.getDataSource();
                _.value?.setTableData([
                    ...n,
                    {}
                ]);
            }
            function L() {
                const n = h.value?.getDataSource();
                h.value?.setTableData([
                    ...n,
                    {}
                ]);
            }
            function B() {
                const n = m.value?.getDataSource();
                m.value?.setTableData([
                    ...n,
                    {}
                ]);
            }
            function P() {
                const n = b.value?.getDataSource();
                b.value?.setTableData([
                    ...n,
                    {}
                ]);
            }
            async function E() {
                let n = [
                    ..._.value?.getDataSource()
                ];
                n.forEach((c)=>{
                    c.causeType = "deficiency_substandard_acts", c.reportId = l.query.reportId, c.deficiencyId = l.query.id;
                });
                let V = [
                    ...h.value?.getDataSource()
                ];
                V.forEach((c)=>{
                    c.causeType = "deficiency_substandard_conditions", c.reportId = l.query.reportId, c.deficiencyId = l.query.id;
                });
                let v = [
                    ...m.value?.getDataSource()
                ];
                v.forEach((c)=>{
                    c.causeType = "deficiency_personal_factors", c.reportId = l.query.reportId, c.deficiencyId = l.query.id;
                });
                let y = [
                    ...b.value?.getDataSource()
                ];
                y.forEach((c)=>{
                    c.causeType = "deficiency_job_factor", c.reportId = l.query.reportId, c.deficiencyId = l.query.id;
                });
                const f = [
                    ...n,
                    ...V,
                    ...v,
                    ...y
                ];
                console.log(f), await se(f) && F.success(e("common.saveSuccessText"));
            }
            return $(()=>{
                U();
            }), o({
                submit: E
            }), (n, V)=>{
                const v = Q, y = z, f = Z, I = W, c = G;
                return O(), H("div", null, [
                    s(v, {
                        title: a(e)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.immediateCause")
                    }, null, 8, [
                        "title"
                    ]),
                    s(c, {
                        bordered: ""
                    }, {
                        default: i(()=>[
                                s(a(R), {
                                    ref_key: "actsPracticesTableRef",
                                    ref: _,
                                    title: a(e)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.substandardActsPractices"),
                                    columns: a(oe),
                                    pagination: !1,
                                    showTableSetting: !1
                                }, {
                                    tableTitle: i(()=>[
                                            s(I, null, {
                                                default: i(()=>[
                                                        s(f, {
                                                            type: "primary",
                                                            onClick: j
                                                        }, {
                                                            icon: i(()=>[
                                                                    s(y, null, {
                                                                        default: i(()=>[
                                                                                s(a(C))
                                                                            ]),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: i(()=>[
                                                                    g(" " + k(a(e)("common.addText")), 1)
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                _: 1
                                            })
                                        ]),
                                    _: 1
                                }, 8, [
                                    "title",
                                    "columns"
                                ]),
                                s(a(R), {
                                    ref_key: "conditionsTableRef",
                                    ref: h,
                                    title: a(e)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.substandardConditions"),
                                    columns: a(re),
                                    pagination: !1,
                                    showTableSetting: !1
                                }, {
                                    tableTitle: i(()=>[
                                            s(I, null, {
                                                default: i(()=>[
                                                        s(f, {
                                                            type: "primary",
                                                            onClick: L
                                                        }, {
                                                            icon: i(()=>[
                                                                    s(y, null, {
                                                                        default: i(()=>[
                                                                                s(a(C))
                                                                            ]),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: i(()=>[
                                                                    g(" " + k(a(e)("common.addText")), 1)
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                _: 1
                                            })
                                        ]),
                                    _: 1
                                }, 8, [
                                    "title",
                                    "columns"
                                ])
                            ]),
                        _: 1
                    }),
                    s(v, {
                        class: "mt-3",
                        title: a(e)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.basicRootCause")
                    }, null, 8, [
                        "title"
                    ]),
                    s(c, {
                        bordered: ""
                    }, {
                        default: i(()=>[
                                s(a(R), {
                                    ref_key: "personalFactorsTableRef",
                                    ref: m,
                                    title: a(e)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.personalFactors"),
                                    columns: a(ue),
                                    pagination: !1,
                                    showTableSetting: !1
                                }, {
                                    tableTitle: i(()=>[
                                            s(I, null, {
                                                default: i(()=>[
                                                        s(f, {
                                                            type: "primary",
                                                            onClick: B
                                                        }, {
                                                            icon: i(()=>[
                                                                    s(y, null, {
                                                                        default: i(()=>[
                                                                                s(a(C))
                                                                            ]),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: i(()=>[
                                                                    g(" " + k(a(e)("common.addText")), 1)
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                _: 1
                                            })
                                        ]),
                                    _: 1
                                }, 8, [
                                    "title",
                                    "columns"
                                ]),
                                s(a(R), {
                                    ref_key: "jobFactorsTableRef",
                                    ref: b,
                                    title: a(e)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.jobFactors"),
                                    columns: a(le),
                                    pagination: !1,
                                    showTableSetting: !1
                                }, {
                                    tableTitle: i(()=>[
                                            s(I, null, {
                                                default: i(()=>[
                                                        s(f, {
                                                            type: "primary",
                                                            onClick: P
                                                        }, {
                                                            icon: i(()=>[
                                                                    s(y, null, {
                                                                        default: i(()=>[
                                                                                s(a(C))
                                                                            ]),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: i(()=>[
                                                                    g(" " + k(a(e)("common.addText")), 1)
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                _: 1
                                            })
                                        ]),
                                    _: 1
                                }, 8, [
                                    "title",
                                    "columns"
                                ])
                            ]),
                        _: 1
                    })
                ]);
            };
        }
    });
});
export { Fe as default, __tla };
