index.vue 4.4 KB

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