|
@@ -246,6 +246,7 @@ import { formatDate } from '@/utils/formatTime'
|
|
import { IotStatApi } from '@/api/pms/stat'
|
|
import { IotStatApi } from '@/api/pms/stat'
|
|
import SummaryCard from "@/components/SummaryCard/index.vue";
|
|
import SummaryCard from "@/components/SummaryCard/index.vue";
|
|
import {reactive, ref} from "vue";
|
|
import {reactive, ref} from "vue";
|
|
|
|
+import { useLocaleStore } from '@/store/modules/locale'
|
|
|
|
|
|
// TODO @super:参考下 /Users/yunai/Java/yudao-ui-admin-vue3/src/views/mall/home/index.vue,拆一拆组件
|
|
// TODO @super:参考下 /Users/yunai/Java/yudao-ui-admin-vue3/src/views/mall/home/index.vue,拆一拆组件
|
|
|
|
|
|
@@ -877,7 +878,7 @@ let activeInstance = null
|
|
// { department: '运营中心', total: 157, active: 89 }
|
|
// { department: '运营中心', total: 157, active: 89 }
|
|
// ])
|
|
// ])
|
|
const activeData = ref([])
|
|
const activeData = ref([])
|
|
-const initActiveChart = async () => {
|
|
|
|
|
|
+const initActiveChart = async (total:any, active:any,people:any) => {
|
|
if (!activeDom.value) return
|
|
if (!activeDom.value) return
|
|
activeData.value = await IotStatApi.getDeptCount()
|
|
activeData.value = await IotStatApi.getDeptCount()
|
|
activeInstance = echarts.init(activeDom.value)
|
|
activeInstance = echarts.init(activeDom.value)
|
|
@@ -888,12 +889,12 @@ const initActiveChart = async () => {
|
|
axisPointer: { type: 'shadow' }, //:ml-citation{ref="1,7" data="citationList"}
|
|
axisPointer: { type: 'shadow' }, //:ml-citation{ref="1,7" data="citationList"}
|
|
formatter: (params) => `
|
|
formatter: (params) => `
|
|
${params[0].name}<br/>
|
|
${params[0].name}<br/>
|
|
- ${params[0].marker} 总人数: ${params[0].value}<br/>
|
|
|
|
- ${params[1].marker} 活跃人数: ${params[1].value}
|
|
|
|
|
|
+ ${params[0].marker} ${total}: ${params[0].value}<br/>
|
|
|
|
+ ${params[1].marker} ${active}: ${params[1].value}
|
|
`
|
|
`
|
|
},
|
|
},
|
|
legend: {
|
|
legend: {
|
|
- data: ['总人数', '活跃人数'],
|
|
|
|
|
|
+ data: [total, active],
|
|
top: 30,
|
|
top: 30,
|
|
textStyle: {
|
|
textStyle: {
|
|
color: '#B6C8DA',
|
|
color: '#B6C8DA',
|
|
@@ -921,7 +922,7 @@ const initActiveChart = async () => {
|
|
},
|
|
},
|
|
yAxis: {
|
|
yAxis: {
|
|
type: 'value',
|
|
type: 'value',
|
|
- name: '人数',
|
|
|
|
|
|
+ name: people,
|
|
axisLabel: {
|
|
axisLabel: {
|
|
color: '#B6C8DA',
|
|
color: '#B6C8DA',
|
|
},
|
|
},
|
|
@@ -942,7 +943,7 @@ const initActiveChart = async () => {
|
|
},
|
|
},
|
|
series: [
|
|
series: [
|
|
{
|
|
{
|
|
- name: '总人数',
|
|
|
|
|
|
+ name: total,
|
|
type: 'bar',
|
|
type: 'bar',
|
|
data: activeData.value.map((item) => item.total),
|
|
data: activeData.value.map((item) => item.total),
|
|
itemStyle: {
|
|
itemStyle: {
|
|
@@ -954,7 +955,7 @@ const initActiveChart = async () => {
|
|
barWidth: 30
|
|
barWidth: 30
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- name: '活跃人数',
|
|
|
|
|
|
+ name: active,
|
|
type: 'bar',
|
|
type: 'bar',
|
|
data: activeData.value.map((item) => item.active),
|
|
data: activeData.value.map((item) => item.active),
|
|
itemStyle: {
|
|
itemStyle: {
|
|
@@ -1100,7 +1101,14 @@ onMounted(() => {
|
|
getStats()
|
|
getStats()
|
|
// initChart()
|
|
// initChart()
|
|
initTopChart()
|
|
initTopChart()
|
|
- initActiveChart()
|
|
|
|
|
|
+ const localeStore = useLocaleStore()
|
|
|
|
+ const lang = localeStore.getCurrentLocale.lang
|
|
|
|
+ if (lang==='zh-CN') {
|
|
|
|
+ initActiveChart('总人数','活跃人数','人数')
|
|
|
|
+ } else if (lang==='en') {
|
|
|
|
+ initActiveChart('totalPeople','activePeople','count')
|
|
|
|
+ }
|
|
|
|
+
|
|
// initQxChart()
|
|
// initQxChart()
|
|
window.addEventListener('resize', resizeQxChart)
|
|
window.addEventListener('resize', resizeQxChart)
|
|
// fetchTop()
|
|
// fetchTop()
|