ith5 пре 5 месеци
родитељ
комит
6cad3b749f

+ 2 - 1
src/components/sa-table/index.vue

@@ -489,7 +489,8 @@ const __summary = ({ data }) => {
         if (item.action && item.action === 'totalRow') {
           // 检查 totalRow 数据是否存在
           if (tableData.totalRow && typeof tableData.totalRow === 'object') {
-            summaryData[item.dataIndex] = tableData.totalRow[item.dataIndex] || 0
+            summaryData[item.dataIndex] =
+              tableData.totalRow[item.dataIndex] !== undefined ? tableData.totalRow[item.dataIndex] : ''
             console.log(`totalRow[${item.dataIndex}]:`, tableData.totalRow[item.dataIndex])
           } else {
             console.log('tableData.totalRow 不存在或格式不正确:', tableData.totalRow)

+ 10 - 0
src/views/v1/api/gameLog/analyse.js

@@ -33,5 +33,15 @@ export default {
       method: 'get',
       params
     })
+  },
+  /**
+   * 数据总览
+   */
+  getDataOverview(params = {}) {
+    return request({
+      url: '/v1/gameLog/analyse/getDataOverview',
+      method: 'get',
+      params
+    })
   }
 }

+ 1 - 0
src/views/v1/api/gameLog/channelAnalysis.js

@@ -25,6 +25,7 @@ export default {
       params
     })
   },
+
   /**
    * 渠道总览
    */

+ 259 - 0
src/views/v1/gameLog/total/index.vue

@@ -0,0 +1,259 @@
+<template>
+  <div class="ma-content-block">
+    <sa-table ref="crudRef" :options="options" :columns="columns" :searchForm="searchForm">
+      <!-- 搜索区 tableSearch -->
+      <template #tableSearch>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="游戏" field="game_id">
+            <game-select v-model="searchForm.game_id" multiple />
+          </a-form-item>
+        </a-col>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="注册日期" field="reg_date">
+            <a-range-picker class="w-full" v-model="searchForm.reg_date" :show-time="false" mode="date" />
+          </a-form-item>
+        </a-col>
+
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="负责人" field="auth_id">
+            <auth-select v-model="searchForm.auth_id" />
+          </a-form-item>
+        </a-col>
+        <a-col :sm="8" :xs="24">
+          <a-form-item label="媒体类型" field="media_id">
+            <media-select v-model="searchForm.media_id" />
+          </a-form-item>
+        </a-col>
+      </template>
+
+      <!-- Table 自定义渲染 -->
+    </sa-table>
+  </div>
+</template>
+
+<script setup>
+import { onMounted, ref, reactive } from 'vue'
+import api from '../../api/gameLog/analyse'
+import dayjs from 'dayjs'
+import GameSelect from '@/components/game-select/index.vue'
+import MediaSelect from '@/components/media-select/index.vue'
+import AuthSelect from '@/components/auth-select/index.vue'
+
+// 引用定义
+const crudRef = ref()
+const gameList = ref([])
+
+// 搜索表单
+const searchForm = ref({
+  game_id: '',
+  media_id: '',
+  auth_id: '',
+  reg_date: [],
+})
+
+// SaTable 基础配置
+const options = reactive({
+  api: api.getDataOverview,
+  pk: 'date',
+  showSort: false,
+  showSummary: true,
+  operationColumn: false,
+  summary: [
+    {
+      action: 'totalRow',
+      dataIndex: 'tdate',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'login_total',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'pay_total',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'pay_num',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'pay_rate',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'arpu',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'reg_total',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'reg_login_total',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'act_rate',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'reg_pay_total',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'reg_pay_num',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'reg_pay_rate',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'reg_arpu',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'old_login_total',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'old_pay_total',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'old_pay_num',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'old_pay_rate',
+    },
+    {
+      action: 'totalRow',
+      dataIndex: 'old_arpu',
+    },
+  ],
+})
+
+// SaTable 列配置
+const columns = reactive([
+  { title: '日期', dataIndex: 'tdate', width: 120, fixed: 'left' },
+  {
+    title: '总用户',
+    children: [
+      {
+        title: 'DAU',
+        dataIndex: 'login_total',
+        width: 90,
+      },
+      {
+        title: '付费金额',
+        dataIndex: 'pay_total',
+        width: 90,
+      },
+      {
+        title: '付费人数',
+        dataIndex: 'pay_num',
+        width: 90,
+      },
+      {
+        title: '付费率',
+        dataIndex: 'pay_rate',
+        width: 90,
+      },
+      {
+        title: 'ARPU',
+        dataIndex: 'arpu',
+        width: 90,
+      },
+    ],
+  },
+  {
+    title: '新用户',
+    children: [
+      {
+        title: '注册数',
+        dataIndex: 'reg_total',
+        width: 90,
+      },
+      {
+        title: '登录',
+        dataIndex: 'reg_login_total',
+        width: 90,
+      },
+      {
+        title: '次留率',
+        dataIndex: 'act_rate',
+        width: 90,
+      },
+      {
+        title: '付费金额',
+        dataIndex: 'reg_pay_total',
+        width: 90,
+      },
+      {
+        title: '付费人数',
+        dataIndex: 'reg_pay_num',
+        width: 90,
+      },
+      {
+        title: '付费率',
+        dataIndex: 'reg_pay_rate',
+        width: 90,
+      },
+      {
+        title: 'ARPU',
+        dataIndex: 'reg_arpu',
+        width: 90,
+      },
+    ],
+  },
+  {
+    title: '老用户',
+    children: [
+      {
+        title: '登录',
+        dataIndex: 'old_login_total',
+        width: 90,
+      },
+      {
+        title: '付费金额',
+        dataIndex: 'old_pay_total',
+        width: 90,
+      },
+      {
+        title: '付费人数',
+        dataIndex: 'old_pay_num',
+        width: 90,
+      },
+      {
+        title: '付费率',
+        dataIndex: 'old_pay_rate',
+        width: 90,
+      },
+      {
+        title: 'ARPU',
+        dataIndex: 'old_arpu',
+        width: 90,
+      },
+    ],
+  },
+])
+
+// 页面数据初始化
+const initPage = async () => {
+  searchForm.value.reg_date[0] = dayjs().subtract(8, 'day').format('YYYY-MM-DD')
+  searchForm.value.reg_date[1] = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
+  await getGameList()
+}
+
+// SaTable 数据请求
+const refresh = async () => {
+  crudRef.value?.refresh()
+}
+
+// 页面加载完成执行
+onMounted(async () => {
+  initPage()
+  refresh()
+})
+</script>