import { r as p, V as A, bk as X, Z as I, ae as Ce, d as qe, u as Se, f as ke, e as Re, b as Te, co as we, a as Ne, gW as q, gX as S, gJ as Ie, aw as De, d9 as Pe, c as v, o as h, w as t, j as d, W as Le, l as o, ds as M, H as Ae, D as P, aI as Be, p as w, A as N, aE as z, B as Ve, ca as L, i as W, X as Ue, c_ as Ee, v as Oe, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as $e } from "./BasicForm-dL_oCSPM.js";
import { _ as He } from "./TableSelect.vue_vue_type_script_setup_true_lang-BAU5mgvB.js";
import { B as Me } from "./Table-0PViRYCf.js";
import { _ as ze } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { O as We, s as Q, R as Qe, u as Ge, c as Xe, U as je } from "./template-rpthWlT9.js";
import { g as Je } from "./planner-BebmniHR.js";
import { _ as Ke, __tla as __tla_1 } from "./Modal.vue_vue_type_script_setup_true_lang-xouDUzHC.js";
import { f as Ze } from "./hook-C9rOLWu_.js";
import { _ as Ye } from "./index.vue_vue_type_script_setup_true_lang-BUzew2LL.js";
import { u as et } 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.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 "./modalSchemas-D9c32bW5.js";
let jt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    const tt = X(), { t: r } = A(), ot = await We();
    function st() {
        const f = p(!1);
        return {
            addSchemas: [
                {
                    field: "reportNum",
                    label: r("hsqe.psc.reportNumber"),
                    component: "NInput",
                    componentProps: ()=>({
                            disabled: !0
                        })
                },
                {
                    field: "shipId",
                    component: "NSelect",
                    label: r("hsqe.auditInspection.vesselInspection.formVessel"),
                    componentProps: {
                        disabled: f,
                        placeholder: r("hsqe.auditInspection.vesselInspection.formVesselHint"),
                        options: ot,
                        "value-field": "id",
                        "label-field": tt.getLocale === "en" ? "shipNameEn" : "shipName"
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (a, n)=>n != null && n !== "",
                            message: r("common.chooseText") + " " + r("hsqe.auditInspection.vesselInspection.formVessel"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "reportDate",
                    label: r("hsqe.psc.raisedOn"),
                    component: "NDatePicker",
                    componentProps: {
                        type: "date",
                        valueFormat: "yyyy-MM-dd",
                        disabled: f
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (a, n)=>n != null && n !== "",
                            message: r("common.chooseText") + " " + r("hsqe.cdi.raisedOn"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "port",
                    label: r("hsqe.psc.port"),
                    slot: "visitPlace",
                    rules: [
                        {
                            required: !0,
                            validator: (a, n)=>n != null && n !== "",
                            message: r("common.chooseText") + " " + r("hsqe.psc.port"),
                            trigger: [
                                "blur"
                            ]
                        }
                    ]
                },
                {
                    field: "editDateList",
                    label: r("hsqe.psc.inspectionFrom"),
                    component: "NDatePicker",
                    componentProps: {
                        type: "daterange",
                        valueFormat: "yyyy-MM-dd",
                        disabled: f
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (a, n)=>n != null && n.length > 0,
                            message: r("common.chooseText") + " " + r("hsqe.psc.inspectionFrom"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "nil_deficiency",
                    component: "NCheckbox",
                    componentProps: ({ model: a })=>({
                            disabled: f,
                            checkedValue: 1,
                            uncheckedValue: 0,
                            options: [
                                {
                                    value: 1,
                                    label: r("hsqe.psc.nilDeficiency")
                                }
                            ],
                            onUpdateValue: (n)=>{
                                a.nil_deficiency = n;
                            }
                        }),
                    giProps: {
                        span: 1
                    }
                },
                {
                    field: "reportUrlName_url",
                    label: r("hsqe.fsc.fscReport"),
                    slot: "fscReport"
                }
            ],
            methods: {
                setReadOnly: (a)=>{
                    f.value = a;
                }
            }
        };
    }
    const G = X(), { t: l } = A();
    function nt() {
        const f = [
            {
                key: "new",
                value: l("hsqe.rs.deficiencyStatus.new"),
                color: {
                    color: "#F0FFFB",
                    textColor: "#00C1A8",
                    borderColor: "#F0FFFB"
                }
            },
            {
                key: "un_rectified",
                value: l("hsqe.rs.deficiencyStatus.unrectified"),
                color: {
                    color: "#FFF0F0",
                    textColor: "#C10003",
                    borderColor: "#FFF0F0"
                }
            },
            {
                key: "pending_master_reviewed",
                value: l("hsqe.rs.deficiencyStatus.reviewed"),
                color: {
                    color: "#FFFCF0",
                    textColor: "#C18400",
                    borderColor: "#FFFCF0"
                }
            },
            {
                key: "un_verified",
                value: l("hsqe.rs.deficiencyStatus.unverified"),
                color: {
                    color: "#FFF0F0",
                    textColor: "#C10003",
                    borderColor: "#FFF0F0"
                }
            },
            {
                key: "closed",
                value: l("hsqe.rs.deficiencyStatus.closed"),
                color: {
                    color: "#F2F0FF",
                    textColor: "#BA4E9A",
                    borderColor: "#F2F0FF"
                }
            },
            {
                key: "master_return",
                value: l("hsqe.rs.deficiencyStatus.masterReturn"),
                color: {
                    color: "#F0FFFB",
                    textColor: "#00C1A8",
                    borderColor: "#F0FFFB"
                }
            },
            {
                key: "superintendent_return",
                value: l("hsqe.rs.deficiencyStatus.superintendentReturn"),
                color: {
                    color: "#F0F5FF",
                    textColor: "#0067C1",
                    borderColor: "#F0F5FF"
                }
            }
        ];
        return {
            columns: [
                {
                    title: l("hsqe.planner.no"),
                    key: "no"
                },
                {
                    title: l("hsqe.psc.deficiencyCode"),
                    key: "defectCode",
                    ifShow: !1
                },
                {
                    title: l("hsqe.auditInspection.vesselInspection.deficiency.description"),
                    key: "desc"
                },
                {
                    title: l("hsqe.psc.actionCode"),
                    key: "observation",
                    ifShow: !1
                },
                {
                    title: l("hsqe.auditInspection.vesselInspection.deficiency.dateRectify"),
                    key: "dueDate",
                    render: (i)=>Ze(new Date(i.dueDate))
                },
                {
                    title: l("hsqe.auditInspection.vesselInspection.deficiency.pic"),
                    key: "owner",
                    render (i) {
                        return I("span", {}, {
                            default: ()=>G.getLocale === "en" ? i.vesselPositionNameEn : i.vesselPositionName
                        });
                    }
                },
                {
                    title: l("hsqe.auditInspection.vesselInspection.deficiency.confirmation"),
                    key: "confirmation",
                    render (i) {
                        return I("span", {}, {
                            default: ()=>G.getLocale === "en" ? i.officePositionNameEn : i.officePositionName
                        });
                    }
                },
                {
                    title: l("hsqe.cdi.status"),
                    key: "status",
                    render (i) {
                        return I(Ce, {
                            bordered: !1,
                            color: f.find((a)=>a.key === i.status)?.color
                        }, {
                            default: ()=>f.find((a)=>a.key === i.status)?.value
                        });
                    }
                }
            ]
        };
    }
    let at;
    at = qe({
        __name: "addFSC",
        setup (f) {
            const x = Se(), i = ke(), a = Re(), n = Te(), { t: s } = A(), j = Ee(), J = we({
                storage: localStorage
            }), g = p(!1), { addSchemas: K, methods: Z } = st(), { setReadOnly: Y } = Z, { columns: ee } = nt(), te = p(0), [oe, { submit: se, getFieldsValue: ne, setFieldsValue: ae }] = et({
                schemas: K,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 5,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), ie = Ne({
                width: 180,
                title: s("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return I(ze, {
                        style: "text",
                        actions: [
                            {
                                label: s("common.optionsViewText"),
                                labelShow: !1,
                                icon: q(S.view, "text-[20px] text-[#3F7AE9]"),
                                onClick: ()=>{
                                    a.push({
                                        name: "Add_HSQE_AuditInspection_ReportList_VesselInspection_DeficiencyReport",
                                        query: {
                                            id: e.id,
                                            type: "view"
                                        }
                                    });
                                }
                            },
                            {
                                label: s("common.exportText"),
                                labelShow: !1,
                                icon: q(S.export, "text-[20px]"),
                                onClick: ()=>{
                                    ye(e);
                                }
                            }
                        ]
                    });
                }
            }), re = {
                gridProps: {
                    cols: "2"
                },
                labelWidth: 80,
                submitButtonText: s("common.searchText"),
                showAdvancedButton: !1,
                schemas: [
                    {
                        field: "namePrefix",
                        component: "NInput",
                        label: s("hsqe.planner.modal.planPort")
                    }
                ]
            }, le = [
                {
                    title: s("hsqe.planner.modal.port"),
                    key: "port"
                },
                {
                    title: s("hsqe.planner.modal.country"),
                    key: "country"
                }
            ], k = p({}), y = p(), ce = p(J.get(Ie, "")), ue = p(), B = p(), R = p(), V = p(!1), U = p(), T = p([]), de = p(!1);
            async function D() {
                const e = await Q({
                    templateCode: "fscReport",
                    uuid: y.value
                });
                R.value = e, ue.value = e.reportNum, e.nil_deficiency = [
                    e.nil_deficiency
                ], e.editDateList = [
                    e.startDate,
                    e.endDate
                ], ae(e), pe(e);
                const u = n.getUserInfo.id, c = await Qe(u);
                de.value = c?.isCaptain == "1", me(e), i.query.type == "view" && (g.value = !0), Y(g.value), E();
            }
            async function pe(e) {
                e.approveStatus == 3 ? V.value = !0 : V.value = !1;
            }
            function me(e) {
                e.reportUrlNameName && (T.value = [
                    {
                        id: "fscReport",
                        name: e.reportUrlNameName || e.reportUrlName_FileName,
                        url: e.reportUrlName || e.reportUrlName_url,
                        status: i.query.type == "view" ? void 0 : "finished"
                    }
                ]);
            }
            function fe(e) {
                return Je({
                    ...e,
                    ...o(k)
                });
            }
            function ye(e) {
                const { href: u } = a.resolve({
                    name: "Add_HSQE_AuditInspection_ReportList_exportDeficiencyPdf",
                    query: {
                        uuid: i.query.uuid,
                        name: "FSC",
                        id: e.id
                    }
                });
                window.open(u, "_blank");
            }
            async function _e() {
                const e = await Q({
                    templateCode: "fscReport",
                    uuid: y.value
                });
                return te.value = e.deficiencyList?.length || 0, {
                    list: e.deficiencyList || [],
                    total: e.deficiencyList?.length || 0
                };
            }
            function E() {
                U.value.reload();
            }
            function ve() {
                if (!R.value) {
                    x.warning(s("hsqe.sire.cantAddHint"));
                    return;
                }
                B.value?.showModal(R.value, i.query.uuid || y.value);
            }
            async function O(e) {
                if (!await se()) return !1;
                const c = ne();
                let _ = c.reportResultList || [];
                _ && _.length > 0 && (c.reportResult = `nil_deficiency:${_[0]},detained:${_[1]}`), c.nil_deficiency = c.nil_deficiency.includes(1) ? 1 : 0, delete c.reportResultList, delete c.reportUrlName_url;
                const b = {
                    template_code: "fscReport",
                    reportBy: ce.value,
                    ...c
                };
                y.value ? (b.uuid = y.value, await Ge(b), e === "save" && x.success(s("common.saveSuccessText"))) : (y.value = await Xe(b), x.success(s("common.saveSuccessText"))), D();
            }
            async function he() {
                await O("submit"), await je({
                    template_code: "fscReport",
                    uuid: y.value
                }), x.success(s("common.submitSuccessText")), a.push({
                    name: "HSQE_AuditInspection_ReportList",
                    query: {
                        asyncComponent: "fsc"
                    }
                }), D();
            }
            function ge() {
                if (g.value) {
                    a.push({
                        name: "HSQE_AuditInspection_ReportList",
                        query: {
                            asyncComponent: "fsc"
                        }
                    });
                    return;
                }
                j.info({
                    title: s("hsqe.auditInspection.back.title"),
                    content: s("hsqe.auditInspection.back.cont"),
                    positiveText: s("common.okText"),
                    negativeText: s("common.cancelText"),
                    onPositiveClick: async ()=>{
                        a.push({
                            name: "HSQE_AuditInspection_ReportList",
                            query: {
                                asyncComponent: "fsc"
                            }
                        });
                    }
                });
            }
            return De(async ()=>{
                y.value = i.query.uuid || null, y.value && !R.value && D();
            }), (e, u)=>{
                const c = Ve, _ = Be, b = Ae, be = He, Fe = $e, $ = Le, xe = Ue, H = Pe("debounce");
                return h(), v(xe, null, {
                    default: t(()=>[
                            d($, {
                                bordered: !1,
                                class: "py-3 proCard",
                                size: "small",
                                segmented: {
                                    content: !0
                                },
                                "content-style": "padding: 20px 15px 0 15px;"
                            }, {
                                header: t(()=>[
                                        d(b, {
                                            align: "center"
                                        }, {
                                            default: t(()=>[
                                                    d(_, {
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: t(()=>[
                                                                d(c, {
                                                                    type: "text",
                                                                    class: "size-8",
                                                                    onClick: ge
                                                                }, {
                                                                    icon: t(()=>[
                                                                            (h(), v(L(o(q)(o(S).back, "text-[16px]"))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: t(()=>[
                                                                w(" " + N(o(s)("common.backToList")), 1)
                                                            ]),
                                                        _: 1
                                                    }),
                                                    W("h1", null, N(o(s)("hsqe.basic.basicTitle")), 1)
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                "header-extra": t(()=>[
                                        d(b, {
                                            align: "center"
                                        }, {
                                            default: t(()=>[
                                                    o(g) ? P("", !0) : (h(), v(_, {
                                                        key: 0,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: t(()=>[
                                                                z((h(), v(c, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7"
                                                                }, {
                                                                    icon: t(()=>[
                                                                            (h(), v(L(o(q)(o(S).save))))
                                                                        ]),
                                                                    _: 1
                                                                })), [
                                                                    [
                                                                        H,
                                                                        ()=>O("save"),
                                                                        "1000"
                                                                    ]
                                                                ])
                                                            ]),
                                                        default: t(()=>[
                                                                w(" " + N(o(s)("common.saveText")), 1)
                                                            ]),
                                                        _: 1
                                                    })),
                                                    o(g) ? P("", !0) : (h(), v(_, {
                                                        key: 1,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: t(()=>[
                                                                z((h(), v(c, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7"
                                                                }, {
                                                                    icon: t(()=>[
                                                                            (h(), v(L(o(q)(o(S).send))))
                                                                        ]),
                                                                    _: 1
                                                                })), [
                                                                    [
                                                                        H,
                                                                        ()=>he(),
                                                                        "1000"
                                                                    ]
                                                                ])
                                                            ]),
                                                        default: t(()=>[
                                                                w(" " + N(o(s)("common.submit")), 1)
                                                            ]),
                                                        _: 1
                                                    }))
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                default: t(()=>[
                                        d(Fe, {
                                            onRegister: o(oe)
                                        }, {
                                            visitPlace: t(({ model: F, field: C })=>[
                                                    d(be, {
                                                        ref: "portTableSelectRef",
                                                        labelField: "port",
                                                        valueField: "id",
                                                        value: F[C],
                                                        "onUpdate:value": (m)=>F[C] = m,
                                                        formValues: o(k),
                                                        "onUpdate:formValues": u[0] || (u[0] = (m)=>M(k) ? k.value = m : null),
                                                        multiple: !1,
                                                        formProps: re,
                                                        disabled: o(g),
                                                        class: "w-full",
                                                        selectTitle: o(s)("hsqe.planner.modal.selectPort"),
                                                        tableProps: {
                                                            rowKey: (m)=>m.id,
                                                            request: fe,
                                                            columns: le,
                                                            pagination: {
                                                                simple: !0
                                                            }
                                                        }
                                                    }, null, 8, [
                                                        "value",
                                                        "onUpdate:value",
                                                        "formValues",
                                                        "disabled",
                                                        "selectTitle",
                                                        "tableProps"
                                                    ])
                                                ]),
                                            fscReport: t(({ model: F, field: C })=>[
                                                    d(Ye, {
                                                        "file-list": o(T),
                                                        "onUpdate:fileList": u[1] || (u[1] = (m)=>M(T) ? T.value = m : null),
                                                        disabled: o(g),
                                                        onFinish: (m)=>F[C] = m?.originalFileName,
                                                        onRemove: (m)=>F[C] = null
                                                    }, null, 8, [
                                                        "file-list",
                                                        "disabled",
                                                        "onFinish",
                                                        "onRemove"
                                                    ])
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            d($, {
                                bordered: !1,
                                class: "mt-3 py-3 proCard",
                                size: "small",
                                segmented: {
                                    content: !0
                                },
                                "content-style": "padding: 20px 15px 0 15px;"
                            }, {
                                default: t(()=>[
                                        d(o(Me), {
                                            ref_key: "basicTableRef",
                                            ref: U,
                                            columns: o(ee),
                                            request: _e,
                                            immediate: !1,
                                            "row-key": (F)=>F.id,
                                            actionColumn: o(ie),
                                            autoScrollX: !0,
                                            "virtual-scroll": "",
                                            pagination: !1
                                        }, {
                                            tableTitle: t(()=>[
                                                    d(b, {
                                                        align: "center"
                                                    }, {
                                                        default: t(()=>[
                                                                o(g) ? P("", !0) : (h(), v(_, {
                                                                    key: 0,
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: t(()=>[
                                                                            d(c, {
                                                                                type: "primary",
                                                                                strong: "",
                                                                                bordered: "",
                                                                                secondary: "",
                                                                                class: "size-7",
                                                                                onClick: ve
                                                                            }, {
                                                                                icon: t(()=>u[2] || (u[2] = [
                                                                                        W("i", {
                                                                                            class: "iconfont icon-ADD"
                                                                                        }, null, -1)
                                                                                    ])),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: t(()=>[
                                                                            u[3] || (u[3] = w(" ADD "))
                                                                        ]),
                                                                    _: 1
                                                                }))
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "row-key",
                                            "actionColumn"
                                        ])
                                    ]),
                                _: 1
                            }),
                            d(Ke, {
                                ref_key: "modalRef",
                                ref: B,
                                onSuccess: E
                            }, null, 512)
                        ]),
                    _: 1
                });
            };
        }
    });
    jt = Oe(at, [
        [
            "__scopeId",
            "data-v-5ece982b"
        ]
    ]);
});
export { jt as default, __tla };
