index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. <game-select v-model="searchForm.game_id" multiple />
  9. </a-form-item>
  10. </a-col>
  11. <a-col :sm="8" :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="8" :xs="24">
  17. <a-form-item label="作者" field="author_id">
  18. <author-select v-model="searchForm.author_id" />
  19. </a-form-item>
  20. </a-col>
  21. <a-col :sm="8" :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. <a-col :sm="8" :xs="24">
  27. <a-form-item label="消耗筛选" field="cost_type">
  28. <a-select v-model="searchForm.cost_type" placeholder="请选择消耗筛选" :options="costTypeOptions" />
  29. </a-form-item>
  30. </a-col>
  31. <a-col :sm="8" :xs="24">
  32. <a-form-item label="素材名称" field="material_name">
  33. <a-input v-model="searchForm.material_name" placeholder="请输入素材名称" allow-clear />
  34. </a-form-item>
  35. </a-col>
  36. <a-col :sm="8" :xs="24">
  37. <a-form-item label="素材ID" field="material_id">
  38. <a-input v-model="searchForm.material_id" placeholder="请输入素材ID" allow-clear />
  39. </a-form-item>
  40. </a-col>
  41. <a-col :sm="8" :xs="24">
  42. <a-form-item label="投手" field="auth_id">
  43. <auth-select v-model="searchForm.auth_id" multiple />
  44. </a-form-item>
  45. </a-col>
  46. <a-col :sm="8" :xs="24">
  47. <a-form-item label="归类" field="group">
  48. <a-select v-model="searchForm.group" placeholder="请选择归类" :options="groupOptions" />
  49. </a-form-item>
  50. </a-col>
  51. </template>
  52. <!-- Table 自定义渲染 -->
  53. </sa-table>
  54. </div>
  55. </template>
  56. <script setup>
  57. import { onMounted, ref, reactive } from 'vue'
  58. import api from '@/views/v1/api/gameLog/material'
  59. import dayjs from 'dayjs'
  60. import GameSelect from '@/components/game-select/index.vue'
  61. import MediaSelect from '@/components/media-select/index.vue'
  62. import AuthorSelect from '@/components/author-select/index.vue'
  63. import AuthSelect from '@/components/auth-select/index.vue'
  64. // 引用定义
  65. const crudRef = ref()
  66. const costTypeOptions = ref([
  67. {
  68. value: 1,
  69. label: '2000消耗以上(包括2000)',
  70. },
  71. {
  72. value: 2,
  73. label: '2000消耗以下',
  74. },
  75. ])
  76. const groupOptions = ref([
  77. {
  78. value: 1,
  79. label: '按素材ID',
  80. },
  81. {
  82. value: 2,
  83. label: '按作者',
  84. },
  85. {
  86. value: 3,
  87. label: '按素材ID + 投手',
  88. },
  89. ])
  90. // 搜索表单
  91. const searchForm = ref({
  92. game_id: '',
  93. media_id: '',
  94. auth_id: '',
  95. agent_id: '',
  96. site_id: '',
  97. reg_date: [],
  98. cost_type: '',
  99. material_name: '',
  100. material_id: '',
  101. group: 1,
  102. })
  103. // SaTable 基础配置
  104. const options = reactive({
  105. api: api.getMaterialListApi,
  106. pk: 'id',
  107. showSort: false,
  108. operationColumn: false,
  109. showSummary: true,
  110. summary: [
  111. {
  112. action: 'totalRow',
  113. dataIndex: 'cost',
  114. },
  115. {
  116. action: 'totalRow',
  117. dataIndex: 'ad_show',
  118. },
  119. {
  120. action: 'totalRow',
  121. dataIndex: 'click',
  122. },
  123. {
  124. action: 'totalRow',
  125. dataIndex: 'ad_click_rate',
  126. },
  127. {
  128. action: 'totalRow',
  129. dataIndex: 'active',
  130. },
  131. {
  132. action: 'totalRow',
  133. dataIndex: 'register',
  134. },
  135. {
  136. action: 'totalRow',
  137. dataIndex: 'reg_cost',
  138. },
  139. {
  140. action: 'totalRow',
  141. dataIndex: 'pay_amount',
  142. },
  143. {
  144. action: 'totalRow',
  145. dataIndex: 'pay_cost',
  146. },
  147. ],
  148. })
  149. // SaTable 列配置
  150. const columns = reactive([
  151. { title: '素材ID', dataIndex: 'material_id', width: 120 },
  152. { title: '素材名称', dataIndex: 'material_name', width: 290 },
  153. { title: '作者', dataIndex: 'author_id', width: 120 },
  154. { title: '投手', dataIndex: 'auth_id', width: 120 },
  155. { title: '消耗', dataIndex: 'cost', width: 120 },
  156. { title: '展示数', dataIndex: 'ad_show', width: 120 },
  157. { title: '点击数', dataIndex: 'click', width: 120 },
  158. { title: '点击率', dataIndex: 'ad_click_rate', width: 120 },
  159. { title: '激活数', dataIndex: 'active', width: 120 },
  160. { title: '注册数', dataIndex: 'register', width: 120 },
  161. { title: '注册成本', dataIndex: 'reg_cost', width: 120 },
  162. { title: '付费数', dataIndex: 'pay_amount', width: 120 },
  163. { title: '付费成本', dataIndex: 'pay_cost', width: 120 },
  164. ])
  165. // 页面数据初始化
  166. const initPage = async () => {
  167. searchForm.value.reg_date[0] = dayjs().subtract(8, 'day').format('YYYY-MM-DD')
  168. searchForm.value.reg_date[1] = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
  169. }
  170. // SaTable 数据请求
  171. const refresh = async () => {
  172. crudRef.value?.refresh()
  173. }
  174. // 页面加载完成执行
  175. onMounted(async () => {
  176. initPage()
  177. refresh()
  178. })
  179. </script>