From 2ef64a62546c38f0e13bf1821eb98ea4606cdbe4 Mon Sep 17 00:00:00 2001 From: pengxiaolong <15716207+pengxiaolong711@user.noreply.gitee.com> Date: Wed, 12 Nov 2025 18:55:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=93=A5=E5=BB=BA=E8=81=94=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.local | 4 +- src/api/server/employeehosts/index.ts | 52 ++++--- src/api/system/user/index.ts | 11 +- src/locales/en.ts | 54 ++++--- src/locales/zh-CN.ts | 47 +++--- src/views/Home/Index.vue | 202 ++++++++++++++++++++++++-- src/views/Home/echarts-data.ts | 44 +++++- 7 files changed, 322 insertions(+), 92 deletions(-) diff --git a/.env.local b/.env.local index 1b44b48..3406c71 100644 --- a/.env.local +++ b/.env.local @@ -5,9 +5,9 @@ VITE_DEV=true # 请求路径 # VITE_BASE_URL='http://172.16.214.222:48080' -# VITE_BASE_URL='http://192.168.1.144:48080' +VITE_BASE_URL='http://192.168.1.144:48080' # VITE_BASE_URL='http://47.79.98.113:48080' -VITE_BASE_URL='https://backstageapi.yolozs.com' +# VITE_BASE_URL='https://backstageapi.yolozs.com' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务 VITE_UPLOAD_TYPE=server diff --git a/src/api/server/employeehosts/index.ts b/src/api/server/employeehosts/index.ts index b821cb4..74f7837 100644 --- a/src/api/server/employeehosts/index.ts +++ b/src/api/server/employeehosts/index.ts @@ -13,7 +13,7 @@ export interface EmployeeHostsVO { fllowernum: number // 关注数量 yesterdayCoins: number // 昨日金币 country: string // 主播国家 - hostsKind: string // 直播类型 娱乐,游戏 + hostsKind: string // 直播类型 娱乐,游戏 operationStatus: number // 操作状态 createTime: string // 创建时间 updateTime: string // 创建时间 @@ -22,26 +22,39 @@ export interface EmployeeHostsVO { uid: string // 用户id } - - // 员工分配主播 API export const EmployeeHostsApi = { // 查询员工分配主播分页 // getEmployeeHostsPage: async (params: any) => { // return await request.get({ url: `/server/employee-hosts/page`, params }) // }, - // 查询员工分配主播分页 - getEmployeeHostsPage: async (params: any) => { - return await request.get({ url: `/server/employee-hosts/self_page`, params }) - }, - // 查询员工分配主播分页 - employeeCompleteBarChart: async (params: number[],days: number) => { - return await request.post({ url: `/server/employee-hosts/employeeCompleteBarChart`, data: {userId:params,days:days} }) - }, - // 查询管理员工分配主播分页 - getMeangeEmployeeHostsPage: async (params: any) => { - return await request.get({ url: `server/employee-hosts/page`, params }) - }, + // 查询员工分配主播分页 + getEmployeeHostsPage: async (params: any) => { + return await request.get({ url: `/server/employee-hosts/self_page`, params }) + }, + // 查询员工分配大哥分页 + getEmployeeHostsPageDsec: async (params: any) => { + return await request.get({ url: `/server/employee-big-brother/self_complete` }) + }, + // 查询员工分配主播分页 + employeeCompleteBarChart: async (params: number[], days: number) => { + return await request.post({ + url: `/server/employee-hosts/employeeCompleteBarChart`, + data: { userId: params, days: days } + }) + }, + // 查询员工分配大哥分页 + employeeCompleteBarChartDsec: async (params: number[], days: number) => { + return await request.post({ + url: `/server/employee-big-brother/employeeCompleteBarChart`, + data: { userId: params, days: days } + }) + }, + + // 查询管理员工分配主播分页 + getMeangeEmployeeHostsPage: async (params: any) => { + return await request.get({ url: `server/employee-hosts/page`, params }) + }, // 查询员工分配主播详情 getEmployeeHosts: async (id: number) => { return await request.get({ url: `/server/employee-hosts/get?id=` + id }) @@ -60,18 +73,21 @@ export const EmployeeHostsApi = { updateBatchEmployeeHosts: async (data: EmployeeHostsVO[]) => { return await request.put({ url: `/server/employee-hosts/batch_update`, data }) }, - + // 删除员工分配主播 deleteEmployeeHosts: async (id: number) => { return await request.delete({ url: `/server/employee-hosts/delete?id=` + id }) }, // 删除员工分配主播 deleteEmployeeHostsList: async (ids: number[]) => { - return await request.delete({ url: `/server/employee-hosts/delete-list`, params: { ids: ids.join(',') } }) + return await request.delete({ + url: `/server/employee-hosts/delete-list`, + params: { ids: ids.join(',') } + }) }, // 导出员工分配主播 Excel exportEmployeeHosts: async (params) => { return await request.download({ url: `/server/employee-hosts/export-employee-excel`, params }) } -} \ No newline at end of file +} diff --git a/src/api/system/user/index.ts b/src/api/system/user/index.ts index 7f55682..1617cdf 100644 --- a/src/api/system/user/index.ts +++ b/src/api/system/user/index.ts @@ -28,12 +28,12 @@ export const getUserPage = (params: PageParam) => { } // 查询租户下用户 export const getUserByTenant = (tenantId: number) => { - return request.get({ url: 'system/user/list-tenant-user?tenantId='+tenantId }) + return request.get({ url: 'system/user/list-tenant-user?tenantId=' + tenantId }) } // 查询用户管理列表 export const getAllocation = (id: number) => { - return request.get({ url: '/system/user/list-all-simple-dept?deptId='+id }) + return request.get({ url: '/system/user/list-all-simple-dept?deptId=' + id }) } // 查询用户详情 @@ -101,17 +101,16 @@ export const getSimpleUserListPage = (params: PageParam): Promise => { return request.get({ url: '/system/user/page', params }) } - // 获取国家 export const getCountry = (country) => { - return request.get({ url: '/server/country-info/get?region='+ country }) + return request.get({ url: '/server/country-info/get?region=' + country }) } // 获取本人建联率 export const getComplete = () => { - return request.get({ url: '/server/employee-hosts/self_complete'}) + return request.get({ url: '/server/employee-hosts/self_complete' }) } // 获取员工建联率 export const getEmployeeComplete = (id) => { - return request.get({ url: '/server/employee-hosts/employeeComplete?userId='+id}) + return request.get({ url: '/server/employee-hosts/employeeComplete?userId=' + id }) } diff --git a/src/locales/en.ts b/src/locales/en.ts index 717a783..54339a9 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -55,7 +55,7 @@ export default { copy: 'Copy', copySuccess: 'Copy Success', copyError: 'Copy Error', - perPage: 'Number page', + perPage: 'Number page' }, lock: { lockScreen: 'Lock screen', @@ -142,9 +142,9 @@ export default { qrcode: 'Scan the QR code to log in', btnRegister: 'Sign up', SmsSendMsg: 'code has been sent', - resetPassword: "Reset Password", - resetPasswordSuccess: "Reset Password Success", - invalidTenantName:"Invalid Tenant Name" + resetPassword: 'Reset Password', + resetPasswordSuccess: 'Reset Password Success', + invalidTenantName: 'Invalid Tenant Name' }, captcha: { verification: 'Please complete security verification', @@ -165,7 +165,7 @@ export default { BigBrotherManage: 'BigBrotherManage', BigBrotherDataManage: 'BigBrotherDataManage', BigBrotherList: 'BigBrotherList', - staffBigBrotherManage: 'StaffBigBrotherManage', + staffBigBrotherManage: 'StaffBigBrotherManage' }, analysis: { newUser: 'New user', @@ -193,10 +193,11 @@ export default { allianceAdvertising: 'Alliance advertising', videoAdvertising: 'Video advertising', searchEngines: 'Search engines', - weeklyUserActivity: 'Weekly user activity', + weeklyUserActivity: 'The number of live-streamers in Jianlian', + weeklyUserActivityDesc: 'The number of Jianlian big brothers', activeQuantity: 'Active quantity', - alreadyJianlian:'Already alliance', - noAlliance:'No alliance', + alreadyJianlian: 'Already alliance', + noAlliance: 'No alliance', monday: 'Monday', tuesday: 'Tuesday', wednesday: 'Wednesday', @@ -431,7 +432,7 @@ export default { man: 'Man', woman: 'Woman', createTime: 'Created Date', - updateTime: 'Update Time', + updateTime: 'Update Time' }, info: { title: 'Basic Information', @@ -488,8 +489,8 @@ export default { placeHostsKind: 'Please enter live type, e.g., game', isAssigned: 'Assigned', aiOperation: 'Ai Operation', - sortType:'Sort Type', - sortName:'Sort Name', + sortType: 'Sort Type', + sortName: 'Sort Name', placeIsAssigned: 'Please select assignment status', placeaiOperation: 'Please select Ai operation', createTime: 'Created Time', @@ -509,9 +510,9 @@ export default { edit: 'Edit', delete: 'Del', cancel: 'Cancel', - confirm: 'Confirm', + confirm: 'Confirm' }, - employee:{ + employee: { hostsId: 'Host ID', placeHostId: 'Please enter host ID', hostsLevel: 'Host Level', @@ -550,11 +551,10 @@ export default { primaryKey: 'ID', action: 'Action', remark: 'Remark', - flag:'Flag', - loadNext:'Next', + flag: 'Flag', + loadNext: 'Next', previous: 'Previous', - updateTime: 'Update Time', - + updateTime: 'Update Time' }, country: { greece: 'Greece Region', @@ -591,23 +591,21 @@ export default { onlineFans: 'Online Fans', fllowernum: 'Followers', updateTime: 'Update Time' - }, - hostsInvitationType:{ - eliteTicket:'elite ticket', - regularTicket:'regular ticket', - + hostsInvitationType: { + eliteTicket: 'elite ticket', + regularTicket: 'regular ticket' }, - Assigned:{ - yes:'yes', + Assigned: { + yes: 'yes', no: 'no' }, - sortState:{ + sortState: { asc: 'asc', desc: 'desc' }, - operational:{ + operational: { contact: 'contact', - noContact: 'noContact', - }, + noContact: 'noContact' + } } diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 9bb729b..d837247 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -1,6 +1,6 @@ -import { BigBrotherApi } from "@/api/server/bigbrother"; -import Search from "@/components/Search/src/Search.vue"; -import { max } from "lodash-es"; +import { BigBrotherApi } from '@/api/server/bigbrother' +import Search from '@/components/Search/src/Search.vue' +import { max } from 'lodash-es' export default { common: { @@ -59,8 +59,7 @@ export default { copy: '复制', copySuccess: '复制成功', copyError: '复制失败', - perPage: '每页', - + perPage: '每页' }, lock: { lockScreen: '锁定屏幕', @@ -172,8 +171,7 @@ export default { BigBrotherManage: '大哥管理', BigBrotherDataManage: '大哥数据管理(管理)', BigBrotherList: '大哥列表(员工)', - staffBigBrotherManage: '员工大哥管理(管理)', - + staffBigBrotherManage: '员工大哥管理(管理)' }, analysis: { newUser: '新增用户', @@ -201,10 +199,11 @@ export default { allianceAdvertising: '联盟广告', videoAdvertising: '视频广告', searchEngines: '搜索引擎', - weeklyUserActivity: '当日建联数', + weeklyUserActivity: '建联主播数', + weeklyUserActivityDesc: '建联大哥数', activeQuantity: '建联数', - alreadyJianlian:'已建联', - noAlliance:'未建联', + alreadyJianlian: '已建联', + noAlliance: '未建联', monday: '周一', tuesday: '周二', wednesday: '周三', @@ -488,8 +487,8 @@ export default { placeHostsKind: '请输入直播类型 如:游戏 ', isAssigned: '是否分配', aiOperation: '是否AI介入', - sortType:'排序类型', - sortName:'排序名字', + sortType: '排序类型', + sortName: '排序名字', placeIsAssigned: '请选择是否已经分配给员工', placeaiOperation: '请筛选是否AI介入', createTime: '创建时间', @@ -509,9 +508,9 @@ export default { edit: '编辑', delete: '删除', cancel: '取消', - confirm: '确定', + confirm: '确定' }, - employee:{ + employee: { hostsId: '主播id', placeHostId: '请输入主播id', hostsLevel: '主播等级', @@ -552,8 +551,8 @@ export default { action: '操作', remark: '备注', flag: '旗帜', - loadNext:'下一页', - previous:'上一页', + loadNext: '下一页', + previous: '上一页' }, country: { greece: '希腊大区', @@ -591,21 +590,21 @@ export default { fllowernum: '关注数', updateTime: '更新时间' }, - hostsInvitationType:{ - eliteTicket:'金票', - regularTicket:'普票', + hostsInvitationType: { + eliteTicket: '金票', + regularTicket: '普票' }, - Assigned:{ - yes:'是', + Assigned: { + yes: '是', no: '否' }, - sortState:{ + sortState: { asc: '升序', desc: '降序' }, - operational:{ + operational: { contact: '转化', - noContact: '未转化', + noContact: '未转化' }, 'OAuth 2.0': 'OAuth 2.0' // 避免菜单名是 OAuth 2.0 时,一直 warn 报错 } diff --git a/src/views/Home/Index.vue b/src/views/Home/Index.vue index 7083db5..b81920d 100644 --- a/src/views/Home/Index.vue +++ b/src/views/Home/Index.vue @@ -108,13 +108,45 @@ -
当日建联数量
+
当日建联主播数量
{{ HostsOperationNum }}
+ + + + + + + + + 当日 + + 近7日 + + + + + + + + + + +
当日建联大哥数量
+ + {{ HostsOperationNumDsec }} +
+
+
+
+
+ @@ -177,7 +209,7 @@ import { formatTime } from '@/utils' import { useUserStore } from '@/store/modules/user' // import { useWatermark } from '@/hooks/web/useWatermark' import type { WorkplaceTotal, Project, Notice, Shortcut } from './types' -import { pieOptions, barOptions } from './echarts-data' +import { pieOptions, barOptions, bigbrotherbarOptions } from './echarts-data' import { useRouter } from 'vue-router' import { getComplete, getEmployeeComplete } from '@/api/system/user' import { useCache } from '@/hooks/web/useCache' @@ -185,35 +217,61 @@ 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' -let HostsOperationNum = ref(0) + + +let HostsOperationNum = ref(0)//当日建联主播数量 + +let HostsOperationNumDsec = ref(0)//当日建联大哥数量 + +let days = ref(1)//当日 + +let daysDsec = ref(1)//当日 + +//初始 onMounted(async () => { await getAllApi() + await getAllocationList() + if (wsCache.get('roleRouters').find(item => item.id === 1)?.children.find(item => item.id === 100)) { await fetchAllHostsCount(1) + + await fetchAllHostsCountDesc(1) } else { await fetchDailyHostsCount() + + await fetchDailyHostsCountDesc() } - - - - }) -let days = ref(1) + // 每次页面“再次显示”时都会触发(前提:该路由组件被 keep-alive 缓存) onActivated(async () => { await fetchDailyHostsCount() + + await fetchDailyHostsCountDesc() + await fetchAllHostsCount(1) + + await fetchAllHostsCountDesc(1) }) +// 天数切换 async function updataDays(val) { await fetchAllHostsCount(val) } +//大哥天数切换 +async function updataDaysDsec(val: any) { + await fetchAllHostsCountDesc(val) +} + // import { useGlobalWebSocket } from '@/components/useGlobalWebSocket' // let messageList = useGlobalWebSocket().messageList // console.log(messageList.value) + const { wsCache } = useCache() + let allocationUser = ref('') //选中的分配用户 + let allocationUserList = ref([ { label: '分配用户1', @@ -229,14 +287,23 @@ defineOptions({ name: 'Index' }) // console.log(data) // const { open } = useGlobalWebSocket() + const { t } = useI18n() + const router = useRouter() + const userStore = useUserStore() + // const { setWatermark } = useWatermark() + const loading = ref(true) + const avatar = userStore.getUser.avatar + const username = userStore.getUser.nickname + const pieOptionsData = reactive(pieOptions) as EChartsOption + // 获取统计数 let totalSate = reactive({ project: 0, @@ -244,6 +311,7 @@ let totalSate = reactive({ todo: 0 }) + const getCount = async () => { const data = { project: 40, @@ -311,6 +379,7 @@ const getProject = async () => { // 获取通知公告 let notice = reactive([]) + const getNotice = async () => { const data = [ // { @@ -383,14 +452,18 @@ const getShortcut = async () => { color: '#1a73e8' } ] + shortcut = Object.assign(shortcut, data) } // 用户来源 const getUserAccessSource = async (id) => { const res = id ? await getEmployeeComplete(id) : await getComplete() + const completeData = res ?? { unfinishedNum: 0, finishedNum: 0 } + console.log('completeData', completeData) + const data = [ { value: completeData.unfinishedNum, name: 'analysis.noAlliance' }, { value: completeData.finishedNum, name: 'analysis.alreadyJianlian' }, @@ -398,11 +471,13 @@ const getUserAccessSource = async (id) => { // { value: 135, name: 'analysis.videoAdvertising' }, // { value: 1548, name: 'analysis.searchEngines' } ] + set( pieOptionsData, 'legend.data', data.map((v) => t(v.name)) ) + pieOptionsData!.series![0].data = data.map((v) => { return { name: t(v.name), @@ -410,21 +485,30 @@ const getUserAccessSource = async (id) => { } }) } + const barOptionsData = reactive(barOptions) as EChartsOption + +const barOptionsDataDsec = reactive(bigbrotherbarOptions) as EChartsOption + type EmpBarItem = { userId: number finishedNum: number | null totalNum: number | null unfinishedNum: number | null } + // 传入希望展示的用户 id 列表 + 后端原始返回,补齐未返回的用户为 0 function mergeZeroUsers(ids: number[], resList: EmpBarItem[]): EmpBarItem[] { const map = new Map(resList.map(it => [it.userId, it])) + return ids.map(id => { const it = map.get(id) + const finished = it?.finishedNum ?? 0 + // 未建联:优先用后端给的 unfinishedNum;若没有且提供了 totalNum,则用 totalNum - finished;否则 0 const total = it?.totalNum ?? 0 + const unfinished = it?.unfinishedNum ?? (it?.totalNum != null && it?.finishedNum != null ? Math.max(Number(total) - Number(finished), 0) : 0) @@ -437,23 +521,28 @@ function mergeZeroUsers(ids: number[], resList: EmpBarItem[]): EmpBarItem[] { } }) } + // 把后端返回的数据渲染到柱状图 function updateEmployeeBarChart(list: EmpBarItem[]) { // 建立 id -> 昵称 的映射 const id2label = new Map(allocationUserList.value.map(u => [u.value, u.label])) + const labels = list.map(it => id2label.get(it.userId) || String(it.userId)) const finished = list.map(it => it.finishedNum ?? 0) + const unfinished = list.map(it => it.unfinishedNum ?? 0) // legend const legendNames = [] set(barOptionsData, 'legend.data', legendNames) + set(barOptionsData, 'xAxis.data', labels) // 1) 轴标签强制全部显示 + 不自动隐藏 set(barOptionsData, 'xAxis.axisLabel.interval', 0) + set(barOptionsData, 'xAxis.axisLabel.hideOverlap', false) // 2) 适当旋转,避免重叠(不想旋转可设为 0) @@ -461,9 +550,10 @@ function updateEmployeeBarChart(list: EmpBarItem[]) { // 3) 防止被裁剪:让 grid 预留标签空间 set(barOptionsData, 'grid.containLabel', true) - set(barOptionsData, 'grid.bottom', 60) // 视情况调大/调小 - set(barOptionsData, 'xAxis.axisTick.alignWithLabel', true) + set(barOptionsData, 'grid.bottom', 60) // 视情况调大/调小 + + set(barOptionsData, 'xAxis.axisTick.alignWithLabel', true) set(barOptionsData, 'series', [ { @@ -478,17 +568,67 @@ function updateEmployeeBarChart(list: EmpBarItem[]) { // } ]) } + +// 周活跃量 大哥图表数据 +function updateEmployeeBarChartDesc(lists: EmpBarItem[]) { + // 建立 id -> 昵称 的映射 + const id2label = new Map(allocationUserList.value.map(u => [u.value, u.label])) + + const labels = lists.map(it => id2label.get(it.userId) || String(it.userId)) + + const finished = lists.map(it => it.finishedNum ?? 0) + + const unfinished = lists.map(it => it.unfinishedNum ?? 0) + + // legend + const legendNames = [] + + set(barOptionsDataDsec, 'legend.data', legendNames) + + set(barOptionsDataDsec, 'xAxis.data', labels) + + // 1) 轴标签强制全部显示 + 不自动隐藏 + set(barOptionsDataDsec, 'xAxis.axisLabel.interval', 0) + + set(barOptionsDataDsec, 'xAxis.axisLabel.hideOverlap', false) + + // 2) 适当旋转,避免重叠(不想旋转可设为 0) + set(barOptionsDataDsec, 'xAxis.axisLabel.rotate', 30) + + // 3) 防止被裁剪:让 grid 预留标签空间 + set(barOptionsDataDsec, 'grid.containLabel', true) + + set(barOptionsDataDsec, 'grid.bottom', 60) // 视情况调大/调小 + + set(barOptionsDataDsec, 'xAxis.axisTick.alignWithLabel', true) + + set(barOptionsDataDsec, 'series', [ + { + name: t('analysis.alreadyJianlian'), + type: 'bar', + data: finished + }, + // { + // name: t('analysis.noAlliance'), + // type: 'bar', + // data: unfinished + // } + ]) +} + // 周活跃量 图表数据 const getWeeklyUserActivity = async () => { const data = [ { value: HostsOperationNum.value, name: 'analysis.monday' }, ] + set( barOptionsData, 'xAxis.data', data.map((v) => t(v.name)) ) + set(barOptionsData, 'series', [ { name: t('analysis.activeQuantity'), @@ -507,6 +647,7 @@ const getAllApi = async () => { getUserAccessSource(null), getWeeklyUserActivity() ]) + loading.value = false } @@ -521,10 +662,14 @@ const handleShortcutClick = (url: string) => { /** 查询员工 */ const getAllocationList = async () => { loading.value = true + allocationUserList.value = [] + try { const data = await getSimpleUserList() + console.log('data', data) + data.forEach((item) => { if (wsCache.get('user').user.id == item.id) { @@ -534,9 +679,8 @@ const getAllocationList = async () => { value: item.id }) } - - }) + console.log(allocationUserList.value) } finally { loading.value = false @@ -545,6 +689,7 @@ const getAllocationList = async () => { // 获取当前日期,格式为 YYYY-MM-DD const getFormattedDate = () => { const now = new Date() + return now.toISOString().split('T')[0] + ' 00:00:00' } @@ -557,16 +702,30 @@ async function fetchDailyHostsCount() { pageSize: 10, updateTime: getFormattedDate() }) + HostsOperationNum.value = res.total ?? 0 // 如果柱状图依赖这个值,顺便刷新一次图表数据 } +async function fetchDailyHostsCountDesc() { + const res = await EmployeeHostsApi.getEmployeeHostsPageDsec({ + operationStatus: 1, + pageNo: 1, + pageSize: 10, + updateTime: getFormattedDate() + }) + + HostsOperationNumDsec.value = res.finishedNum ?? 0 + // 如果柱状图依赖这个值,顺便刷新一次图表数据 +} + // ✅ 抽成函数:每天所有员工数量(用于多人柱状图) async function fetchAllHostsCount(val) { // 以“传入的用户 id”为准展示(顺序也按这里来) const ids = allocationUserList.value.map(item => item.value) const res = await EmployeeHostsApi.employeeCompleteBarChart(ids, val) + const rawList: EmpBarItem[] = Array.isArray(res) ? res : (res?.data ?? []) // 补齐后端未返回的用户为 0 @@ -575,4 +734,23 @@ async function fetchAllHostsCount(val) { // 渲染 updateEmployeeBarChart(list) } + +async function fetchAllHostsCountDesc(val) { + // 以“传入的用户 id”为准展示(顺序也按这里来) + const idss = allocationUserList.value.map(item => item.value) + + const ress = await EmployeeHostsApi.employeeCompleteBarChartDsec(idss, val) + + console.log('fetchAllHostsCountDesc', ress); + + const rawLists: EmpBarItem[] = Array.isArray(ress) ? ress : (ress?.data ?? []) + + // 补齐后端未返回的用户为 0 + const lists = mergeZeroUsers(idss, rawLists) + + // 渲染 + updateEmployeeBarChartDesc(lists) +} + + diff --git a/src/views/Home/echarts-data.ts b/src/views/Home/echarts-data.ts index 11f3301..d9ff8f6 100644 --- a/src/views/Home/echarts-data.ts +++ b/src/views/Home/echarts-data.ts @@ -108,8 +108,6 @@ export const pieOptions: EChartsOption = { ] } - - export const barOptions: EChartsOption = { title: { text: t('analysis.weeklyUserActivity'), @@ -152,6 +150,48 @@ export const barOptions: EChartsOption = { } ] } +export const bigbrotherbarOptions: EChartsOption = { + title: { + text: t('analysis.weeklyUserActivityDesc'), + left: 'center' + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow' + } + }, + grid: { + left: 50, + right: 20, + bottom: 20 + }, + xAxis: { + type: 'category', + data: [ + t('analysis.monday'), + t('analysis.tuesday'), + t('analysis.wednesday'), + t('analysis.thursday'), + t('analysis.friday'), + t('analysis.saturday'), + t('analysis.sunday') + ], + axisTick: { + alignWithLabel: true + } + }, + yAxis: { + type: 'value' + }, + series: [ + { + name: t('analysis.activeQuantity'), + data: [0, 0, 0, 0, 0, 0, 0], + type: 'bar' + } + ] +} export const radarOption: EChartsOption = { legend: {