|
@@ -1,42 +1,133 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { TableFilterType } from '@/types/Tables/table'
|
|
|
-
|
|
|
import type {
|
|
|
- SearchFilterItem,
|
|
|
- SelectFilterItem,
|
|
|
- DateFilterItem,
|
|
|
- TableProps,
|
|
|
- TableFilterItem,
|
|
|
+ TableData,
|
|
|
+ FilterInfo,
|
|
|
+ TableInfoItem,
|
|
|
+ BaseFieldItem,
|
|
|
+ TableFields,
|
|
|
} from '@/types/Tables/table'
|
|
|
import type { BaseMenu } from '@/types/Promotion/Menu'
|
|
|
+import type {
|
|
|
+ AdmgeTTAccData,
|
|
|
+ AdmgeTTProjData,
|
|
|
+ AdmgeTTAdData,
|
|
|
+} from '@/types/Tables/tableData/ttAd'
|
|
|
+import type {
|
|
|
+ AdmgeTTAccFileds,
|
|
|
+ AdmgeTTProjFileds,
|
|
|
+ AdmgeTTAdFileds,
|
|
|
+} from '@/types/Tables/tableData/ttAd'
|
|
|
|
|
|
+import { TableFilterType } from '@/types/Tables/table'
|
|
|
+
|
|
|
+import { useRequest } from '@/hooks/useRequest'
|
|
|
import { useDate } from '@/hooks/useDate'
|
|
|
-import { ref } from 'vue'
|
|
|
+import { onMounted, reactive, ref } from 'vue'
|
|
|
+import { useTable } from '@/hooks/useTable'
|
|
|
|
|
|
import Menu from '@/components/navigation/Menu.vue'
|
|
|
import Table from '@/components/table/Table.vue'
|
|
|
|
|
|
+interface TableInfo {
|
|
|
+ [key: string]: any
|
|
|
+ account: TableInfoItem<AdmgeTTAccData, BaseFieldItem<AdmgeTTAccFileds>> // 账户信息
|
|
|
+ project: TableInfoItem<AdmgeTTProjData, BaseFieldItem<AdmgeTTProjFileds>> // 项目信息
|
|
|
+ advertise: TableInfoItem<AdmgeTTAdData, BaseFieldItem<AdmgeTTAdFileds>> // 广告信息
|
|
|
+}
|
|
|
+// interface TableInfo {
|
|
|
+// [key: string]: any
|
|
|
+// account: TableInfoItem<AdmgeTTAccData, AdmgeTTAccFileds> // 账户信息
|
|
|
+// project: TableInfoItem<AdmgeTTProjData, AdmgeTTProjFileds> // 项目信息
|
|
|
+// advertise: TableInfoItem<AdmgeTTAdData, AdmgeTTAdFileds> // 广告信息
|
|
|
+// }
|
|
|
+
|
|
|
+interface AllFieldsInfo {
|
|
|
+ [key: string]: any
|
|
|
+ account: AdmgeTTAccFileds[]
|
|
|
+ project: AdmgeTTProjFileds[]
|
|
|
+ advertise: AdmgeTTAdFileds[]
|
|
|
+}
|
|
|
+// interface AllFieldsInfo {
|
|
|
+// [key: string]: BaseFieldItem<TableFields>[]
|
|
|
+// account: BaseFieldItem<AdmgeTTAccFileds>[]
|
|
|
+// project: BaseFieldItem<AdmgeTTProjFileds>[]
|
|
|
+// advertise: BaseFieldItem<AdmgeTTAdFileds>[]
|
|
|
+// }
|
|
|
+
|
|
|
+interface AllFilterInfo {
|
|
|
+ [key: string]: FilterInfo
|
|
|
+ account: FilterInfo
|
|
|
+ project: FilterInfo
|
|
|
+ advertise: FilterInfo
|
|
|
+}
|
|
|
+
|
|
|
+interface AllFixedFiledsInfo {
|
|
|
+ [key: string]: Array<string>
|
|
|
+ account: Array<string>
|
|
|
+ project: Array<string>
|
|
|
+ advertise: Array<string>
|
|
|
+}
|
|
|
+
|
|
|
+const { AllApi } = useRequest()
|
|
|
const { disableDate, shortcuts } = useDate()
|
|
|
+const { getData } = useTable()
|
|
|
|
|
|
-// 导航
|
|
|
-const ttAdMenu: BaseMenu[] = [
|
|
|
- {
|
|
|
- name: 'account',
|
|
|
- title: '账户',
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'project',
|
|
|
- title: '项目',
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'advertise',
|
|
|
- title: '广告',
|
|
|
- },
|
|
|
-]
|
|
|
+// 当前菜单选中
|
|
|
+const activeMenu = ref('account')
|
|
|
|
|
|
-const filterInfo: {
|
|
|
- [key: string]: TableFilterItem
|
|
|
-} = {
|
|
|
+// 所有子字段信息
|
|
|
+const AllFields: AllFieldsInfo = {
|
|
|
+ account: [
|
|
|
+ { label: '账户余额', name: 'accountBalance', state: true },
|
|
|
+ { label: '账户流动', name: 'accountFlow', state: true },
|
|
|
+ { label: '账户名', name: 'accountName', state: true },
|
|
|
+ { label: '账户状态', name: 'accountStatus', state: true },
|
|
|
+ { label: '操作', name: 'action', state: false },
|
|
|
+ { label: '广告账户数量', name: 'adAccountCount', state: true },
|
|
|
+ { label: '每日预算', name: 'dailyBudget', state: true },
|
|
|
+ { label: '登录邮箱', name: 'loginEmail', state: true },
|
|
|
+ { label: '媒体ID', name: 'mediaId', state: true },
|
|
|
+ ],
|
|
|
+ project: [
|
|
|
+ { label: '项目', name: 'project', state: true },
|
|
|
+ { label: '项目预算(元)', name: 'projectBudget', state: true },
|
|
|
+ { label: '创建时间', name: 'creationTime', state: true },
|
|
|
+ { label: '项目出价(元)', name: 'projectBid', state: true },
|
|
|
+ { label: '深度转化出价(元)', name: 'deepConversionBid', state: true },
|
|
|
+ { label: '消耗', name: 'consumption', state: true },
|
|
|
+ { label: '展示数', name: 'impressions', state: true },
|
|
|
+ { label: '平均千次展示费用', name: 'averageCpm', state: true },
|
|
|
+ { label: '点击数', name: 'clicks', state: true },
|
|
|
+ { label: '点击率', name: 'clickThroughRate', state: true },
|
|
|
+ { label: '转化数', name: 'conversions', state: true },
|
|
|
+ { label: '转化成本', name: 'conversionCost', state: true },
|
|
|
+ { label: '转化率', name: 'conversionRate', state: true },
|
|
|
+ { label: '深度转化数', name: 'deepConversions', state: true },
|
|
|
+ { label: '深度转化成本', name: 'deepConversionCost', state: true },
|
|
|
+ { label: '深度转化率', name: 'deepConversionRate', state: true },
|
|
|
+ ],
|
|
|
+ advertise: [
|
|
|
+ { label: '广告', name: 'ad', state: true },
|
|
|
+ { label: '广告预算(元)', name: 'adBudget', state: true },
|
|
|
+ { label: '拒绝建议', name: 'rejectSuggestions', state: true },
|
|
|
+ { label: '广告出价(元)', name: 'adBid', state: true },
|
|
|
+ { label: '深度转化出价(元)', name: 'deepConversionBid', state: true },
|
|
|
+ { label: '消耗', name: 'consumption', state: true },
|
|
|
+ { label: '展示数', name: 'impressions', state: true },
|
|
|
+ { label: '平均千次展现费用', name: 'averageCpm', state: true },
|
|
|
+ { label: '点击数', name: 'clicks', state: true },
|
|
|
+ { label: '点击率', name: 'clickThroughRate', state: true },
|
|
|
+ { label: '转化数', name: 'conversions', state: true },
|
|
|
+ { label: '转化成本', name: 'conversionCost', state: true },
|
|
|
+ { label: '转化率', name: 'conversionRate', state: true },
|
|
|
+ { label: '深度转化数', name: 'deepConversions', state: true },
|
|
|
+ { label: '深度转化成本', name: 'deepConversionCost', state: true },
|
|
|
+ { label: '深度转化率', name: 'deepConversionRate', state: true },
|
|
|
+ ],
|
|
|
+}
|
|
|
+
|
|
|
+// 账户查询表单信息
|
|
|
+const accFilterInfo: FilterInfo = {
|
|
|
accMain: {
|
|
|
label: '账号主体',
|
|
|
name: 'accMain',
|
|
@@ -86,6 +177,85 @@ const filterInfo: {
|
|
|
},
|
|
|
}
|
|
|
|
|
|
+const allFilters: AllFilterInfo = {
|
|
|
+ account: accFilterInfo,
|
|
|
+ project: {},
|
|
|
+ advertise: {},
|
|
|
+}
|
|
|
+
|
|
|
+const allFixedFileds: AllFixedFiledsInfo = {
|
|
|
+ account: ['accountName', 'action'],
|
|
|
+ project: [],
|
|
|
+ advertise: [],
|
|
|
+}
|
|
|
+
|
|
|
+const tableReqInfo: { [key: string]: any } = {
|
|
|
+ account: AllApi.mockAdTTAcc,
|
|
|
+ project: AllApi.mockAdTTProj,
|
|
|
+ advertise: AllApi.mockAdTTAd,
|
|
|
+}
|
|
|
+
|
|
|
+// 项目查询表单信息
|
|
|
+
|
|
|
+// 广告查询表单信息
|
|
|
+// AllFields['account']
|
|
|
+const tableInfo = reactive<TableInfo>({
|
|
|
+ account: {
|
|
|
+ data: [],
|
|
|
+ fields: [{ label: '基础', children: AllFields['account'] }],
|
|
|
+ filters: allFilters['account'],
|
|
|
+ fixedFields: allFixedFileds['account'],
|
|
|
+ },
|
|
|
+ project: {
|
|
|
+ data: [],
|
|
|
+ fields: [{ label: '基础', children: AllFields['project'] }],
|
|
|
+ filters: allFilters['project'],
|
|
|
+ fixedFields: allFixedFileds['project'],
|
|
|
+ },
|
|
|
+ advertise: {
|
|
|
+ data: [],
|
|
|
+ fields: [{ label: '基础', children: AllFields['advertise'] }],
|
|
|
+ filters: allFilters['advertise'],
|
|
|
+ fixedFields: allFixedFileds['advertise'],
|
|
|
+ },
|
|
|
+})
|
|
|
+// const tableInfo = reactive<TableInfo>({
|
|
|
+// account: {
|
|
|
+// data: [],
|
|
|
+// fields: AllFields['account'],
|
|
|
+// filters: allFilters['account'],
|
|
|
+// fixedFields: allFixedFileds['account'],
|
|
|
+// },
|
|
|
+// project: {
|
|
|
+// data: [],
|
|
|
+// fields: AllFields['project'],
|
|
|
+// filters: allFilters['project'],
|
|
|
+// fixedFields: allFixedFileds['project'],
|
|
|
+// },
|
|
|
+// advertise: {
|
|
|
+// data: [],
|
|
|
+// fields: AllFields['advertise'],
|
|
|
+// filters: allFilters['advertise'],
|
|
|
+// fixedFields: allFixedFileds['advertise'],
|
|
|
+// },
|
|
|
+// })
|
|
|
+
|
|
|
+// 导航
|
|
|
+const ttAdMenu: BaseMenu[] = [
|
|
|
+ {
|
|
|
+ name: 'account',
|
|
|
+ title: '账户',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'project',
|
|
|
+ title: '项目',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'advertise',
|
|
|
+ title: '广告',
|
|
|
+ },
|
|
|
+]
|
|
|
+
|
|
|
// 选择的日期
|
|
|
const selectDate = ref(shortcuts[0].value())
|
|
|
|
|
@@ -97,6 +267,27 @@ const selectDate = ref(shortcuts[0].value())
|
|
|
const dateChange = (val: Array<Date>) => {
|
|
|
// emits('changeDate', val)
|
|
|
}
|
|
|
+
|
|
|
+const menuActiveChange = (val: string) => {
|
|
|
+ activeMenu.value = val
|
|
|
+ updateTableData()
|
|
|
+ console.log('执行')
|
|
|
+ console.log(activeMenu.value)
|
|
|
+ console.log(tableInfo)
|
|
|
+}
|
|
|
+
|
|
|
+const updateTableData = () => {
|
|
|
+ getData(tableReqInfo[activeMenu.value]).then((res: Array<TableData>) => {
|
|
|
+ tableInfo[activeMenu.value].data.splice(
|
|
|
+ 0,
|
|
|
+ tableInfo[activeMenu.value].data.length,
|
|
|
+ ...res,
|
|
|
+ )
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+updateTableData()
|
|
|
+onMounted(() => {})
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -107,6 +298,7 @@ const dateChange = (val: Array<Date>) => {
|
|
|
:menu-list="ttAdMenu"
|
|
|
:menu-item-style="'margin-right:30px;'"
|
|
|
mode="horizontal"
|
|
|
+ @active-change="menuActiveChange"
|
|
|
></Menu>
|
|
|
<div class="datePickerBox">
|
|
|
<el-date-picker
|
|
@@ -126,7 +318,12 @@ const dateChange = (val: Array<Date>) => {
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="ttAdContent">
|
|
|
- <Table :filters-info="filterInfo"></Table>
|
|
|
+ <Table
|
|
|
+ :table-fields="tableInfo[activeMenu].fields"
|
|
|
+ :table-data="tableInfo[activeMenu].data"
|
|
|
+ :fixed-fields="tableInfo[activeMenu].fixedFields"
|
|
|
+ :filters-info="tableInfo[activeMenu].filters"
|
|
|
+ ></Table>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -134,6 +331,8 @@ const dateChange = (val: Array<Date>) => {
|
|
|
<style scoped>
|
|
|
.ttAdContainer {
|
|
|
width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.ttAdHeader {
|
|
@@ -145,11 +344,11 @@ const dateChange = (val: Array<Date>) => {
|
|
|
}
|
|
|
|
|
|
.ttAdContent {
|
|
|
- width: 96%;
|
|
|
+ width: 100%;
|
|
|
height: 100%;
|
|
|
background-color: white;
|
|
|
margin: 0 auto;
|
|
|
- overflow: scroll;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.datePickerBox {
|