import { V as Q, Z as l, aA as h, k as S, r as y, d as te, f as se, a as k, aw as ae, c as ie, o as ne, w as u, j as I, ao as ce, l as n, c6 as V, i as f, A as b, X as oe, cZ as le, v as re, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as L } from "./Table-0PViRYCf.js";
import { _ as O } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { ao as w, ap as de, aq as ue, ar as fe, as as pe, I as ye, J as he } 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 We;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: p } = Q(), be = await de(), me = await ue(), Ce = await fe(), _e = await pe();
    y();
    const J = y(), N = y(), M = y();
    function Z(r) {
        const j = [
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
                key: "cause",
                width: 150,
                editable: !0,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (t, d)=>(w(t.cause).then((s)=>{
                        t.deficiencyChangeList = s;
                    }), l(h, {
                        value: t.cause,
                        disabled: r?.readOnly,
                        onUpdateValue: async (s)=>{
                            t.cause = s, t.subCause = null, t.deficiencyChangeList = await w(s);
                        },
                        style: {
                            width: "100%"
                        },
                        options: be
                    }))
            },
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
                key: "subCause",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (t, d)=>l(h, {
                        value: t.subCause,
                        disabled: r?.readOnly,
                        onUpdateValue: (s)=>{
                            t.subCause = s;
                        },
                        style: {
                            width: "100%"
                        },
                        options: t.deficiencyChangeList
                    })
            },
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
                key: "remark",
                align: "left",
                ellipsis: !1,
                resizable: !1,
                width: 150,
                render: (t, d)=>l(S, {
                        value: t.remark,
                        disabled: r?.readOnly,
                        onUpdateValue: (s)=>{
                            t.remark = s;
                        },
                        type: "textarea",
                        style: {
                            width: "100%"
                        },
                        autosize: {
                            minRows: 1,
                            maxRows: 3
                        },
                        maxlength: 50,
                        "show-count": !0
                    })
            }
        ], E = [
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
                key: "cause",
                width: 150,
                editable: !0,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (t, d)=>l(h, {
                        value: t.cause,
                        disabled: r?.readOnly,
                        onUpdateValue: async (s)=>{
                            t.cause = s, J.value = await w(s);
                        },
                        style: {
                            width: "100%"
                        },
                        options: me
                    })
            },
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
                key: "subCause",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (t, d)=>l(h, {
                        value: t.subCause,
                        disabled: r?.readOnly,
                        onUpdateValue: (s)=>{
                            t.subCause = s;
                        },
                        style: {
                            width: "100%"
                        },
                        options: J.value
                    })
            },
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
                key: "remark",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (t, d)=>l(S, {
                        value: t.remark,
                        disabled: r?.readOnly,
                        onUpdateValue: (s)=>{
                            t.remark = s;
                        },
                        type: "textarea",
                        style: {
                            width: "100%"
                        },
                        autosize: {
                            minRows: 1,
                            maxRows: 3
                        },
                        maxlength: 50,
                        "show-count": !0
                    })
            }
        ], c = [
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
                key: "cause",
                width: 150,
                editable: !0,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (t, d)=>l(h, {
                        value: t.cause,
                        disabled: r?.readOnly,
                        onUpdateValue: async (s)=>{
                            t.cause = s, N.value = await w(s);
                        },
                        style: {
                            width: "100%"
                        },
                        options: Ce
                    })
            },
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
                key: "subCause",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (t, d)=>l(h, {
                        value: t.subCause,
                        disabled: r?.readOnly,
                        onUpdateValue: (s)=>{
                            t.subCause = s;
                        },
                        style: {
                            width: "100%"
                        },
                        options: N.value
                    })
            },
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
                key: "remark",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (t, d)=>l(S, {
                        value: t.remark,
                        disabled: r?.readOnly,
                        onUpdateValue: (s)=>{
                            t.remark = s;
                        },
                        type: "textarea",
                        style: {
                            width: "100%"
                        },
                        autosize: {
                            minRows: 1,
                            maxRows: 3
                        },
                        maxlength: 50,
                        "show-count": !0
                    })
            }
        ], z = [
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.cause"),
                key: "cause",
                width: 150,
                editable: !0,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (t, d)=>l(h, {
                        value: t.cause,
                        disabled: r?.readOnly,
                        onUpdateValue: async (s)=>{
                            t.cause = s, M.value = await w(s);
                        },
                        style: {
                            width: "100%"
                        },
                        options: _e
                    })
            },
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.subCause"),
                key: "subCause",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (t, d)=>l(h, {
                        value: t.subCause,
                        disabled: r?.readOnly,
                        onUpdateValue: (s)=>{
                            t.subCause = s;
                        },
                        style: {
                            width: "100%"
                        },
                        options: M.value
                    })
            },
            {
                title: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.remark"),
                key: "remark",
                width: 150,
                align: "left",
                ellipsis: !1,
                resizable: !1,
                render: (t, d)=>l(S, {
                        value: t.remark,
                        disabled: r?.readOnly,
                        onUpdateValue: (s)=>{
                            t.remark = s;
                        },
                        type: "textarea",
                        style: {
                            width: "100%"
                        },
                        autosize: {
                            minRows: 1,
                            maxRows: 3
                        },
                        maxlength: 50,
                        "show-count": !0
                    })
            }
        ];
        return {
            columns: j,
            columns2: E,
            columns3: c,
            columns4: z
        };
    }
    let ge, ve, Ie, De, Re;
    ge = {
        class: "table_title"
    };
    ve = {
        class: "table_title"
    };
    Ie = {
        class: "table_title"
    };
    De = {
        class: "table_title"
    };
    Re = te({
        __name: "index",
        props: {
            btnsDisabled: {
                type: Object,
                default: ()=>({
                        hasCaptainReject: "0",
                        hasOfficerCommit: "0",
                        hasCaptainPass: "0",
                        hasDeficiencyCommit: "0",
                        hasBasicInfoEdit: "0"
                    })
            }
        },
        emits: [
            "saveCallBack"
        ],
        setup (r, { expose: j, emit: E }) {
            const c = se(), z = le(), t = r, d = E, { t: s } = Q(), F = y(), B = y(), U = y(), P = y(), A = Z({
                readOnly: !1
            });
            F.value = A.columns, B.value = A.columns2, U.value = A.columns3, P.value = A.columns4;
            const m = y(), C = y(), _ = y(), g = y(), W = k({
                width: 20,
                title: s("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (o, a) {
                    const i = m.value?.getDataSource();
                    return l(O, {
                        style: "text",
                        actions: [
                            {
                                icon: l("i", {
                                    class: "iconfont icon-a-Add-oneshanchu text-[1.1rem] text-[#0EC06A]"
                                }),
                                ifShow: i.length !== 1,
                                onClick: q.bind(null, o, a, "actsPractices")
                            }
                        ]
                    });
                }
            }), X = k({
                width: 20,
                title: s("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (o, a) {
                    const i = C.value?.getDataSource();
                    return l(O, {
                        style: "text",
                        actions: [
                            {
                                icon: l("i", {
                                    class: "iconfont icon-a-Add-oneshanchu text-[1.1rem] text-[#0EC06A]"
                                }),
                                ifShow: i.length !== 1,
                                onClick: q.bind(null, o, a, "conditions")
                            }
                        ]
                    });
                }
            }), G = k({
                width: 20,
                title: s("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (o, a) {
                    const i = _.value?.getDataSource();
                    return l(O, {
                        style: "text",
                        actions: [
                            {
                                icon: l("i", {
                                    class: "iconfont icon-a-Add-oneshanchu text-[1.1rem] text-[#0EC06A]"
                                }),
                                ifShow: i.length !== 1,
                                onClick: q.bind(null, o, a, "personalFactors")
                            }
                        ]
                    });
                }
            }), H = k({
                width: 20,
                title: s("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (o, a) {
                    const i = g.value?.getDataSource();
                    return l(O, {
                        style: "text",
                        actions: [
                            {
                                ifShow: i.length !== 1,
                                icon: l("i", {
                                    class: "iconfont icon-a-Add-oneshanchu text-[1.1rem] text-[#0EC06A]"
                                }),
                                onClick: q.bind(null, o, a, "jobFactors")
                            }
                        ]
                    });
                }
            }), x = k({
                actsPractices: m,
                conditions: C,
                personalFactors: _,
                jobFactors: g
            });
            async function K() {
                if (c.query.id) {
                    const i = await ye(Number(c.query.id));
                    i.deficiency_substandard_acts ? m.value?.setTableData([
                        ...i.deficiency_substandard_acts
                    ]) : m.value?.setTableData([
                        {}
                    ]), i.deficiency_substandard_conditions ? C.value?.setTableData([
                        ...i.deficiency_substandard_conditions
                    ]) : C.value?.setTableData([
                        {}
                    ]), i.deficiency_personal_factors ? _.value?.setTableData([
                        ...i.deficiency_personal_factors
                    ]) : _.value?.setTableData([
                        {}
                    ]), i.deficiency_job_factor ? g.value?.setTableData([
                        ...i.deficiency_job_factor
                    ]) : g.value?.setTableData([
                        {}
                    ]);
                }
                let o = !1;
                o = !c.query.isEdit || t.btnsDisabled.hasCaptainPass == 1 && t.btnsDisabled.hasOfficerCommit == 0;
                const a = Z({
                    readOnly: o
                });
                F.value = a.columns, B.value = a.columns2, U.value = a.columns3, P.value = a.columns4;
            }
            function T(o) {
                const a = x[o].getDataSource();
                a && a.length < 3 && x[o]?.setTableData([
                    ...a,
                    {}
                ]);
            }
            function q(o, a, i) {
                console.log(x[i]), x[i].deleteTableDataRecord(a);
            }
            async function Y() {
                let o = [
                    ...m.value?.getDataSource()
                ];
                o.forEach((e)=>{
                    e.causeType = "deficiency_substandard_acts", e.reportId = c.query.reportId, e.deficiencyId = c.query.id, e.deficiencyChangeList = e.deficiencyChangeList || [];
                });
                let a = [
                    ...C.value?.getDataSource()
                ];
                a.forEach((e)=>{
                    e.causeType = "deficiency_substandard_conditions", e.reportId = c.query.reportId, e.deficiencyId = c.query.id, e.deficiencyChangeList = e.deficiencyChangeList || [];
                });
                let i = [
                    ..._.value?.getDataSource()
                ];
                i.forEach((e)=>{
                    e.causeType = "deficiency_personal_factors", e.reportId = c.query.reportId, e.deficiencyId = c.query.id, e.deficiencyChangeList = e.deficiencyChangeList || [];
                });
                let v = [
                    ...g.value?.getDataSource()
                ];
                v.forEach((e)=>{
                    e.causeType = "deficiency_job_factor", e.reportId = c.query.reportId, e.deficiencyId = c.query.id, e.deficiencyChangeList = e.deficiencyChangeList || [];
                });
                const $ = [
                    ...o,
                    ...a,
                    ...i,
                    ...v
                ].map((e)=>{
                    const R = e;
                    return delete R.id, R;
                });
                await he($), z.success(s("hsqe.deficiency.operationSuccessful")), d("saveCallBack");
            }
            function ee() {
                let o = [
                    ...m.value?.getDataSource()
                ];
                o.forEach((e)=>{
                    e.cause === "" || e.subCause, e.causeType = "deficiency_substandard_acts", e.reportId = c.query.reportId, e.deficiencyId = c.query.id, e.deficiencyChangeList = e.deficiencyChangeList || [];
                });
                let a = [
                    ...C.value?.getDataSource()
                ];
                a.forEach((e)=>{
                    e.cause === "" || e.subCause, e.causeType = "deficiency_substandard_conditions", e.reportId = c.query.reportId, e.deficiencyId = c.query.id, e.deficiencyChangeList = e.deficiencyChangeList || [];
                });
                let i = [
                    ..._.value?.getDataSource()
                ];
                i.forEach((e)=>{
                    e.cause === "" || e.subCause, e.causeType = "deficiency_personal_factors", e.reportId = c.query.reportId, e.deficiencyId = c.query.id, e.deficiencyChangeList = e.deficiencyChangeList || [];
                });
                let v = [
                    ...g.value?.getDataSource()
                ];
                return v.forEach((e)=>{
                    e.cause === "" || e.subCause, e.causeType = "deficiency_job_factor", e.reportId = c.query.reportId, e.deficiencyId = c.query.id, e.deficiencyChangeList = e.deficiencyChangeList || [];
                }), [
                    ...o,
                    ...a,
                    ...i,
                    ...v
                ].map((e)=>{
                    const R = e;
                    return delete R.id, R;
                });
            }
            return ae(()=>{
                K();
            }), j({
                submit: Y,
                getData: ee
            }), (o, a)=>{
                const i = ce, v = oe;
                return ne(), ie(v, null, {
                    default: u(()=>[
                            I(i, {
                                class: "desStyle",
                                title: n(s)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.immediateCause")
                            }, null, 8, [
                                "title"
                            ]),
                            I(n(L), {
                                ref_key: "actsPracticesTableRef",
                                ref: m,
                                columns: n(F),
                                pagination: !1,
                                showTableSetting: !1,
                                class: "tableStyle",
                                showTitleBorder: !0,
                                actionColumn: n(W)
                            }, V({
                                tableTitle: u(()=>[
                                        f("h2", ge, b(n(s)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.substandardActsPractices")), 1)
                                    ]),
                                empty: u(()=>[
                                        f("span", null, b(n(s)("common.noData")), 1)
                                    ]),
                                _: 2
                            }, [
                                t.btnsDisabled.hasDeficiencyCommit == 1 || t.btnsDisabled.hasOfficerCommit == 1 ? {
                                    name: "toolbar",
                                    fn: u(()=>[
                                            f("i", {
                                                class: "iconfont icon-a-Add-onetianjia text-[1.7rem] text-[#0EC06A]",
                                                onClick: a[0] || (a[0] = (D)=>T("actsPractices"))
                                            })
                                        ]),
                                    key: "0"
                                } : void 0
                            ]), 1032, [
                                "columns",
                                "actionColumn"
                            ]),
                            I(n(L), {
                                ref_key: "conditionsTableRef",
                                ref: C,
                                columns: n(B),
                                pagination: !1,
                                showTableSetting: !1,
                                class: "tableStyle",
                                showTitleBorder: !0,
                                actionColumn: n(X)
                            }, V({
                                tableTitle: u(()=>[
                                        f("h2", ve, b(n(s)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.substandardConditions")), 1)
                                    ]),
                                empty: u(()=>[
                                        f("span", null, b(n(s)("common.noData")), 1)
                                    ]),
                                _: 2
                            }, [
                                t.btnsDisabled.hasDeficiencyCommit == 1 || t.btnsDisabled.hasOfficerCommit == 1 ? {
                                    name: "toolbar",
                                    fn: u(()=>[
                                            f("i", {
                                                class: "iconfont icon-a-Add-onetianjia text-[1.7rem] text-[#0EC06A]",
                                                onClick: a[1] || (a[1] = (D)=>T("conditions"))
                                            })
                                        ]),
                                    key: "0"
                                } : void 0
                            ]), 1032, [
                                "columns",
                                "actionColumn"
                            ]),
                            I(i, {
                                class: "mt-3 desStyle",
                                title: n(s)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.basicRootCause")
                            }, null, 8, [
                                "title"
                            ]),
                            I(n(L), {
                                ref_key: "personalFactorsTableRef",
                                ref: _,
                                columns: n(U),
                                pagination: !1,
                                showTableSetting: !1,
                                class: "tableStyle",
                                showTitleBorder: !0,
                                actionColumn: n(G)
                            }, V({
                                empty: u(()=>[
                                        f("span", null, b(n(s)("common.noData")), 1)
                                    ]),
                                _: 2
                            }, [
                                t.btnsDisabled.hasDeficiencyCommit == 1 ? {
                                    name: "tableTitle",
                                    fn: u(()=>[
                                            f("h2", Ie, b(n(s)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.personalFactors")), 1)
                                        ]),
                                    key: "0"
                                } : void 0,
                                t.btnsDisabled.hasDeficiencyCommit == 1 || t.btnsDisabled.hasOfficerCommit == 1 ? {
                                    name: "toolbar",
                                    fn: u(()=>[
                                            f("i", {
                                                class: "iconfont icon-a-Add-onetianjia text-[1.7rem] text-[#0EC06A]",
                                                onClick: a[2] || (a[2] = (D)=>T("personalFactors"))
                                            })
                                        ]),
                                    key: "1"
                                } : void 0
                            ]), 1032, [
                                "columns",
                                "actionColumn"
                            ]),
                            I(n(L), {
                                ref_key: "jobFactorsTableRef",
                                ref: g,
                                columns: n(P),
                                pagination: !1,
                                showTableSetting: !1,
                                class: "tableStyle",
                                showTitleBorder: !0,
                                actionColumn: n(H)
                            }, V({
                                tableTitle: u(()=>[
                                        f("h2", De, b(n(s)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.causeAnalysis.jobFactors")), 1)
                                    ]),
                                empty: u(()=>[
                                        f("span", null, b(n(s)("common.noData")), 1)
                                    ]),
                                _: 2
                            }, [
                                t.btnsDisabled.hasDeficiencyCommit == 1 || t.btnsDisabled.hasOfficerCommit == 1 ? {
                                    name: "toolbar",
                                    fn: u(()=>[
                                            f("i", {
                                                class: "iconfont icon-a-Add-onetianjia text-[1.7rem] text-[#0EC06A]",
                                                onClick: a[3] || (a[3] = (D)=>T("jobFactors"))
                                            })
                                        ]),
                                    key: "0"
                                } : void 0
                            ]), 1032, [
                                "columns",
                                "actionColumn"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
    We = re(Re, [
        [
            "__scopeId",
            "data-v-7c0fa979"
        ]
    ]);
});
export { We as default, __tla };
