|
@@ -0,0 +1,131 @@
|
|
|
|
|
+<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="媒体ID" field="media_id">
|
|
|
|
|
+ <a-select v-model="searchForm.media_id" placeholder="请选择媒体ID" allow-clear>
|
|
|
|
|
+ <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>
|
|
|
|
|
+ </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 centerCommonApi from "../../api/center/common";
|
|
|
|
|
+import api from '../../api/advert/gamePackage'
|
|
|
|
|
+import commonApi from '../../api/common'
|
|
|
|
|
+
|
|
|
|
|
+// 引用定义
|
|
|
|
|
+const crudRef = ref()
|
|
|
|
|
+const editRef = ref()
|
|
|
|
|
+const mediaOptions = ref([])
|
|
|
|
|
+const gameListTree = ref([])
|
|
|
|
|
+
|
|
|
|
|
+// 搜索表单
|
|
|
|
|
+const searchForm = ref({
|
|
|
|
|
+ media_id: '',
|
|
|
|
|
+ game_id: '',
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+// SaTable 基础配置
|
|
|
|
|
+const options = reactive({
|
|
|
|
|
+ api: api.getPageList,
|
|
|
|
|
+ rowSelection: { showCheckedAll: true },
|
|
|
|
|
+ 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: '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 getGameOptions();
|
|
|
|
|
+ await getMediaOptions()
|
|
|
|
|
+ await getGameListTree()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 获取媒体列表
|
|
|
|
|
+const getMediaOptions = async () => {
|
|
|
|
|
+ const resp = await advertCommonApi.getMediaOptionsApi()
|
|
|
|
|
+ if (resp.code === 200) {
|
|
|
|
|
+ mediaOptions.value = resp.data
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 获取游戏列表
|
|
|
|
|
+// const getGameOptions = async () => {
|
|
|
|
|
+// const resp = await centerCommonApi.getGameOptionsApi();
|
|
|
|
|
+// if (resp.code === 200) {
|
|
|
|
|
+// gameOptions.value = resp.data;
|
|
|
|
|
+// }
|
|
|
|
|
+// };
|
|
|
|
|
+
|
|
|
|
|
+const getGameListTree = async () => {
|
|
|
|
|
+ const resp = await commonApi.getGameListTreeApi({ single: true })
|
|
|
|
|
+ if (resp.code === 200) {
|
|
|
|
|
+ gameListTree.value = resp.data
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// SaTable 数据请求
|
|
|
|
|
+const refresh = async () => {
|
|
|
|
|
+ crudRef.value?.refresh()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 页面加载完成执行
|
|
|
|
|
+onMounted(async () => {
|
|
|
|
|
+ initPage()
|
|
|
|
|
+ refresh()
|
|
|
|
|
+})
|
|
|
|
|
+</script>
|