index.vue 4.4 KB

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