import { B as F } from "./BasicForm-dL_oCSPM.js";
import { r as L, __tla as __tla_0 } from "./columns-CcSTU2Qa.js";
import { B as j } from "./Table-0PViRYCf.js";
import { d as D, V as U, bk as I, r as f, h as A, o as C, j as m, l as t, w as c, aH as P, ds as W, cO as z, fm as O, cq as G, aI as H, p as V, A as q, B as X, c as $, ca as K, gW as M, gX as Z, F as J, ac as Q, bR as Y, R as ee, cZ as ne, __tla as __tla_1 } from "./index-9PRMimni.js";
import { s as te, __tla as __tla_2 } from "./schemas-h8fDbkdf.js";
import { c as ae } from "./componentSetting-DVhNDBTO.js";
import { u as oe } from "./useForm-CKmgcynv.js";
let fe;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    let re;
    re = {
        name: "CrewInjuryReport"
    };
    fe = D({
        ...re,
        props: {
            readonly: {
                type: Boolean,
                default: !1
            }
        },
        setup (h, { expose: g }) {
            const d = h, { t: E } = U(), _ = I(), y = ne(), r = f([]), { schemasUpload: b } = te(), [v] = oe({
                schemas: b,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 4,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), { crewInjuryReportColumns: R } = L(d), l = f([
                {
                    nameContent: "受伤船员姓名和职务",
                    nameContentEn: "Name & Rank of the injured crew",
                    remark1: ""
                },
                {
                    nameContent: "家庭住址",
                    nameContentEn: "Address",
                    remark1: ""
                },
                {
                    nameContent: "出生日期",
                    nameContentEn: "Date of birth",
                    remark1: null
                },
                {
                    nameContent: "海员证号码",
                    nameContentEn: "No. of seafarer’s passport",
                    remark1: ""
                },
                {
                    nameContent: "受伤日期/时间",
                    nameContentEn: "Date/time of injury",
                    remark1: null
                },
                {
                    nameContent: "事故地点",
                    nameContentEn: "Position",
                    remark1: ""
                },
                {
                    nameContent: "如果在船上，说明船上位置",
                    nameContentEn: "If onboard, state the Location where accident occurred.",
                    remark1: ""
                },
                {
                    nameContent: "如果在海上，说明经度",
                    nameContentEn: "If at sea, state the ship position",
                    title: "纬度",
                    titleEn: "Lat",
                    remark2: ""
                },
                {
                    nameContent: "如果在海上，说明经度",
                    nameContentEn: "If at sea, state the ship position",
                    title: " 经度",
                    titleEn: " Long",
                    remark2: ""
                },
                {
                    nameContent: "如果在港口，说明港口名",
                    nameContentEn: "If in port, state the name of port",
                    title: " 港口",
                    titleEn: "Port",
                    remark2: ""
                },
                {
                    nameContent: "受伤性质",
                    nameContentEn: "Nature of injury",
                    remark1: ""
                },
                {
                    nameContent: "事故详细经过",
                    nameContentEn: "Details of the accident",
                    remark1: ""
                },
                {
                    nameContent: "是否上岸就医",
                    nameContentEn: "Referred ashore for medical treatment or not",
                    remark1: ""
                },
                {
                    nameContent: "是否需要代理协助",
                    nameContentEn: "Need agent's assistance or not",
                    remark1: ""
                },
                {
                    nameContent: "陪同就医人员",
                    nameContentEn: "Person accompany",
                    title: "名称",
                    titleEn: "Name",
                    rank: "职务",
                    rankEn: "Rank",
                    remark2: "",
                    remark3: ""
                },
                {
                    nameContent: "船舶见证人",
                    nameContentEn: "Witness on board",
                    title: "名称",
                    titleEn: "Name",
                    rank: "职务",
                    rankEn: "Rank",
                    remark2: "",
                    remark3: ""
                },
                {
                    nameContent: "船舶见证人",
                    nameContentEn: "Witness on board",
                    title: "名称",
                    titleEn: "Name",
                    rank: "职务",
                    rankEn: "Rank",
                    remark2: "",
                    remark3: ""
                },
                {
                    nameContent: "因伤开始休息日期和时间",
                    nameContentEn: "Hour and date when taken off work",
                    remark1: null
                },
                {
                    nameContent: "伤愈后复工日期和时间",
                    nameContentEn: "Hour and date when returned to work",
                    remark1: null
                }
            ]), i = f();
            function N() {
                return i.value?.getDataSource();
            }
            function S(e) {
                l.value[0].remark1 = _.getLocale === "en" ? e?.crewNameEn || " " + e?.rankNameEn || "" : e?.crewName || " " + e?.rankName || "", l.value[1].remark1 = e?.homeAddress || "", l.value[2].remark1 = Date.parse(e?.birthday) || null, l.value[3].remark1 = e?.empNo || "", k();
            }
            function k() {
                i.value?.setBordered(!0), i.value?.setStriped(!1);
            }
            function T(e, n) {
                l.value = e;
                const a = [];
                n && n.length > 0 && (n.forEach((o)=>{
                    o.fileType === "5" && a.push({
                        id: o.fileName || "",
                        url: o.fileUrl || "",
                        name: o.fileName?.split("/").pop() || "",
                        thumbnailUrl: o.fileName || "",
                        fileType: o.fileType,
                        status: "finished"
                    });
                }), r.value = a), Q(()=>{
                    i.value?.reload(), k();
                });
            }
            function x({ file: e, event: n }) {
                try {
                    const a = Y("(" + n.target.response + ")"), { infoField: o } = ae.upload.apiSetting, { code: u } = a, p = a.msg || a.message || "上传失败", s = a[o];
                    u === ee.SUCCESS ? e.thumbnailUrl = s.name : y.error(p);
                } catch  {}
            }
            function w() {
                const e = [];
                return r.value && r.value.length > 0 && r.value.forEach((n)=>{
                    e.push({
                        fileName: n.thumbnailUrl || "",
                        fileType: "5"
                    });
                }), e;
            }
            return g({
                handleOpen: S,
                voList: N,
                listInfo: T,
                getFileList: w
            }), (e, n)=>{
                const a = X, o = H, u = P, p = F;
                return C(), A(J, null, [
                    m(t(j), {
                        class: "isTitleTable",
                        ref_key: "crewInjuryReportTableRef",
                        ref: i,
                        columns: t(R),
                        dataSource: t(l),
                        "row-key": (s)=>s.id,
                        autoScrollX: !0,
                        immediate: !1,
                        pagination: !1,
                        "show-table-setting": !1,
                        "can-resize": !1
                    }, null, 8, [
                        "columns",
                        "dataSource",
                        "row-key"
                    ]),
                    m(p, {
                        onRegister: t(v)
                    }, {
                        attachment: c(({})=>[
                                m(u, {
                                    action: `${t(G)().urlPrefix}/files`,
                                    accept: ".doc,.docx,.pdf,.xls,.xlsx",
                                    headers: {
                                        timestamp: new Date().getTime(),
                                        authorization: `${t(z).get(t(O))}`
                                    },
                                    max: 15,
                                    "file-list": t(r),
                                    "onUpdate:fileList": n[0] || (n[0] = (s)=>W(r) ? r.value = s : null),
                                    onFinish: n[1] || (n[1] = ({ file: s, event: B })=>x({
                                            file: s,
                                            event: B
                                        })),
                                    class: "uploadStyle",
                                    "file-list-style": {
                                        margin: 0,
                                        flex: 1
                                    },
                                    disabled: d.readonly
                                }, {
                                    default: c(()=>[
                                            m(o, {
                                                trigger: "hover"
                                            }, {
                                                trigger: c(()=>[
                                                        m(a, {
                                                            strong: "",
                                                            secondary: "",
                                                            class: "size-7"
                                                        }, {
                                                            icon: c(()=>[
                                                                    (C(), $(K(t(M)(t(Z).upload))))
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                default: c(()=>[
                                                        V(" " + q(t(E)("hsqe.rs.uploadText")), 1)
                                                    ]),
                                                _: 1
                                            })
                                        ]),
                                    _: 1
                                }, 8, [
                                    "action",
                                    "headers",
                                    "file-list",
                                    "disabled"
                                ])
                            ]),
                        _: 1
                    }, 8, [
                        "onRegister"
                    ])
                ], 64);
            };
        }
    });
});
export { fe as _, __tla };
