index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <div class="ma-content-block">
  3. <sa-table ref="crudRef" :options="options" :columns="columns" :searchForm="searchForm">
  4. <!-- 搜索区 tableSearch -->
  5. <template #tableSearch>
  6. <a-col :sm="6" :xs="24">
  7. <a-form-item label="游戏" field="game_id">
  8. <game-select v-model="searchForm.game_id" multiple />
  9. </a-form-item>
  10. </a-col>
  11. <a-col :sm="6" :xs="24">
  12. <a-form-item label="注册日期" field="reg_date">
  13. <a-range-picker class="w-full" v-model="searchForm.reg_date" :show-time="false" mode="date" />
  14. </a-form-item>
  15. </a-col>
  16. <a-col :sm="6" :xs="24">
  17. <a-form-item label="负责人" field="auth_id">
  18. <auth-select v-model="searchForm.auth_id" multiple />
  19. </a-form-item>
  20. </a-col>
  21. <a-col :sm="6" :xs="24">
  22. <a-form-item label="媒体类型" field="media_id">
  23. <media-select v-model="searchForm.media_id" />
  24. </a-form-item>
  25. </a-col>
  26. </template>
  27. <!-- Table 自定义渲染 -->
  28. </sa-table>
  29. </div>
  30. </template>
  31. <script setup>
  32. import { onMounted, ref, reactive } from 'vue'
  33. import api from '../../api/gameLog/analyse'
  34. import dayjs from 'dayjs'
  35. import GameSelect from '@/components/game-select/index.vue'
  36. import MediaSelect from '@/components/media-select/index.vue'
  37. import AuthSelect from '@/components/auth-select/index.vue'
  38. // 引用定义
  39. const crudRef = ref()
  40. const gameList = ref([])
  41. // 搜索表单
  42. const searchForm = ref({
  43. game_id: '',
  44. media_id: '',
  45. auth_id: '',
  46. reg_date: [],
  47. })
  48. // SaTable 基础配置
  49. const options = reactive({
  50. api: api.getDataOverview,
  51. pk: 'date',
  52. showSort: false,
  53. showSummary: true,
  54. operationColumn: false,
  55. summary: [
  56. {
  57. action: 'totalRow',
  58. dataIndex: 'tdate',
  59. },
  60. {
  61. action: 'totalRow',
  62. dataIndex: 'login_total',
  63. },
  64. {
  65. action: 'totalRow',
  66. dataIndex: 'pay_total',
  67. },
  68. {
  69. action: 'totalRow',
  70. dataIndex: 'pay_num',
  71. },
  72. {
  73. action: 'totalRow',
  74. dataIndex: 'pay_rate',
  75. },
  76. {
  77. action: 'totalRow',
  78. dataIndex: 'arpu',
  79. },
  80. {
  81. action: 'totalRow',
  82. dataIndex: 'reg_total',
  83. },
  84. {
  85. action: 'totalRow',
  86. dataIndex: 'reg_login_total',
  87. },
  88. {
  89. action: 'totalRow',
  90. dataIndex: 'act_rate',
  91. },
  92. {
  93. action: 'totalRow',
  94. dataIndex: 'reg_pay_total',
  95. },
  96. {
  97. action: 'totalRow',
  98. dataIndex: 'reg_pay_num',
  99. },
  100. {
  101. action: 'totalRow',
  102. dataIndex: 'reg_pay_rate',
  103. },
  104. {
  105. action: 'totalRow',
  106. dataIndex: 'reg_arpu',
  107. },
  108. {
  109. action: 'totalRow',
  110. dataIndex: 'old_login_total',
  111. },
  112. {
  113. action: 'totalRow',
  114. dataIndex: 'old_pay_total',
  115. },
  116. {
  117. action: 'totalRow',
  118. dataIndex: 'old_pay_num',
  119. },
  120. {
  121. action: 'totalRow',
  122. dataIndex: 'old_pay_rate',
  123. },
  124. {
  125. action: 'totalRow',
  126. dataIndex: 'old_arpu',
  127. },
  128. ],
  129. })
  130. // SaTable 列配置
  131. const columns = reactive([
  132. { title: '日期', dataIndex: 'tdate', width: 120, fixed: 'left' },
  133. {
  134. title: '总用户',
  135. children: [
  136. {
  137. title: 'DAU',
  138. dataIndex: 'login_total',
  139. width: 90,
  140. },
  141. {
  142. title: '付费金额',
  143. dataIndex: 'pay_total',
  144. width: 90,
  145. },
  146. {
  147. title: '付费人数',
  148. dataIndex: 'pay_num',
  149. width: 90,
  150. },
  151. {
  152. title: '付费率',
  153. dataIndex: 'pay_rate',
  154. width: 90,
  155. },
  156. {
  157. title: 'ARPU',
  158. dataIndex: 'arpu',
  159. width: 90,
  160. },
  161. ],
  162. },
  163. {
  164. title: '新用户',
  165. children: [
  166. {
  167. title: '注册数',
  168. dataIndex: 'reg_total',
  169. width: 90,
  170. },
  171. {
  172. title: '登录',
  173. dataIndex: 'reg_login_total',
  174. width: 90,
  175. },
  176. {
  177. title: '次留率',
  178. dataIndex: 'act_rate',
  179. width: 90,
  180. },
  181. {
  182. title: '付费金额',
  183. dataIndex: 'reg_pay_total',
  184. width: 90,
  185. },
  186. {
  187. title: '付费人数',
  188. dataIndex: 'reg_pay_num',
  189. width: 90,
  190. },
  191. {
  192. title: '付费率',
  193. dataIndex: 'reg_pay_rate',
  194. width: 90,
  195. },
  196. {
  197. title: 'ARPU',
  198. dataIndex: 'reg_arpu',
  199. width: 90,
  200. },
  201. ],
  202. },
  203. {
  204. title: '老用户',
  205. children: [
  206. {
  207. title: '登录',
  208. dataIndex: 'old_login_total',
  209. width: 90,
  210. },
  211. {
  212. title: '付费金额',
  213. dataIndex: 'old_pay_total',
  214. width: 90,
  215. },
  216. {
  217. title: '付费人数',
  218. dataIndex: 'old_pay_num',
  219. width: 90,
  220. },
  221. {
  222. title: '付费率',
  223. dataIndex: 'old_pay_rate',
  224. width: 90,
  225. },
  226. {
  227. title: 'ARPU',
  228. dataIndex: 'old_arpu',
  229. width: 90,
  230. },
  231. ],
  232. },
  233. ])
  234. // 页面数据初始化
  235. const initPage = async () => {
  236. searchForm.value.reg_date[0] = dayjs().subtract(8, 'day').format('YYYY-MM-DD')
  237. searchForm.value.reg_date[1] = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
  238. await getGameList()
  239. }
  240. // SaTable 数据请求
  241. const refresh = async () => {
  242. crudRef.value?.refresh()
  243. }
  244. // 页面加载完成执行
  245. onMounted(async () => {
  246. initPage()
  247. refresh()
  248. })
  249. </script>
  250. <script>
  251. export default { name: 'v1/analyse/total' }
  252. </script>