import { defineComponent, ref, computed, 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-BNSkSrat.mjs'; import { u as useToast } from './useToast-MBvLaNjH.mjs'; import { _ as _export_sfc, R as ROLE_ACCESS_CEILING, A as ALL_MENU_IDS, M as MENU_GROUPS, D as DEFAULT_ADMIN_ACCESS } from './server.mjs'; import { R as REGION_OPTIONS } from './regions-D1dSykUW.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: "运营", 5: "渠道商" }; const ROLE_CLS = { 1: "badge-error", 2: "badge-primary", 3: "badge-warning", 4: "badge-info", 5: "badge-accent" }; const view = ref("list"); const rows = ref([]); const apps = ref([]); const appNames = computed( () => [...new Set(apps.value.map((a) => a.app_name || a.name).filter(Boolean))].sort() ); const loading = ref(false); const submitting = ref(false); const editId = ref(0); const form = reactive({ username: "", password: "", identity: 2, enabled: "1", remark: "", brandid: 0, channelid: "" }); const roleCeiling = computed(() => ROLE_ACCESS_CEILING[form.identity] ?? null); computed(() => roleCeiling.value ?? ALL_MENU_IDS); const menuGroupsForRole = computed(() => { const ceiling = roleCeiling.value; if (!ceiling) return MENU_GROUPS; return MENU_GROUPS.map((g) => ({ ...g, items: g.items.filter((m) => ceiling.includes(m.id)) })).filter((g) => g.items.length > 0); }); const channels = ref([]); const accountChannelOptions = computed( () => form.brandid ? channels.value.filter((ch) => ch.brandid === form.brandid) : [] ); const sel = reactive({ access: [], apps: [], regions: [], products: [] }); const brands = ref([]); 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(); const ceiling = ROLE_ACCESS_CEILING[idt]; if (ceiling) sel.access = sel.access.filter((id) => ceiling.includes(id)); }); ref(null); ref(0); const topup = reactive({ name: "", cur: "", vipday: 0, trademin: 0, meetmin: 0 }); return (_ctx, _push, _parent, _attrs) => { _push(`

后台账号

超管 / 管理员 / 代理 / 运营。代理·运营可绑定应用·区域·产品,登录后仪表盘按绑定限制。

`); if (loading.value) { _push(``); } else if (!rows.value.length) { _push(``); } else { _push(``); } _push(``); ssrRenderList(rows.value, (a) => { _push(``); }); _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(`

${ssrInterpolate(editId.value ? "编辑账号 #" + editId.value : "新建账号")}

菜单权限
`); if (!roleCeiling.value) { _push(``); } else { _push(``); } _push(`
`); if (roleCeiling.value) { _push(`

该角色为外部账号,可见页面固定在下列范围内(留空即全部开放这些页面)。

`); } else { _push(`

管理员默认开放除「SaaS 管理 / 系统管理」以外的全部菜单(权限留空时按默认生效);代理/运营需显式勾选。

`); } _push(``); ssrRenderList(menuGroupsForRole.value, (g) => { _push(`
${ssrInterpolate(g.label)}`); if (g.restricted) { _push(`(管理员默认不开放)`); } else { _push(``); } _push(`
`); ssrRenderList(g.items, (m) => { _push(``); }); _push(`
`); }); _push(`
归属绑定 (品牌商账号只绑品牌商;渠道商账号两者都要绑)

数据隔离由后端强制:品牌商账号只能看到本品牌商及其名下渠道商的数据,渠道商账号只能看到自己渠道的数据。

作用域绑定 (代理/运营生效;限制仪表盘数据范围)
绑定应用 (仪表盘只显示这些应用数据;不勾=不限)
`); if (appNames.value.length) { _push(``); ssrRenderList(appNames.value, (n) => { _push(``); }); _push(``); } else { _push(`无注册应用`); } _push(`
绑定区域 (不勾=不限)
`); ssrRenderList(unref(REGION_OPTIONS), (r) => { _push(``); }); _push(`
绑定产品 (按厂家分组;仪表盘只显示这些产品数据;不勾=不限)
`); if (prodLoading.value) { _push(`加载产品中...`); } else if (!productGroups.value.length) { _push(`无产品`); } else { _push(``); ssrRenderList(productGroups.value, (g) => { _push(`
🏭 ${ssrInterpolate(g.label)}
`); ssrRenderList(g.products, (p) => { _push(``); }); _push(`
`); }); _push(``); } _push(`
`); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/accounts.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; const accounts = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a2832f1b"]]); export { accounts as default }; //# sourceMappingURL=accounts-CM5YEJ4p.mjs.map