index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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="game_id">
  8. <!-- <a-tree-select
  9. v-model="searchForm.game_id"
  10. :data="gameList"
  11. placeholder="请选择游戏"
  12. allow-clear
  13. :field-names="{ title: 'name', key: 'id' }"
  14. allow-search
  15. tree-checked-strategy="child"
  16. :tree-checkable="true"
  17. :max-tag-count="1"
  18. /> -->
  19. <game-select v-model="searchForm.game_id" multiple />
  20. </a-form-item>
  21. </a-col>
  22. <a-col :sm="8" :xs="24">
  23. <a-form-item label="媒体ID" field="media_id">
  24. <a-input v-model="searchForm.media_id" placeholder="请输入媒体ID" allow-clear />
  25. </a-form-item>
  26. </a-col>
  27. <a-col :sm="8" :xs="24">
  28. <a-form-item label="广告位id" field="site_id">
  29. <a-input v-model="searchForm.site_id" placeholder="请输入广告位id" allow-clear />
  30. </a-form-item>
  31. </a-col>
  32. <a-col :sm="8" :xs="24">
  33. <a-form-item label="负责人ID" field="auth_id">
  34. <a-input v-model="searchForm.auth_id" placeholder="请输入负责人ID" allow-clear />
  35. </a-form-item>
  36. </a-col>
  37. <a-col :sm="8" :xs="24">
  38. <a-form-item label="用户名" field="user_name">
  39. <a-input v-model="searchForm.user_name" placeholder="请输入用户名" allow-clear />
  40. </a-form-item>
  41. </a-col>
  42. <a-col :sm="8" :xs="24">
  43. <a-form-item label="注册日期" field="reg_time">
  44. <a-date-picker
  45. class="w-full"
  46. v-model="searchForm.reg_time"
  47. :show-time="false"
  48. mode="date"
  49. placeholder="请选择注册日期" />
  50. </a-form-item>
  51. </a-col>
  52. </template>
  53. <!-- Table 自定义渲染 -->
  54. <template #roles="{ record }">
  55. <div v-if="record && record.roles && record.roles.length > 0">
  56. <p v-for="(role, index) in record.roles" :key="`${role.role_name}-${index}`">
  57. {{ role.server_name }} {{ role.role_name }} ({{ role.role_level }})
  58. </p>
  59. </div>
  60. <div v-else>
  61. <span>-</span>
  62. </div>
  63. </template>
  64. </sa-table>
  65. </div>
  66. </template>
  67. <script setup>
  68. import { onMounted, ref, reactive } from 'vue'
  69. import { Message } from '@arco-design/web-vue'
  70. import api from '../../api/gameLog/roleData'
  71. import dayjs from 'dayjs'
  72. import commonApi from '../../api/common'
  73. import GameSelect from '@/components/game-select/index.vue'
  74. // 引用定义
  75. const crudRef = ref()
  76. const gameList = ref([])
  77. // 搜索表单
  78. const searchForm = ref({
  79. game_id: '',
  80. media_id: '',
  81. site_id: '',
  82. auth_id: '',
  83. user_name: '',
  84. reg_time: '',
  85. })
  86. // SaTable 基础配置
  87. const options = reactive({
  88. api: api.getPageList,
  89. rowSelection: { showCheckedAll: true },
  90. operationColumn: false,
  91. showSort: false,
  92. })
  93. // SaTable 列配置
  94. const columns = reactive([
  95. { title: '用户名', dataIndex: 'user_name', width: 120 },
  96. { title: '游戏名', dataIndex: 'game_name', width: 120 },
  97. { title: '渠道id', dataIndex: 'agent_id', width: 100 },
  98. { title: '广告位id', dataIndex: 'site_id', width: 100 },
  99. { title: '注册IP', dataIndex: 'ip', width: 180 },
  100. { title: '注册时间', dataIndex: 'create_time', width: 180 },
  101. { title: '角色信息', width: 180, dataIndex: 'roles' },
  102. { title: '渠道名', dataIndex: 'agent_name', width: 120 },
  103. { title: '负责人', dataIndex: 'auth_name', width: 120 },
  104. ])
  105. // 页面数据初始化
  106. const initPage = async () => {
  107. searchForm.value.reg_time = dayjs().format('YYYY-MM-DD')
  108. await getGameList()
  109. }
  110. // 获取游戏列表
  111. const getGameList = async () => {
  112. const res = await commonApi.getGameListTreeApi()
  113. if (res.code === 200) {
  114. gameList.value = res.data
  115. }
  116. }
  117. // SaTable 数据请求
  118. const refresh = async () => {
  119. crudRef.value?.refresh()
  120. }
  121. // 页面加载完成执行
  122. onMounted(async () => {
  123. initPage()
  124. refresh()
  125. })
  126. </script>