2025-06-27 16:26:03 +08:00
|
|
|
<template>
|
2025-07-07 20:59:54 +08:00
|
|
|
<div class="guidelines-data-wrap">
|
2025-06-27 16:26:03 +08:00
|
|
|
<div class="part-div">
|
|
|
|
|
<div>
|
2025-07-07 20:59:54 +08:00
|
|
|
<a-tabs
|
|
|
|
|
v-model:activeKey="tabData"
|
|
|
|
|
@tab-click="onSearch"
|
|
|
|
|
class="a-tab-class"
|
|
|
|
|
default-active-key="placement_guide"
|
|
|
|
|
>
|
2025-06-27 16:26:03 +08:00
|
|
|
<a-tab-pane key="placement_guide" title="投放指南"></a-tab-pane>
|
|
|
|
|
<a-tab-pane key="guide_history">
|
|
|
|
|
<template #title>历史投放指南</template>
|
|
|
|
|
</a-tab-pane>
|
|
|
|
|
</a-tabs>
|
|
|
|
|
</div>
|
|
|
|
|
<!--表单组件搜索-->
|
2025-07-06 18:27:51 +08:00
|
|
|
<listSearchForm v-model:query="query" @onSearch="onSearch"></listSearchForm>
|
2025-06-27 16:26:03 +08:00
|
|
|
<!-- 投放指南-->
|
2025-07-06 18:27:51 +08:00
|
|
|
<PlacementGuideList
|
|
|
|
|
v-if="tabData === 'placement_guide'"
|
2025-07-07 20:59:54 +08:00
|
|
|
:listData="listData.list"
|
|
|
|
|
@updateQuery="handleUpdateQuery"
|
2025-07-06 18:27:51 +08:00
|
|
|
></PlacementGuideList>
|
2025-06-27 16:26:03 +08:00
|
|
|
<!-- 历史指南列表-->
|
2025-07-07 20:59:54 +08:00
|
|
|
<GuideListHistory v-if="tabData === 'guide_history'" :listData="listData.list"></GuideListHistory>
|
|
|
|
|
|
|
|
|
|
<div v-if="listData.total > 0" class="pagination-box flex justify-end">
|
|
|
|
|
<a-pagination
|
|
|
|
|
:total="listData.total"
|
|
|
|
|
size="mini"
|
|
|
|
|
show-total
|
|
|
|
|
show-jumper
|
|
|
|
|
show-page-size
|
|
|
|
|
:current="query.page"
|
|
|
|
|
:page-size="query.pageSize"
|
|
|
|
|
@change="onPageChange"
|
|
|
|
|
@page-size-change="onPageSizeChange"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2025-06-27 16:26:03 +08:00
|
|
|
</div>
|
|
|
|
|
|
2025-07-07 20:59:54 +08:00
|
|
|
<div v-if="loading === false">
|
2025-07-04 10:35:16 +08:00
|
|
|
<!-- 本月摘要-->
|
2025-07-07 20:59:54 +08:00
|
|
|
<MonthData :overview="aiResult.overview"></MonthData>
|
2025-06-27 16:26:03 +08:00
|
|
|
|
2025-07-04 10:35:16 +08:00
|
|
|
<!-- 投放建议-->
|
2025-07-06 18:27:51 +08:00
|
|
|
<PlacementSuggestions :optimization="aiResult.optimization"></PlacementSuggestions>
|
|
|
|
|
<!-- 投放行动指南-->
|
2025-07-07 20:59:54 +08:00
|
|
|
<ActionGuideDistribution :action_guide="aiResult.action_guide" :tmp="tmp"></ActionGuideDistribution>
|
|
|
|
|
</div>
|
2025-06-27 16:26:03 +08:00
|
|
|
<div>
|
2025-06-30 16:11:25 +08:00
|
|
|
<a-space class="down-btn">
|
2025-07-07 20:59:54 +08:00
|
|
|
<a-button type="outline" @click="onSearch">
|
2025-06-27 16:26:03 +08:00
|
|
|
<template #icon>
|
|
|
|
|
<icon-download />
|
|
|
|
|
</template>
|
|
|
|
|
<template #default>下载</template>
|
|
|
|
|
</a-button>
|
2025-07-07 20:59:54 +08:00
|
|
|
<a-button type="primary" @click="handleSave">
|
2025-06-27 16:26:03 +08:00
|
|
|
<template #icon>
|
|
|
|
|
<icon-drive-file />
|
|
|
|
|
</template>
|
|
|
|
|
<template #default>保存</template>
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-space>
|
|
|
|
|
</div>
|
2025-07-07 20:59:54 +08:00
|
|
|
</div>
|
2025-06-27 16:26:03 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { reactive, ref } from 'vue';
|
|
|
|
|
import PlacementGuideList from './components/table-data/placementGuideList.vue';
|
|
|
|
|
import listSearchForm from './components/table-data/listSearchForm.vue';
|
|
|
|
|
import GuideListHistory from './components/table-data/guideListHistory.vue';
|
|
|
|
|
import MonthData from './components/month-data/index.vue';
|
|
|
|
|
import PlacementSuggestions from './components/placement-suggestions/index.vue';
|
|
|
|
|
import ActionGuideDistribution from './components/action-guide-distribution';
|
2025-07-04 10:35:16 +08:00
|
|
|
import {
|
|
|
|
|
getAiResult,
|
|
|
|
|
getPlacementGuide,
|
2025-07-07 20:59:54 +08:00
|
|
|
getPlacementGuideHistory,
|
|
|
|
|
savePlacementGuide,
|
2025-07-04 10:35:16 +08:00
|
|
|
} from '@/api/all/propertyMarketing';
|
2025-06-27 16:26:03 +08:00
|
|
|
|
|
|
|
|
const tabData = ref('placement_guide');
|
|
|
|
|
|
2025-07-04 10:35:16 +08:00
|
|
|
const query = reactive({
|
|
|
|
|
platform: '',
|
2025-07-07 20:59:54 +08:00
|
|
|
date_time: '',
|
|
|
|
|
sort_column: '',
|
|
|
|
|
sort_order: '',
|
|
|
|
|
page_size: 20,
|
|
|
|
|
page: 1,
|
2025-06-27 16:26:03 +08:00
|
|
|
});
|
2025-07-04 10:35:16 +08:00
|
|
|
|
2025-07-07 20:59:54 +08:00
|
|
|
const tmp = ref(0);
|
2025-07-06 18:27:51 +08:00
|
|
|
|
2025-07-07 20:59:54 +08:00
|
|
|
const onPageChange = (current) => {
|
|
|
|
|
query.page = current;
|
|
|
|
|
onSearch();
|
|
|
|
|
};
|
|
|
|
|
const onPageSizeChange = (pageSize) => {
|
|
|
|
|
query.page_size = pageSize;
|
|
|
|
|
onSearch();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleUpdateQuery = (payload) => {
|
|
|
|
|
payload.order = payload.order === 'ascend' ? 'asc' : 'desc';
|
|
|
|
|
query.sort_column = payload.column;
|
|
|
|
|
query.sort_order = payload.order;
|
|
|
|
|
onSearch();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const loading = ref(true);
|
|
|
|
|
|
|
|
|
|
const listData = reactive({
|
|
|
|
|
list: [],
|
2025-07-06 18:27:51 +08:00
|
|
|
total: 0,
|
2025-07-04 10:35:16 +08:00
|
|
|
});
|
|
|
|
|
|
2025-07-06 18:27:51 +08:00
|
|
|
const onSearch = async () => {
|
2025-07-07 20:59:54 +08:00
|
|
|
let result;
|
|
|
|
|
if (tabData.value === 'placement_guide') {
|
|
|
|
|
result = await getPlacementGuide(query);
|
|
|
|
|
} else {
|
|
|
|
|
result = await getPlacementGuideHistory(query);
|
|
|
|
|
}
|
|
|
|
|
const { code, data } = result;
|
|
|
|
|
console.log(data, 'data');
|
2025-07-04 10:35:16 +08:00
|
|
|
if (code === 200) {
|
2025-07-07 20:59:54 +08:00
|
|
|
listData.list = data.data;
|
|
|
|
|
listData.total = data.total;
|
|
|
|
|
if (tabData.value === 'placement_guide') {
|
|
|
|
|
getSyncAiResult();
|
|
|
|
|
}
|
2025-07-04 10:35:16 +08:00
|
|
|
}
|
|
|
|
|
};
|
2025-07-06 18:27:51 +08:00
|
|
|
const aiResult = reactive({
|
|
|
|
|
optimization: [], //投放建议优化
|
|
|
|
|
action_guide: [], //新投放建议生成
|
2025-07-07 20:59:54 +08:00
|
|
|
overview: [], //新投放建议生成
|
2025-07-06 18:27:51 +08:00
|
|
|
});
|
|
|
|
|
|
2025-07-07 20:59:54 +08:00
|
|
|
const saveForm = reactive({
|
|
|
|
|
account: [],
|
|
|
|
|
plan: [],
|
|
|
|
|
platform: [],
|
|
|
|
|
aiResult: [],
|
|
|
|
|
});
|
|
|
|
|
const timer = ref(null);
|
2025-07-04 10:35:16 +08:00
|
|
|
const getSyncAiResult = async () => {
|
2025-07-07 20:59:54 +08:00
|
|
|
if (listData.list.length == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-07-04 10:35:16 +08:00
|
|
|
const { code, data } = await getAiResult(query);
|
|
|
|
|
if (code === 200) {
|
2025-07-06 18:27:51 +08:00
|
|
|
// 成功或者失败清除定时任务
|
2025-07-04 10:35:16 +08:00
|
|
|
if ((data.status && data.status === 3) || data.status === 2) {
|
2025-07-06 18:27:51 +08:00
|
|
|
// clearInterval(timer);
|
2025-07-04 10:35:16 +08:00
|
|
|
}
|
2025-07-06 18:27:51 +08:00
|
|
|
aiResult.optimization = data.result.optimization.modules;
|
|
|
|
|
aiResult.action_guide = data.result?.action_guide?.modules;
|
2025-07-07 20:59:54 +08:00
|
|
|
aiResult.overview = data.result?.overview?.content_blocks;
|
|
|
|
|
Object.assign(saveForm, data);
|
|
|
|
|
}
|
|
|
|
|
loading.value = false;
|
|
|
|
|
// 定时任务请求接口
|
|
|
|
|
timer.value = setInterval(() => {
|
|
|
|
|
getSyncAiResult();
|
|
|
|
|
}, 5000);
|
|
|
|
|
console.log(loading.value, 'loading.value');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleSave = async () => {
|
|
|
|
|
const updatedSaveForm = {
|
|
|
|
|
...saveForm,
|
|
|
|
|
ai_result: aiResult,
|
|
|
|
|
};
|
|
|
|
|
const { code, data } = await savePlacementGuide(updatedSaveForm);
|
|
|
|
|
if (code === 200) {
|
2025-07-04 10:35:16 +08:00
|
|
|
}
|
|
|
|
|
};
|
2025-07-07 20:59:54 +08:00
|
|
|
onMounted(() => {
|
|
|
|
|
onSearch();
|
|
|
|
|
});
|
2025-06-27 16:26:03 +08:00
|
|
|
</script>
|
|
|
|
|
|
2025-06-30 11:36:11 +08:00
|
|
|
<style lang="scss">
|
|
|
|
|
@import './style.scss';
|
|
|
|
|
</style>
|