import { B as F } from "./BasicForm-dL_oCSPM.js";
import { r as w, __tla as __tla_0 } from "./columns-CcSTU2Qa.js";
import { B as U } from "./Table-0PViRYCf.js";
import { d as O, r as p, V, bk as W, h as A, o as k, j as m, l as n, w as u, aH as z, ds as G, cO as P, fm as H, cq as q, aI as M, p as X, A as $, B as j, c as K, ca as Z, gW as J, gX as Q, F as Y, hc as ee, ac as te, bR as ne, R as ae, cZ as se, __tla as __tla_1 } from "./index-9PRMimni.js";
import { s as oe, __tla as __tla_2 } from "./schemas-h8fDbkdf.js";
import { c as ie } from "./componentSetting-DVhNDBTO.js";
import { v as re, __tla as __tla_3 } from "./schemas-DzvLPsci.js";
import { a3 as le } from "./template-rpthWlT9.js";
import { u as me } from "./useForm-CKmgcynv.js";
let _e;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_3;
        } catch  {}
    })()
]).then(async ()=>{
    let ue;
    ue = {
        name: "ShipsIdentityAndNavigationalStatus"
    };
    _e = O({
        ...ue,
        props: {
            readonly: {
                type: Boolean,
                default: !1
            }
        },
        setup (C, { expose: v }) {
            const g = C, c = p(), { t: _ } = V(), E = se(), S = W(), o = p([]), { schemasUpload: y } = oe(), [b] = me({
                schemas: y,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 4,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), { shipsIdentityAndNavigationalStatusColumns: I } = w(g), i = p([
                {
                    nameContent: "船名",
                    nameContentEn: "Vessel",
                    title: "呼号",
                    titleEn: "Call Sign",
                    isInput: !0,
                    remark: "",
                    remark2: ""
                },
                {
                    nameContent: "日期和时间（国际标准时间）",
                    nameContentEn: "Date and time (GMT)",
                    title: "通信资源",
                    titleEn: "Communications Resources",
                    isDate: !0,
                    remark: new Date().getTime(),
                    remark2: ""
                },
                {
                    nameContent: "船旗",
                    nameContentEn: "Flag of registry",
                    title: "船籍港",
                    titleEn: "Home Port",
                    isInput: !0,
                    remark: "",
                    remark2: ""
                },
                {
                    nameContent: "船级社",
                    nameContentEn: "Vessel classification",
                    title: "直升机甲板",
                    titleEn: "Helicopter Deck",
                    isInput: !0,
                    isRadio: !0,
                    remark: "",
                    remark2: ""
                },
                {
                    nameContent: "船长(m)",
                    nameContentEn: "Length(m)",
                    title: "船位（纬度/经度）",
                    titleEn: "Position (latitude/longitude)",
                    isInput: !0,
                    remark: "",
                    remark2: ""
                },
                {
                    nameContent: "航向",
                    nameContentEn: "Course",
                    title: "船速",
                    titleEn: "Speed",
                    isInput: !0,
                    remark: "",
                    remark2: ""
                },
                {
                    nameContent: "拟目的港",
                    nameContentEn: "Intended port of destination ",
                    title: "最近的港口",
                    titleEn: "Nearest port",
                    isInput: !0,
                    remark: "",
                    remark2: ""
                },
                {
                    nameContent: "其他可能挂靠的港口",
                    nameContentEn: "Other possible ports of call",
                    title: "现场海况",
                    titleEn: "On-scene Sea State",
                    isInput: !0,
                    remark: "",
                    remark2: ""
                },
                {
                    nameContent: "风向",
                    nameContentEn: "Wind direction",
                    title: "风速",
                    titleEn: "Wind speed",
                    isInput: !0,
                    remark: "",
                    remark2: ""
                },
                {
                    nameContent: "视线",
                    nameContentEn: "Visibility",
                    title: "天气条件",
                    titleEn: "Weather conditions",
                    isInput: !0,
                    remark: "",
                    remark2: ""
                }
            ]), l = p();
            function T() {
                return l.value?.getDataSource();
            }
            async function R() {
                const t = await ee();
                x(t[0].id);
                const e = await le(t[0].id);
                i.value[2].remark = e?.flagStateLabel || "", i.value[2].remark2 = e?.portOfRegistryLabel || "", i.value[3].remark = e?.classLabel || "", h();
            }
            function h() {
                l.value?.setBordered(!0), l.value?.setStriped(!1);
            }
            function x(t) {
                c.value = re.find((e)=>e.id === t), i.value[0].remark = S.getLocale === "en" ? c.value?.shipNameEn || "" : c.value?.shipName || "", i.value[0].remark2 = c.value?.callSign || "";
            }
            function B(t, e) {
                i.value = t;
                const a = [];
                e && e.length > 0 && (e.forEach((s)=>{
                    s.fileType === "2" && a.push({
                        id: s.fileName || "",
                        url: s.fileUrl || "",
                        name: s.fileName?.split("/").pop() || "",
                        thumbnailUrl: s.fileName || "",
                        fileType: s.fileType,
                        status: "finished"
                    });
                }), o.value = a), te(()=>{
                    l.value?.reload(), h();
                });
            }
            function L({ file: t, event: e }) {
                try {
                    const a = ne("(" + e.target.response + ")"), { infoField: s } = ie.upload.apiSetting, { code: f } = a, d = a.msg || a.message || "上传失败", r = a[s];
                    f === ae.SUCCESS ? t.thumbnailUrl = r.name : E.error(d);
                } catch  {}
            }
            function N() {
                const t = [];
                return o.value && o.value.length > 0 && o.value.forEach((e)=>{
                    t.push({
                        fileName: e.thumbnailUrl || "",
                        fileType: "2"
                    });
                }), t;
            }
            return v({
                handleOpen: R,
                voList: T,
                listInfo: B,
                getFileList: N
            }), (t, e)=>{
                const a = j, s = M, f = z, d = F;
                return k(), A(Y, null, [
                    m(n(U), {
                        class: "isTitleTable",
                        ref_key: "monthTableRef1",
                        ref: l,
                        columns: n(I),
                        dataSource: n(i),
                        "row-key": (r)=>r.id,
                        autoScrollX: !0,
                        immediate: !1,
                        pagination: !1,
                        "show-table-setting": !1,
                        "can-resize": !1
                    }, null, 8, [
                        "columns",
                        "dataSource",
                        "row-key"
                    ]),
                    m(d, {
                        onRegister: n(b)
                    }, {
                        attachment: u(({})=>[
                                m(f, {
                                    action: `${n(q)().urlPrefix}/files`,
                                    accept: ".doc,.docx,.pdf,.xls,.xlsx",
                                    headers: {
                                        timestamp: new Date().getTime(),
                                        authorization: `${n(P).get(n(H))}`
                                    },
                                    max: 15,
                                    "file-list": n(o),
                                    "onUpdate:fileList": e[0] || (e[0] = (r)=>G(o) ? o.value = r : null),
                                    onFinish: e[1] || (e[1] = ({ file: r, event: D })=>L({
                                            file: r,
                                            event: D
                                        })),
                                    class: "uploadStyle",
                                    "file-list-style": {
                                        margin: 0,
                                        flex: 1
                                    },
                                    disabled: g.readonly
                                }, {
                                    default: u(()=>[
                                            m(s, {
                                                trigger: "hover"
                                            }, {
                                                trigger: u(()=>[
                                                        m(a, {
                                                            strong: "",
                                                            secondary: "",
                                                            class: "size-7"
                                                        }, {
                                                            icon: u(()=>[
                                                                    (k(), K(Z(n(J)(n(Q).upload))))
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                default: u(()=>[
                                                        X(" " + $(n(_)("hsqe.rs.uploadText")), 1)
                                                    ]),
                                                _: 1
                                            })
                                        ]),
                                    _: 1
                                }, 8, [
                                    "action",
                                    "headers",
                                    "file-list",
                                    "disabled"
                                ])
                            ]),
                        _: 1
                    }, 8, [
                        "onRegister"
                    ])
                ], 64);
            };
        }
    });
});
export { _e as _, __tla };
