代理功能+web客户端权限

This commit is contained in:
2025-12-05 21:10:27 +08:00
parent e8ab8252f8
commit df9df3144b
33 changed files with 2294 additions and 162 deletions

View File

@@ -74,7 +74,7 @@
<el-card shadow="never" class="mt-8px">
<!-- <div style="display: flex; width: 50%;"
v-if="wsCache.get('roleRouters').find(item => item.id === 1)?.children.find(item => item.id === 100)">
v-if="wsCache.get('roleRouters').find(item => item.id === 5019)?.children.find(item => item.id === 5020)">
<el-select v-model="allocationUser" :placeholder="t('newHosts.placeAllocationUser')" clearable
@change="getUserAccessSource(allocationUser)">
@@ -93,7 +93,7 @@
</el-card>
</el-col> -->
<el-col
v-if="wsCache.get('roleRouters').find(item => item.id === 1)?.children.find(item => item.id === 100)"
v-if="wsCache.get('roleRouters').find(item => item.id === 5019)?.children.find(item => item.id === 5020)"
:xl="20" :lg="20" :md="24" :sm="24" :xs="24">
<el-card shadow="hover" class="mb-8px">
<el-select style="width: 200px;" v-model="days" @change="updataDays">
@@ -106,7 +106,7 @@
</el-skeleton>
</el-card>
</el-col>
<el-col v-else :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
<el-col v-if="tenantLevel != 1" :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
<el-card shadow="hover" class="mb-8px">
<div>当日建联主播数量</div>
{{ HostsOperationNum }}
@@ -121,7 +121,7 @@
<el-skeleton :loading="loading" animated>
<el-row :gutter="20" justify="space-between">
<el-col
v-if="wsCache.get('roleRouters').find(item => item.id === 1)?.children.find(item => item.id === 100)"
v-if="wsCache.get('roleRouters').find(item => item.id === 5041)?.children.find(item => item.id === 5042)"
:xl="20" :lg="20" :md="24" :sm="24" :xs="24">
<el-card shadow="hover" class="mb-8px">
<el-select style="width: 200px;" v-model="daysDsec" @change="updataDaysDsec">
@@ -136,7 +136,7 @@
</el-card>
</el-col>
<el-col v-else :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
<el-col v-if="tenantLevel != 1" :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
<el-card shadow="hover" class="mb-8px">
<div>当日建联大哥数量</div>
@@ -217,7 +217,7 @@ import { getSimpleUserListPage, getSimpleUserList } from '@/api/system/user'
import { EmployeeHostsApi } from '@/api/server/employeehosts'
import { ref, reactive, onMounted, onActivated } from 'vue'
import WxMusic from '../mp/components/wx-music'
import * as TenantApi from '@/api/system/tenant'
let HostsOperationNum = ref(0)//当日建联主播数量
@@ -226,19 +226,28 @@ let HostsOperationNumDsec = ref(0)//当日建联大哥数量
let days = ref(1)//当日
let daysDsec = ref(1)//当日
let tenantLevel = ref()//租户等级
//初始
onMounted(async () => {
await TenantApi.getSelfTenantLevel().then(res => {
tenantLevel.value = res.tenantLevel
console.log(res.tenantLevel)
})
if (tenantLevel.value == 1) {
loading.value = false
return
}
console.log(1321231)
await getAllApi()
await getAllocationList()
if (wsCache.get('roleRouters').find(item => item.id === 1)?.children.find(item => item.id === 100)) {
//用户id == 1 且
if (wsCache.get('roleRouters').find(item => item.id === 5019)?.children.find(item => item.id === 5020)) {
await fetchAllHostsCount(1)
await fetchAllHostsCountDesc(1)
} else {
await fetchDailyHostsCount()
// await fetchDailyHostsCount()
await fetchDailyHostsCountDesc()
}
@@ -246,13 +255,23 @@ onMounted(async () => {
// 每次页面“再次显示”时都会触发(前提:该路由组件被 keep-alive 缓存)
onActivated(async () => {
await fetchDailyHostsCount()
console.log(wsCache.get('user'))
console.log(tenantLevel.value)
await TenantApi.getSelfTenantLevel().then(res => {
tenantLevel.value = res.tenantLevel
console.log(res.tenantLevel)
})
if (tenantLevel.value == 1) {
loading.value = false
return
}
await fetchDailyHostsCount() //爬主播建联率
await fetchDailyHostsCountDesc()
await fetchDailyHostsCountDesc()//爬主播建联率 指定员工
await fetchAllHostsCount(1)
await fetchAllHostsCount(1) //爬大哥建联率
await fetchAllHostsCountDesc(1)
await fetchAllHostsCountDesc(1) //爬大哥建联率 指定员工
})
// 天数切换
@@ -644,7 +663,7 @@ const getAllApi = async () => {
getProject(),
getNotice(),
getShortcut(),
getUserAccessSource(null),
wsCache.get('roleRouters').find(item => item.id === 5019)?.children.find(item => item.id === 5020) ? getUserAccessSource(null) : null,
getWeeklyUserActivity()
])
@@ -719,7 +738,7 @@ async function fetchDailyHostsCountDesc() {
// 如果柱状图依赖这个值,顺便刷新一次图表数据
}
// ✅ 抽成函数:每天所有员工数量(用于多人柱状图)
// ✅ 爬大哥建联率
async function fetchAllHostsCount(val) {
// 以“传入的用户 id”为准展示顺序也按这里来
const ids = allocationUserList.value.map(item => item.value)