import { defineComponent, ref, reactive, watch, unref, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrRenderStyle, ssrRenderList, ssrInterpolate, ssrRenderClass, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual } from 'vue/server-renderer'; import { u as useApi } from './useApi-B-E5eLsI.mjs'; import { u as useToast } from './useToast-CS21XT61.mjs'; import { _ as _export_sfc, D as DEFAULT_ADMIN_ACCESS, M as MENU_GROUPS } from './server.mjs'; import './useLoading-D4zrSa2m.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 = /* @__PURE__ */ defineComponent({ __name: "accounts", __ssrInlineRender: true, setup(__props) { useApi(); useToast(); const ROLE = { 1: "超管", 2: "管理员", 3: "代理", 4: "运营" }; const ROLE_CLS = { 1: "badge-error", 2: "badge-primary", 3: "badge-warning", 4: "badge-info" }; const REGIONS = [["cn", "中国"], ["us", "美国"], ["ea", "东亚"], ["sea", "东南亚"], ["sa", "南亚"], ["me", "中东"], ["eu", "欧洲"], ["ru", "俄罗斯"], ["af", "非洲"], ["sam", "南美"], ["nam", "北美"], ["oc", "大洋洲"], ["br", "巴西"], ["in", "印度"]]; const view = ref("list"); const rows = ref([]); const apps = ref([]); const loading = ref(false); const submitting = ref(false); const editId = ref(0); const form = reactive({ username: "", password: "", identity: 2, enabled: "1", remark: "" }); const sel = reactive({ access: [], apps: [], regions: [], products: [] }); const productGroups = ref([]); const prodLoading = ref(false); function fromCsv(s) { return (s || "").split(",").map((x) => x.trim()).filter((x) => x); } function scopeParts(a) { const parts = []; if (a.apps) parts.push("应用:" + fromCsv(a.apps).length); if (a.regions) parts.push("区域:" + fromCsv(a.regions).length); if (a.products) parts.push("产品:" + fromCsv(a.products).length); if (a.access) parts.push("页面:" + fromCsv(a.access).length); return parts; } watch(() => form.identity, (idt) => { if (idt === 2 && sel.access.length === 0) sel.access = DEFAULT_ADMIN_ACCESS.slice(); }); ref(null); ref(0); const topup = reactive({ name: "", cur: "", vipday: 0, trademin: 0, meetmin: 0 }); return (_ctx, _push, _parent, _attrs) => { _push(`
超管 / 管理员 / 代理 / 运营。代理·运营可绑定应用·区域·产品,登录后仪表盘按绑定限制。
| ID | 用户名 | 角色 | 状态 | 绑定作用域 | 备注 | 操作 |
|---|---|---|---|---|---|---|
| 加载中... | ||||||
| 暂无账号(引导超管不在此列) | ||||||
| ${ssrInterpolate(a.id)} | ${ssrInterpolate(a.username || "")} | ${ssrInterpolate(ROLE[a.identity] || a.identity)} | `); if (a.enabled) { _push(`启用`); } else { _push(`停用`); } _push(` | `);
if (a.identity === 3 || a.identity === 4) {
_push(``);
if (scopeParts(a).length) {
_push(`${ssrInterpolate(scopeParts(a).join(" · "))}`);
} else {
_push(`未绑定(不限)`);
}
_push(``);
} else if (a.identity === 2) {
_push(``);
if (a.access) {
_push(`菜单:${ssrInterpolate(fromCsv(a.access).length)}`);
} else {
_push(`默认(除SaaS/系统管理)`);
}
_push(``);
} else {
_push(`全部权限`);
}
if (a.identity === 3) {
_push(` 余额 VIP${ssrInterpolate(a.balance_vipday || 0)}天 · 翻译${ssrInterpolate(a.balance_trademin || 0)}分 · 会议${ssrInterpolate(a.balance_meetmin || 0)}分 `);
} else {
_push(``);
}
_push(` | ${ssrInterpolate(a.remark || "")} | `);
if (a.identity === 3) {
_push(``);
} else {
_push(``);
}
_push(` |
管理员默认开放除「SaaS 管理 / 系统管理」以外的全部菜单(权限留空时按默认生效);代理/运营需显式勾选。
`); ssrRenderList(unref(MENU_GROUPS), (g) => { _push(`