import { d as G, bk as O, V as U, f as J, a4 as K, r as g, ay as Q, a as Y, Z as T, aj as ee, aw as te, d9 as oe, c as m, o as p, w as e, j as i, W as se, l as s, H as ae, D as V, aI as ie, p as y, A as v, aE as re, B as ne, i as b, X as le, cZ as ce, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as ue } from "./BasicForm-dL_oCSPM.js";
import { B as me } from "./Table-0PViRYCf.js";
import { _ as pe } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { u as de } from "./useTags-C1thGhjF.js";
import { g as fe, a as _e, __tla as __tla_1 } from "./columns-BBmIfxY_.js";
import { u as ge, a as ye, b as ve } from "./vesselRuleMappingSetting-D4CBkDWj.js";
import { u as be } from "./useForm-CKmgcynv.js";
import { i as we } from "./isEmpty-BUg1OsQj.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./componentSetting-DVhNDBTO.js";
import "./ImageUpload-DUsnro3W.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js";
import "./tabsView-BXskTdVh.js";
import "./BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js";
import "./propTypes-CebMRUpe.js";
import "./BasicSelect-C_uwzMkE.js";
import "./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";
import "./dictionary-BRse4lkf.js";
import "./index-DkvzUEqh.js";
import "./index-kKnqLkWM.js";
import "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./print-CT_2hrjP.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./useModal-CO65vga3.js";
import "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./Flex-CTSf12gq.js";
let nt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    nt = G({
        __name: "Add",
        setup (De) {
            const w = O(), { closeCurrentTabToBack: S } = de(), { t: r } = U(), c = J(), d = ce(), l = K(()=>c.query?.type === "view"), x = g(), a = g(), f = g(), { schemas: N, initShipValue: R, updateMainIsView: F } = fe({
                isView: !1
            }), { addColumns: I, readonlyColumns: E, updateDetailIsView: P } = _e({
                isView: !1
            });
            Q(l, (n)=>{
                F(n), P(n);
            }, {
                immediate: !0
            });
            const [$, { getFieldsValue: D, setFieldsValue: C, submit: A }] = be({
                gridProps: {
                    cols: 6
                },
                schemas: N,
                showActionButtonGroup: !1
            }), H = Y({
                width: 130,
                title: r("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (n, t) {
                    return T(pe, {
                        style: "text",
                        actions: [
                            {
                                label: r("common.optionsDelText"),
                                labelShow: !1,
                                icon: T("i", {
                                    class: "iconfont icon-Delete red"
                                }),
                                onPositiveClick: async ()=>{
                                    const o = ee(a.value);
                                    o.splice(t, 1), a.value = o;
                                },
                                onNegativeClick: ()=>{},
                                isConfirm: !0,
                                confirmContent: r("common.dialogContentDeleteText")
                            }
                        ]
                    });
                }
            });
            function h() {
                S();
            }
            function L() {
                a.value.unshift({
                    ruleType: void 0,
                    periodHours: 0,
                    ruleHours: 0,
                    longestRestNum: 0,
                    description: void 0
                });
            }
            async function q() {
                if (await A(), !M()) return !1;
                c.query?.id ? await ge({
                    ...D(),
                    details: a.value
                }) : await ye({
                    ...D(),
                    details: a.value
                }), d.success(r("common.saveSuccessText")), h();
            }
            async function z() {
                c.query?.id ? (f.value = await ve(c.query?.id), C(f.value), a.value = f.value?.details) : (C({
                    vesselId: R,
                    isUsed: 1
                }), a.value = []);
            }
            function u(n, t, o) {
                d.warning(w.getLocale === "en" ? `Index: ${o + 1}, ${t} is not empty` : `序号: ${o + 1}, ${n}不能为空`);
            }
            function M() {
                return we(a.value) ? (d.warning(w.getLocale === "en" ? "Detail is not empty" : "明细不能为空"), !1) : !a.value.some((t, o)=>t.ruleType ? t.periodHours ? t.ruleHours ? t.longestRestNum ? !1 : (u("最长休息时间段数", "最长休息时间段数", o), !0) : (u("计算的间隔数/小时数", "计算的间隔数/小时数", o), !0) : (u("周期小时数", "周期小时数", o), !0) : (u("规则类型", "规则类型", o), !0));
            }
            return te(()=>{
                z();
            }), (n, t)=>{
                const o = ne, _ = ie, k = ae, W = ue, B = se, j = le, X = oe("debounce");
                return p(), m(j, null, {
                    default: e(()=>[
                            i(B, {
                                bordered: !1,
                                class: "mb-3 proCard",
                                title: s(r)("common.basicInformation"),
                                segmented: {
                                    content: !0,
                                    footer: "soft"
                                }
                            }, {
                                "header-extra": e(()=>[
                                        i(k, null, {
                                            default: e(()=>[
                                                    s(l) ? V("", !0) : (p(), m(_, {
                                                        key: 0,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: e(()=>[
                                                                re((p(), m(o, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7"
                                                                }, {
                                                                    icon: e(()=>t[0] || (t[0] = [
                                                                            b("i", {
                                                                                class: "iconfont icon-Save"
                                                                            }, null, -1)
                                                                        ])),
                                                                    _: 1
                                                                })), [
                                                                    [
                                                                        X,
                                                                        q,
                                                                        "1000"
                                                                    ]
                                                                ])
                                                            ]),
                                                        default: e(()=>[
                                                                y(" " + v(s(r)("common.saveText")), 1)
                                                            ]),
                                                        _: 1
                                                    })),
                                                    i(_, {
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: e(()=>[
                                                                i(o, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7 bg-[#E4E4E4]",
                                                                    onClick: h
                                                                }, {
                                                                    icon: e(()=>t[1] || (t[1] = [
                                                                            b("i", {
                                                                                class: "iconfont icon-a-Return text-[#B1B4BF]"
                                                                            }, null, -1)
                                                                        ])),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: e(()=>[
                                                                y(" " + v(s(r)("common.back")), 1)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                default: e(()=>[
                                        i(W, {
                                            onRegister: s($)
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "title"
                            ]),
                            i(B, {
                                bordered: !1,
                                class: "proCard mt-3"
                            }, {
                                default: e(()=>[
                                        i(s(me), {
                                            ref_key: "basicTableRef",
                                            ref: x,
                                            columns: s(l) ? s(E) : s(I),
                                            dataSource: s(a),
                                            "row-key": (Z)=>Z.id,
                                            autoScrollX: !0,
                                            actionColumn: s(l) ? void 0 : s(H),
                                            immediate: !1,
                                            pagination: !1,
                                            showTableSetting: !1
                                        }, {
                                            toolbar: e(()=>[
                                                    i(k, null, {
                                                        default: e(()=>[
                                                                s(l) ? V("", !0) : (p(), m(_, {
                                                                    key: 0,
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: e(()=>[
                                                                            i(o, {
                                                                                type: "primary",
                                                                                strong: "",
                                                                                bordered: "",
                                                                                secondary: "",
                                                                                class: "size-7",
                                                                                onClick: L
                                                                            }, {
                                                                                icon: e(()=>t[2] || (t[2] = [
                                                                                        b("i", {
                                                                                            class: "iconfont icon-ADD"
                                                                                        }, null, -1)
                                                                                    ])),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: e(()=>[
                                                                            y(" " + v(s(r)("common.addText")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }))
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "dataSource",
                                            "row-key",
                                            "actionColumn"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { nt as default, __tla };
