index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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="8" :xs="24">
  7. <a-form-item label="用户名" field="user_name">
  8. <a-input v-model="searchForm.user_name" placeholder="请输入用户名" allow-clear />
  9. </a-form-item>
  10. </a-col>
  11. <a-col :sm="8" :xs="24">
  12. <a-form-item label="游戏" field="game_id">
  13. <!-- <a-tree-select
  14. v-model="searchForm.game_id"
  15. :data="gameList"
  16. placeholder="请选择游戏"
  17. allow-clear
  18. :field-names="{ title: 'name', key: 'id' }"
  19. allow-search
  20. tree-checked-strategy="child"
  21. :tree-checkable="true"
  22. :max-tag-count="1"
  23. /> -->
  24. <game-select v-model="searchForm.game_id" multiple />
  25. </a-form-item>
  26. </a-col>
  27. <a-col :sm="8" :xs="24">
  28. <a-form-item label="媒体类型" field="media_id">
  29. <a-select v-model="searchForm.media_id" placeholder="请选择媒体类型" allow-clear allow-search>
  30. <a-option
  31. v-for="item in mediaOptions"
  32. :key="item.id"
  33. :value="item.id"
  34. :label="`${item.id}:${item.name}`" />
  35. </a-select>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :sm="8" :xs="24">
  39. <a-form-item label="渠道id" field="agent_id">
  40. <a-input v-model="searchForm.agent_id" placeholder="请输入渠道id" allow-clear />
  41. </a-form-item>
  42. </a-col>
  43. <a-col :sm="8" :xs="24">
  44. <a-form-item label="广告位id" field="site_id">
  45. <a-input v-model="searchForm.site_id" placeholder="请输入广告位id" allow-clear />
  46. </a-form-item>
  47. </a-col>
  48. <a-col :sm="8" :xs="24">
  49. <a-form-item label="负责人" field="auth_id">
  50. <auth-select v-model="searchForm.auth_id" multiple />
  51. </a-form-item>
  52. </a-col>
  53. <a-col :sm="8" :xs="24">
  54. <a-form-item label="登录日期" field="login_time">
  55. <a-range-picker class="w-full" v-model="searchForm.login_time" :clearable="false" />
  56. </a-form-item>
  57. </a-col>
  58. <a-col :sm="8" :xs="24">
  59. <a-form-item label="注册日期" field="reg_time">
  60. <a-range-picker class="w-full" v-model="searchForm.reg_time" />
  61. </a-form-item>
  62. </a-col>
  63. </template>
  64. <template #login_time="{ record }">
  65. {{ dayjs(record.login_time * 1000).format('YYYY-MM-DD HH:mm:ss') }}
  66. </template>
  67. <template #reg_time="{ record }">
  68. {{ dayjs(record.reg_time * 1000).format('YYYY-MM-DD HH:mm:ss') }}
  69. </template>
  70. <!-- Table 自定义渲染 -->
  71. </sa-table>
  72. <!-- 编辑表单 -->
  73. <edit-form ref="editRef" @success="refresh" />
  74. </div>
  75. </template>
  76. <script setup>
  77. import { onMounted, ref, reactive } from 'vue'
  78. import EditForm from './edit.vue'
  79. import api from '../../api/gameLog/sdkLoginLog'
  80. import commonApi from '../../api/common'
  81. import dayjs from 'dayjs'
  82. import GameSelect from '@/components/game-select/index.vue'
  83. import AuthSelect from '@/components/auth-select/index.vue'
  84. // 引用定义
  85. const crudRef = ref()
  86. const editRef = ref()
  87. const mediaOptions = ref()
  88. // 搜索表单
  89. const searchForm = ref({
  90. user_name: '',
  91. game_id: '',
  92. media_id: '',
  93. agent_id: '',
  94. site_id: '',
  95. auth_id: '',
  96. login_time: [dayjs().format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
  97. reg_time: [],
  98. })
  99. // SaTable 基础配置
  100. const options = reactive({
  101. api: api.getPageList,
  102. rowSelection: { showCheckedAll: true },
  103. operationColumn: false,
  104. showSort: false,
  105. })
  106. // SaTable 列配置
  107. const columns = reactive([
  108. { title: '用户名', dataIndex: 'user_name', width: 80 },
  109. { title: '游戏', dataIndex: 'game_name', width: 120 },
  110. { title: '媒体ID', dataIndex: 'media_id', width: 80 },
  111. { title: '广告位id', dataIndex: 'site_id', width: 100 },
  112. { title: '登录IP', dataIndex: 'ip', width: 180 },
  113. { title: '登录IMEI/IDFA', dataIndex: 'imei', width: 180 },
  114. { title: '登录OAID/CID', dataIndex: 'oaid', width: 180 },
  115. { title: '登录时间', dataIndex: 'login_time', width: 140 },
  116. { title: '注册时间', dataIndex: 'reg_time', width: 140 },
  117. { title: '手机品牌', dataIndex: 'brand', width: 120 },
  118. { title: '手机型号', dataIndex: 'model', width: 120 },
  119. { title: '系统版本', dataIndex: 'system_version', width: 100 },
  120. { title: 'sdk版本', dataIndex: 'sdk_version', width: 100 },
  121. { title: '设备类型', dataIndex: 'vt', type: 'dict', dict: 'vt', width: 120 },
  122. { title: '渠道名', dataIndex: 'agent_name', width: 100 },
  123. { title: '负责人', dataIndex: 'auth_name', width: 100 },
  124. ])
  125. // 获取媒体类型
  126. const getMediaOptions = async () => {
  127. const resp = await commonApi.getMediaOptionsApi()
  128. if (resp.code === 200) {
  129. mediaOptions.value = resp.data
  130. }
  131. }
  132. // 页面数据初始化
  133. const initPage = async () => {
  134. await getMediaOptions()
  135. }
  136. // SaTable 数据请求
  137. const refresh = async () => {
  138. crudRef.value?.refresh()
  139. }
  140. // 页面加载完成执行
  141. onMounted(async () => {
  142. initPage()
  143. refresh()
  144. })
  145. </script>
  146. <script>
  147. export default { name: 'v1/user-logs/sdkLoginLog' }
  148. </script>