You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

231 lines
16 KiB

import { _ as __nuxt_component_0 } from './nuxt-link-CQqhT_O_.mjs';
import { defineComponent, computed, mergeProps, unref, withCtx, openBlock, createBlock, createVNode, createTextVNode, toDisplayString, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrRenderStyle, ssrInterpolate, ssrRenderList, ssrRenderComponent, ssrRenderAttr, ssrRenderSlot, ssrRenderClass } from 'vue/server-renderer';
import { u as useToast } from './useToast-CS21XT61.mjs';
import { u as useLoading } from './useLoading-D4zrSa2m.mjs';
import { b as useRouter, a as useRoute$1, _ as _export_sfc } from './server.mjs';
import { u as useAuthStore } from './auth-QFkCoU1C.mjs';
import '../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/utils';
import 'pinia';
import 'perfect-debounce';
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
__name: "AppToast",
__ssrInlineRender: true,
setup(__props) {
const { toasts } = useToast();
function alertClass(type) {
switch (type) {
case "success":
return "alert-success";
case "error":
return "alert-error";
case "warning":
return "alert-warning";
case "info":
default:
return "alert-info";
}
}
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(mergeProps({ class: "toast toast-bottom toast-end z-50" }, _attrs))}><!--[-->`);
ssrRenderList(unref(toasts), (t) => {
_push(`<div class="${ssrRenderClass(["alert", alertClass(t.type)])}"><span>${ssrInterpolate(t.msg)}</span></div>`);
});
_push(`<!--]--></div>`);
};
}
});
const _sfc_setup$2 = _sfc_main$2.setup;
_sfc_main$2.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/AppToast.vue");
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const __nuxt_component_1 = Object.assign(_sfc_main$2, { __name: "AppToast" });
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "AppLoading",
__ssrInlineRender: true,
setup(__props) {
const { loading } = useLoading();
return (_ctx, _push, _parent, _attrs) => {
if (unref(loading)) {
_push(`<div${ssrRenderAttrs(mergeProps({
class: "fixed inset-0 z-[100] flex items-center justify-center bg-black/30 backdrop-blur-[1px]",
"aria-busy": "true",
role: "alert"
}, _attrs))} data-v-c1ace0c2><div class="flex flex-col items-center gap-3 rounded-2xl bg-white px-10 py-7 shadow-xl" data-v-c1ace0c2><span class="loading loading-spinner loading-lg text-primary" data-v-c1ace0c2></span><span class="text-sm text-slate-600" data-v-c1ace0c2>处理中,请稍候…</span></div></div>`);
} else {
_push(`<!---->`);
}
};
}
});
const _sfc_setup$1 = _sfc_main$1.setup;
_sfc_main$1.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/AppLoading.vue");
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const __nuxt_component_2 = /* @__PURE__ */ Object.assign(_export_sfc(_sfc_main$1, [["__scopeId", "data-v-c1ace0c2"]]), { __name: "AppLoading" });
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "default",
__ssrInlineRender: true,
setup(__props) {
const auth = useAuthStore();
useRouter();
const route = useRoute$1();
const identityLabel = computed(() => {
const map = { 1: "超级管理员", 2: "管理员", 3: "代理", 4: "运营" };
return map[auth.identity] ?? "";
});
const identityLabelShort = computed(() => {
const map = { 1: "超管", 2: "管理员", 3: "代理", 4: "运营" };
return map[auth.identity] ?? "";
});
const avatarChar = computed(() => (auth.account || "A").charAt(0).toUpperCase());
const menuGroups = [
{
label: "数据概览",
items: [
{ id: "dashboard", label: "仪表盘", to: "/dashboard", icon: "M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }
]
},
{
label: "生产管理",
items: [
{ id: "factory", label: "厂家管理", to: "/factory", icon: "M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" },
{ id: "product", label: "产品管理", to: "/product", icon: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" },
{ id: "code", label: "公码管理", to: "/code", icon: "M4 4h6v6H4V4zm10 0h6v6h-6V4zM4 14h6v6H4v-6zm10 2h2m-2 4h6m-4-4v4m4-8h2m-2 0v4" },
{ id: "device", label: "生产管理", to: "/device", icon: "M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z" }
]
},
{
label: "用户管理",
items: [
{ id: "user", label: "用户查询", to: "/users", icon: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" }
]
},
{
label: "服务配置",
items: [
{ id: "globalconfig", label: "全局环境配置", to: "/globalconfig", icon: "M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" },
{ id: "mcpconfig", label: "MCP配置", to: "/mcpconfig", icon: "M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-3-4h.01M16 16h.01" },
{ id: "meettemplate", label: "会议模板", to: "/meettemplates", icon: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" },
{ id: "svcconfig", label: "第三方服务配置", to: "/serviceconfig", icon: "M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z M15 12a3 3 0 11-6 0 3 3 0 016 0z" },
{ id: "calltranslate", label: "通话翻译配置", to: "/calltranslate", icon: "M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129" }
]
},
{
label: "SaaS 管理",
items: [
{ id: "apps", label: "应用管理", to: "/apps", icon: "M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" },
{ id: "environments", label: "环境节点", to: "/environments", icon: "M5 3h14a2 2 0 012 2v4a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2zM5 13h14a2 2 0 012 2v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4a2 2 0 012-2zM7 7h.01M7 17h.01" }
]
},
{
label: "系统管理",
items: [
{ id: "systemconfig", label: "系统配置", to: "/systemconfig", icon: "M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4" },
{ id: "statlog", label: "统计日志", to: "/statlog", icon: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4" },
{ id: "admin", label: "后台账号", to: "/accounts", icon: "M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" }
]
}
];
function hasVisibleItems(group) {
return group.items.some((item) => auth.hasAccess(item.id));
}
const pageTitle = computed(() => {
if (route.meta?.title) return route.meta.title;
for (const g of menuGroups) {
const item = g.items.find((m) => route.path.startsWith(m.to));
if (item) return item.label;
}
return "Console";
});
return (_ctx, _push, _parent, _attrs) => {
const _component_NuxtLink = __nuxt_component_0;
const _component_AppToast = __nuxt_component_1;
const _component_AppLoading = __nuxt_component_2;
_push(`<div${ssrRenderAttrs(mergeProps({ class: "flex min-h-screen" }, _attrs))}><aside class="fixed top-0 left-0 bottom-0 z-30 overflow-y-auto flex flex-col" style="${ssrRenderStyle({ "width": "256px", "background": "#1E293B" })}"><div style="${ssrRenderStyle({ "padding": "20px 20px 16px", "border-bottom": "1px solid rgba(255,255,255,0.06)" })}"><div style="${ssrRenderStyle({ "display": "flex", "align-items": "center", "gap": "12px" })}"><div style="${ssrRenderStyle({ "width": "40px", "height": "40px", "background": "linear-gradient(135deg,#4F46E5,#7C3AED)", "border-radius": "12px", "display": "flex", "align-items": "center", "justify-content": "center", "box-shadow": "0 6px 20px rgba(79,70,229,0.35)", "flex-shrink": "0" })}"><svg style="${ssrRenderStyle({ "width": "22px", "height": "22px", "color": "#fff" })}" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg></div><div><div style="${ssrRenderStyle({ "color": "#fff", "font-weight": "700", "font-size": "15px", "letter-spacing": "-0.02em" })}">${ssrInterpolate(unref(auth).siteTitle || "Admin")}</div><div style="${ssrRenderStyle({ "color": "#64748B", "font-size": "11px", "font-weight": "500" })}">Admin Console · v1.0.1</div></div></div></div><nav style="${ssrRenderStyle({ "padding": "12px 0", "flex": "1" })}"><!--[-->`);
ssrRenderList(menuGroups, (group) => {
_push(`<!--[-->`);
if (hasVisibleItems(group)) {
_push(`<div class="group-title">${ssrInterpolate(group.label)}</div>`);
} else {
_push(`<!---->`);
}
_push(`<!--[-->`);
ssrRenderList(group.items, (item) => {
_push(`<!--[-->`);
if (unref(auth).hasAccess(item.id)) {
_push(ssrRenderComponent(_component_NuxtLink, {
key: item.id,
to: item.to,
class: "sidebar-link",
"active-class": "active"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<svg class="icon" width="18" height="18" fill="none" viewBox="0 0 24 24" stroke="currentColor"${_scopeId}><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"${ssrRenderAttr("d", item.icon)}${_scopeId}></path></svg> ${ssrInterpolate(item.label)}`);
} else {
return [
(openBlock(), createBlock("svg", {
class: "icon",
width: "18",
height: "18",
fill: "none",
viewBox: "0 0 24 24",
stroke: "currentColor"
}, [
createVNode("path", {
"stroke-linecap": "round",
"stroke-linejoin": "round",
"stroke-width": "2",
d: item.icon
}, null, 8, ["d"])
])),
createTextVNode(" " + toDisplayString(item.label), 1)
];
}
}),
_: 2
}, _parent));
} else {
_push(`<!---->`);
}
_push(`<!--]-->`);
});
_push(`<!--]--><!--]-->`);
});
_push(`<!--]--></nav><div style="${ssrRenderStyle({ "margin-top": "auto", "padding": "14px 18px", "border-top": "1px solid rgba(255,255,255,0.06)" })}"><div style="${ssrRenderStyle({ "display": "flex", "align-items": "center", "gap": "10px" })}"><div style="${ssrRenderStyle({ "width": "32px", "height": "32px", "border-radius": "9px", "background": "linear-gradient(135deg,#4F46E5,#7C3AED)", "color": "#fff", "display": "flex", "align-items": "center", "justify-content": "center", "font-weight": "700", "flex-shrink": "0" })}">${ssrInterpolate(avatarChar.value)}</div><div style="${ssrRenderStyle({ "min-width": "0" })}"><div style="${ssrRenderStyle({ "color": "#E2E8F0", "font-size": "13px", "font-weight": "600", "line-height": "1.2", "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" })}">${ssrInterpolate(unref(auth).account || "-")}</div><div style="${ssrRenderStyle({ "color": "#64748B", "font-size": "11px", "margin-top": "2px" })}">${ssrInterpolate(identityLabel.value)}</div></div></div></div></aside><main class="flex-1" style="${ssrRenderStyle({ "margin-left": "256px" })}"><header class="bg-white shadow-sm sticky top-0 z-20 h-16 flex items-center justify-between px-6"><div class="flex items-center gap-2 text-sm"><span class="text-slate-400">首页</span><span class="text-slate-300">/</span><span class="text-slate-700 font-medium">${ssrInterpolate(pageTitle.value)}</span></div><div class="flex items-center gap-2"><div class="dropdown dropdown-end"><div tabindex="0" class="btn btn-ghost btn-sm btn-circle relative"><svg class="h-5 w-5 text-slate-500" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"></path></svg></div><div tabindex="0" class="dropdown-content z-[2] shadow-xl bg-white rounded-xl w-80 border" style="${ssrRenderStyle({ "max-height": "400px" })}"><div class="flex items-center justify-between px-4 py-3 border-b"><span class="text-sm font-semibold text-slate-700">系统通知</span></div><div class="px-3 py-6 text-center text-slate-400 text-xs">暂无新通知</div></div></div><div class="dropdown dropdown-end"><div tabindex="0" class="flex items-center gap-2 cursor-pointer hover:bg-slate-50 rounded-lg px-3 py-1.5"><div class="avatar placeholder"><div class="bg-indigo-600 text-white rounded-full w-8"><span class="text-sm">${ssrInterpolate(avatarChar.value)}</span></div></div><div><div class="text-sm text-slate-700 leading-tight">${ssrInterpolate(unref(auth).account)}</div><div class="text-[10px] text-slate-400">${ssrInterpolate(identityLabelShort.value)}</div></div></div><ul tabindex="0" class="dropdown-content z-[1] menu p-2 shadow-lg bg-white rounded-lg w-44 border"><li><a class="text-sm text-red-500 cursor-pointer">退出登录</a></li></ul></div></div></header>`);
_push(ssrRenderComponent(_component_AppToast, null, null, _parent));
_push(ssrRenderComponent(_component_AppLoading, null, null, _parent));
_push(`<div class="p-6">`);
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
_push(`</div></main></div>`);
};
}
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("layouts/default.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };
//# sourceMappingURL=default-Vvv7KKiT.mjs.map