import { ad as Y, V as S, bk as L, Z as s, ae as E, r as _, d as j, b as G, e as X, u as Q, a as U, iT as z, ho as H, c as Z, o as J, w as p, j as c, W as K, l as d, H as ee, B as te, i as oe, X as ie, gD as ne, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as ae } from "./Table-0PViRYCf.js";
import { _ as re } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { B as le } from "./BasicForm-dL_oCSPM.js";
import { u as se } from "./useForm-CKmgcynv.js";
import { d as pe, g as ce } from "./requisitionListPage-CxtdksCl.js";
import { d as me, s as ue, P as f, __tla as __tla_1 } from "./helper-CNwA55dE.js";
import { d as N } from "./dictionary-BRse4lkf.js";
import { f as k } from "./find-D_h_aJYR.js";
import { f as de } from "./filter-D9g65sdN.js";
import { h as fe } from "./head-aneRfQQJ.js";
import { g as be } from "./requisitionOrder-D0IG9N7e.js";
import { i as ye } from "./isEmpty-BUg1OsQj.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./componentMap-CElCaWis.js";
import "./propTypes-CebMRUpe.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 "./componentSetting-DVhNDBTO.js";
import "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./tabsView-BXskTdVh.js";
import "./Flex-CTSf12gq.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./ImageUpload-DUsnro3W.js";
import "./BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js";
import "./BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js";
import "./BasicSelect-C_uwzMkE.js";
import "./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";
import "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
import "./equipmentMainLibrary-bJTzj5mC.js";
import "./useRole-C-Zpngq4.js";
import "./index-DkvzUEqh.js";
import "./index-kKnqLkWM.js";
import "./findIndex-BgUIH3i1.js";
import "./toInteger-DQeH-nF-.js";
let gt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    const he = "";
    function P() {
        return Y.Get(`${he}/dict-data/purchase_req_state/options`);
    }
    let b, o, _e, ge, qe, y, r, we, Se, ve, Ee, ke, Le;
    b = L();
    ({ t: o } = S());
    _e = await N("purchase_category_all");
    ge = await P();
    qe = [
        {
            title: o("common.management.Num"),
            key: "num",
            width: 60,
            render: (t, i)=>i + 1
        },
        {
            title: o("pms.requisition.reqNo"),
            key: "reqNo",
            width: 130
        },
        {
            title: o("pms.requisition.vessel"),
            key: "",
            width: 120,
            render (t) {
                return b.getLocale === "en" ? t.shipNameEn : t.shipName;
            }
        },
        {
            title: o("pms.requisition.category"),
            key: "category",
            width: 160,
            render (t) {
                if (t.category) {
                    const i = _e.filter((n)=>n.value == t.category);
                    return b.getLocale === "en" ? i[0]?.labelEn : i[0]?.label;
                } else return "";
            }
        },
        {
            title: o("pms.requisition.title"),
            key: "title",
            width: 180
        },
        {
            title: o("pms.requisition.priority"),
            key: "priority",
            width: 100,
            render (t) {
                return s(E, {
                    class: "rounded-[5px]",
                    type: t.priority === 1 ? "success" : "warning"
                }, {
                    default: ()=>t.priority === 1 ? o("pms.requisition.normal") : o("pms.requisition.emergency")
                });
            }
        },
        {
            title: o("pms.requisition.itemNum"),
            key: "itemNum",
            width: 120
        },
        {
            title: o("pms.requisition.department"),
            key: "department",
            width: 140,
            render (t) {
                const i = k(me, (n)=>n.value === t?.department);
                return b.getLocale === "en" ? i?.labelEn : i?.label;
            }
        },
        {
            title: o("pms.requisition.applicationSource"),
            key: "source",
            width: 120,
            render (t) {
                const i = k(ue, (n)=>n.value === t?.source);
                return b.getLocale === "en" ? i?.labelEn : i?.label;
            }
        },
        {
            title: o("reqList.mainTable.applicationDate"),
            key: "applyDate",
            width: 140
        },
        {
            title: o("reqList.mainTable.applicant"),
            key: "createName",
            width: 100
        },
        {
            title: o("pms.requisition.approveStatus"),
            key: "approveStatus",
            width: 200,
            render (t) {
                if (!t.approveStatus) return "";
                const i = de(ge, {
                    value: t.approveStatus + ""
                }), n = fe(i), a = b.getLocale === "en" ? n?.labelEn : n?.label;
                return a ? s(E, {
                    class: "rounded-[5px]",
                    color: {
                        color: "rgba(53, 78, 241, 0.12)",
                        borderColor: "rgba(53, 78, 241, 0.5)",
                        textColor: "rgba(53, 78, 241, 1)"
                    }
                }, {
                    default: ()=>a
                }) : "";
            }
        },
        {
            title: o("reqList.mainTable.approvedDate"),
            key: "approveDate",
            width: 130
        },
        {
            title: o("reqList.mainTable.approvedBy"),
            key: "approveName",
            width: 140
        }
    ];
    y = L();
    ({ t: r } = S());
    we = await N("purchase_category_all");
    Se = await P();
    ve = await be({
        roleCodes: [
            "marine_superintendent",
            "technical_superintendent"
        ].join(",")
    });
    Ee = _([
        {
            value: "1",
            label: "正常",
            labelEn: "Normal"
        },
        {
            value: "2",
            label: "紧急",
            labelEn: "Emergency"
        }
    ]);
    ke = _([
        {
            value: "1",
            label: "船端",
            labelEn: "Vessel"
        },
        {
            value: "2",
            label: "岸端",
            labelEn: "Office"
        }
    ]);
    Le = [
        {
            field: "shipId",
            label: r("hsqe.planner.formShip"),
            component: "NSelect",
            componentProps: {
                options: ve,
                filterable: !0,
                "label-field": y.getLocale === "en" ? "shipNameEn" : "shipName",
                "value-field": "id"
            }
        },
        {
            field: "reqNo",
            component: "NInput",
            label: r("pms.requisition.reqNo"),
            componentProps: {}
        },
        {
            field: "category",
            component: "NSelect",
            label: r("pms.requisition.category"),
            componentProps: {
                options: we,
                filterable: !0,
                "label-field": y.getLocale === "en" ? "labelEn" : "label"
            }
        },
        {
            field: "priority",
            component: "NSelect",
            label: r("pms.requisition.priority"),
            componentProps: {
                options: Ee,
                filterable: !0,
                "label-field": y.getLocale === "en" ? "labelEn" : "label"
            }
        },
        {
            field: "approveStatus",
            component: "NSelect",
            label: r("pms.requisition.approveStatus"),
            componentProps: {
                options: Se,
                filterable: !0,
                "label-field": y.getLocale === "en" ? "labelEn" : "label"
            }
        },
        {
            field: "source",
            component: "NSelect",
            label: r("pms.requisition.ApplicationSource"),
            componentProps: {
                options: ke,
                filterable: !0,
                "label-field": y.getLocale === "en" ? "labelEn" : "label"
            }
        },
        {
            field: "applyDate",
            component: "NDatePicker",
            label: r("pms.requisition.ApplicationDate"),
            componentProps: {
                type: "daterange"
            }
        },
        {
            label: r("reqList.search.title"),
            field: "title",
            component: "NInput",
            componentProps: {}
        },
        {
            label: r("reqList.search.mineReq"),
            field: "createBy",
            component: "NSwitch",
            componentProps: {}
        }
    ];
    gt = j({
        name: "PMS_requisitionListPage",
        __name: "index",
        setup (t) {
            const { info: i } = G(), n = X(), { t: a } = S(), T = Q(), v = _(), C = _(), D = U({
                width: 160,
                title: a("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return s(re, {
                        style: "text",
                        actions: [
                            {
                                label: a("common.optionsEditText"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-a-Frame28"
                                }),
                                onClick: B.bind(null, e),
                                ifShow: ()=>e.canEdit
                            },
                            {
                                label: a("common.optionsApprovalText"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-Approve1"
                                }),
                                onClick: R.bind(null, e),
                                ifShow: ()=>e.canApprove
                            },
                            {
                                label: a("common.optionsViewText"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-View blue"
                                }),
                                onClick: O.bind(null, e)
                            },
                            {
                                label: a("reqList.rfqBtnText"),
                                labelShow: !1,
                                icon: s(z, {
                                    class: "blue"
                                }),
                                onClick: x.bind(null, e),
                                ifShow: ()=>e.canInquiry
                            },
                            {
                                label: a("common.optionsDelText"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-Delete red"
                                }),
                                onPositiveClick: ()=>{
                                    I(e);
                                },
                                onNegativeClick: ()=>{},
                                isConfirm: !0,
                                confirmContent: a("common.delPop.cont"),
                                ifShow: ()=>e.canEdit
                            }
                        ]
                    });
                }
            }), A = async (e, l)=>{
                const { applyDate: m, createBy: g } = l;
                ye(m) || (l.applyDate = m.map((q)=>ne(q).format("YYYY-MM-DD")).join(",")), g ? l.createBy = i.id : l.createBy = void 0;
                const u = await ce({
                    ...e,
                    ...l
                });
                return u && (C.value = u.list), u;
            };
            function h() {
                v.value.restReload();
            }
            function x(e) {
                n.push({
                    name: "Add_RFQ_PageList",
                    query: {
                        reqId: e.id,
                        type: f.CREATE
                    }
                });
            }
            function B(e) {
                n.push({
                    name: "requisitionOrder",
                    query: {
                        orderId: e.id,
                        type: f.EDIT
                    }
                });
            }
            function R(e) {
                n.push({
                    name: "requisitionOrder",
                    query: {
                        orderId: e.id,
                        type: f.APPROVE
                    }
                });
            }
            function O(e) {
                n.push({
                    name: "requisitionOrder",
                    query: {
                        orderId: e.id,
                        type: f.VIEW
                    }
                });
            }
            async function I(e) {
                await pe(e.id), T.success("Operation succesfully!"), h();
            }
            function V(e) {
                h();
            }
            function F(e) {
                h();
            }
            const [$, { getFieldsValue: M }] = se({
                gridProps: {
                    cols: "6",
                    xGap: "15"
                },
                labelWidth: 150,
                schemas: Le
            });
            function W() {
                n.push({
                    name: "requisitionOrder",
                    query: {
                        type: f.CREATE
                    }
                });
            }
            return H(()=>{
                h();
            }), (e, l)=>{
                const m = K, g = te, u = ee, q = ie;
                return J(), Z(q, null, {
                    default: p(()=>[
                            c(m, {
                                bordered: !1,
                                class: "mb-2 proCard"
                            }, {
                                default: p(()=>[
                                        c(d(le), {
                                            onRegister: d($),
                                            onSubmit: V,
                                            onReset: F
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            c(m, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: p(()=>[
                                        c(d(ae), {
                                            columns: d(qe),
                                            request: (w)=>A(w, d(M)()),
                                            "row-key": (w)=>w.id,
                                            ref_key: "basicTableRef",
                                            ref: v,
                                            actionColumn: D,
                                            autoScrollX: !0,
                                            "virtual-scroll": ""
                                        }, {
                                            tableTitle: p(()=>[
                                                    c(u, null, {
                                                        default: p(()=>[
                                                                c(g, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: W
                                                                }, {
                                                                    icon: p(()=>l[0] || (l[0] = [
                                                                            oe("i", {
                                                                                class: "iconfont icon-ADD"
                                                                            }, null, -1)
                                                                        ])),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "request",
                                            "row-key",
                                            "actionColumn"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { gt as default, __tla };
