import { hc as b, V as m, bk as k, r as h, Z as l, ch as u, k as N, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as c } from "./BasicSelect-C_uwzMkE.js";
import { i as _ } from "./isEmpty-BUg1OsQj.js";
let T, v, S, I;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    let o, n, y, d;
    ({ t: o } = m());
    n = await b();
    y = k();
    v = ()=>{
        const t = n && n.length > 0 ? n[0].id : 0;
        return {
            schemas: [
                {
                    field: "shipId",
                    component: "NSelect",
                    label: o("crew.crewList.vesselName"),
                    labelWidth: 100,
                    giProps: {
                        span: 1
                    },
                    componentProps: {
                        placeholder: o("crew.crewList.vesselName"),
                        options: n,
                        labelField: y.getLocale === "en" ? "shipNameEn" : "shipName",
                        valueField: "id",
                        disabled: !0,
                        defaultValue: t
                    }
                }
            ],
            initShipValue: t
        };
    };
    S = (t)=>{
        const r = n && n.length > 0 ? n[0].id : 0, a = h(t.isView);
        return {
            schemas: [
                {
                    field: "id",
                    hidden: !0
                },
                {
                    field: "vesselId",
                    component: "NSelect",
                    label: "船舶名称",
                    componentProps: {
                        placeholder: o("crew.crewList.vesselName"),
                        options: n,
                        labelField: y.getLocale === "en" ? "shipNameEn" : "shipName",
                        valueField: "id",
                        disabled: !0
                    },
                    rules: [
                        {
                            required: !0,
                            message: o("common.RequireTips"),
                            trigger: [
                                "submit"
                            ],
                            type: "any"
                        }
                    ]
                },
                {
                    field: "ruleName",
                    component: "NInput",
                    label: "规则名称",
                    componentProps: {
                        disabled: a
                    },
                    rules: [
                        {
                            required: !0,
                            message: o("common.RequireTips"),
                            trigger: [
                                "submit"
                            ]
                        }
                    ]
                },
                {
                    field: "ruleNameEn",
                    component: "NInput",
                    label: "规则名称英文",
                    componentProps: {
                        disabled: a
                    },
                    rules: [
                        {
                            required: !0,
                            message: o("common.RequireTips"),
                            trigger: [
                                "submit"
                            ]
                        }
                    ]
                },
                {
                    field: "ruleGroupCode",
                    component: "NInput",
                    label: "公约集合编码",
                    componentProps: {
                        disabled: !0
                    }
                },
                {
                    field: "version",
                    component: "NInput",
                    label: "版本号",
                    componentProps: {
                        disabled: !0
                    }
                },
                {
                    field: "isUsed",
                    component: "NSwitch",
                    label: "是否启用",
                    componentProps: {
                        checkedValue: 1,
                        uncheckedValue: 0,
                        disabled: a
                    },
                    componentSlots: {
                        unchecked: ()=>l("span", [
                                "是"
                            ]),
                        checked: ()=>l("span", [
                                "否"
                            ])
                    }
                }
            ],
            initShipValue: r,
            updateMainIsView: (e)=>{
                a.value = e;
            }
        };
    };
    ({ t: d } = m());
    I = [
        {
            title: d("common.messagedefine.Num"),
            key: "num",
            width: 50,
            render: (t, r)=>r + 1
        },
        {
            title: "规则中文名称",
            key: "ruleName"
        },
        {
            title: "规则英文名称",
            key: "ruleNameEn"
        },
        {
            title: "同一规则集合编码",
            key: "ruleGroupCode"
        },
        {
            title: "版本号",
            key: "version"
        },
        {
            title: "明细条目",
            key: "",
            render: (t)=>l("span", {}, [
                    _(t.details) ? 0 : t.details.length
                ])
        },
        {
            title: "是否启用",
            key: "isUsed",
            render: (t)=>+t.isUsed == 1 ? "启用" : "不启用"
        }
    ];
    T = (t)=>{
        const r = h(t.isView), a = [
            {
                title: d("common.messagedefine.Num"),
                key: "num",
                width: 50,
                render: (e, i)=>i + 1
            },
            {
                title: "规则类型",
                key: "ruleType",
                render: (e, i)=>l(c, {
                        width: 250,
                        cacheKey: "schedule_vessel_rule_calc_type",
                        value: e.ruleType,
                        disabled: !1,
                        onUpdateValue (s) {
                            e.ruleType = s;
                        }
                    })
            },
            {
                title: "周期小时数",
                key: "periodHours",
                render: (e, i)=>l(u, {
                        value: +e.periodHours,
                        disabled: !1,
                        precision: 0,
                        min: 0,
                        onUpdateValue (s) {
                            e.periodHours = s;
                        }
                    })
            },
            {
                title: "计算的间隔数/小时数",
                key: "ruleHours",
                render: (e, i)=>l(u, {
                        value: +e.ruleHours,
                        disabled: !1,
                        precision: 0,
                        min: 0,
                        onUpdateValue (s) {
                            e.ruleHours = s;
                        }
                    })
            },
            {
                title: "最长休息时间段数",
                key: "longestRestNum",
                render: (e, i)=>l(u, {
                        value: +e.longestRestNum,
                        disabled: !1,
                        precision: 0,
                        min: 0,
                        onUpdateValue (s) {
                            e.longestRestNum = s;
                        }
                    })
            },
            {
                title: "说明",
                key: "description",
                render: (e, i)=>l(N, {
                        value: e.description,
                        disabled: !1,
                        onUpdateValue (s) {
                            e.description = s;
                        }
                    })
            }
        ], p = [
            {
                title: d("common.messagedefine.Num"),
                key: "num",
                width: 50,
                render: (e, i)=>i + 1
            },
            {
                title: "规则类型",
                key: "ruleType",
                render: (e, i)=>l(c, {
                        width: 250,
                        cacheKey: "schedule_vessel_rule_calc_type",
                        value: e.ruleType,
                        disabled: !0,
                        onUpdateValue (s) {
                            e.ruleType = s;
                        }
                    })
            },
            {
                title: "周期小时数",
                key: "periodHours"
            },
            {
                title: "计算的间隔数/小时数",
                key: "ruleHours"
            },
            {
                title: "最长休息时间段数",
                key: "longestRestNum"
            },
            {
                title: "说明",
                key: "description"
            }
        ];
        return {
            addColumns: a,
            readonlyColumns: p,
            updateDetailIsView: (e)=>{
                r.value = e;
            }
        };
    };
});
export { T as a, v as b, S as g, I as m, __tla };
