import { d as ae, V as ne, b as se, f as ie, r as i, aw as re, d9 as le, c as r, o as l, w as n, aE as me, j as s, W as ue, l as o, D as v, aH as ce, hr as de, i as pe, N as fe, aJ as _e, S as ve, p as d, A as p, H as ye, B as ge, X as be, ac as he, c_ as Ce, gT as xe, gR as Te, cZ as we, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as ke } from "./BasicForm-dL_oCSPM.js";
import { u as Fe } from "./account-C850CBTF.js";
import { e as Me, f as Ne, s as Re } from "./smsFormsTemplate-Dsea_L5v.js";
import { u as Se } from "./useTags-C1thGhjF.js";
import { _ as De, __tla as __tla_1 } from "./index.vue_vue_type_script_setup_true_lang-CJLhb5rA.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./print-CT_2hrjP.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import { __tla as __tla_2 } from "./index.vue_vue_type_style_index_0_scoped_b974e5ec_lang-_0QwzFKM.js";
import { u as Ie } from "./useForm-CKmgcynv.js";
import { H as Be, __tla as __tla_3 } from "./index-8tHZJCCW.js";
import "./schemas-BmKi-UM9.js";
import "./props-CLtNejQT.js";
import { d as Le } from "./download-CIBdrxiA.js";
import { c as Ae, __tla as __tla_4 } from "./schemas-VNkutZfL.js";
import { _ as ze } from "./OnlyOffice.vue_vue_type_script_setup_true_lang-BH1_y9Dy.js";
import { h as He } from "./has-CjqcrIOV.js";
import { i as Oe } from "./isEmpty-BUg1OsQj.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 "./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 "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./useModal-CO65vga3.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./jobOrder-CGbsc7bp.js";
import "./usePageCache-DluHn7Yy.js";
import "./TimelineItem-Bkds7ZW8.js";
import "./Flex-CTSf12gq.js";
import "./base64Conver-4Xd-Hzyx.js";
import "./event-CLiVQHeO.js";
let Oo;
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 Ve;
    Ve = {
        style: {
            "margin-bottom": "12px"
        }
    };
    Oo = ae({
        __name: "smsFormsDetail",
        setup (Pe) {
            const { t: a } = ne(), D = se(), { closeCurrentTabToBack: I } = Se(), b = we(), w = Ce(), B = ie(), { editSchemas: L } = Ae({}), m = D.getShipList, { id: h, type: f } = B.query, k = i(), F = i(), C = i(), y = i();
            i(!1);
            const _ = i(!1), M = i(!0), N = i(!1), e = i(), [A, { submit: Ue, setFieldsValue: x }] = Ie({
                gridProps: {
                    cols: "2 m:3 l:4 xl:5"
                },
                layout: "horizontal",
                schemas: L,
                showActionButtonGroup: !1
            });
            function z() {
                M.value = !1;
            }
            async function H() {
                e.value = await Me(h), e.value.type === "2" && (e.value.url = [
                    {
                        id: 0,
                        url: e.value.url,
                        name: e.value.fileCode,
                        status: "finished"
                    }
                ]), x({
                    ...e.value,
                    _name_: e.value.code
                }), await he(), C.value?.handleInitOffice(e.value.fileCode, Number(h));
            }
            function g() {
                try {
                    I();
                } catch (t) {
                    console.warn("Error closing tab:", t);
                }
            }
            function O() {
                g();
            }
            async function V() {
                w.warning({
                    title: a("common.confirmText"),
                    content: a("mdm.smsFormsTemplate.confirmCopyLastForm"),
                    positiveText: a("common.dialogPositiveText"),
                    negativeText: a("common.dialogNegativeText"),
                    onPositiveClick: async ()=>{
                        if (!e.value) return;
                        const t = e.value.id;
                        e.value = await Ne(e.value.code), e.value.id = t, x({
                            ...e.value,
                            _name_: e.value.code
                        }), C.value?.handleInitOffice(e.value.fileCode, Number(h));
                    },
                    onNegativeClick: ()=>{}
                });
            }
            async function P() {
                w.warning({
                    title: a("common.confirmText"),
                    content: a("mdm.smsFormsTemplate.confirmSubmitForm"),
                    positiveText: a("common.confirmText"),
                    negativeText: a("common.dialogNegativeText"),
                    loading: _,
                    onPositiveClick: async ()=>{
                        try {
                            if (!e.value) return;
                            if (N.value = !0, _.value = !0, He(e.value, "subModuleCode") && !Oe(e.value.subModuleCode)) {
                                const t = {
                                    shipId: m?.length ? Number(m[0].id) : 0,
                                    busId: e.value.id,
                                    moduleCode: e.value.moduleCode,
                                    subModuleCode: e.value.subModuleCode
                                };
                                await xe(t);
                            } else await Re(e.value.id);
                            _.value = !1, g();
                        } catch  {
                            _.value = !1;
                        }
                    },
                    onNegativeClick: ()=>{}
                });
            }
            async function U() {
                if (!e.value) return;
                const t = {
                    shipId: m?.length ? Number(m[0].id) : 0,
                    busId: e.value.id,
                    moduleCode: e.value.moduleCode,
                    subModuleCode: e.value.subModuleCode,
                    comment: "pass"
                };
                await Te(t), g();
            }
            function W() {
                if (!e.value) return;
                const t = {
                    shipId: m?.length ? Number(m[0].id) : 0,
                    busId: e.value.id,
                    moduleCode: e.value.moduleCode,
                    subModuleCode: e.value.subModuleCode,
                    comment: "return"
                };
                k.value?.showModal(t);
            }
            function E() {
                if (!e.value) return;
                const t = {
                    shipId: m?.length ? Number(m[0].id) : 0,
                    busId: e.value.id,
                    moduleCode: e.value.moduleCode,
                    subModuleCode: e.value.subModuleCode
                };
                F.value?.handleOpenModal(t);
            }
            function q({ file: t }) {
                if (console.log(t), t.file.size > 1024 * 1024 * 10) return b.error(a("mdm.smsFormsTemplate.uploadFileSizeLimitText")), !1;
                if (!t.file.name.endsWith(".doc") && !t.file.name.endsWith(".docx") && !t.file.name.endsWith(".pdf")) return b.error(a("mdm.smsFormsTemplate.uploadFileTypeLimitText")), !1;
            }
            async function $({ file: t, onFinish: T, onError: u }) {
                try {
                    if (!e.value) return;
                    const c = new FormData;
                    c.append("file", t.file), y.value = await Fe(c), x({
                        fileCode: y.value.name,
                        url: y.value.url
                    }), T({
                        file: t
                    });
                } catch  {
                    u();
                }
            }
            async function G() {
                e.value && (e.value.url = "", b.success(a("common.optionsDelSuccessText")));
            }
            function j() {
                Le({
                    url: y.value.url
                });
            }
            return re(()=>{
                H();
            }), (t, T)=>{
                const u = ge, c = ye, J = fe, X = ve, Z = de, K = ce, Q = ke, Y = ue, ee = be, oe = le("loading");
                return l(), r(ee, null, {
                    default: n(()=>[
                            me((l(), r(Y, {
                                segmented: {
                                    content: !0
                                },
                                size: "small",
                                class: "proCard"
                            }, {
                                header: n(()=>[
                                        d(p(o(f) === "add" ? o(a)("common.optionsAddText") : o(f) === "edit" ? o(a)("common.optionsEditText") : o(a)("common.optionsViewText")), 1)
                                    ]),
                                "header-extra": n(()=>[
                                        o(f) !== "view" && o(e) ? (l(), r(c, {
                                            key: 0
                                        }, {
                                            default: n(()=>[
                                                    o(e).type === "1" ? (l(), r(u, {
                                                        key: 0,
                                                        type: "primary",
                                                        onClick: V
                                                    }, {
                                                        default: n(()=>[
                                                                d(p(o(a)("mdm.smsFormsTemplate.copyLastForm")), 1)
                                                            ]),
                                                        _: 1
                                                    })) : v("", !0),
                                                    [
                                                        1,
                                                        3
                                                    ].includes(o(e).status) ? (l(), r(u, {
                                                        key: 1,
                                                        class: "w-[76px]",
                                                        loading: o(_),
                                                        onClick: P,
                                                        type: "primary"
                                                    }, {
                                                        default: n(()=>[
                                                                d(p(o(a)("common.submit")), 1)
                                                            ]),
                                                        _: 1
                                                    }, 8, [
                                                        "loading"
                                                    ])) : v("", !0)
                                                ]),
                                            _: 1
                                        })) : o(f) === "view" && o(e) && o(e).canApprove ? (l(), r(c, {
                                            key: 1
                                        }, {
                                            default: n(()=>[
                                                    s(u, {
                                                        type: "primary",
                                                        onClick: U
                                                    }, {
                                                        default: n(()=>[
                                                                d(p(o(a)("common.optionsApproveText")), 1)
                                                            ]),
                                                        _: 1
                                                    }),
                                                    s(u, {
                                                        type: "primary",
                                                        strong: "",
                                                        secondary: "",
                                                        onClick: W
                                                    }, {
                                                        default: n(()=>[
                                                                d(p(o(a)("common.optionsReturnText")), 1)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        })) : o(f) === "view" ? (l(), r(c, {
                                            key: 2
                                        }, {
                                            default: n(()=>[
                                                    s(u, {
                                                        type: "primary",
                                                        onClick: E
                                                    }, {
                                                        default: n(()=>[
                                                                d(p(o(a)("common.reviewHistory")), 1)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        })) : v("", !0),
                                        s(c, {
                                            class: "ml-4"
                                        }, {
                                            default: n(()=>[
                                                    s(u, {
                                                        class: "w-[76px]",
                                                        onClick: O
                                                    }, {
                                                        default: n(()=>[
                                                                d(p(o(a)("common.backText")), 1)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                default: n(()=>[
                                        s(Q, {
                                            ref: "formRef",
                                            onRegister: o(A)
                                        }, {
                                            fileSlot: n(({ model: R, field: S })=>[
                                                    o(e) && o(e).type === "2" ? (l(), r(K, {
                                                        key: 0,
                                                        "file-list": R[S],
                                                        "onUpdate:fileList": (te)=>R[S] = te,
                                                        accept: ".doc,.docx,.pdf",
                                                        "directory-dnd": "",
                                                        "show-download-button": !0,
                                                        "on-before-upload": q,
                                                        "custom-request": $,
                                                        onDownload: j,
                                                        onRemove: G,
                                                        "show-remove-button": !0,
                                                        max: 1
                                                    }, {
                                                        default: n(()=>[
                                                                s(Z, null, {
                                                                    default: n(()=>[
                                                                            pe("div", Ve, [
                                                                                s(J, {
                                                                                    size: "48",
                                                                                    depth: 3
                                                                                }, {
                                                                                    default: n(()=>[
                                                                                            s(o(_e))
                                                                                        ]),
                                                                                    _: 1
                                                                                })
                                                                            ]),
                                                                            s(X, {
                                                                                style: {
                                                                                    "font-size": "16px"
                                                                                }
                                                                            }, {
                                                                                default: n(()=>[
                                                                                        d(p(o(a)("common.uploadText")), 1)
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 2
                                                    }, 1032, [
                                                        "file-list",
                                                        "onUpdate:fileList"
                                                    ])) : v("", !0),
                                                    o(N) ? v("", !0) : (l(), r(o(ze), {
                                                        key: 1,
                                                        ref_key: "onlyOfficeRef",
                                                        ref: C,
                                                        mode: o(f),
                                                        onOnInfo: z
                                                    }, null, 8, [
                                                        "mode"
                                                    ]))
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            })), [
                                [
                                    oe,
                                    o(M)
                                ]
                            ]),
                            s(o(De), {
                                ref_key: "returnModalRef",
                                ref: k,
                                subModuleCode: !1,
                                onSuccess: g
                            }, null, 512),
                            s(o(Be), {
                                ref_key: "approvalHistoryModalRef",
                                ref: F
                            }, null, 512)
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Oo as default, __tla };
