Merge remote-tracking branch 'origin/feature/v1.3_营销资产中台' into feature/v1.3_营销资产中台
# Conflicts: # src/api/all/propertyMarketing.ts
This commit is contained in:
@ -6,189 +6,191 @@ export const TABLE_COLUMNS = [
|
||||
{
|
||||
title: '账户名称',
|
||||
dataIndex: 'name',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: '项目分组',
|
||||
dataIndex: 'group.name',
|
||||
prop: 'name',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
prop: 'status',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: '运营人员',
|
||||
dataIndex: 'operator.name',
|
||||
dataIndex: 'operator_ame',
|
||||
prop: 'operator_ame',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '最新项目名称',
|
||||
dataIndex: 'newest_project_name',
|
||||
prop: 'newest_project_name',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '最新项目展示数',
|
||||
dataIndex: 'newest_project_show_number',
|
||||
prop: 'newest_project_show_number',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '最新项目点击数',
|
||||
dataIndex: 'newest_project_click_number',
|
||||
prop: 'newest_project_click_number',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '最新项目点击率',
|
||||
dataIndex: 'newest_project_click_rate',
|
||||
prop: 'newest_project_click_rate',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '最新项目平均点击成本',
|
||||
dataIndex: 'newest_project_avg_click_cost',
|
||||
prop: 'newest_project_avg_click_cost',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '最新项目平均千次展示成本',
|
||||
dataIndex: 'newest_project_thousand_show_cost',
|
||||
prop: 'newest_project_thousand_show_cost',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '账户总消耗',
|
||||
dataIndex: 'total_consumption',
|
||||
dataIndex: 'total_use_amount',
|
||||
prop: 'total_use_amount',
|
||||
width: 180,
|
||||
tooltip: '账号总消耗',
|
||||
tooltip: '指账户在统计周期内的总广告消耗金额,衡量广告实际投放的花费。',
|
||||
prefix: '¥',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '账户余额',
|
||||
dataIndex: 'balance',
|
||||
width: 180,
|
||||
tooltip: '账号余额',
|
||||
prefix: '¥',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'AI评价',
|
||||
dataIndex: 'ai_evaluation',
|
||||
width: 260,
|
||||
},
|
||||
{
|
||||
title: 'ROI',
|
||||
dataIndex: 'roi',
|
||||
width: 180,
|
||||
tooltip: '账号ROI',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'ROI环比',
|
||||
dataIndex: 'roi_chain',
|
||||
width: 180,
|
||||
tooltip: '相比上一周期的ROI变化百分比',
|
||||
align: 'right',
|
||||
suffix: '%',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'CPA',
|
||||
dataIndex: 'cpa',
|
||||
width: 180,
|
||||
tooltip: '账号CPA',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'CPA环比',
|
||||
dataIndex: 'roi_chain',
|
||||
width: 180,
|
||||
tooltip: '相比上一周期的CPA变化百分比',
|
||||
align: 'right',
|
||||
suffix: '%',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '转化数',
|
||||
dataIndex: 'conversion_number',
|
||||
width: 180,
|
||||
tooltip: '账号转化数',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '转化数环比',
|
||||
dataIndex: 'conversion_chain',
|
||||
width: 180,
|
||||
tooltip: '相比上一周期的转化数变化百分比',
|
||||
align: 'right',
|
||||
suffix: '%',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'CVR',
|
||||
dataIndex: 'conversion_rate',
|
||||
width: 180,
|
||||
tooltip: '账号转化率',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'CVR环比',
|
||||
dataIndex: 'conversion_rate_chain',
|
||||
width: 180,
|
||||
tooltip: '相比上一周期的CVR变化百分比',
|
||||
align: 'right',
|
||||
suffix: '%',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '最新投放计划标题/日期',
|
||||
dataIndex: 'like_chain1',
|
||||
width: 260,
|
||||
tooltip: '最新发布内容的标题和发布日期',
|
||||
},
|
||||
{
|
||||
title: '最新投放计划表现',
|
||||
dataIndex: 'latest_plan_performance',
|
||||
width: 180,
|
||||
tooltip: '最新投放计划表现',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
|
||||
// {
|
||||
// title: '账户余额',
|
||||
// dataIndex: 'balance',
|
||||
// prop: 'balance',
|
||||
// width: 180,
|
||||
// tooltip: '当前账户剩余的可用余额,用于后续广告投放。',
|
||||
// prefix: '¥',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: 'AI评价',
|
||||
// dataIndex: 'ai_evaluate',
|
||||
// prop: 'ai_evaluate',
|
||||
// width: 260,
|
||||
// },
|
||||
// {
|
||||
// title: '投资回报率',
|
||||
// dataIndex: 'roi',
|
||||
// prop: 'roi',
|
||||
// width: 180,
|
||||
// tooltip: '投入产出比(ROI),等于收益 ÷ 投入,反映投放带来的商业价值。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '投资回报率环比',
|
||||
// dataIndex: 'roi_chain',
|
||||
// prop: 'roi_chain',
|
||||
// width: 180,
|
||||
// tooltip: '当前 ROI 相较于上一周期的变化百分比,用于评估投放效益变化。',
|
||||
// align: 'right',
|
||||
// suffix: '%',
|
||||
// isRateField: true,
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '展示量',
|
||||
dataIndex: 'view_number',
|
||||
dataIndex: 'show_number',
|
||||
prop: 'show_number',
|
||||
width: 180,
|
||||
tooltip: '账号所有内容的总展示次数',
|
||||
tooltip: '广告被用户看到的次数(曝光次数),是广告触达能力的基本指标。',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '展示量环比',
|
||||
// dataIndex: 'view_number_chain',
|
||||
// prop: 'view_number_chain',
|
||||
// width: 180,
|
||||
// tooltip: '展示量与上一周期的变化百分比,反映广告曝光趋势。',
|
||||
// align: 'right',
|
||||
// suffix: '%',
|
||||
// isRateField: true,
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '点击量',
|
||||
dataIndex: 'click_number',
|
||||
prop: 'click_number',
|
||||
width: 180,
|
||||
tooltip: '账号所有内容的总点击次数',
|
||||
tooltip: '用户点击广告的次数,代表广告实际引起的兴趣行为。',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '点击量环比',
|
||||
// dataIndex: 'click_number_chain',
|
||||
// prop: 'click_number_chain',
|
||||
// width: 180,
|
||||
// tooltip: '当前周期点击量相较上一周期的变化百分比。',
|
||||
// align: 'right',
|
||||
// suffix: '%',
|
||||
// isRateField: true,
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '点击率',
|
||||
dataIndex: 'click_rate',
|
||||
prop: 'click_rate',
|
||||
width: 180,
|
||||
tooltip: '账号所有内容的总点击率',
|
||||
tooltip: '广告点击率(CTR),= 点击量 ÷ 展示量,衡量广告吸引力。',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '点击率环比',
|
||||
// dataIndex: 'click_rate_chain',
|
||||
// prop: 'click_rate_chain',
|
||||
// width: 180,
|
||||
// tooltip: '当前 CTR 相较上一周期的变化百分比,评估广告表现是否优化。',
|
||||
// align: 'right',
|
||||
// suffix: '%',
|
||||
// isRateField: true,
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '平均点击成本',
|
||||
dataIndex: 'avg_click_cost',
|
||||
prop: 'avg_click_cost',
|
||||
width: 180,
|
||||
tooltip: '账号所有内容的平均点击成本',
|
||||
tooltip: '每次用户点击广告所花费的平均金额(CPC),= 消耗 ÷ 点击量。',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
@ -196,44 +198,112 @@ export const TABLE_COLUMNS = [
|
||||
},
|
||||
{
|
||||
title: '千次展现费用',
|
||||
dataIndex: 'cost_per_thousand_views',
|
||||
dataIndex: 'thousand_show_cost',
|
||||
prop: 'thousand_show_cost',
|
||||
width: 180,
|
||||
prefix: '¥',
|
||||
tooltip: '账号所有内容的千次展现费用',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '平均转化成本',
|
||||
dataIndex: 'avg_conversion_cost',
|
||||
width: 180,
|
||||
prefix: '¥',
|
||||
tooltip: '账号所有内容的平均转化成本',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '深度转化数',
|
||||
dataIndex: 'deep_conversion_number',
|
||||
width: 180,
|
||||
tooltip: '账号所有内容的总深度转化次数',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '深度转化率',
|
||||
dataIndex: 'deep_conversion_rate',
|
||||
width: 180,
|
||||
tooltip: '账号所有内容的总深度转化率',
|
||||
tooltip: '每 1000 次广告展示的平均费用(CPM),= 消耗 ÷ 展示量 × 1000。',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '转化数',
|
||||
// dataIndex: 'conversion_number',
|
||||
// prop: 'conversion_number',
|
||||
// width: 180,
|
||||
// tooltip: '用户完成设定目标行为(如下单、注册)的总次数,是广告成效的重要指标。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '转化数环比',
|
||||
// dataIndex: 'conversion_number_chain',
|
||||
// prop: 'conversion_number_chain',
|
||||
// width: 180,
|
||||
// tooltip: '当前周期转化数与上一周期的变化百分比。',
|
||||
// align: 'right',
|
||||
// suffix: '%',
|
||||
// isRateField: true,
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '转化率',
|
||||
// dataIndex: 'conversion_rate',
|
||||
// prop: 'conversion_rate',
|
||||
// width: 180,
|
||||
// tooltip: '转化率(CVR)= 转化数 ÷ 点击量,衡量广告转化能力。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '转化率环比',
|
||||
// dataIndex: 'conversion_rate_chain',
|
||||
// prop: 'conversion_rate_chain',
|
||||
// width: 180,
|
||||
// tooltip: '当前 CVR 相较上一周期的变化百分比。',
|
||||
// align: 'right',
|
||||
// suffix: '%',
|
||||
// isRateField: true,
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '平均转化成本',
|
||||
// dataIndex: 'avg_conversion_cost',
|
||||
// prop: 'avg_conversion_cost',
|
||||
// width: 180,
|
||||
// prefix: '¥',
|
||||
// tooltip: '每次转化平均花费的成本(CPA),= 消耗 ÷ 转化数。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '深度转化数',
|
||||
// dataIndex: 'deep_conversion_number',
|
||||
// prop: 'deep_conversion_number',
|
||||
// width: 180,
|
||||
// tooltip: '表示完成更高价值行为(如支付、留资等)的次数,是高质量转化的衡量标准。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '深度转化率',
|
||||
// dataIndex: 'deep_conversion_rate',
|
||||
// prop: 'deep_conversion_rate',
|
||||
// width: 180,
|
||||
// tooltip: '深度转化数 ÷ 点击量,代表高价值行为的转化效率。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '最新投放计划标题/日期',
|
||||
// dataIndex: 'newest_work_title',
|
||||
// prop: 'newest_work_title',
|
||||
// width: 260,
|
||||
// },
|
||||
// {
|
||||
// title: '投放回报率',
|
||||
// dataIndex: 'roi_chain1',
|
||||
// prop: 'roi_chain1',
|
||||
// width: 180,
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
];
|
||||
|
||||
@ -33,7 +33,11 @@
|
||||
ref="tableRef"
|
||||
:data="dataSource"
|
||||
row-key="id"
|
||||
:row-selection="rowSelection"
|
||||
:row-selection="{
|
||||
type: 'checkbox',
|
||||
showCheckedAll: true,
|
||||
width: 48,
|
||||
}"
|
||||
:selected-keys="selectedItems"
|
||||
:pagination="false"
|
||||
:scroll="{ x: '100%' }"
|
||||
@ -48,7 +52,7 @@
|
||||
</template>
|
||||
<template #columns>
|
||||
<a-table-column
|
||||
v-for="column in getColumns()"
|
||||
v-for="column in tableColumns"
|
||||
:key="column.dataIndex"
|
||||
:data-index="column.dataIndex"
|
||||
:fixed="column.fixed"
|
||||
@ -61,7 +65,7 @@
|
||||
>
|
||||
<template #title>
|
||||
<div class="flex items-center">
|
||||
<img v-if="column.dataIndex === 'ai_evaluation'" width="16" height="16" :src="icon5" class="mr-4px" />
|
||||
<img v-if="column.dataIndex === 'ai_evaluate'" width="16" height="16" :src="icon5" class="mr-4px" />
|
||||
<span class="cts mr-4px">{{ column.title }}</span>
|
||||
<a-tooltip v-if="column.tooltip" :content="column.tooltip" position="top">
|
||||
<icon-question-circle class="tooltip-icon color-#737478" size="16" />
|
||||
@ -79,48 +83,43 @@
|
||||
}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'ai_evaluation'" #cell="{ record }">
|
||||
<template v-else-if="column.dataIndex === 'ai_evaluate'" #cell="{ record }">
|
||||
<div class="ai-evaluation-row flex">
|
||||
<img
|
||||
width="16"
|
||||
height="16"
|
||||
:src="record.ai_evaluation?.status === 1 ? icon4 : record.ai_evaluation?.status === 2 ? icon3 : icon2"
|
||||
class="mr-8px icon"
|
||||
/>
|
||||
<div>
|
||||
<p class="cts">{{ record.ai_evaluation?.text || '-' }}</p>
|
||||
<p class="cts text-12px lh-20px !color-#939499">
|
||||
{{ `ROI: ${record.ai_evaluation?.look_chain}% CVR: ${record.ai_evaluation?.like_chain}%` }}
|
||||
</p>
|
||||
</div>
|
||||
<template v-if="record.ai_evaluate">
|
||||
<img
|
||||
width="16"
|
||||
height="16"
|
||||
:src="record.ai_evaluate?.status === 0 ? icon2 : record.ai_evaluate?.status === 1 ? icon3 : icon4"
|
||||
class="mr-8px icon"
|
||||
/>
|
||||
<div>
|
||||
<p class="cts">{{ `${record.ai_evaluate?.level} | ${record.ai_evaluate?.advise}` }}。</p>
|
||||
<p class="cts text-12px lh-20px !color-#939499">
|
||||
{{ `ROI: ${record.roi}% CVR: ${record.conversion_rate}%` }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="cts">-</p>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'operation'" #cell="{ record }">
|
||||
<a-button type="outline" size="small" class="search-btn" @click="handleDetail(record)">详情</a-button>
|
||||
</template>
|
||||
|
||||
<template
|
||||
v-else-if="
|
||||
[
|
||||
'view_chain',
|
||||
'roi_chain',
|
||||
'like_chain',
|
||||
'cpa_chain',
|
||||
'conversion_chain',
|
||||
'conversion_rate_chain',
|
||||
].includes(column.dataIndex)
|
||||
"
|
||||
#cell="{ record }"
|
||||
>
|
||||
<template v-else-if="column.isRateField" #cell="{ record }">
|
||||
<div class="flex items-center rate-row justify-end" :class="record[column.dataIndex] > 0 ? 'up' : 'down'">
|
||||
<icon-arrow-up v-if="record[column.dataIndex] > 0" size="16" />
|
||||
<icon-arrow-down v-else size="16" />
|
||||
{{ formatTableField(column, record) }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="['like_chain1', 'like_chain4'].includes(column.dataIndex)" #cell="{ record }">
|
||||
<p class="cts cursor-pointer hover:!color-#6D4CFE">打工人的环游世界旅行计划(国内版)</p>
|
||||
<p class="cts text-12px lh-20px !color-#939499">2025-06-18</p>
|
||||
<template v-else-if="column.dataIndex === 'newest_work_title'" #cell="{ record }">
|
||||
<p class="cts cursor-pointer hover:!color-#6D4CFe">{{ record.newest_work_title }}</p>
|
||||
<p class="cts text-12px lh-20px !color-#939499">
|
||||
{{ exactFormatTime(record.newest_project_published_at) }}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<template v-else #cell="{ record }">
|
||||
@ -130,16 +129,17 @@
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<CustomTableColumnModal ref="modalRef" type="placement_account" @success="onCustomColumnSuccess" />
|
||||
<CustomTableColumnModal ref="modalRef" :type="CUSTOM_COLUMN_TYPE" @success="onCustomColumnSuccess" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { STATUS_LIST } from '../../constants';
|
||||
import { formatTableField } from '@/utils/tools';
|
||||
import { STATUS_LIST } from '@/views/property-marketing/put-account/components/status-select/constants';
|
||||
import { formatTableField, exactFormatTime } from '@/utils/tools';
|
||||
import { TABLE_COLUMNS } from './constants';
|
||||
import { useRouter } from 'vue-router';
|
||||
import CustomTableColumnModal from '@/components/custom-table-column-modal';
|
||||
import { getCustomColumns } from '@/api/all/common';
|
||||
|
||||
import icon1 from '@/assets/img/media-account/icon-custom.png';
|
||||
import icon2 from '@/assets/img/media-account/icon-warn.png';
|
||||
@ -156,11 +156,14 @@ const props = defineProps({
|
||||
|
||||
const emit = defineEmits(['selectionChange', 'sorterChange', 'export']);
|
||||
|
||||
const CUSTOM_COLUMN_TYPE = 'placement_account';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const selectedItems = ref([]);
|
||||
const tableRef = ref(null);
|
||||
const modalRef = ref(null);
|
||||
const selectedColumns = ref([]);
|
||||
|
||||
const checkedAll = computed(
|
||||
() => selectedItems.value.length > 0 && selectedItems.value.length === props.dataSource.length,
|
||||
@ -169,11 +172,6 @@ const indeterminate = computed(
|
||||
() => selectedItems.value.length > 0 && selectedItems.value.length < props.dataSource.length,
|
||||
);
|
||||
|
||||
const rowSelection = computed(() => ({
|
||||
type: 'checkbox',
|
||||
showCheckedAll: true,
|
||||
}));
|
||||
|
||||
const handleSelectAll = (checked) => {
|
||||
if (checked) {
|
||||
selectedItems.value = props.dataSource.map((item) => item.id);
|
||||
@ -200,10 +198,18 @@ const handleSelect = (selectedRowKeys, selectedRows) => {
|
||||
const handleExport = () => {
|
||||
emit('export');
|
||||
};
|
||||
const getColumns = () => {
|
||||
const columns = cloneDeep(TABLE_COLUMNS);
|
||||
return columns;
|
||||
};
|
||||
|
||||
const tableColumns = computed(() => {
|
||||
const _result = [];
|
||||
const _columns = cloneDeep(TABLE_COLUMNS);
|
||||
selectedColumns.value.forEach((item) => {
|
||||
const _column = _columns.find((_item) => _item.prop === item);
|
||||
if (_column) {
|
||||
_result.push(_column);
|
||||
}
|
||||
});
|
||||
return _result;
|
||||
});
|
||||
|
||||
const resetTable = () => {
|
||||
selectedItems.value = [];
|
||||
@ -214,10 +220,36 @@ const openCustomColumn = () => {
|
||||
modalRef.value.open();
|
||||
};
|
||||
|
||||
const onCustomColumnSuccess = (selectedColumns) => {
|
||||
console.log(selectedColumns);
|
||||
const onCustomColumnSuccess = (columns) => {
|
||||
selectedColumns.value = columns;
|
||||
};
|
||||
|
||||
const getSelectedColumns = () => {
|
||||
getCustomColumns({ type: CUSTOM_COLUMN_TYPE }).then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code === 200) {
|
||||
const { selected_columns, groups } = data;
|
||||
|
||||
setDefaultCheckColumns(groups, selected_columns);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const setDefaultCheckColumns = (groups, selected_columns) => {
|
||||
const requiredGroups = groups.filter((group) => group.is_require === 1);
|
||||
const requiredValues = requiredGroups
|
||||
.flatMap((group) => (group.columns || []).filter((col) => col.is_require === 1))
|
||||
.map((col) => col.value);
|
||||
|
||||
const merged = union(requiredValues, selected_columns);
|
||||
|
||||
selectedColumns.value = merged;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getSelectedColumns();
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
resetTable,
|
||||
});
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<div class="container px-24px">
|
||||
<div class="filter-row flex mb-20px">
|
||||
<div class="filter-row-item flex items-center">
|
||||
<span class="label">账户名称</span>
|
||||
<span class="label">{{ isAccountTab ? '账户名称' : '计划名称' }}</span>
|
||||
<a-space size="medium" class="w-240px">
|
||||
<a-input v-model="query.name" placeholder="请搜索..." size="medium" allow-clear @change="handleSearch">
|
||||
<template #prefix>
|
||||
@ -16,7 +16,7 @@
|
||||
</a-input>
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="filter-row-item flex items-center">
|
||||
<div v-if="!isAccountTab" class="filter-row-item flex items-center">
|
||||
<span class="label">计划分组</span>
|
||||
<a-space class="w-200px">
|
||||
<group-select v-model="query.group_ids" multiple :options="groups" @change="handleSearch" />
|
||||
@ -25,34 +25,33 @@
|
||||
<div class="filter-row-item flex items-center">
|
||||
<span class="label">状态</span>
|
||||
<a-space class="w-180px">
|
||||
<a-select v-model="query.status" size="medium" placeholder="全部" allow-clear @change="handleSearch">
|
||||
<a-option v-for="(item, index) in STATUS_LIST" :key="index" :value="item.value" :label="item.text">{{
|
||||
item.text
|
||||
}}</a-option>
|
||||
</a-select>
|
||||
<StatusSelect v-model="query.status" @change="handleSearch" />
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="filter-row-item flex items-center">
|
||||
<span class="label">运营人员</span>
|
||||
<a-space class="w-160px">
|
||||
<a-select v-model="query.operator_id" size="medium" placeholder="全部" allow-clear @change="handleSearch">
|
||||
<a-option v-for="(item, index) in operators" :key="index" :value="item.id" :label="item.name">{{
|
||||
item.name
|
||||
}}</a-option>
|
||||
</a-select>
|
||||
<OperatorSelect v-model="query.operator_id" :options="operators" @change="handleSearch" />
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
<div class="filter-row flex">
|
||||
<div v-if="!isAccountTab" class="filter-row-item flex items-center">
|
||||
<span class="label">关联账户</span>
|
||||
<a-space class="w-160px">
|
||||
<AccountSelect v-model="query.placement_account_id" :options="placementAccounts" @change="handleSearch" />
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="filter-row-item flex items-center">
|
||||
<span class="label">时间筛选</span>
|
||||
<a-space class="w-240px">
|
||||
<a-range-picker
|
||||
v-model="query.date_range"
|
||||
v-model="query.data_time"
|
||||
size="medium"
|
||||
allow-clear
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
format="YYYY-MM-DD"
|
||||
class="w-100%"
|
||||
@change="handleSearch"
|
||||
/>
|
||||
</a-space>
|
||||
</div>
|
||||
@ -74,25 +73,41 @@
|
||||
|
||||
<script setup>
|
||||
import { reactive, defineEmits, defineProps } from 'vue';
|
||||
import { getPlacementAccountProjectGroupsList, getPlacementAccountOperators } from '@/api/all/propertyMarketing';
|
||||
import GroupSelect from '../group-select/index.vue';
|
||||
import { STATUS_LIST } from '../../constants';
|
||||
import {
|
||||
getPlacementAccountProjectGroupsList,
|
||||
getPlacementAccountsList,
|
||||
getPlacementAccountOperators,
|
||||
} from '@/api/all/propertyMarketing';
|
||||
import GroupSelect from '../group-select';
|
||||
|
||||
import OperatorSelect from '@/views/property-marketing/put-account/components/operator-select';
|
||||
import StatusSelect from '@/views/property-marketing/put-account/components/status-select';
|
||||
import AccountSelect from '@/views/property-marketing/put-account/components/account-select';
|
||||
|
||||
const props = defineProps({
|
||||
query: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
isAccountTab: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits('onSearch', 'onReset', 'update:query');
|
||||
|
||||
const tags = ref([]);
|
||||
// const tags = ref([]);
|
||||
const groups = ref([]);
|
||||
const operators = ref([]);
|
||||
const placementAccounts = ref([]);
|
||||
// const dataTime = ref([]);
|
||||
|
||||
const handleSearch = () => {
|
||||
emits('onSearch', props.query);
|
||||
emits('update:query', props.query);
|
||||
nextTick(() => {
|
||||
emits('onSearch');
|
||||
});
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
@ -100,7 +115,6 @@ const handleReset = () => {
|
||||
};
|
||||
|
||||
const getGroups = async () => {
|
||||
console.log('getGroups');
|
||||
const { code, data } = await getPlacementAccountProjectGroupsList();
|
||||
if (code === 200) {
|
||||
groups.value = data;
|
||||
@ -113,9 +127,17 @@ const getOperators = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const getAccounts = async () => {
|
||||
const { code, data } = await getPlacementAccountsList();
|
||||
if (code === 200) {
|
||||
placementAccounts.value = data;
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getGroups();
|
||||
getOperators();
|
||||
getAccounts();
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
|
||||
@ -98,8 +98,8 @@ const list = ref([]);
|
||||
const loading = ref(false);
|
||||
const query = ref({
|
||||
name: '',
|
||||
sort_column: '',
|
||||
sort_order: '',
|
||||
sort_column: undefined,
|
||||
sort_order: undefined,
|
||||
});
|
||||
const pageInfo = ref({
|
||||
page: 1,
|
||||
@ -139,8 +139,8 @@ const close = () => {
|
||||
pageInfo.value.page = 1;
|
||||
pageInfo.value.pageSize = 20;
|
||||
pageInfo.value.total = 0;
|
||||
query.value.sort_column = '';
|
||||
query.value.sort_order = '';
|
||||
query.value.sort_column = undefined;
|
||||
query.value.sort_order = undefined;
|
||||
list.value = [];
|
||||
visible.value = false;
|
||||
};
|
||||
|
||||
@ -0,0 +1,207 @@
|
||||
/*
|
||||
* @Author: RenXiaoDong
|
||||
* @Date: 2025-06-28 10:33:06
|
||||
*/
|
||||
export const TABLE_COLUMNS = [
|
||||
{
|
||||
title: '计划名称',
|
||||
dataIndex: 'name',
|
||||
prop: 'name',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: '计划分组',
|
||||
dataIndex: 'group.name',
|
||||
prop: 'group',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: '关联账户',
|
||||
dataIndex: 'account_name',
|
||||
prop: 'account_name',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
prop: 'status',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: '运营人员',
|
||||
dataIndex: 'operator_name',
|
||||
prop: 'operator_name',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '账户总消耗',
|
||||
dataIndex: 'total_use_amount',
|
||||
prop: 'total_use_amount',
|
||||
width: 180,
|
||||
tooltip: '当前投流计划已消耗的广告预算总额,反映该计划的实际投放成本。',
|
||||
prefix: '¥',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '账户余额',
|
||||
// dataIndex: 'balance',
|
||||
// prop: 'balance',
|
||||
// width: 180,
|
||||
// tooltip: '当前投流计划剩余可用预算,用于后续广告持续投放。',
|
||||
// prefix: '¥',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: 'AI评价',
|
||||
// dataIndex: 'ai_evaluate',
|
||||
// prop: 'ai_evaluate',
|
||||
// width: 260,
|
||||
// },
|
||||
// {
|
||||
// title: '投资回报率',
|
||||
// dataIndex: 'roi',
|
||||
// prop: 'roi',
|
||||
// width: 180,
|
||||
// tooltip: '投入产出比(ROI),= 收益 ÷ 投入,用于衡量该计划的经济效益。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '展示量',
|
||||
dataIndex: 'show_number',
|
||||
prop: 'show_number',
|
||||
width: 180,
|
||||
tooltip: '广告被用户展示的总次数,是该投流计划的曝光表现基础指标。',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '点击量',
|
||||
dataIndex: 'click_number',
|
||||
prop: 'click_number',
|
||||
width: 180,
|
||||
tooltip: '用户点击广告的总次数,表示广告对用户的吸引效果。',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '点击率',
|
||||
dataIndex: 'click_rate',
|
||||
prop: 'click_rate',
|
||||
width: 180,
|
||||
tooltip: '点击率(CTR)= 点击量 ÷ 展示量,用于衡量广告吸引力。',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '点击率环比',
|
||||
// dataIndex: 'click_rate_chain',
|
||||
// prop: 'click_rate_chain',
|
||||
// width: 180,
|
||||
// tooltip: '当前 CTR 与上一周期对比的变化百分比,用于追踪广告吸引力趋势。',
|
||||
// align: 'right',
|
||||
// suffix: '%',
|
||||
// isRateField: true,
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '平均点击成本',
|
||||
dataIndex: 'avg_click_cost',
|
||||
prop: 'avg_click_cost',
|
||||
width: 180,
|
||||
tooltip: '每次点击广告的平均成本(CPC)= 总消耗 ÷ 点击量。',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '千次展现费用',
|
||||
dataIndex: 'thousand_show_cost',
|
||||
prop: 'thousand_show_cost',
|
||||
width: 180,
|
||||
prefix: '¥',
|
||||
tooltip: '每千次展示的平均成本(CPM)= 总消耗 ÷ 展示量 × 1000。',
|
||||
align: 'right',
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
|
||||
// {
|
||||
// title: '转化数',
|
||||
// dataIndex: 'conversion_number',
|
||||
// prop: 'conversion_number',
|
||||
// width: 180,
|
||||
// tooltip: '用户完成设定目标行为(如注册、购买)的次数,是广告效果核心指标。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '转化率',
|
||||
// dataIndex: 'conversion_rate',
|
||||
// prop: 'conversion_rate',
|
||||
// width: 180,
|
||||
// tooltip: '转化率(CVR)= 转化数 ÷ 点击量,评估广告引导转化的能力。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '平均转化成本',
|
||||
// dataIndex: 'avg_conversion_cost',
|
||||
// prop: 'avg_conversion_cost',
|
||||
// width: 180,
|
||||
// prefix: '¥',
|
||||
// tooltip: '每次转化的平均广告成本(CPA)= 总消耗 ÷ 转化数。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '深度转化数',
|
||||
// dataIndex: 'deep_conversion_number',
|
||||
// prop: 'deep_conversion_number',
|
||||
// width: 180,
|
||||
// tooltip: '表示完成更高质量目标行为的用户数量(如付款、留资等)。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '深度转化率',
|
||||
// dataIndex: 'deep_conversion_rate',
|
||||
// prop: 'deep_conversion_rate',
|
||||
// width: 180,
|
||||
// tooltip: '深度转化率 = 深度转化数 ÷ 点击量,衡量高质量转化效率。',
|
||||
// align: 'right',
|
||||
// sortable: {
|
||||
// sortDirections: ['ascend', 'descend'],
|
||||
// },
|
||||
// },
|
||||
];
|
||||
@ -0,0 +1,258 @@
|
||||
<!--
|
||||
* @Author: RenXiaoDong
|
||||
* @Date: 2025-06-27 18:08:04
|
||||
-->
|
||||
<template>
|
||||
<div class="action-row mb-12px flex justify-between">
|
||||
<div>
|
||||
<a-checkbox
|
||||
v-if="dataSource.length > 0"
|
||||
:model-value="checkedAll"
|
||||
:indeterminate="indeterminate"
|
||||
class="!pl-13px"
|
||||
@change="handleSelectAll"
|
||||
>全选</a-checkbox
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center">
|
||||
<a-button class="w-110px search-btn mr-12px" size="medium" @click="handleExport">
|
||||
<template #icon> <icon-download /> </template>
|
||||
<template #default>导出数据</template>
|
||||
</a-button>
|
||||
<a-button class="w-110px search-btn" size="medium" @click="openCustomColumn">
|
||||
<template #icon>
|
||||
<img :src="icon1" width="14" height="14" />
|
||||
</template>
|
||||
<template #default>自定义列</template>
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="tableRef"
|
||||
:data="dataSource"
|
||||
row-key="id"
|
||||
:row-selection="{
|
||||
type: 'checkbox',
|
||||
showCheckedAll: true,
|
||||
width: 48,
|
||||
}"
|
||||
:selected-keys="selectedItems"
|
||||
:pagination="false"
|
||||
:scroll="{ x: '100%' }"
|
||||
class="plan-table w-100%"
|
||||
bordered
|
||||
@sorter-change="handleSorterChange"
|
||||
@select="handleSelect"
|
||||
@select-all="handleSelectAll"
|
||||
>
|
||||
<template #empty>
|
||||
<NoData />
|
||||
</template>
|
||||
<template #columns>
|
||||
<a-table-column
|
||||
v-for="column in tableColumns"
|
||||
:key="column.dataIndex"
|
||||
:data-index="column.dataIndex"
|
||||
:fixed="column.fixed"
|
||||
:width="column.width"
|
||||
:min-width="column.minWidth"
|
||||
:sortable="column.sortable"
|
||||
:align="column.align"
|
||||
ellipsis
|
||||
tooltip
|
||||
>
|
||||
<template #title>
|
||||
<div class="flex items-center">
|
||||
<img v-if="column.dataIndex === 'ai_evaluate'" width="16" height="16" :src="icon5" class="mr-4px" />
|
||||
<span class="cts mr-4px">{{ column.title }}</span>
|
||||
<a-tooltip v-if="column.tooltip" :content="column.tooltip" position="top">
|
||||
<icon-question-circle class="tooltip-icon color-#737478" size="16" />
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="column.dataIndex === 'platform'" #cell="{ record }">
|
||||
{{ record.platform === 0 ? '抖音' : record.platform === 1 ? '小红书' : '-' }}
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'status'" #cell="{ record }">
|
||||
<div class="status-tag" :class="`status-tag-${record.status}`">
|
||||
<span class="cts status-tag-text">{{
|
||||
STATUS_LIST.find((item) => item.value === record.status)?.label
|
||||
}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'ai_evaluate'" #cell="{ record }">
|
||||
<div class="ai-evaluation-row flex">
|
||||
<template v-if="record.ai_evaluate">
|
||||
<img
|
||||
width="16"
|
||||
height="16"
|
||||
:src="record.ai_evaluate?.status === 0 ? icon2 : record.ai_evaluate?.status === 1 ? icon3 : icon4"
|
||||
class="mr-8px icon"
|
||||
/>
|
||||
<div>
|
||||
<p class="cts">{{ `${record.ai_evaluate?.level} | ${record.ai_evaluate?.advise}` }}。</p>
|
||||
<p class="cts text-12px lh-20px !color-#939499">
|
||||
{{ `ROI: ${record.roi}% CVR: ${record.conversion_rate}%` }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="cts">-</p>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'operation'" #cell="{ record }">
|
||||
<a-button type="outline" size="small" class="search-btn" @click="handleDetail(record)">详情</a-button>
|
||||
</template>
|
||||
|
||||
<template v-else-if="column.isRateField" #cell="{ record }">
|
||||
<div class="flex items-center rate-row justify-end" :class="record[column.dataIndex] > 0 ? 'up' : 'down'">
|
||||
<icon-arrow-up v-if="record[column.dataIndex] > 0" size="16" />
|
||||
<icon-arrow-down v-else size="16" />
|
||||
{{ formatTableField(column, record) }}
|
||||
</div>
|
||||
</template>
|
||||
<!-- <template v-else-if="['like_chain1', 'like_chain4'].includes(column.dataIndex)" #cell="{ record }">
|
||||
<p class="cts cursor-pointer hover:!color-#6D4CFE">打工人的环游世界旅行计划(国内版)</p>
|
||||
<p class="cts text-12px lh-20px !color-#939499">2025-06-18</p>
|
||||
</template> -->
|
||||
|
||||
<template v-else #cell="{ record }">
|
||||
{{ formatTableField(column, record, true) }}
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<CustomTableColumnModal ref="modalRef" :type="CUSTOM_COLUMN_TYPE" @success="onCustomColumnSuccess" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { STATUS_LIST } from '@/views/property-marketing/put-account/components/status-select/constants';
|
||||
import { formatTableField } from '@/utils/tools';
|
||||
import { TABLE_COLUMNS } from './constants';
|
||||
import { useRouter } from 'vue-router';
|
||||
import CustomTableColumnModal from '@/components/custom-table-column-modal';
|
||||
import { getCustomColumns } from '@/api/all/common';
|
||||
|
||||
import icon1 from '@/assets/img/media-account/icon-custom.png';
|
||||
import icon2 from '@/assets/img/media-account/icon-warn.png';
|
||||
import icon3 from '@/assets/img/media-account/icon-warn-1.png';
|
||||
import icon4 from '@/assets/img/media-account/icon-success.png';
|
||||
import icon5 from '@/assets/img/media-account/icon5.png';
|
||||
|
||||
const props = defineProps({
|
||||
dataSource: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['selectionChange', 'sorterChange', 'export']);
|
||||
|
||||
const CUSTOM_COLUMN_TYPE = 'placement_account_project';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const selectedItems = ref([]);
|
||||
const tableRef = ref(null);
|
||||
const modalRef = ref(null);
|
||||
const selectedColumns = ref([]);
|
||||
|
||||
const checkedAll = computed(
|
||||
() => selectedItems.value.length > 0 && selectedItems.value.length === props.dataSource.length,
|
||||
);
|
||||
const indeterminate = computed(
|
||||
() => selectedItems.value.length > 0 && selectedItems.value.length < props.dataSource.length,
|
||||
);
|
||||
|
||||
const handleSelectAll = (checked) => {
|
||||
if (checked) {
|
||||
selectedItems.value = props.dataSource.map((item) => item.id);
|
||||
} else {
|
||||
selectedItems.value = [];
|
||||
}
|
||||
emit('selectionChange', checked ? selectedItems.value : []);
|
||||
};
|
||||
|
||||
const handleDetail = (record) => {
|
||||
router.push(`/media-account/detail/${record.id}`);
|
||||
};
|
||||
|
||||
// 处理排序变化
|
||||
const handleSorterChange = (column, order) => {
|
||||
emit('sorterChange', column, order === 'ascend' ? 'asc' : 'desc');
|
||||
};
|
||||
|
||||
const handleSelect = (selectedRowKeys, selectedRows) => {
|
||||
selectedItems.value = selectedRowKeys;
|
||||
emit('selectionChange', selectedRows);
|
||||
};
|
||||
|
||||
const handleExport = () => {
|
||||
emit('export');
|
||||
};
|
||||
|
||||
const tableColumns = computed(() => {
|
||||
const _result = [];
|
||||
const _columns = cloneDeep(TABLE_COLUMNS);
|
||||
selectedColumns.value.forEach((item) => {
|
||||
const _column = _columns.find((_item) => _item.prop === item);
|
||||
if (_column) {
|
||||
_result.push(_column);
|
||||
}
|
||||
});
|
||||
return _result;
|
||||
});
|
||||
|
||||
const resetTable = () => {
|
||||
selectedItems.value = [];
|
||||
// tableRef.value?.clearSorters();
|
||||
};
|
||||
|
||||
const openCustomColumn = () => {
|
||||
modalRef.value.open();
|
||||
};
|
||||
|
||||
const onCustomColumnSuccess = (columns) => {
|
||||
selectedColumns.value = columns;
|
||||
};
|
||||
|
||||
const getSelectedColumns = () => {
|
||||
getCustomColumns({ type: CUSTOM_COLUMN_TYPE }).then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code === 200) {
|
||||
const { selected_columns, groups } = data;
|
||||
|
||||
setDefaultCheckColumns(groups, selected_columns);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const setDefaultCheckColumns = (groups, selected_columns) => {
|
||||
const requiredGroups = groups.filter((group) => group.is_require === 1);
|
||||
const requiredValues = requiredGroups
|
||||
.flatMap((group) => (group.columns || []).filter((col) => col.is_require === 1))
|
||||
.map((col) => col.value);
|
||||
|
||||
const merged = union(requiredValues, selected_columns);
|
||||
|
||||
selectedColumns.value = merged;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getSelectedColumns();
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
resetTable,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import './style.scss';
|
||||
</style>
|
||||
@ -0,0 +1,63 @@
|
||||
.action-row {
|
||||
:deep(.arco-btn) {
|
||||
.arco-btn-icon {
|
||||
line-height: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.plan-table {
|
||||
.cts {
|
||||
color: var(--Text-1, #211f24);
|
||||
font-family: 'PuHuiTi-Medium';
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 22px;
|
||||
}
|
||||
.status-tag {
|
||||
width: fit-content;
|
||||
display: flex;
|
||||
height: 28px;
|
||||
padding: 0px 8px;
|
||||
align-items: center;
|
||||
border-radius: 2px;
|
||||
background: var(--Functional-Red-1, #ffe9e7);
|
||||
|
||||
.status-tag-text {
|
||||
color: var(--Functional-Red-6, #f64b31);
|
||||
}
|
||||
&-3 {
|
||||
background: #fff7e5;
|
||||
.status-tag-text {
|
||||
color: var(--Functional-yellow-6, #ffae00);
|
||||
}
|
||||
}
|
||||
&-1 {
|
||||
background: var(--Functional-Green-1, #ebf7f2);
|
||||
.status-tag-text {
|
||||
color: var(--Functional-Green-6, #25c883);
|
||||
}
|
||||
}
|
||||
&-0 {
|
||||
background: var(--BG-200, #f2f3f5);
|
||||
.status-tag-text {
|
||||
color: var(--Text-2, #3c4043);
|
||||
}
|
||||
}
|
||||
}
|
||||
.ai-evaluation-row {
|
||||
.icon {
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
}
|
||||
.rate-row {
|
||||
&.up {
|
||||
color: var(--Functional-Red-6, #f64b31);
|
||||
}
|
||||
&.down {
|
||||
color: var(--Functional-Green-6, #25c883);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,59 +7,15 @@ export const INITIAL_QUERY = {
|
||||
name: '',
|
||||
status: '',
|
||||
operator_id: '',
|
||||
placement_account_id: '',
|
||||
group_ids: [],
|
||||
date_range: [],
|
||||
data_time: [],
|
||||
column: '',
|
||||
order: '',
|
||||
};
|
||||
|
||||
export enum EnumStatus {
|
||||
NORMAL = 1,
|
||||
PAUSE = 3,
|
||||
UNAUTHORIZED = 0,
|
||||
ABNORMAL = 2,
|
||||
ABNORMAL_LOGIN = 4,
|
||||
ABNORMAL_REQUEST = 5,
|
||||
ABNORMAL_FREEZE = 6,
|
||||
}
|
||||
|
||||
export const STATUS_LIST = [
|
||||
{
|
||||
text: '正常',
|
||||
label: '正常',
|
||||
value: EnumStatus.NORMAL,
|
||||
},
|
||||
{
|
||||
text: '暂停同步',
|
||||
label: '暂停同步',
|
||||
value: EnumStatus.PAUSE,
|
||||
},
|
||||
{
|
||||
text: '未授权',
|
||||
label: '未授权',
|
||||
value: EnumStatus.UNAUTHORIZED,
|
||||
},
|
||||
{
|
||||
text: '异常',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL,
|
||||
},
|
||||
{
|
||||
text: '异常-登录状态失效',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL_LOGIN,
|
||||
tooltip: '登录状态失效,需重新扫码授权',
|
||||
},
|
||||
{
|
||||
text: '异常-请求过于频繁',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL_REQUEST,
|
||||
tooltip: '请求过于频繁,需等待24小时后重试',
|
||||
},
|
||||
{
|
||||
text: '异常-账号被冻结/封禁',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL_FREEZE,
|
||||
tooltip: '账号被冻结/封禁',
|
||||
},
|
||||
];
|
||||
export const INITIAL_PAGE_INFO = {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
total: 0,
|
||||
};
|
||||
|
||||
@ -17,12 +17,19 @@
|
||||
</a-button>
|
||||
</template>
|
||||
</a-tabs>
|
||||
<FilterBlock ref="filterBlockRef" v-model:query="query" @onSearch="getData" @onReset="handleReset" />
|
||||
<FilterBlock
|
||||
ref="filterBlockRef"
|
||||
v-model:query="query"
|
||||
:isAccountTab="isAccountTab"
|
||||
@onSearch="getData"
|
||||
@onReset="handleReset"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="table-wrap bg-#fff rounded-8px border-1px border-#D7D7D9 border-solid px-24px py-24px flex-1 flex flex-col"
|
||||
>
|
||||
<BoardTable
|
||||
<component
|
||||
:is="isAccountTab ? BoardTable : PlanTable"
|
||||
ref="accountTableRef"
|
||||
:dataSource="dataSource"
|
||||
@export="handleExport"
|
||||
@ -37,7 +44,7 @@
|
||||
show-jumper
|
||||
show-page-size
|
||||
:current="pageInfo.page"
|
||||
:page-size="pageInfo.pageSize"
|
||||
:page-size="pageInfo.page_size"
|
||||
@change="onPageChange"
|
||||
@page-size-change="onPageSizeChange"
|
||||
/>
|
||||
@ -51,6 +58,7 @@
|
||||
<script setup>
|
||||
import FilterBlock from './components/filter-block';
|
||||
import BoardTable from './components/board-table';
|
||||
import PlanTable from './components/plan-table';
|
||||
import GroupManageModal from './components/group-manage-modal';
|
||||
|
||||
import {
|
||||
@ -60,7 +68,8 @@ import {
|
||||
postPlacementAccountDataListExport,
|
||||
} from '@/api/all/propertyMarketing';
|
||||
|
||||
import { INITIAL_QUERY } from './constants';
|
||||
import { INITIAL_QUERY, INITIAL_PAGE_INFO } from './constants';
|
||||
import { downloadByUrl } from '@/utils/tools';
|
||||
|
||||
import icon2 from '@/assets/img/media-account/icon-group.png';
|
||||
|
||||
@ -69,19 +78,20 @@ const activeTab = ref('1');
|
||||
const accountTableRef = ref(null);
|
||||
const groupManageModalRef = ref(null);
|
||||
const filterBlockRef = ref(null);
|
||||
const query = ref({});
|
||||
const query = ref(cloneDeep(INITIAL_QUERY));
|
||||
const dataSource = ref([]);
|
||||
const pageInfo = ref({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 100,
|
||||
});
|
||||
const pageInfo = ref(cloneDeep(INITIAL_PAGE_INFO));
|
||||
|
||||
const isAccountTab = computed(() => activeTab.value === '1');
|
||||
|
||||
const getData = async () => {
|
||||
const _fn = isAccountTab.value ? getPlacementAccountData : getPlacementAccountDataList;
|
||||
const { code, data } = await _fn(query.value);
|
||||
const { page, page_size } = pageInfo.value;
|
||||
const { code, data } = await _fn({
|
||||
...query.value,
|
||||
page,
|
||||
page_size,
|
||||
});
|
||||
if (code === 200) {
|
||||
dataSource.value = data?.data ?? [];
|
||||
pageInfo.value.total = data.total;
|
||||
@ -94,7 +104,7 @@ const onPageChange = (current) => {
|
||||
};
|
||||
|
||||
const onPageSizeChange = (pageSize) => {
|
||||
pageInfo.value.pageSize = pageSize;
|
||||
pageInfo.value.page_size = pageSize;
|
||||
reload();
|
||||
};
|
||||
|
||||
@ -104,9 +114,7 @@ const reload = () => {
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
pageInfo.value.page = 1;
|
||||
pageInfo.value.pageSize = 20;
|
||||
pageInfo.value.total = 0;
|
||||
pageInfo.value = cloneDeep(INITIAL_PAGE_INFO);
|
||||
selectedRowKeys.value = [];
|
||||
accountTableRef.value?.resetTable();
|
||||
query.value = cloneDeep(INITIAL_QUERY);
|
||||
@ -124,6 +132,7 @@ const handleSelectionChange = (selectedRows) => {
|
||||
|
||||
const handleTabClick = (key) => {
|
||||
activeTab.value = key;
|
||||
dataSource.value = [];
|
||||
handleReset();
|
||||
};
|
||||
|
||||
@ -134,7 +143,7 @@ const handleExport = () => {
|
||||
}).then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code === 200) {
|
||||
window.open(data.download_url, '_blank');
|
||||
downloadByUrl(data.download_url);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@ -57,7 +57,7 @@ const open = (record) => {
|
||||
|
||||
async function onDelete() {
|
||||
const _fn = isBatch.value ? batchDeletePlacementAccounts : deletePlacementAccount;
|
||||
const _params = isBatch.value ? { ids: accountId.value } : accountId.value;
|
||||
const _params = isBatch.value ? { ids: accountId.value } : { id: accountId.value };
|
||||
const { code } = await _fn(_params);
|
||||
if (code === 200) {
|
||||
AMessage.success('删除成功');
|
||||
|
||||
@ -70,7 +70,9 @@
|
||||
|
||||
<script setup>
|
||||
import { defineProps, ref, computed } from 'vue';
|
||||
import { STATUS_LIST, EnumStatus, PLATFORM_LIST } from '../../constants';
|
||||
import { PLATFORM_LIST } from '@/views/property-marketing/put-account/common_constants';
|
||||
import { EnumStatus } from '@/views/property-marketing/put-account/components/status-select/constants';
|
||||
|
||||
import { formatNumberShow } from '@/utils/tools';
|
||||
|
||||
import PauseAccountPatchModal from './pause-account-patch';
|
||||
|
||||
@ -33,7 +33,15 @@
|
||||
:custom-request="handleUpload"
|
||||
accept=".xlsx,.xls,.docx,.doc"
|
||||
:show-file-list="false"
|
||||
/>
|
||||
>
|
||||
<template #upload-button>
|
||||
<div class="upload-box">
|
||||
<icon-plus size="14" class="mb-16px" />
|
||||
<span class="text mb-4px">点击或拖拽文件到此处上传</span>
|
||||
<span class="tip">支持 xls, xlsx格式</span>
|
||||
</div>
|
||||
</template>
|
||||
</a-upload>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="flex items-center">
|
||||
@ -44,7 +52,7 @@
|
||||
}"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
<icon-file size="16" />
|
||||
<icon-file size="16" class="flex-shrink-0" />
|
||||
<span class="name ml-8px">{{ fileName }}</span>
|
||||
</div>
|
||||
<span
|
||||
@ -140,7 +148,7 @@ import { ref, defineEmits } from 'vue';
|
||||
import AuthorizedAccountModal from '../authorized-account-modal';
|
||||
// import ImportPromptModal from '../import-prompt-modal';
|
||||
import StatusBox from '../status-box';
|
||||
import { PLATFORM_LIST } from '../../constants';
|
||||
import { PLATFORM_LIST } from '@/views/property-marketing/put-account/common_constants';
|
||||
|
||||
import {
|
||||
postPlacementAccounts,
|
||||
|
||||
@ -46,6 +46,36 @@
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
}
|
||||
.upload-box {
|
||||
display: flex;
|
||||
height: 120px;
|
||||
padding: 0 16px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 2px;
|
||||
border: 1px dashed var(--Border-1, #d7d7d9);
|
||||
background: var(--BG-200, #f2f3f5);
|
||||
.text {
|
||||
color: var(--Text-1, #211f24);
|
||||
text-align: center;
|
||||
|
||||
font-family: 'PingFang SC';
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 22px;
|
||||
}
|
||||
.tip {
|
||||
color: var(--Text-3, #737478);
|
||||
text-align: center;
|
||||
font-family: 'PuHuiTi-Regular';
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.upload-dragger {
|
||||
border: 1px dashed #d9d9d9;
|
||||
|
||||
@ -85,10 +85,13 @@ const lastSyncedAt = ref(null);
|
||||
const syncType = ref('sync'); // sync | no_sync
|
||||
const showSyncTip = ref(false);
|
||||
|
||||
const form = ref({
|
||||
const INITIAL_FORM = {
|
||||
account: '',
|
||||
password: '',
|
||||
});
|
||||
};
|
||||
|
||||
const form = ref(cloneDeep(INITIAL_FORM));
|
||||
|
||||
let progressTimer = null;
|
||||
let statusPollingTimer = null;
|
||||
|
||||
@ -118,6 +121,7 @@ const close = () => {
|
||||
formRef.value?.resetFields();
|
||||
formRef.value?.clearValidate();
|
||||
|
||||
form.value = cloneDeep(INITIAL_FORM);
|
||||
isLoading.value = false;
|
||||
isCompleted.value = false;
|
||||
isSuccess.value = false;
|
||||
|
||||
@ -26,11 +26,7 @@
|
||||
<div class="filter-row-item flex items-center">
|
||||
<span class="label">状态</span>
|
||||
<a-space class="w-180px">
|
||||
<a-select v-model="query.status" size="medium" placeholder="全部" allow-clear @change="handleSearch">
|
||||
<a-option v-for="(item, index) in STATUS_LIST" :key="index" :value="item.value" :label="item.text">{{
|
||||
item.text
|
||||
}}</a-option>
|
||||
</a-select>
|
||||
<StatusSelect v-model="query.status" @change="handleSearch" />
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="filter-row-item flex items-center">
|
||||
@ -46,11 +42,7 @@
|
||||
<div class="filter-row-item flex items-center">
|
||||
<span class="label">运营人员</span>
|
||||
<a-space class="w-160px">
|
||||
<a-select v-model="query.operator_id" size="medium" placeholder="全部" allow-clear @change="handleSearch">
|
||||
<a-option v-for="(item, index) in operators" :key="index" :value="item.id" :label="item.name">{{
|
||||
item.name
|
||||
}}</a-option>
|
||||
</a-select>
|
||||
<OperatorSelect v-model="query.operator_id" :options="operators" @change="handleSearch" />
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
@ -73,8 +65,10 @@
|
||||
|
||||
<script setup>
|
||||
import { defineEmits, defineProps } from 'vue';
|
||||
import { fetchPlacementAccountOperators } from '@/api/all/propertyMarketing';
|
||||
import { PLATFORM_LIST, STATUS_LIST } from '@/views/property-marketing/put-account/account-manage/constants';
|
||||
import { getPlacementAccountOperators } from '@/api/all/propertyMarketing';
|
||||
import { PLATFORM_LIST } from '@/views/property-marketing/put-account/common_constants';
|
||||
import StatusSelect from '@/views/property-marketing/put-account/components/status-select';
|
||||
import OperatorSelect from '@/views/property-marketing/put-account/components/operator-select';
|
||||
|
||||
const props = defineProps({
|
||||
query: {
|
||||
@ -88,14 +82,17 @@ const emits = defineEmits('onSearch', 'onReset', 'update:query');
|
||||
const operators = ref([]);
|
||||
|
||||
const handleSearch = () => {
|
||||
emits('onSearch', props.query);
|
||||
emits('update:query', props.query);
|
||||
nextTick(() => {
|
||||
emits('onSearch');
|
||||
});
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
emits('onReset');
|
||||
};
|
||||
const getOperators = async () => {
|
||||
const { code, data } = await fetchPlacementAccountOperators();
|
||||
const { code, data } = await getPlacementAccountOperators();
|
||||
if (code === 200) {
|
||||
operators.value = data;
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { STATUS_LIST, EnumStatus } from '../../constants';
|
||||
import { STATUS_LIST, EnumStatus } from '@/views/property-marketing/put-account/components/status-select/constants';
|
||||
|
||||
import iconWarn1 from '@/assets/img/media-account/icon-warn-1.png';
|
||||
import iconWarn2 from '@/assets/img/media-account/icon-warn-2.png';
|
||||
|
||||
@ -2,9 +2,6 @@
|
||||
* @Author: RenXiaoDong
|
||||
* @Date: 2025-06-25 15:24:59
|
||||
*/
|
||||
import icon1 from '@/assets/img/media-account/icon-jl.png';
|
||||
import icon2 from '@/assets/img/media-account/icon-jg.png';
|
||||
import icon3 from '@/assets/img/media-account/icon-bili.png';
|
||||
|
||||
export const INITIAL_QUERY = {
|
||||
search: '',
|
||||
@ -12,78 +9,3 @@ export const INITIAL_QUERY = {
|
||||
platform: '',
|
||||
operator_id: '',
|
||||
};
|
||||
|
||||
export const PLATFORM_LIST = [
|
||||
{
|
||||
label: '巨量',
|
||||
value: 0,
|
||||
icon: icon1,
|
||||
},
|
||||
{
|
||||
label: '聚光',
|
||||
value: 1,
|
||||
icon: icon2,
|
||||
},
|
||||
{
|
||||
label: 'B站',
|
||||
value: 2,
|
||||
icon: icon3,
|
||||
},
|
||||
];
|
||||
|
||||
export enum EnumStatus {
|
||||
UNAUTHORIZED = 0,
|
||||
NORMAL = 1,
|
||||
PAUSE = 2,
|
||||
ABNORMAL = 3,
|
||||
ABNORMAL_LOGIN = 4,
|
||||
ABNORMAL_REQUEST = 5,
|
||||
ABNORMAL_FREEZE = 6,
|
||||
ABNORMAL_MISSING = 7,
|
||||
}
|
||||
|
||||
export const STATUS_LIST = [
|
||||
{
|
||||
text: '正常',
|
||||
label: '正常',
|
||||
value: EnumStatus.NORMAL,
|
||||
},
|
||||
{
|
||||
text: '暂停同步',
|
||||
label: '暂停同步',
|
||||
value: EnumStatus.PAUSE,
|
||||
},
|
||||
{
|
||||
text: '未授权',
|
||||
label: '未授权',
|
||||
value: EnumStatus.UNAUTHORIZED,
|
||||
},
|
||||
{
|
||||
text: '异常',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL,
|
||||
},
|
||||
{
|
||||
text: '异常-登录状态失效',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL_LOGIN,
|
||||
tooltip: '登录状态失效,需重新扫码授权',
|
||||
},
|
||||
{
|
||||
text: '异常-请求过于频繁',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL_REQUEST,
|
||||
tooltip: '请求过于频繁,需等待24小时后重试',
|
||||
},
|
||||
{
|
||||
text: '异常-账号被冻结/封禁',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL_FREEZE,
|
||||
tooltip: '账号被冻结/封禁',
|
||||
},
|
||||
{
|
||||
text: '数据缺失',
|
||||
label: '数据缺失',
|
||||
value: EnumStatus.ABNORMAL_MISSING,
|
||||
},
|
||||
];
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<div
|
||||
v-if="dataSource.length > 0"
|
||||
class="tip-row flex justify-between px-16px py-10px w-100% my-12px h-42px"
|
||||
:class="selectedItems.length > 0 ? 'selected' : 'normal'"
|
||||
:class="selectedItems.length > 0 ? 'selected' : isAbNormalStatus ? 'abnormal' : 'normal'"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
<div class="flex items-center">
|
||||
@ -42,8 +42,8 @@
|
||||
<span class="operation-btn red" @click="handleBatchDelete"> 批量删除 </span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<img :src="icon4" width="16" height="16" class="mr-8px" />
|
||||
<span class="label"> 太棒啦!所有账号都在正常运行。 </span>
|
||||
<img :src="isAbNormalStatus ? icon5 : icon4" width="16" height="16" class="mr-8px" />
|
||||
<span class="label"> {{ tipLabel }} </span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
@ -51,6 +51,13 @@
|
||||
<template v-if="selectedItems.length > 0">
|
||||
<img :src="icon6" width="16" height="16" class="cursor-pointer" @click="handleCloseTip" />
|
||||
</template>
|
||||
<div v-else>
|
||||
<a-space v-if="isAbNormalStatus" class="flex items-center">
|
||||
<a-button class="w-96px err-btn" size="mini" @click="handleOpenAbnormalAccount">
|
||||
<template #default>查看异常账号</template>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-wrap">
|
||||
<AccountTable
|
||||
@ -93,7 +100,7 @@ import AddAccountModal from './components/add-account-modal';
|
||||
import DeleteAccountModal from './components/account-table/delete-account';
|
||||
|
||||
import { INITIAL_QUERY } from './constants';
|
||||
import { getPlacementAccounts } from '@/api/all/propertyMarketing';
|
||||
import { getPlacementAccounts, getPlacementAccountsHealth } from '@/api/all/propertyMarketing';
|
||||
|
||||
import icon1 from '@/assets/img/media-account/icon-add.png';
|
||||
import icon4 from '@/assets/img/media-account/icon-success.png';
|
||||
@ -113,17 +120,57 @@ const pageInfo = ref({
|
||||
const query = ref(cloneDeep(INITIAL_QUERY));
|
||||
const dataSource = ref([]);
|
||||
const selectedItems = ref([]);
|
||||
const healthData = ref({});
|
||||
|
||||
const isAbNormalStatus = computed(() => healthData.value?.abnormal_number > 0);
|
||||
|
||||
const checkedAll = computed(() => selectedItems.value.length === dataSource.value.length);
|
||||
const indeterminate = computed(
|
||||
() => selectedItems.value.length > 0 && selectedItems.value.length < dataSource.value.length,
|
||||
);
|
||||
|
||||
const tipLabel = computed(() => {
|
||||
if (!isAbNormalStatus.value) {
|
||||
return '太棒啦!所有账号都在正常运行。';
|
||||
}
|
||||
|
||||
const {
|
||||
abnormal_number = 0,
|
||||
login_invalid_number = 0,
|
||||
too_many_requests_number = 0,
|
||||
account_frozen_number = 0,
|
||||
} = healthData.value;
|
||||
|
||||
// 定义异常类型映射
|
||||
const abnormalTypes = [
|
||||
{ count: login_invalid_number, label: 'cookie过期' },
|
||||
{ count: too_many_requests_number, label: '已请求频繁' },
|
||||
{ count: account_frozen_number, label: '账号被封' },
|
||||
];
|
||||
|
||||
// 过滤出有异常的项并格式化
|
||||
const abnormalLabels = abnormalTypes.filter(({ count }) => count > 0).map(({ count, label }) => `${count}个${label}`);
|
||||
|
||||
return `共有 ${abnormal_number} 个账号存在授权异常,其中:${abnormalLabels.join(',')}。`;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getData();
|
||||
});
|
||||
|
||||
const getData = async () => {
|
||||
const getData = () => {
|
||||
getHealthData();
|
||||
getAccountData();
|
||||
};
|
||||
|
||||
const getHealthData = async () => {
|
||||
const { code, data } = await getMediaAccountsHealth();
|
||||
if (code === 200) {
|
||||
healthData.value = data;
|
||||
console.log(healthData.value);
|
||||
}
|
||||
};
|
||||
const getAccountData = async () => {
|
||||
const { page, pageSize } = pageInfo.value;
|
||||
const { code, data, total } = await getPlacementAccounts({
|
||||
page,
|
||||
@ -183,12 +230,12 @@ const handleChangeAll = (val) => {
|
||||
};
|
||||
const handleBatchDelete = () => {
|
||||
const ids = selectedItems.value.map((item) => item.id);
|
||||
const names = selectedItems.value.map((item) => `"${item.name}"`).join(',');
|
||||
const names = selectedItems.value.map((item) => `"${item.name || '-'}"`).join(',');
|
||||
deleteAccountRef.value?.open({ id: ids, name: names });
|
||||
};
|
||||
const handleDelete = (item) => {
|
||||
const { id, name } = item;
|
||||
deleteAccountRef.value?.open({ id, name: `"${name}"` });
|
||||
deleteAccountRef.value?.open({ id, name: `"${name || '-'}"` });
|
||||
};
|
||||
const handleCloseTip = () => {
|
||||
selectedItems.value = [];
|
||||
@ -202,6 +249,10 @@ const onDeleteSuccess = (ids) => {
|
||||
selectedItems.value = selectedItems.value.filter((item) => !ids.includes(item.id));
|
||||
getData();
|
||||
};
|
||||
const handleOpenAbnormalAccount = () => {
|
||||
query.value.status = 2;
|
||||
reload();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
<!--
|
||||
* @Author: RenXiaoDong
|
||||
* @Date: 2025-06-25 14:02:40
|
||||
-->
|
||||
<template>
|
||||
<a-select
|
||||
v-model="selectedOperators"
|
||||
:multiple="multiple"
|
||||
size="medium"
|
||||
:placeholder="placeholder"
|
||||
allow-clear
|
||||
@change="handleChange"
|
||||
>
|
||||
<a-option v-for="(item, index) in options" :key="index" :value="item.id" :label="item.name">
|
||||
{{ item.name }}
|
||||
</a-option>
|
||||
</a-select>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: [Array, String, Number],
|
||||
default: () => [],
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '全部',
|
||||
},
|
||||
options: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['update:modelValue', 'change']);
|
||||
|
||||
const selectedOperators = ref(props.multiple ? [] : '');
|
||||
|
||||
// 监听外部传入的值变化
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
selectedOperators.value = newVal;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
// 监听内部值变化,向外部发送更新
|
||||
watch(selectedOperators, (newVal) => {
|
||||
emits('update:modelValue', newVal);
|
||||
});
|
||||
|
||||
const handleChange = (value) => {
|
||||
selectedOperators.value = value;
|
||||
emits('change', value);
|
||||
};
|
||||
</script>
|
||||
@ -0,0 +1,64 @@
|
||||
<!--
|
||||
* @Author: RenXiaoDong
|
||||
* @Date: 2025-06-25 14:02:40
|
||||
-->
|
||||
<template>
|
||||
<a-select
|
||||
v-model="selectedOperators"
|
||||
:multiple="multiple"
|
||||
size="medium"
|
||||
:placeholder="placeholder"
|
||||
allow-clear
|
||||
@change="handleChange"
|
||||
>
|
||||
<a-option v-for="(item, index) in options" :key="index" :value="item.id" :label="item.name">
|
||||
{{ item.name }}
|
||||
</a-option>
|
||||
</a-select>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: [Array, String, Number],
|
||||
default: () => [],
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '全部',
|
||||
},
|
||||
options: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['update:modelValue', 'change']);
|
||||
|
||||
const selectedOperators = ref(props.multiple ? [] : '');
|
||||
|
||||
// 监听外部传入的值变化
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
selectedOperators.value = newVal;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
// 监听内部值变化,向外部发送更新
|
||||
watch(selectedOperators, (newVal) => {
|
||||
emits('update:modelValue', newVal);
|
||||
});
|
||||
|
||||
const handleChange = (value) => {
|
||||
selectedOperators.value = value;
|
||||
emits('change', value);
|
||||
};
|
||||
</script>
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* @Author: RenXiaoDong
|
||||
* @Date: 2025-07-04 11:18:11
|
||||
*/
|
||||
export enum EnumStatus {
|
||||
UNAUTHORIZED = 0,
|
||||
NORMAL = 1,
|
||||
ABNORMAL = 2,
|
||||
PAUSE = 3,
|
||||
ABNORMAL_LOGIN = 4,
|
||||
ABNORMAL_REQUEST = 5,
|
||||
ABNORMAL_FREEZE = 6,
|
||||
ABNORMAL_MISSING = 7,
|
||||
}
|
||||
|
||||
export const STATUS_LIST = [
|
||||
{
|
||||
text: '正常',
|
||||
label: '正常',
|
||||
value: EnumStatus.NORMAL,
|
||||
},
|
||||
{
|
||||
text: '暂停同步',
|
||||
label: '暂停同步',
|
||||
value: EnumStatus.PAUSE,
|
||||
},
|
||||
{
|
||||
text: '未授权',
|
||||
label: '未授权',
|
||||
value: EnumStatus.UNAUTHORIZED,
|
||||
},
|
||||
{
|
||||
text: '异常',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL,
|
||||
},
|
||||
{
|
||||
text: '数据缺失',
|
||||
label: '数据缺失',
|
||||
value: EnumStatus.ABNORMAL_MISSING,
|
||||
},
|
||||
{
|
||||
text: '异常-登录状态失效',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL_LOGIN,
|
||||
tooltip: '登录状态失效,需重新扫码授权',
|
||||
},
|
||||
{
|
||||
text: '异常-请求过于频繁',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL_REQUEST,
|
||||
tooltip: '请求过于频繁,需等待24小时后重试',
|
||||
},
|
||||
{
|
||||
text: '异常-账号被冻结/封禁',
|
||||
label: '异常',
|
||||
value: EnumStatus.ABNORMAL_FREEZE,
|
||||
tooltip: '账号被冻结/封禁',
|
||||
},
|
||||
];
|
||||
@ -0,0 +1,60 @@
|
||||
<!--
|
||||
* @Author: RenXiaoDong
|
||||
* @Date: 2025-06-25 14:02:40
|
||||
-->
|
||||
<template>
|
||||
<a-select
|
||||
v-model="selectedStatus"
|
||||
:multiple="multiple"
|
||||
size="medium"
|
||||
:placeholder="placeholder"
|
||||
allow-clear
|
||||
@change="handleChange"
|
||||
>
|
||||
<a-option v-for="(item, index) in STATUS_LIST" :key="index" :value="item.value" :label="item.text">
|
||||
{{ item.text }}
|
||||
</a-option>
|
||||
</a-select>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { STATUS_LIST } from './constants';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: [Array, String, Number],
|
||||
default: () => [],
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '全部',
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['update:modelValue', 'change']);
|
||||
|
||||
const selectedStatus = ref(props.multiple ? [] : '');
|
||||
|
||||
// 监听外部传入的值变化
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
selectedStatus.value = newVal;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
// 监听内部值变化,向外部发送更新
|
||||
watch(selectedStatus, (newVal) => {
|
||||
emits('update:modelValue', newVal);
|
||||
});
|
||||
|
||||
const handleChange = (value) => {
|
||||
selectedStatus.value = value;
|
||||
emits('change', value);
|
||||
};
|
||||
</script>
|
||||
@ -8,7 +8,7 @@
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
display: inline-flex;
|
||||
margin: 10px;
|
||||
// margin: 10px;
|
||||
|
||||
.arco-tabs {
|
||||
margin-bottom: 10px;
|
||||
|
||||
Reference in New Issue
Block a user