|
@@ -0,0 +1,390 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="p-2">
|
|
|
|
+ <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
|
|
+ <div v-show="showSearch" class="mb-[10px]">
|
|
|
|
+ <el-card shadow="hover">
|
|
|
|
+ <el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
|
|
|
+ <el-form-item prop="id">
|
|
|
|
+ <el-input v-model="queryParams.id" placeholder="渠道" clearable @keyup.enter="handleQuery" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item prop="productId">
|
|
|
|
+ <el-select v-model="queryParams.productId" placeholder="请选择产品ID" clearable>
|
|
|
|
+ <el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item prop="proxyId">
|
|
|
|
+ <el-select v-model="queryParams.proxyId" placeholder="请选择代理商" clearable>
|
|
|
|
+ <el-option v-for="item in categoryList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item prop="accountId">
|
|
|
|
+ <el-input v-model="queryParams.accountId" placeholder="请输入媒体账号ID" clearable @keyup.enter="handleQuery" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item prop="productName">
|
|
|
|
+ <el-input v-model="queryParams.productName" placeholder="请输入产品名" clearable @keyup.enter="handleQuery" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item prop="userName">
|
|
|
|
+ <el-input v-model="queryParams.userName" placeholder="请输入投放人员名称" clearable @keyup.enter="handleQuery" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item prop="name">
|
|
|
|
+ <el-input v-model="queryParams.name" placeholder="请输入渠道名称" clearable @keyup.enter="handleQuery" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item prop="company">
|
|
|
|
+ <el-input v-model="queryParams.company" placeholder="请输入公司名" clearable @keyup.enter="handleQuery" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item prop="operatingMode">
|
|
|
|
+ <el-select v-model="queryParams.operatingMode" placeholder="请选择运营方式" clearable>
|
|
|
|
+<!-- <el-option v-for="dict in dict.type.operating_mode" :key="dict.value" :label="dict.label" :value="dict.value" />-->
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button type="primary" icon="Search" size="small" @click="handleQuery">查询</el-button>
|
|
|
|
+ <el-button type="primary" plain size="small" @click="handleAdd" v-hasPermi="['game:channel:add']">添加渠道</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ </el-card>
|
|
|
|
+ </div>
|
|
|
|
+ </transition>
|
|
|
|
+
|
|
|
|
+ <el-card shadow="never">
|
|
|
|
+ <template #header>
|
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
+ <el-button type="warning" size="small" @click="handleUpdateStatus(1)">批量暂停</el-button>
|
|
|
|
+ <el-button size="small" @click="handleUpdateStatus(0)">批量开启</el-button>
|
|
|
|
+ <el-button size="small" @click="handleActionUpdate">批量修改关键行为</el-button>
|
|
|
|
+ <el-button size="small" @click="handleActiveUpdate">批量修改激活行为</el-button>
|
|
|
|
+ <el-button size="small" @click="handleDeliverUpdate">批量修改投放人员</el-button>
|
|
|
|
+ <el-button size="small" @click="handleProxyUpdate">批量修改代理</el-button>
|
|
|
|
+ <el-button size="small" @click="handleNameUpdate">批量修改渠道名称规则</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+<!-- <right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>-->
|
|
|
|
+ </el-row>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
|
|
+ <el-table v-loading="loading" :data="channelList" @selection-change="handleSelectionChange">
|
|
|
|
+ <el-table-column type="selection" width="50" align="center" />
|
|
|
|
+ <el-table-column label="渠道号" width="80" align="center" prop="id" />
|
|
|
|
+ <el-table-column label="产品ID" width="80" align="center" prop="productId" />
|
|
|
|
+ <el-table-column label="产品名" align="center" prop="productName">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <span v-if="productList.find(cat => cat.id === scope.row.productId)">
|
|
|
|
+ {{ productList.find(cat => cat.id === scope.row.productId).name }}
|
|
|
|
+ </span>
|
|
|
|
+ <span v-else>scope.row.productId</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="投放人员" align="center" prop="userName" />
|
|
|
|
+ <el-table-column label="媒体" align="center" prop="platType" >
|
|
|
|
+ <template #default="scope">
|
|
|
|
+<!-- <dict-tag :options="dict.type.plat_type" :value="scope.row.platType"/>-->
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="渠道名称" align="center" prop="name" />
|
|
|
|
+ <el-table-column label="账号ID" align="center" prop="accountId" />
|
|
|
|
+ <el-table-column label="代理" align="center" prop="proxyId">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <span v-if="proxyList.find(cat => cat.id === scope.row.proxyId)">
|
|
|
|
+ {{ proxyList.find(cat => cat.id === scope.row.proxyId).name }}
|
|
|
|
+ </span>
|
|
|
|
+ <span v-else>scope.row.proxyId</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="公司名" align="center" prop="company" />
|
|
|
|
+ <el-table-column label="投放方式" align="center" prop="deliveryMode">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+<!-- <dict-tag :options="dict.type.delivery_mode" :value="scope.row.deliveryMode"/>-->
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="运营方式" align="center" prop="operatingMode">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+<!-- <dict-tag :options="dict.type.operating_mode" :value="scope.row.operatingMode"/>-->
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="状态" align="center" prop="status">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+<!-- <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>-->
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" width="350">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="info"
|
|
|
|
+ @click="copyToClipboard(scope.row.name)"
|
|
|
|
+ >复制渠道</el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
|
+ v-hasPermi="['miniGame:channel:edit']"
|
|
|
|
+ >修改</el-button>
|
|
|
|
+ <!-- <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ icon="el-icon-delete"
|
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
|
+ v-hasPermi="['miniGame:channel:remove']"
|
|
|
|
+ >删除</el-button>-->
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="warning"
|
|
|
|
+ @click="copyToClipboard(scope.row.url)"
|
|
|
|
+ >获取监测地址</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+
|
|
|
|
+ <pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
|
|
|
|
+ </el-card>
|
|
|
|
+ <!-- 添加或修改渠道对话框 -->
|
|
|
|
+ <el-dialog v-model="dialog.visible" :title="dialog.title" width="500px" append-to-body>
|
|
|
|
+ <el-form ref="channelFormRef" :model="form" :rules="rules" label-width="80px">
|
|
|
|
+ <el-form-item label="产品ID" prop="productId">
|
|
|
|
+ <el-select v-model="form.productId" placeholder="请选择产品ID">
|
|
|
|
+ <el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="代理商ID" prop="proxyId">
|
|
|
|
+ <el-select v-model="form.proxyId" placeholder="请选择代理商ID">
|
|
|
|
+ <el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="媒体账号ID" prop="accountId">
|
|
|
|
+ <el-input v-model="form.accountId" placeholder="请输入媒体账号ID" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="产品名" prop="productName">
|
|
|
|
+ <el-input v-model="form.productName" placeholder="请输入产品名" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="投放人员名称" prop="userName">
|
|
|
|
+ <el-input v-model="form.userName" placeholder="请输入投放人员名称" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="渠道名称" prop="name">
|
|
|
|
+ <el-input v-model="form.name" placeholder="请输入渠道名称" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="公司名" prop="company">
|
|
|
|
+ <el-input v-model="form.company" placeholder="请输入公司名" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="运营方式" prop="operatingMode">
|
|
|
|
+ <el-input v-model="form.operatingMode" placeholder="请输入运营方式" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="投放方式" prop="deliveryMode">
|
|
|
|
+ <el-input v-model="form.deliveryMode" placeholder="请输入投放方式" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="激活上报规则" prop="activeRules">
|
|
|
|
+ <el-input v-model="form.activeRules" type="textarea" placeholder="请输入内容" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="关键行为上报规则" prop="actionRules">
|
|
|
|
+ <el-input v-model="form.actionRules" type="textarea" placeholder="请输入内容" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="是否上报" prop="isReport">
|
|
|
|
+ <el-input v-model="form.isReport" placeholder="请输入是否上报" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <div class="dialog-footer">
|
|
|
|
+ <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script setup name="Channel" lang="ts">
|
|
|
|
+import { listChannel, getChannel, delChannel, addChannel, updateChannel } from '@/api/game/channel';
|
|
|
|
+import { ChannelVO, ChannelQuery, ChannelForm } from '@/api/game/channel/types';
|
|
|
|
+import { ProductVO } from '@/api/game/product/types';
|
|
|
|
+import { ProductCategoryVO } from '@/api/game/productCategory/types';
|
|
|
|
+import { ProductProxyVO } from '@/api/game/productProxy/types';
|
|
|
|
+import {allProduct} from "@/api/game/product";
|
|
|
|
+import {allProductProxy} from "@/api/game/productProxy";
|
|
|
|
+import {allProductCategory} from "@/api/game/productCategory";
|
|
|
|
+
|
|
|
|
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
+const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
|
|
|
|
+
|
|
|
|
+const channelList = ref<ChannelVO[]>([]);
|
|
|
|
+const productList = ref<ProductVO[]>([]);
|
|
|
|
+const categoryList = ref<ProductCategoryVO[]>([]);
|
|
|
|
+const proxyList = ref<ProductProxyVO[]>([]);
|
|
|
|
+const buttonLoading = ref(false);
|
|
|
|
+const loading = ref(true);
|
|
|
|
+const showSearch = ref(true);
|
|
|
|
+const ids = ref<Array<string | number>>([]);
|
|
|
|
+const single = ref(true);
|
|
|
|
+const multiple = ref(true);
|
|
|
|
+const total = ref(0);
|
|
|
|
+
|
|
|
|
+const queryFormRef = ref<ElFormInstance>();
|
|
|
|
+const channelFormRef = ref<ElFormInstance>();
|
|
|
|
+
|
|
|
|
+const dialog = reactive<DialogOption>({
|
|
|
|
+ visible: false,
|
|
|
|
+ title: ''
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+const initFormData: ChannelForm = {
|
|
|
|
+ id: undefined,
|
|
|
|
+ productId: undefined,
|
|
|
|
+ proxyId: undefined,
|
|
|
|
+ accountId: undefined,
|
|
|
|
+ productName: undefined,
|
|
|
|
+ platType: undefined,
|
|
|
|
+ userName: undefined,
|
|
|
|
+ name: undefined,
|
|
|
|
+ company: undefined,
|
|
|
|
+ operatingMode: undefined,
|
|
|
|
+ deliveryMode: undefined,
|
|
|
|
+ activeRules: undefined,
|
|
|
|
+ actionRules: undefined,
|
|
|
|
+ isReport: undefined,
|
|
|
|
+ status: undefined
|
|
|
|
+};
|
|
|
|
+const data = reactive<PageData<ChannelForm, ChannelQuery>>({
|
|
|
|
+ form: { ...initFormData },
|
|
|
|
+ queryParams: {
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ id: undefined,
|
|
|
|
+ productId: undefined,
|
|
|
|
+ proxyId: undefined,
|
|
|
|
+ accountId: undefined,
|
|
|
|
+ productName: undefined,
|
|
|
|
+ platType: undefined,
|
|
|
|
+ userName: undefined,
|
|
|
|
+ name: undefined,
|
|
|
|
+ company: undefined,
|
|
|
|
+ operatingMode: undefined,
|
|
|
|
+ deliveryMode: undefined,
|
|
|
|
+ activeRules: undefined,
|
|
|
|
+ actionRules: undefined,
|
|
|
|
+ isReport: undefined,
|
|
|
|
+ status: undefined,
|
|
|
|
+ params: {}
|
|
|
|
+ },
|
|
|
|
+ rules: {
|
|
|
|
+ id: [{ required: true, message: '渠道ID不能为空', trigger: 'blur' }],
|
|
|
|
+ productId: [{ required: true, message: '产品ID不能为空', trigger: 'change' }],
|
|
|
|
+ proxyId: [{ required: true, message: '代理商ID不能为空', trigger: 'change' }],
|
|
|
|
+ accountId: [{ required: true, message: '媒体账号ID不能为空', trigger: 'blur' }],
|
|
|
|
+ productName: [{ required: true, message: '产品名不能为空', trigger: 'blur' }],
|
|
|
|
+ platType: [{ required: true, message: '媒体类型不能为空', trigger: 'change' }],
|
|
|
|
+ userName: [{ required: true, message: '投放人员名称不能为空', trigger: 'blur' }],
|
|
|
|
+ name: [{ required: true, message: '渠道名称不能为空', trigger: 'blur' }],
|
|
|
|
+ company: [{ required: true, message: '公司名不能为空', trigger: 'blur' }],
|
|
|
|
+ operatingMode: [{ required: true, message: '运营方式不能为空', trigger: 'blur' }],
|
|
|
|
+ deliveryMode: [{ required: true, message: '投放方式不能为空', trigger: 'blur' }],
|
|
|
|
+ activeRules: [{ required: true, message: '激活上报规则不能为空', trigger: 'blur' }],
|
|
|
|
+ actionRules: [{ required: true, message: '关键行为上报规则不能为空', trigger: 'blur' }],
|
|
|
|
+ isReport: [{ required: true, message: '是否上报不能为空', trigger: 'blur' }],
|
|
|
|
+ status: [{ required: true, message: '状态不能为空', trigger: 'change' }]
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+const { queryParams, form, rules } = toRefs(data);
|
|
|
|
+
|
|
|
|
+/** 查询渠道列表 */
|
|
|
|
+const getList = async () => {
|
|
|
|
+ loading.value = true;
|
|
|
|
+ const res = await listChannel(queryParams.value);
|
|
|
|
+ channelList.value = res.rows;
|
|
|
|
+ total.value = res.total;
|
|
|
|
+ loading.value = false;
|
|
|
|
+ productList.value = await allProduct();
|
|
|
|
+ proxyList.value = await allProductProxy();
|
|
|
|
+ categoryList.value = await allProductCategory();
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 取消按钮 */
|
|
|
|
+const cancel = () => {
|
|
|
|
+ reset();
|
|
|
|
+ dialog.visible = false;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 表单重置 */
|
|
|
|
+const reset = () => {
|
|
|
|
+ form.value = { ...initFormData };
|
|
|
|
+ channelFormRef.value?.resetFields();
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 搜索按钮操作 */
|
|
|
|
+const handleQuery = () => {
|
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
|
+ getList();
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 重置按钮操作 */
|
|
|
|
+const resetQuery = () => {
|
|
|
|
+ queryFormRef.value?.resetFields();
|
|
|
|
+ handleQuery();
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 多选框选中数据 */
|
|
|
|
+const handleSelectionChange = (selection: ChannelVO[]) => {
|
|
|
|
+ ids.value = selection.map((item) => item.id);
|
|
|
|
+ single.value = selection.length != 1;
|
|
|
|
+ multiple.value = !selection.length;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 新增按钮操作 */
|
|
|
|
+const handleAdd = () => {
|
|
|
|
+ reset();
|
|
|
|
+ dialog.visible = true;
|
|
|
|
+ dialog.title = '添加渠道';
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 修改按钮操作 */
|
|
|
|
+const handleUpdate = async (row?: ChannelVO) => {
|
|
|
|
+ reset();
|
|
|
|
+ const _id = row?.id || ids.value[0];
|
|
|
|
+ const res = await getChannel(_id);
|
|
|
|
+ Object.assign(form.value, res.data);
|
|
|
|
+ dialog.visible = true;
|
|
|
|
+ dialog.title = '修改渠道';
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 提交按钮 */
|
|
|
|
+const submitForm = () => {
|
|
|
|
+ channelFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ buttonLoading.value = true;
|
|
|
|
+ if (form.value.id) {
|
|
|
|
+ await updateChannel(form.value).finally(() => (buttonLoading.value = false));
|
|
|
|
+ } else {
|
|
|
|
+ await addChannel(form.value).finally(() => (buttonLoading.value = false));
|
|
|
|
+ }
|
|
|
|
+ proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
+ dialog.visible = false;
|
|
|
|
+ await getList();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 删除按钮操作 */
|
|
|
|
+const handleDelete = async (row?: ChannelVO) => {
|
|
|
|
+ const _ids = row?.id || ids.value;
|
|
|
|
+ await proxy?.$modal.confirm('是否确认删除渠道编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
|
|
|
+ await delChannel(_ids);
|
|
|
|
+ proxy?.$modal.msgSuccess('删除成功');
|
|
|
|
+ await getList();
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 导出按钮操作 */
|
|
|
|
+const handleExport = () => {
|
|
|
|
+ proxy?.download(
|
|
|
|
+ 'game/channel/export',
|
|
|
|
+ {
|
|
|
|
+ ...queryParams.value
|
|
|
|
+ },
|
|
|
|
+ `channel_${new Date().getTime()}.xlsx`
|
|
|
|
+ );
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+onMounted(() => {
|
|
|
|
+ getList();
|
|
|
|
+});
|
|
|
|
+</script>
|