index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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="gameListTree"
  11. tree-checked-strategy="child"
  12. :tree-checkable="false"
  13. :max-tag-count="2"
  14. :fieldNames="{ title: 'name', key: 'id' }"
  15. allow-search
  16. allow-clear
  17. placeholder="请选择游戏"
  18. /> -->
  19. <game-select v-model="searchForm.game_id" />
  20. </a-form-item>
  21. </a-col>
  22. <a-col :sm="8" :xs="24">
  23. <a-form-item label="渠道ID" field="agent_id">
  24. <a-input v-model="searchForm.agent_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. </template>
  33. <template #site_id="{ record }"> [{{ record.site_id }}] {{ record.site_name }} </template>
  34. <template #agent_id="{ record }"> [{{ record.agent_id }}] {{ record.agent_name }} </template>
  35. <!-- Table 自定义渲染 -->
  36. </sa-table>
  37. <!-- 编辑表单 -->
  38. <edit-form ref="editRef" @success="refresh" />
  39. </div>
  40. </template>
  41. <script setup>
  42. import { onMounted, ref, reactive } from 'vue'
  43. import { Message } from '@arco-design/web-vue'
  44. import EditForm from './edit.vue'
  45. import api from '../../api/advert/gamePackageLog'
  46. import commonApi from '../../api/common'
  47. import GameSelect from '@/components/game-select/index.vue'
  48. // 引用定义
  49. const crudRef = ref()
  50. const editRef = ref()
  51. // 搜索表单
  52. const searchForm = ref({
  53. game_name: '',
  54. })
  55. // SaTable 基础配置
  56. const options = reactive({
  57. api: api.getPageList,
  58. operationColumn: false,
  59. add: {
  60. show: false,
  61. auth: ['/v1/gameLog/GamePackLog/save'],
  62. func: async () => {
  63. editRef.value?.open()
  64. },
  65. },
  66. edit: {
  67. show: false,
  68. auth: ['/v1/gameLog/GamePackLog/update'],
  69. func: async (record) => {
  70. editRef.value?.open('edit')
  71. editRef.value?.setFormData(record)
  72. },
  73. },
  74. delete: {
  75. show: false,
  76. auth: ['/v1/gameLog/GamePackLog/destroy'],
  77. func: async (params) => {
  78. const resp = await api.destroy(params)
  79. if (resp.code === 200) {
  80. Message.success(`删除成功!`)
  81. crudRef.value?.refresh()
  82. }
  83. },
  84. },
  85. })
  86. // SaTable 列配置
  87. const columns = reactive([
  88. { title: '广告位ID', dataIndex: 'site_id', width: 120 },
  89. { title: '渠道ID', dataIndex: 'agent_id', width: 120 },
  90. { title: '游戏', dataIndex: 'game_name', width: 160 },
  91. { title: '目录', dataIndex: 'letter', width: 180 },
  92. { title: 'icon', dataIndex: 'icon', type: 'image', width: 120 },
  93. {
  94. title: '状态',
  95. dataIndex: 'status',
  96. type: 'dict',
  97. dict: 'package_status',
  98. width: 180,
  99. },
  100. { title: '创建时间', dataIndex: 'create_time', width: 180, type: 'date' },
  101. { title: '更新时间', dataIndex: 'update_time', width: 180, type: 'date' },
  102. ])
  103. // 页面数据初始化
  104. const initPage = async () => {}
  105. // SaTable 数据请求
  106. const refresh = async () => {
  107. crudRef.value?.refresh()
  108. }
  109. // 页面加载完成执行
  110. onMounted(async () => {
  111. initPage()
  112. refresh()
  113. })
  114. </script>