gemercheung 2 năm trước cách đây
mục cha
commit
d81a4bedb4
3 tập tin đã thay đổi với 70 bổ sung69 xóa
  1. 0 1
      src/components.d.ts
  2. 68 64
      src/views/statistic/tab/tab1.vue
  3. 2 4
      src/views/statistic/tab/tab3.vue

+ 0 - 1
src/components.d.ts

@@ -35,7 +35,6 @@ declare module '@vue/runtime-core' {
     ATabPane: typeof import('ant-design-vue/es')['TabPane']
     ATabs: typeof import('ant-design-vue/es')['Tabs']
     ATextarea: typeof import('ant-design-vue/es')['Textarea']
-    ATooltip: typeof import('ant-design-vue/es')['Tooltip']
     BarChartOutlined: typeof import('@ant-design/icons-vue')['BarChartOutlined']
     CloseOutlined: typeof import('@ant-design/icons-vue')['CloseOutlined']
     DataList: typeof import('./components/data-list/index.vue')['default']

+ 68 - 64
src/views/statistic/tab/tab1.vue

@@ -205,60 +205,66 @@ const initTab = async () => {
   await statisticStore.fetchRoomVisitChart({
     roomTitle: ''
   })
-}
-const initOnlineChart = () => {
-  const chart1 = document.getElementById('chart-1')
-  const data = unref(onelineTimeCount)
-  const xAxis = data.map(i => i.dataKey)
-  const yAxis = data.map(i => i.dataCount)
-  const max = Math.max.apply(Math, yAxis) + 200
-  const min =
-    Math.min.apply(Math, yAxis) === 0 ? 0 : Math.min.apply(Math, yAxis)
-  if (chart1) {
-    if (!onlineTimeChart) {
-      onlineTimeChart = echarts.init(chart1)
-    }
-
-    // 绘制图表
-    onlineTimeChart.setOption({
-      tooltip: {
-        trigger: 'axis',
-        axisPointer: {
-          lineStyle: {
-            width: 1,
-            color: '#019680'
-          }
-        }
-      },
-      grid: {
-        left: '2%',
-        right: '2%',
-        top: '2%',
-        bottom: '10%',
-        containLabel: true
-      },
-      legend: {
-        orient: 'horizontal',
-        bottom: 0
-      },
-      xAxis: {
-        data: xAxis
-      },
-      yAxis: {
-        min: min,
-        max: max
-      },
-      series: [
-        {
-          name: t('statistic.aofubt'),
-          type: 'line',
-          smooth: true,
-          data: yAxis
-        }
-      ]
-    })
+  if (unref(userVisitList)?.length || unref(userShareList)?.length) {
+    initRoomVisitChart()
+  }
+  if (unref(userMsgCountList)?.length || unref(userMsgManList)?.length) {
+    initRoomMsgChart()
   }
 }
+// const initOnlineChart = () => {
+//   const chart1 = document.getElementById('chart-1')
+//   const data = unref(onelineTimeCount)
+//   const xAxis = data.map(i => i.dataKey)
+//   const yAxis = data.map(i => i.dataCount)
+//   const max = Math.max.apply(Math, yAxis) + 200
+//   const min =
+//     Math.min.apply(Math, yAxis) === 0 ? 0 : Math.min.apply(Math, yAxis)
+//   if (chart1) {
+//     if (!onlineTimeChart) {
+//       onlineTimeChart = echarts.init(chart1)
+//     }
+
+//     // 绘制图表
+//     onlineTimeChart.setOption({
+//       tooltip: {
+//         trigger: 'axis',
+//         axisPointer: {
+//           lineStyle: {
+//             width: 1,
+//             color: '#019680'
+//           }
+//         }
+//       },
+//       grid: {
+//         left: '2%',
+//         right: '2%',
+//         top: '2%',
+//         bottom: '10%',
+//         containLabel: true
+//       },
+//       legend: {
+//         orient: 'horizontal',
+//         bottom: 0
+//       },
+//       xAxis: {
+//         data: xAxis
+//       },
+//       yAxis: {
+//         min: min,
+//         max: max
+//       },
+//       series: [
+//         {
+//           name: t('statistic.aofubt'),
+//           type: 'line',
+//           smooth: true,
+//           data: yAxis
+//         }
+//       ]
+//     })
+//   }
+// }
 
 const initRoomVisitChart = () => {
   const chart = document.getElementById('chart-2')
@@ -472,25 +478,23 @@ watch(
 )
 onMounted(async () => {
   watchEffect(() => {
-    if (unref(onelineTimeCount)?.length) {
-      initOnlineChart()
-    }
-    if (unref(userVisitList)?.length || unref(userShareList)?.length) {
-      initRoomVisitChart()
-    }
-    if (unref(userMsgCountList)?.length || unref(userMsgManList)?.length) {
-      initRoomMsgChart()
-    }
+    // if (unref(onelineTimeCount)?.length) {
+    //   initOnlineChart()
+    // }
   })
 
   window.onresize = function () {
     //自适应大小
-    onlineTimeChart && onlineTimeChart.resize()
-    roomUseVisitChart && roomUseVisitChart.resize()
-    roomMsgChart && roomMsgChart.resize()
+    handleResize()
   }
 })
 
+const handleResize = () => {
+  onlineTimeChart && onlineTimeChart.resize()
+  roomUseVisitChart && roomUseVisitChart.resize()
+  roomMsgChart && roomMsgChart.resize()
+}
+
 const handleFinish = async () => {
   await statisticStore.fetchRoomVisitChart({
     timeList: formState.userTime

+ 2 - 4
src/views/statistic/tab/tab3.vue

@@ -106,7 +106,6 @@ const columns: TableColumnProps[] = [
   {
     title: t('room.form.nickname'),
     dataIndex: 'nickName',
-    width: 120
   },
   {
     title: t('room.form.phoneNumber'),
@@ -127,12 +126,11 @@ const columns: TableColumnProps[] = [
   {
     title: t('statistic.firstEnter'),
     dataIndex: 'firstInRoomTime',
-    width: 160
+    
   },
   {
     title: t('statistic.departure'),
     dataIndex: 'lastOutRoomTime',
-    width: 160
   },
   {
     title: t('statistic.amount'),
@@ -142,7 +140,7 @@ const columns: TableColumnProps[] = [
   {
     title: t('statistic.message'),
     dataIndex: 'texts',
-    width: 140
+    ellipsis:true,
   }
 ]