import { B as F } from "./BasicForm-dL_oCSPM.js";
import { r as U, __tla as __tla_0 } from "./columns-CcSTU2Qa.js";
import { s as I, __tla as __tla_1 } from "./schemas-h8fDbkdf.js";
import { B as N } from "./Table-0PViRYCf.js";
import { d as z, V as D, r as p, h as M, o as h, j as i, l as t, w as c, aH as L, ds as O, cO as A, fm as G, cq as P, aI as V, p as q, A as H, B as W, c as X, ca as $, gW as j, gX as K, F as Z, bR as J, R as Q, cZ as Y, ac as ee, __tla as __tla_2 } from "./index-9PRMimni.js";
import { c as te } from "./componentSetting-DVhNDBTO.js";
import { u as ae } from "./useForm-CKmgcynv.js";
let me;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    let oe;
    oe = {
        name: "CrewMedicalReport"
    };
    me = z({
        ...oe,
        props: {
            readonly: {
                type: Boolean,
                default: !1
            }
        },
        setup (_, { expose: y }) {
            const f = _, { t: C } = D(), v = Y(), n = p([]), { crewMedicalReportColumns: R } = U(f), { schemasUpload: S } = I(), [T] = ae({
                schemas: S,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 4,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), d = p([
                {
                    nameContent: "港口",
                    nameContentEn: "Port",
                    title: "就医日期",
                    titleEn: "Date of Hospitalizing",
                    remark1: "",
                    remark2: null
                },
                {
                    nameContent: "疾病或症状",
                    nameContentEn: "Illness or Symptom",
                    remark1: ""
                },
                {
                    nameContent: "若住院治疗，医院的诊断治疗材料",
                    nameContentEn: "Diagnostic and therapeutic material of hospital if hospitalization",
                    remark1: ""
                },
                {
                    nameContent: "其他资料",
                    nameContentEn: "Other Information",
                    remark1: ""
                }
            ]), r = p();
            function b() {
                return r.value?.getDataSource();
            }
            function x({ file: s, event: e }) {
                try {
                    const a = J("(" + e.target.response + ")"), { infoField: o } = te.upload.apiSetting, { code: u } = a, m = a.msg || a.message || "上传失败", l = a[o];
                    u === Q.SUCCESS ? s.thumbnailUrl = l.name : v.error(m);
                } catch  {}
            }
            function g() {
                r.value?.setBordered(!0), r.value?.setStriped(!1);
            }
            function B() {
                g();
            }
            function E(s, e) {
                d.value = s;
                const a = [];
                e && e.length > 0 && (e.forEach((o)=>{
                    o.fileType === "6" && a.push({
                        id: o.fileName || "",
                        url: o.fileUrl || "",
                        name: o.fileName?.split("/").pop() || "",
                        thumbnailUrl: o.fileName || "",
                        fileType: o.fileType,
                        status: "finished"
                    });
                }), n.value = a), ee(()=>{
                    r.value?.reload(), g();
                });
            }
            function k() {
                const s = [];
                return n.value && n.value.length > 0 && n.value.forEach((e)=>{
                    s.push({
                        fileName: e.thumbnailUrl || "",
                        fileType: "6"
                    });
                }), s;
            }
            return y({
                handleOpen: B,
                voList: b,
                listInfo: E,
                getFileList: k
            }), (s, e)=>{
                const a = W, o = V, u = L, m = F;
                return h(), M(Z, null, [
                    i(t(N), {
                        class: "isTitleTable",
                        ref_key: "crewMedicalReportTableRef",
                        ref: r,
                        columns: t(R),
                        dataSource: t(d),
                        "row-key": (l)=>l.id,
                        autoScrollX: !0,
                        immediate: !1,
                        pagination: !1,
                        "show-table-setting": !1,
                        "can-resize": !1
                    }, null, 8, [
                        "columns",
                        "dataSource",
                        "row-key"
                    ]),
                    i(m, {
                        onRegister: t(T)
                    }, {
                        attachment: c(({})=>[
                                i(u, {
                                    action: `${t(P)().urlPrefix}/files`,
                                    accept: ".doc,.docx,.pdf,.xls,.xlsx",
                                    headers: {
                                        timestamp: new Date().getTime(),
                                        authorization: `${t(A).get(t(G))}`
                                    },
                                    max: 15,
                                    "file-list": t(n),
                                    "onUpdate:fileList": e[0] || (e[0] = (l)=>O(n) ? n.value = l : null),
                                    onFinish: e[1] || (e[1] = ({ file: l, event: w })=>x({
                                            file: l,
                                            event: w
                                        })),
                                    class: "uploadStyle",
                                    "file-list-style": {
                                        margin: 0,
                                        flex: 1
                                    },
                                    disabled: f.readonly
                                }, {
                                    default: c(()=>[
                                            i(o, {
                                                trigger: "hover"
                                            }, {
                                                trigger: c(()=>[
                                                        i(a, {
                                                            strong: "",
                                                            secondary: "",
                                                            class: "size-7"
                                                        }, {
                                                            icon: c(()=>[
                                                                    (h(), X($(t(j)(t(K).upload))))
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                default: c(()=>[
                                                        q(" " + H(t(C)("hsqe.rs.uploadText")), 1)
                                                    ]),
                                                _: 1
                                            })
                                        ]),
                                    _: 1
                                }, 8, [
                                    "action",
                                    "headers",
                                    "file-list",
                                    "disabled"
                                ])
                            ]),
                        _: 1
                    }, 8, [
                        "onRegister"
                    ])
                ], 64);
            };
        }
    });
});
export { me as _, __tla };
