import { _ as b } from "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import { B as w } from "./BasicForm-dL_oCSPM.js";
import { a as N, __tla as __tla_0 } from "./schemas-h8fDbkdf.js";
import { d as C, V as E, r as f, c as d, o as _, l as s, w as a, j as l, aH as F, ds as I, cO as M, fm as T, cq as V, aI as A, p as D, A as k, B as z, ca as G, gW as L, gX as O, bR as $, R as j, cZ as q, __tla as __tla_1 } from "./index-9PRMimni.js";
import { c as P } from "./componentSetting-DVhNDBTO.js";
import { u as W } from "./useForm-CKmgcynv.js";
import { u as H } from "./useModal-CO65vga3.js";
let ae;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    let K;
    K = {
        name: "UploadFileView"
    };
    ae = C({
        ...K,
        setup (X, { expose: g }) {
            const { t: u } = E(), h = q(), n = f([]), [R] = W({
                schemas: N,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 1,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), x = f(), [y, { openModal: S }] = H({
                title: u("illnessInjury.attachmentView"),
                width: 500
            });
            function v({ file: t, event: o }) {
                try {
                    const e = $("(" + o.target.response + ")"), { infoField: i } = P.upload.apiSetting, { code: r } = e, c = e.msg || e.message || "上传失败", p = e[i];
                    r === j.SUCCESS ? t.thumbnailUrl = p.name : h.error(c);
                } catch  {}
            }
            function B(t) {
                S();
                const o = [];
                t && t.length > 0 ? (t.forEach((e)=>{
                    o.push({
                        id: e.fileName || "",
                        url: e.fileUrl || "",
                        name: e.fileName?.split("/").pop() || "",
                        thumbnailUrl: e.fileName || "",
                        fileName: e.thumbnailUrl || e.fileName || ""
                    });
                }), n.value = o) : n.value = [];
            }
            return g({
                handleOpenModal: B
            }), (t, o)=>{
                const e = z, i = A, r = F, c = w, p = b;
                return _(), d(p, {
                    ref_key: "modalRef",
                    ref: x,
                    onRegister: s(y),
                    showAction: !1
                }, {
                    default: a(()=>[
                            l(c, {
                                onRegister: s(R)
                            }, {
                                attachment: a(({})=>[
                                        l(r, {
                                            action: `${s(V)().urlPrefix}/files`,
                                            accept: ".doc,.docx,.pdf,.xls,.xlsx",
                                            headers: {
                                                timestamp: new Date().getTime(),
                                                authorization: `${s(M).get(s(T))}`
                                            },
                                            max: 15,
                                            "file-list": s(n),
                                            "onUpdate:fileList": o[0] || (o[0] = (m)=>I(n) ? n.value = m : null),
                                            onFinish: o[1] || (o[1] = ({ file: m, event: U })=>v({
                                                    file: m,
                                                    event: U
                                                })),
                                            class: "uploadStyle",
                                            disabled: "",
                                            "file-list-style": {
                                                margin: 0,
                                                flex: 1
                                            }
                                        }, {
                                            default: a(()=>[
                                                    l(i, {
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: a(()=>[
                                                                l(e, {
                                                                    strong: "",
                                                                    secondary: "",
                                                                    class: "size-7"
                                                                }, {
                                                                    icon: a(()=>[
                                                                            (_(), d(G(s(L)(s(O).upload))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: a(()=>[
                                                                D(" " + k(s(u)("hsqe.rs.uploadText")), 1)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "action",
                                            "headers",
                                            "file-list"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "onRegister"
                            ])
                        ]),
                    _: 1
                }, 8, [
                    "onRegister"
                ]);
            };
        }
    });
});
export { ae as _, __tla };
