import { hc as J, V as x, bk as M, d as X, e as K, f as U, r as u, a as Z, Z as Y, gW as v, gX as C, cZ as $, aw as z, c as A, o as G, w as N, j as m, W as H, l as d, X as Q, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as ee } from "./BasicForm-dL_oCSPM.js";
import { u as oe } from "./useForm-CKmgcynv.js";
import { B as te } from "./Table-0PViRYCf.js";
import { _ as ie } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { a as R } from "./requisitionOrder-D0IG9N7e.js";
import { T as ne, U as se } from "./jobOrder-CGbsc7bp.js";
import { h as f } from "./has-CjqcrIOV.js";
import { a as ae, __tla as __tla_1 } from "./columns-tUQK1rQL.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 "./usePageCache-DluHn7Yy.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 "./Flex-CTSf12gq.js";
import "./dictUtils-D8jA3mBt.js";
let Ae;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    let k, n, h, q, le, re, ce;
    k = M();
    ({ t: n } = x());
    h = await J();
    q = h && h.length > 0 ? h[0].id : "";
    le = async ({ shipId: s, code: i = "0", model: a = "0", serialNumber: c = "0" })=>(await R({
            shipId: s,
            code: i,
            model: a,
            serialNumber: c
        })).map((t)=>({
                label: t.name,
                value: t.code + "-" + t.model + "-" + t.serialNumber,
                isLeaf: t.ifLeaf,
                raw: t
            }));
    re = [
        {
            label: "是",
            labelEn: "YES",
            value: !0
        },
        {
            label: "否",
            labelEn: "NO",
            value: !1
        }
    ];
    ce = (s)=>({
            schemas: [
                {
                    field: "planId",
                    hidden: !0
                },
                {
                    field: "shipId",
                    component: "NSelect",
                    label: n("jobOrderList.vessel"),
                    componentProps: {
                        options: h,
                        defaultValue: q,
                        clearable: !1,
                        filterable: !0,
                        "label-field": k.getLocale === "en" ? "shipNameEn" : "shipName",
                        "value-field": "id",
                        onUpdateValue: (a)=>{
                            s.initCodePrefixOptions(a), s.shipId.value = a;
                        }
                    }
                },
                {
                    field: "equipmentType",
                    component: "NCascader",
                    label: n("jobOrderList.equipmentType"),
                    componentProps: ({ formAction: a })=>{
                        const { getFieldsValue: c } = a;
                        return {
                            checkStrategy: "parent",
                            showPath: !1,
                            allowCheckingNotLoaded: !0,
                            options: s.codePrefixOptions.value,
                            remote: !0,
                            onLoad: async (p)=>{
                                f(c(), "shipId") && (s.shipId.value = c().shipId), p.children = await le({
                                    shipId: s.shipId.value,
                                    code: p.raw.code,
                                    model: p.raw.model,
                                    serialNumber: p.raw.serialNumber
                                });
                            }
                        };
                    }
                },
                {
                    field: "equipmentCode",
                    component: "NInput",
                    label: n("jobOrderList.equipmentCode"),
                    componentProps: {}
                },
                {
                    field: "equipmentName",
                    component: "NInput",
                    label: n("jobOrderList.equipmentName"),
                    componentProps: {}
                },
                {
                    field: "criticalToSafety",
                    component: "NSelect",
                    label: n("jobOrderList.criticalToSafety"),
                    componentProps: {
                        options: re,
                        "label-field": k.getLocale === "en" ? "labelEn" : "label"
                    }
                },
                {
                    field: "status",
                    component: "BasicSelect",
                    label: n("jobOrderList.jobOrderStatus"),
                    componentProps: {
                        block: !0,
                        cacheKey: "job_order_status"
                    }
                },
                {
                    field: "jobCodeOrTitle",
                    component: "NInput",
                    label: n("jobOrderList.search"),
                    componentProps: {
                        placeholder: n("jobOrderList.searchPlaceholder")
                    }
                },
                {
                    field: "isMine",
                    component: "NSwitch",
                    label: n("jobOrderList.mine"),
                    componentProps: {
                        checkedValue: 1,
                        uncheckedValue: 0
                    }
                }
            ],
            initShipValue: q
        });
    Ae = X({
        __name: "index",
        setup (s) {
            const { t: i } = x(), a = $(), c = K(), t = U().query, O = u(), b = u(!1), I = u(0), T = u(), j = u(), V = Z({
                width: 140,
                title: i("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return Y(ie, {
                        style: "text",
                        actions: [
                            {
                                label: i("common.optionsEditText"),
                                labelShow: !1,
                                icon: v(C.edit),
                                onClick: ()=>w({
                                        shipId: e.shipId,
                                        id: e.id,
                                        planId: e.planId,
                                        type: "edit"
                                    }),
                                ifShow: ()=>[
                                        1,
                                        4,
                                        5,
                                        9,
                                        10
                                    ].includes(e.status)
                            },
                            {
                                label: i("common.optionsViewText"),
                                labelShow: !1,
                                icon: v(C.view, "blue"),
                                onClick: ()=>w({
                                        id: e.id,
                                        type: "view"
                                    })
                            },
                            {
                                label: i("common.optionsDelText"),
                                labelShow: !1,
                                icon: v(C.delete, "red"),
                                onPositiveClick: async ()=>{
                                    await ne(e.id), _(), a.success(i("common.optionsDelSuccessText"));
                                },
                                onNegativeClick: ()=>{},
                                isConfirm: !0,
                                confirmContent: i("common.delPop.contRole"),
                                ifShow: ()=>[
                                        1,
                                        4,
                                        5,
                                        9,
                                        10
                                    ].includes(e.status)
                            }
                        ]
                    });
                }
            });
            function B(e, o) {
                console.log("行选中", e.value, o), j.value = o;
            }
            function w(e) {
                c.push({
                    name: "jobOrder",
                    query: {
                        ...e
                    }
                });
            }
            async function E(e, o) {
                if (!f(L(), "shipId") && !b.value) {
                    if (f(t, "shipId") && f(t, "planId")) {
                        const l = {
                            shipId: Number(t.shipId),
                            planId: Number(t.planId)
                        };
                        console.log("params", t), y(l), o.shipId = l.shipId, o.planId = l.planId;
                    } else y({
                        shipId: g
                    }), o.shipId = g;
                    b.value = !0;
                }
                return o.equipmentType && (o.equipmentType = o.equipmentType.split("-")[0]), I.value = o.shipId, y({
                    shipId: o.shipId
                }), await se({
                    ...e,
                    ...o
                });
            }
            function _() {
                b.value = !1, O.value?.restReload();
            }
            async function P(e) {
                const o = e.toString() || g.toString(), l = await R({
                    shipId: o,
                    code: "0",
                    model: "0",
                    serialNumber: "0"
                });
                T.value = l.map((r)=>({
                        label: r.name,
                        value: r.code + "-" + r.model + "-" + r.serialNumber,
                        isLeaf: r.ifLeaf,
                        raw: r
                    }));
            }
            const { schemas: F, initShipValue: g } = ce({
                codePrefixOptions: T,
                shipId: I,
                initCodePrefixOptions: P
            }), [D, { getFieldsValue: L, setFieldsValue: y }] = oe({
                gridProps: {
                    cols: 6
                },
                schemas: F
            }), { columns: W } = ae({
                viewJobOrder: w
            });
            return z(()=>{
                P(I.value);
            }), (e, o)=>{
                const l = H, r = Q;
                return G(), A(r, null, {
                    default: N(()=>[
                            m(l, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: N(()=>[
                                        m(d(ee), {
                                            onRegister: d(D),
                                            onSubmit: _,
                                            onReset: _
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            m(l, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: N(()=>[
                                        m(d(te), {
                                            ref_key: "basicTableRef",
                                            ref: O,
                                            columns: d(W),
                                            actionColumn: d(V),
                                            request: (S)=>E(S, d(L)()),
                                            onCheckedRowChange: B,
                                            "row-key": (S)=>S.id,
                                            autoScrollX: !0,
                                            "virtual-scroll": ""
                                        }, null, 8, [
                                            "columns",
                                            "actionColumn",
                                            "request",
                                            "row-key"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Ae as default, __tla };
