| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <div class="ma-content-block">
- <sa-table ref="crudRef" :options="options" :columns="columns" :searchForm="searchForm">
- <!-- 搜索区 tableSearch -->
- <template #tableSearch>
- <a-col :sm="8" :xs="24">
- <a-form-item label="媒体类型" field="media_id">
- <a-select v-model="searchForm.media_id" placeholder="请选择媒体类型" allow-clear allow-search>
- <a-option
- v-for="item in mediaOptions"
- :key="item.id"
- :value="item.id"
- :label="`${item.id}:${item.name}`" />
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :sm="8" :xs="24">
- <a-form-item label="游戏" field="game_id">
- <game-select v-model="searchForm.game_id" multiple />
- </a-form-item>
- </a-col>
- </template>
- <!-- Table 自定义渲染 -->
- <template #letter="{ record }"> {{ record.game_id }}_{{ record.letter }} </template>
- </sa-table>
- <!-- 编辑表单 -->
- <edit-form ref="editRef" @success="refresh" />
- </div>
- </template>
- <script setup>
- import { onMounted, ref, reactive } from 'vue'
- import { Message } from '@arco-design/web-vue'
- import EditForm from './edit.vue'
- import advertCommonApi from '../../api/advert/common'
- import api from '../../api/advert/gamePackage'
- import GameSelect from '@/components/game-select/index.vue'
- // 引用定义
- const crudRef = ref()
- const editRef = ref()
- const mediaOptions = ref([])
- // 搜索表单
- const searchForm = ref({
- media_id: '',
- game_id: '',
- })
- // SaTable 基础配置
- const options = reactive({
- api: api.getPageList,
- add: {
- show: true,
- auth: ['/v1/gameLog/GamePackage/save'],
- func: async () => {
- editRef.value?.open()
- },
- },
- edit: {
- show: true,
- auth: ['/v1/gameLog/GamePackage/update'],
- func: async (record) => {
- editRef.value?.open('edit')
- editRef.value?.setFormData(record)
- },
- },
- delete: {
- show: false,
- auth: ['/v1/gameLog/GamePackage/destroy'],
- func: async (params) => {
- const resp = await api.destroy(params)
- if (resp.code === 200) {
- Message.success(`删除成功!`)
- crudRef.value?.refresh()
- }
- },
- },
- })
- // SaTable 列配置
- const columns = reactive([
- { title: 'ID', dataIndex: 'id', width: 80 },
- { title: '游戏ID', dataIndex: 'game_id', width: 80 },
- { title: '母包名称', dataIndex: 'name', width: 220 },
- { title: '打包目录', dataIndex: 'letter', width: 120 },
- { title: '包名', dataIndex: 'package_name', width: 180 },
- { title: 'APPID(头条)', dataIndex: 'tt_appid', width: 180 },
- { title: '账号ID(头条)', dataIndex: 'tt_advertiser_id', width: 180 },
- ])
- // 页面数据初始化
- const initPage = async () => {
- await getMediaOptions()
- }
- // 获取媒体列表
- const getMediaOptions = async () => {
- const resp = await advertCommonApi.getMediaOptionsApi()
- if (resp.code === 200) {
- mediaOptions.value = resp.data
- }
- }
- // SaTable 数据请求
- const refresh = async () => {
- crudRef.value?.refresh()
- }
- // 页面加载完成执行
- onMounted(async () => {
- initPage()
- refresh()
- })
- </script>
|