import { _ as D } 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 G } from "./BasicForm-dL_oCSPM.js";
import { s as W, a as $, __tla as __tla_0 } from "./schemas-DzvLPsci.js";
import { d as j, bk as H, r as w, f as K, V as X, a4 as Z, aw as J, ac as y, c as f, o as g, w as a, j as c, l as t, aH as Q, ds as Y, cO as ee, fm as te, cq as oe, D as se, aI as ae, p as ne, A as re, B as ce, ca as le, gW as ie, gX as ue, cZ as me, bR as pe, R as de, __tla as __tla_1 } from "./index-9PRMimni.js";
import { c as fe } from "./componentSetting-DVhNDBTO.js";
import { u as R } from "./useForm-CKmgcynv.js";
import { u as ge } from "./useModal-CO65vga3.js";
let be;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    be = j({
        __name: "Contract",
        emits: [
            "success"
        ],
        setup (_e, { expose: v, emit: C }) {
            const x = H(), n = w([]), _ = w(), [S] = R({
                schemas: W,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 4,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), b = K(), { t: l } = X(), h = me(), F = b.query, r = Z(()=>F.type === "view"), B = C, [N, { openModal: V, closeModal: L, setSubLoading: I }] = ge({
                title: l("crew.crewList.contractCrew"),
                width: 800
            }), { contractSchemas: O, methods: T } = $(r.value, !0, _), { updateIsView: k } = T, [E, { submit: M, setFieldsValue: P }] = R({
                gridProps: {
                    cols: 3
                },
                schemas: O.value,
                labelPlacement: "top",
                showActionButtonGroup: !1,
                layout: "horizontal"
            });
            async function U(o, s) {
                console.log("contract-row", o), o.crewPlanContractInfoFileVoList && o?.crewPlanContractInfoFileVoList.length > 0 && (n.value = [], o?.crewPlanContractInfoFileVoList.forEach((e)=>{
                    n.value.push({
                        id: e.fileName || "",
                        url: e.fileUrl || "",
                        name: e.fileName?.split("/").pop() || "",
                        thumbnailUrl: e.fileName || "",
                        fileType: e.fileType,
                        status: "finished"
                    });
                })), V(), y(()=>{
                    P({
                        ...o,
                        handoverName: x.getLocale === "en" ? s?.crewNameEnOff : s?.crewNameOff
                    });
                });
            }
            async function A() {
                I(!1);
                const o = await M();
                if (!o) return h.warning(l("crew.message.emptyWarning"));
                B("success", o, n.value), L();
            }
            function q({ file: o, event: s }) {
                try {
                    const e = pe("(" + s.target.response + ")"), { infoField: i } = fe.upload.apiSetting, { code: u } = e, m = e.msg || e.message || "上传失败", p = e[i];
                    u === de.SUCCESS ? o.thumbnailUrl = p.name : h.error(m);
                } catch  {}
            }
            return J(()=>{
                y(()=>{
                    k(r.value);
                });
            }), v({
                handleOpenModal: U
            }), (o, s)=>{
                const e = G, i = ce, u = ae, m = Q, p = D;
                return g(), f(p, {
                    ref: "modalRef",
                    onRegister: t(N),
                    onOnOk: A,
                    showAction: !t(r)
                }, {
                    default: a(()=>[
                            c(e, {
                                ref_key: "documentFormRef",
                                ref: _,
                                onRegister: t(E)
                            }, {
                                attachment: a(({})=>s[2] || (s[2] = [])),
                                _: 1
                            }, 8, [
                                "onRegister"
                            ]),
                            c(e, {
                                onRegister: t(S)
                            }, {
                                attachment: a(({})=>[
                                        c(m, {
                                            action: `${t(oe)().urlPrefix}/system/files`,
                                            accept: ".doc,.docx,.pdf,.xls,.xlsx",
                                            "show-remove-button": !t(r),
                                            headers: {
                                                timestamp: new Date().getTime(),
                                                authorization: `${t(ee).get(t(te))}`
                                            },
                                            max: 15,
                                            "file-list": t(n),
                                            "onUpdate:fileList": s[0] || (s[0] = (d)=>Y(n) ? n.value = d : null),
                                            onFinish: s[1] || (s[1] = ({ file: d, event: z })=>q({
                                                    file: d,
                                                    event: z
                                                })),
                                            class: "uploadStyle",
                                            "file-list-style": {
                                                margin: 0,
                                                flex: 1
                                            }
                                        }, {
                                            default: a(()=>[
                                                    t(r) ? se("", !0) : (g(), f(u, {
                                                        key: 0,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: a(()=>[
                                                                c(i, {
                                                                    strong: "",
                                                                    secondary: "",
                                                                    class: "size-7"
                                                                }, {
                                                                    icon: a(()=>[
                                                                            (g(), f(le(t(ie)(t(ue).upload))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: a(()=>[
                                                                ne(" " + re(t(l)("hsqe.rs.uploadText")), 1)
                                                            ]),
                                                        _: 1
                                                    }))
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "action",
                                            "show-remove-button",
                                            "headers",
                                            "file-list"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "onRegister"
                            ])
                        ]),
                    _: 1
                }, 8, [
                    "onRegister",
                    "showAction"
                ]);
            };
        }
    });
});
export { be as _, __tla };
