import { V as x, d as R, gG as S, u as B, c as F, o as V, l as o, w as l, j as f, aI as C, p as d, B as E, cO as b, fm as w, cq as T, aH as A, bR as N, R as U, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as y } from "./BasicForm-dL_oCSPM.js";
import { u as G } from "./useForm-CKmgcynv.js";
import { T as I } from "./template-rpthWlT9.js";
import { c as M } from "./componentSetting-DVhNDBTO.js";
let j;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    await I();
    let O, k;
    ({ t: O } = x());
    k = [
        {
            field: "file",
            label: O("mdm.mou.uploadFile"),
            slot: "fileUpload",
            defaultValue: ""
        }
    ];
    j = R({
        __name: "index",
        props: {
            modelValue: {
                default: ()=>[]
            },
            modelModifiers: {}
        },
        emits: [
            "update:modelValue"
        ],
        setup (p) {
            const s = S(p, "modelValue"), g = B(), [_] = G({
                gridProps: {
                    cols: 1
                },
                layout: "horizontal",
                showActionButtonGroup: !1,
                schemas: k,
                labelWidth: "100"
            });
            function h({ file: n, event: e }, a, i) {
                try {
                    const t = N("(" + e.target.response + ")"), { infoField: r } = M.upload.apiSetting, { code: u } = t, m = t.msg || t.message || "上传失败", c = t[r];
                    u === U.SUCCESS ? (a[i] = c.url, s.value.push({
                        id: n.id,
                        name: n.name,
                        resultName: c.name,
                        url: c.url
                    }), console.log(s.value, "fileList")) : g.error(m);
                } catch (t) {
                    console.error(t);
                }
            }
            function v(n) {
                const e = s.value.findIndex((a)=>a.url === n.file.url);
                e !== -1 && s.value.splice(e, 1);
            }
            return (n, e)=>{
                const a = C, i = A;
                return V(), F(o(y), {
                    ref: "contentFromRef",
                    onRegister: o(_)
                }, {
                    fileUpload: l(({ model: t, field: r })=>[
                            f(i, {
                                "default-file-list": s.value,
                                action: `${o(T)().urlPrefix}/files`,
                                headers: {
                                    timestamp: new Date().getTime(),
                                    authorization: `${o(b).get(o(w))}`
                                },
                                max: 15,
                                onRemove: v,
                                onFinish: ({ file: u, event: m })=>h({
                                        file: u,
                                        event: m
                                    }, t, r)
                            }, {
                                default: l(()=>[
                                        f(a, {
                                            trigger: "hover"
                                        }, {
                                            trigger: l(()=>[
                                                    f(o(E), null, {
                                                        default: l(()=>e[0] || (e[0] = [
                                                                d(" Attachments File Upload ")
                                                            ])),
                                                        _: 1
                                                    })
                                                ]),
                                            default: l(()=>[
                                                    e[1] || (e[1] = d(" The number of attachments is tentatively limited to no more than 15 "))
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 2
                            }, 1032, [
                                "default-file-list",
                                "action",
                                "headers",
                                "onFinish"
                            ])
                        ]),
                    _: 1
                }, 8, [
                    "onRegister"
                ]);
            };
        }
    });
});
export { j as _, __tla };
