import { d as te, V as ae, e as oe, f as se, u as ne, bk as ie, Z as R, H as z, c9 as re, r as m, c8 as le, k as ue, aw as pe, c as d, o as r, w as e, j as s, W as ce, D as w, U as de, h as T, F as A, a9 as H, M as me, p as c, A as l, l as u, gD as ve, x as _e, y as fe, i as y, aI as ye, B as ke, X as ge, v as be, __tla as __tla_0 } from "./index-9PRMimni.js";
import we, { __tla as __tla_1 } from "./WorkDetail-17jZoFEl.js";
import { B as he } from "./Table-0PViRYCf.js";
import { N as qe, A as xe, z as Ce } from "./template-rpthWlT9.js";
import { g as Se, a as Re, u as Te } from "./workpermit-ycq2YJDA.js";
import { _ as Ae } from "./rejectModal.vue_vue_type_script_setup_true_lang-KCtZZHCu.js";
import { _ as Me, __tla as __tla_2 } from "./Modal.vue_vue_type_script_setup_true_lang-D448duf4.js";
import "./BasicForm-dL_oCSPM.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 "./useForm-CKmgcynv.js";
import "./usePageCache-DluHn7Yy.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 "./Flex-CTSf12gq.js";
import { __tla as __tla_3 } from "./index.vue_vue_type_style_index_0_scoped_b974e5ec_lang-_0QwzFKM.js";
import "./jobOrder-CGbsc7bp.js";
import "./has-CjqcrIOV.js";
import { __tla as __tla_4 } from "./index-8tHZJCCW.js";
import "./TimelineItem-Bkds7ZW8.js";
import "./schemas-BmKi-UM9.js";
import "./props-CLtNejQT.js";
let Ct;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_3;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_4;
        } catch  {}
    })()
]).then(async ()=>{
    let Ne;
    Ne = te({
        __name: "AddApplication",
        setup (Le) {
            const { t } = ae(), P = oe(), C = se(), h = ne(), D = ie(), F = ()=>[
                    {
                        label: t("hsqe.workpermit.optionYes"),
                        value: "Yes"
                    },
                    {
                        label: t("hsqe.workpermit.optionNo"),
                        value: "No"
                    },
                    {
                        label: t("hsqe.workpermit.optionNa"),
                        value: "Na"
                    }
                ], O = [
                {
                    title: t("hsqe.workpermit.content"),
                    align: "left",
                    key: D.getLocale === "en" ? "inspectionContentEn" : "inspectionContentZh"
                },
                {
                    title: t("hsqe.workpermit.result"),
                    key: "inspectionResult",
                    width: 300,
                    editRule: !0,
                    render (n) {
                        return n.resultLevel == 3 ? R(le, {
                            value: n.inspectionResult,
                            disabled: S.value,
                            onUpdateValue (a) {
                                n.inspectionResult = a;
                            }
                        }, ()=>R(z, {}, F().map((a)=>R(re, {
                                    label: a.label,
                                    value: a.value
                                })))) : R(ue, {
                            disabled: S.value,
                            value: n.inspectionResult,
                            onUpdateValue (a) {
                                n.inspectionResult = a;
                            }
                        });
                    }
                }
            ], o = m({
                reportNum: "",
                approveStatus: 1,
                reportBy: "",
                requestTime: ""
            }), Y = m([
                {
                    label: t("hsqe.workpermit.tableNum"),
                    key: "reportNum",
                    span: 1
                },
                {
                    label: t("hsqe.workpermit.Status"),
                    key: "approveStatus",
                    span: 1
                },
                {
                    label: t("hsqe.workpermit.requestBy"),
                    key: "user_name",
                    span: 1
                },
                {
                    label: t("hsqe.workpermit.requestTime"),
                    key: "submitTime",
                    span: 1
                }
            ]), I = m("detail"), _ = m(), q = m([]), g = m(!1), k = m("add"), S = m(!1), V = m(), $ = m([
                {
                    name: t("hsqe.workpermit.defaultOptions"),
                    key: "chiefComment"
                },
                {
                    name: t("hsqe.workpermit.masterOpinions"),
                    key: "masterComment"
                },
                {
                    name: t("hsqe.workpermit.techOpinion"),
                    key: "techSupervisorComment"
                },
                {
                    name: t("hsqe.workpermit.marineOpinion"),
                    key: "marineSupervisorComment"
                },
                {
                    name: t("hsqe.workpermit.lastOptions"),
                    key: "managerComment"
                }
            ]), x = m(), M = m("");
            async function N(n) {
                const a = await Se({
                    templateCode: C.query?.code || "workPermitHotWork",
                    uuid: n
                });
                o.value = a, q.value = a?.work_permit, _.value.initData(a);
            }
            function L() {
                P.push({
                    path: "/hsqe/workPermit",
                    query: {
                        selectKey: C.query.selectKey
                    }
                });
            }
            async function j(n) {
                let a = {
                    ..._.value.getFieldsValue(),
                    ..._.value.getDescriptFieldsValue(),
                    ..._.value.getExperienceFieldsValue(),
                    ..._.value.getBallastFieldsValue(),
                    ..._.value.getCargoFieldsValue()
                };
                if (n.value == "add" || !o.value.uuid) {
                    const p = await Re({
                        template_code: "workPermitHotWork",
                        ...a
                    });
                    N(p), h.success(t("common.saveSuccessText"));
                } else if (o.value.uuid) {
                    let p = q.value.map((f)=>({
                            id: f.id,
                            inspectionResult: f.inspectionResult
                        }));
                    const v = await Te({
                        template_code: "workPermitHotWork",
                        ...a,
                        uuid: o.value.uuid,
                        checkList: p
                    });
                    n == "submit" ? (await qe({
                        shipId: o.value?.shipId,
                        busId: o.value.uuid,
                        moduleCode: "workPermitHotWork",
                        subModuleCode: o.value.subModuleCode
                    }), g.value = !1, h.success(t("common.optionsSuccessText")), L()) : (h.success(t("common.saveSuccessText")), N(v));
                }
            }
            async function U() {
                M.value = "return", x.value?.setTitle(t("hsqe.workpermit.return")), x.value?.showModal();
            }
            async function K(n) {
                n.type == "return" ? (await xe({
                    shipId: o.value?.shipId,
                    busId: o.value.uuid,
                    moduleCode: "workPermitHotWork",
                    subModuleCode: o.value.subModuleCode,
                    ...n
                }), h.success(t("common.submitRejectText"))) : (await Ce({
                    busId: o.value.uuid,
                    moduleCode: "workPermitHotWork",
                    subModuleCode: o.value.subModuleCode,
                    ...n
                }), h.success(t("common.submitApproveText"))), x.value?.closeModal(), L();
            }
            async function Z() {
                M.value = "approve", x.value?.setTitle(t("hsqe.workpermit.approve")), x.value?.showModal();
            }
            async function X() {
                try {
                    const n = await _.value.submit(), a = await _.value.descriptionSubmit(), p = await _.value.experienceSubmit();
                    if (console.log(p, "rimerd"), !n || !a || !p) return !1;
                    if (!q.value.every((f)=>f.inspectionResult !== void 0 && f.inspectionResult !== null && f.inspectionResult !== "")) {
                        h.error(t("hsqe.workpermit.validateSafetyTip"));
                        return;
                    }
                    j("submit");
                } catch (n) {
                    console.log(n), g.value = !1;
                }
            }
            async function G() {}
            function J() {
                let n = o.value.subModuleCode;
                V.value?.showModal(o.value.uuid, n);
            }
            return pe(()=>{
                k.value = typeof C.query.type == "string" ? C.query.type : "", (k.value == "edit" || k.value == "view") && N(C.query?.uuid), k.value == "view" && (S.value = !0);
            }), (n, a)=>{
                const p = ke, v = ye, f = z, b = me, E = de, B = fe, W = ce, Q = _e, ee = ge;
                return r(), d(ee, null, {
                    default: e(()=>[
                            s(W, {
                                bordered: !1,
                                class: "py-3 proCard",
                                size: "small",
                                segmented: {
                                    content: !0
                                },
                                "content-style": "padding: 20px 15px 0 15px;"
                            }, {
                                header: e(()=>[
                                        y("div", null, [
                                            s(f, {
                                                justify: "space-between",
                                                class: "flex items-center"
                                            }, {
                                                default: e(()=>[
                                                        s(f, {
                                                            justify: "start",
                                                            class: "flex items-center"
                                                        }, {
                                                            default: e(()=>[
                                                                    s(v, {
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: e(()=>[
                                                                                s(p, {
                                                                                    border: !1,
                                                                                    type: "text",
                                                                                    class: "size-8",
                                                                                    onClick: L
                                                                                }, {
                                                                                    icon: e(()=>a[1] || (a[1] = [
                                                                                            y("i", {
                                                                                                class: "iconfont icon-a-shangyibu2 text-[16px]"
                                                                                            }, null, -1)
                                                                                        ])),
                                                                                    _: 1
                                                                                })
                                                                            ]),
                                                                        default: e(()=>[
                                                                                c(" " + l(u(t)("hsqe.noticeCircular.back")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    }),
                                                                    s(v, {
                                                                        trigger: "click"
                                                                    }, {
                                                                        trigger: e(()=>[
                                                                                y("span", null, l(u(t)("hsqe.workpermit.tabApplication")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            _: 1
                                                        }),
                                                        s(f, {
                                                            justify: "end"
                                                        }, {
                                                            default: e(()=>[
                                                                    o.value.approveShow == 1 ? (r(), d(v, {
                                                                        key: 0,
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: e(()=>[
                                                                                s(p, {
                                                                                    loading: g.value,
                                                                                    type: "primary",
                                                                                    strong: "",
                                                                                    secondary: "",
                                                                                    bordered: "",
                                                                                    class: "size-8",
                                                                                    onClick: Z
                                                                                }, {
                                                                                    icon: e(()=>a[2] || (a[2] = [
                                                                                            y("i", {
                                                                                                class: "iconfont icon-Approve text-[16px]"
                                                                                            }, null, -1)
                                                                                        ])),
                                                                                    _: 1
                                                                                }, 8, [
                                                                                    "loading"
                                                                                ])
                                                                            ]),
                                                                        default: e(()=>[
                                                                                c(" " + l(u(t)("hsqe.workpermit.approve")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })) : w("", !0),
                                                                    o.value.approveShow == 1 ? (r(), d(v, {
                                                                        key: 1,
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: e(()=>[
                                                                                s(p, {
                                                                                    loading: g.value,
                                                                                    type: "primary",
                                                                                    strong: "",
                                                                                    secondary: "",
                                                                                    bordered: "",
                                                                                    class: "size-8",
                                                                                    onClick: U
                                                                                }, {
                                                                                    icon: e(()=>a[3] || (a[3] = [
                                                                                            y("i", {
                                                                                                class: "iconfont icon-Returned text-[16px]"
                                                                                            }, null, -1)
                                                                                        ])),
                                                                                    _: 1
                                                                                }, 8, [
                                                                                    "loading"
                                                                                ])
                                                                            ]),
                                                                        default: e(()=>[
                                                                                c(" " + l(u(t)("hsqe.workpermit.return")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })) : w("", !0),
                                                                    o.value.url ? (r(), d(v, {
                                                                        key: 2,
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: e(()=>[
                                                                                s(p, {
                                                                                    type: "primary",
                                                                                    strong: "",
                                                                                    secondary: "",
                                                                                    bordered: "",
                                                                                    class: "size-8",
                                                                                    loading: g.value,
                                                                                    onClick: G
                                                                                }, {
                                                                                    icon: e(()=>a[4] || (a[4] = [
                                                                                            y("i", {
                                                                                                class: "iconfont icon-Export text-[16px]"
                                                                                            }, null, -1)
                                                                                        ])),
                                                                                    _: 1
                                                                                }, 8, [
                                                                                    "loading"
                                                                                ])
                                                                            ]),
                                                                        default: e(()=>[
                                                                                c(" " + l(u(t)("hsqe.workpermit.export")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })) : w("", !0),
                                                                    k.value != "view" && (k.value == "add" || o.value.updateEnable == 1) ? (r(), d(v, {
                                                                        key: 3,
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: e(()=>[
                                                                                s(p, {
                                                                                    loading: g.value,
                                                                                    type: "primary",
                                                                                    strong: "",
                                                                                    secondary: "",
                                                                                    bordered: "",
                                                                                    class: "size-8",
                                                                                    onClick: j
                                                                                }, {
                                                                                    icon: e(()=>a[5] || (a[5] = [
                                                                                            y("i", {
                                                                                                class: "iconfont icon-Save text-[16px]"
                                                                                            }, null, -1)
                                                                                        ])),
                                                                                    _: 1
                                                                                }, 8, [
                                                                                    "loading"
                                                                                ])
                                                                            ]),
                                                                        default: e(()=>[
                                                                                c(" " + l(u(t)("hsqe.workpermit.save")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })) : w("", !0),
                                                                    o.value.submitEnable == 1 ? (r(), d(v, {
                                                                        key: 4,
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: e(()=>[
                                                                                s(p, {
                                                                                    type: "primary",
                                                                                    strong: "",
                                                                                    secondary: "",
                                                                                    bordered: "",
                                                                                    class: "size-8",
                                                                                    loading: g.value,
                                                                                    onClick: X
                                                                                }, {
                                                                                    icon: e(()=>a[6] || (a[6] = [
                                                                                            y("i", {
                                                                                                class: "iconfont icon-Submit text-[16px]"
                                                                                            }, null, -1)
                                                                                        ])),
                                                                                    _: 1
                                                                                }, 8, [
                                                                                    "loading"
                                                                                ])
                                                                            ]),
                                                                        default: e(()=>[
                                                                                c(" " + l(u(t)("hsqe.workpermit.submit")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })) : w("", !0),
                                                                    o.value.approveStatus != 1 && o.value.approveStatus != 2 ? (r(), d(v, {
                                                                        key: 5,
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: e(()=>[
                                                                                s(p, {
                                                                                    type: "primary",
                                                                                    strong: "",
                                                                                    bordered: "",
                                                                                    secondary: "",
                                                                                    class: "size-8",
                                                                                    onClick: J
                                                                                }, {
                                                                                    icon: e(()=>a[7] || (a[7] = [
                                                                                            y("i", {
                                                                                                class: "iconfont icon-Log"
                                                                                            }, null, -1)
                                                                                        ])),
                                                                                    _: 1
                                                                                })
                                                                            ]),
                                                                        default: e(()=>[
                                                                                c(" " + l(u(t)("hsqe.workpermit.viewAuditLog")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })) : w("", !0)
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                _: 1
                                            })
                                        ])
                                    ]),
                                default: e(()=>[
                                        k.value != "add" ? (r(), d(E, {
                                            key: 0,
                                            cols: 8,
                                            class: "detail-content"
                                        }, {
                                            default: e(()=>[
                                                    (r(!0), T(A, null, H(Y.value, (i)=>(r(), T(A, {
                                                            key: i.key
                                                        }, [
                                                            s(b, {
                                                                class: "my-label td",
                                                                span: 1
                                                            }, {
                                                                default: e(()=>[
                                                                        c(l(i.label), 1)
                                                                    ]),
                                                                _: 2
                                                            }, 1024),
                                                            i.key == "approveStatus" ? (r(), d(b, {
                                                                key: 0,
                                                                class: "td",
                                                                span: i.span
                                                            }, {
                                                                default: e(()=>[
                                                                        c(l(u(D).getLocale === "en" ? o.value.approveStatusNameEn : o.value.approveStatusName), 1)
                                                                    ]),
                                                                _: 2
                                                            }, 1032, [
                                                                "span"
                                                            ])) : i.key == "submitTime" ? (r(), d(b, {
                                                                key: 1,
                                                                class: "td",
                                                                span: i.span
                                                            }, {
                                                                default: e(()=>[
                                                                        c(l(o.value.submitTime ? u(ve)(o.value.submitTime).format("YYYY-MM-DD  HH:mm") : ""), 1)
                                                                    ]),
                                                                _: 2
                                                            }, 1032, [
                                                                "span"
                                                            ])) : (r(), d(b, {
                                                                key: 2,
                                                                class: "td",
                                                                span: i.span
                                                            }, {
                                                                default: e(()=>[
                                                                        c(l(o.value[i.key] || ""), 1)
                                                                    ]),
                                                                _: 2
                                                            }, 1032, [
                                                                "span"
                                                            ]))
                                                        ], 64))), 128))
                                                ]),
                                            _: 1
                                        })) : w("", !0),
                                        s(Q, {
                                            type: "line",
                                            animated: "",
                                            class: "mt-6",
                                            value: I.value,
                                            "onUpdate:value": a[0] || (a[0] = (i)=>I.value = i)
                                        }, {
                                            default: e(()=>[
                                                    s(B, {
                                                        tab: u(t)("hsqe.workpermit.detail"),
                                                        name: "detail",
                                                        "display-directive": "show"
                                                    }, {
                                                        default: e(()=>[
                                                                s(we, {
                                                                    ref_key: "workDetailRef",
                                                                    ref: _,
                                                                    isEdit: S.value,
                                                                    data: o.value
                                                                }, null, 8, [
                                                                    "isEdit",
                                                                    "data"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "tab"
                                                    ]),
                                                    s(B, {
                                                        tab: u(t)("hsqe.workpermit.safety"),
                                                        name: "safety",
                                                        "display-directive": "show",
                                                        disabled: q.value && q.value.length == 0
                                                    }, {
                                                        default: e(()=>[
                                                                s(u(he), {
                                                                    columns: O,
                                                                    "row-key": (i)=>i.id,
                                                                    ref: "basicTableRef",
                                                                    dataSource: q.value,
                                                                    showTableSetting: !1,
                                                                    pagination: !1,
                                                                    class: "safe-table"
                                                                }, null, 8, [
                                                                    "row-key",
                                                                    "dataSource"
                                                                ])
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "tab",
                                                        "disabled"
                                                    ]),
                                                    s(B, {
                                                        tab: u(t)("hsqe.workpermit.review"),
                                                        name: "review",
                                                        disabled: k.value == "add",
                                                        "display-directive": "show"
                                                    }, {
                                                        default: e(()=>[
                                                                s(W, {
                                                                    bordered: !1,
                                                                    style: {
                                                                        position: "relative"
                                                                    },
                                                                    class: "py-3 proCard"
                                                                }, {
                                                                    default: e(()=>[
                                                                            s(E, {
                                                                                cols: 3,
                                                                                class: "detail-content"
                                                                            }, {
                                                                                default: e(()=>[
                                                                                        (r(!0), T(A, null, H($.value, (i)=>(r(), T(A, {
                                                                                                key: i.name
                                                                                            }, [
                                                                                                s(b, {
                                                                                                    class: "my-label td",
                                                                                                    span: 1
                                                                                                }, {
                                                                                                    default: e(()=>[
                                                                                                            c(l(i.name), 1)
                                                                                                        ]),
                                                                                                    _: 2
                                                                                                }, 1024),
                                                                                                o.value[i.key] ? (r(), d(b, {
                                                                                                    key: 0,
                                                                                                    class: "td",
                                                                                                    span: 2
                                                                                                }, {
                                                                                                    default: e(()=>[
                                                                                                            c(l(o.value[i.key]), 1)
                                                                                                        ]),
                                                                                                    _: 2
                                                                                                }, 1024)) : (r(), d(b, {
                                                                                                    key: 1,
                                                                                                    class: "td",
                                                                                                    span: 2,
                                                                                                    style: {
                                                                                                        opacity: "0.6"
                                                                                                    }
                                                                                                }, {
                                                                                                    default: e(()=>[
                                                                                                            c(l(u(t)("hsqe.workpermit.noOptions")), 1)
                                                                                                        ]),
                                                                                                    _: 1
                                                                                                }))
                                                                                            ], 64))), 128))
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "tab",
                                                        "disabled"
                                                    ])
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "value"
                                        ])
                                    ]),
                                _: 1
                            }),
                            s(Me, {
                                ref_key: "modalRef",
                                ref: V
                            }, null, 512),
                            s(Ae, {
                                ref_key: "rejectModalRef",
                                ref: x,
                                onSuccess: K,
                                type: M.value
                            }, null, 8, [
                                "type"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
    Ct = be(Ne, [
        [
            "__scopeId",
            "data-v-c663aa1f"
        ]
    ]);
});
export { Ct as default, __tla };
