feat(property-marketing): 优化投放指南删除功能并添加页面下载功能
This commit is contained in:
@ -164,7 +164,6 @@ const MODEL_PLACEMENT_SUGGESTION = '新投放建议生成';
|
|||||||
|
|
||||||
// 封装通用方法来获取 submodules 的内容
|
// 封装通用方法来获取 submodules 的内容
|
||||||
const getSubmoduleContent = (moduleName: string, submoduleName: string) => {
|
const getSubmoduleContent = (moduleName: string, submoduleName: string) => {
|
||||||
console.log(props.action_guide, 'getSubmoduleContent');
|
|
||||||
const module = props.action_guide
|
const module = props.action_guide
|
||||||
.find((item) => item.title === moduleName)
|
.find((item) => item.title === moduleName)
|
||||||
?.submodules.find((mod) => mod.subtitle === submoduleName);
|
?.submodules.find((mod) => mod.subtitle === submoduleName);
|
||||||
|
|||||||
@ -45,7 +45,6 @@
|
|||||||
<div class="overall-strategy">
|
<div class="overall-strategy">
|
||||||
<span class="placement-optimization-title">素材优化</span>
|
<span class="placement-optimization-title">素材优化</span>
|
||||||
<span class="placement-optimization-str">{{ props?.optimization?.[4]?.['content'] }}</span>
|
<span class="placement-optimization-str">{{ props?.optimization?.[4]?.['content'] }}</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
@ -66,7 +65,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(props.optimization,'optimization')
|
console.log(props.optimization, 'optimization');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@ -70,7 +70,9 @@ const columns = [
|
|||||||
];
|
];
|
||||||
// hotTranslation.vue
|
// hotTranslation.vue
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { deleteHistorylog } from '@/api/all/propertyMarketing'; // 引入 useRouter
|
import { deleteHistorylog } from '@/api/all/propertyMarketing';
|
||||||
|
import { defineEmits } from 'vue'; // 引入 useRouter
|
||||||
|
const emits = defineEmits(['onSearch']);
|
||||||
|
|
||||||
const router = useRouter(); // 创建 router 实例
|
const router = useRouter(); // 创建 router 实例
|
||||||
|
|
||||||
@ -101,10 +103,11 @@ const downloadDetailAsImage = (id) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
const deleteData = async (id) => {
|
const deleteData = async (id) => {
|
||||||
const { code, data } = await deleteHistorylog(id);
|
const { code, message } = await deleteHistorylog(id);
|
||||||
|
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
Message.success('删除成功');
|
Message.success(message);
|
||||||
|
emits('onSearch');
|
||||||
|
console.log('onsearch')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="loading === false">
|
<div v-if="loading === false && tabData === 'placement_guide'">
|
||||||
<!-- 本月摘要-->
|
<!-- 本月摘要-->
|
||||||
<MonthData :overview="aiResult.overview"></MonthData>
|
<MonthData :overview="aiResult.overview"></MonthData>
|
||||||
|
|
||||||
@ -49,9 +49,9 @@
|
|||||||
<!-- 投放行动指南-->
|
<!-- 投放行动指南-->
|
||||||
<ActionGuideDistribution :action_guide="aiResult.action_guide" :tmp="tmp"></ActionGuideDistribution>
|
<ActionGuideDistribution :action_guide="aiResult.action_guide" :tmp="tmp"></ActionGuideDistribution>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div v-if="tabData == 'placement_guide'">
|
||||||
<a-space class="down-btn">
|
<a-space class="down-btn">
|
||||||
<a-button type="outline" @click="onSearch">
|
<a-button type="outline" @click="downPage">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<icon-download />
|
<icon-download />
|
||||||
</template>
|
</template>
|
||||||
@ -82,6 +82,8 @@ import {
|
|||||||
getPlacementGuideHistory,
|
getPlacementGuideHistory,
|
||||||
savePlacementGuide,
|
savePlacementGuide,
|
||||||
} from '@/api/all/propertyMarketing';
|
} from '@/api/all/propertyMarketing';
|
||||||
|
import { Message } from '@arco-design/web-vue';
|
||||||
|
import html2canvas from 'html2canvas';
|
||||||
|
|
||||||
const tabData = ref('placement_guide');
|
const tabData = ref('placement_guide');
|
||||||
|
|
||||||
@ -133,6 +135,12 @@ const onSearch = async () => {
|
|||||||
listData.total = data.total;
|
listData.total = data.total;
|
||||||
if (tabData.value === 'placement_guide') {
|
if (tabData.value === 'placement_guide') {
|
||||||
getSyncAiResult();
|
getSyncAiResult();
|
||||||
|
if (listData.list.length != 0) {
|
||||||
|
// 设置定时器每5秒执行一次
|
||||||
|
timer.value = setInterval(() => {
|
||||||
|
getSyncAiResult();
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -142,13 +150,26 @@ const aiResult = reactive({
|
|||||||
overview: [], //新投放建议生成
|
overview: [], //新投放建议生成
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 下载当前页面
|
||||||
|
|
||||||
|
const downPage = async () => {
|
||||||
|
await nextTick(); // 确保 DOM 更新完成
|
||||||
|
html2canvas(document.querySelector('.guidelines-data-wrap')).then(canvas => {
|
||||||
|
const imgData = canvas.toDataURL('image/png');
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = imgData;
|
||||||
|
const timestamp = new Date().getTime();
|
||||||
|
link.download = `投放指南-${timestamp}.png`;
|
||||||
|
link.click();
|
||||||
|
});
|
||||||
|
};
|
||||||
const saveForm = reactive({
|
const saveForm = reactive({
|
||||||
account: [],
|
account: [],
|
||||||
plan: [],
|
plan: [],
|
||||||
platform: [],
|
platform: [],
|
||||||
aiResult: [],
|
aiResult: [],
|
||||||
});
|
});
|
||||||
const timer = ref(null);
|
const timer = ref<number | null>(null); // 定时器引用
|
||||||
const getSyncAiResult = async () => {
|
const getSyncAiResult = async () => {
|
||||||
if (listData.list.length == 0) {
|
if (listData.list.length == 0) {
|
||||||
return;
|
return;
|
||||||
@ -156,8 +177,8 @@ const getSyncAiResult = async () => {
|
|||||||
const { code, data } = await getAiResult(query);
|
const { code, data } = await getAiResult(query);
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
// 成功或者失败清除定时任务
|
// 成功或者失败清除定时任务
|
||||||
if ((data.status && data.status === 3) || data.status === 2) {
|
if ((data.ai_result_status && data.ai_result_status === 3) || data.ai_result_status === 2) {
|
||||||
// clearInterval(timer);
|
clearInterval(timer.value);
|
||||||
}
|
}
|
||||||
aiResult.optimization = data.result.optimization.modules;
|
aiResult.optimization = data.result.optimization.modules;
|
||||||
aiResult.action_guide = data.result?.action_guide?.modules;
|
aiResult.action_guide = data.result?.action_guide?.modules;
|
||||||
@ -165,11 +186,6 @@ const getSyncAiResult = async () => {
|
|||||||
Object.assign(saveForm, data);
|
Object.assign(saveForm, data);
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
// 定时任务请求接口
|
|
||||||
timer.value = setInterval(() => {
|
|
||||||
getSyncAiResult();
|
|
||||||
}, 5000);
|
|
||||||
console.log(loading.value, 'loading.value');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
@ -177,8 +193,9 @@ const handleSave = async () => {
|
|||||||
...saveForm,
|
...saveForm,
|
||||||
ai_result: aiResult,
|
ai_result: aiResult,
|
||||||
};
|
};
|
||||||
const { code, data } = await savePlacementGuide(updatedSaveForm);
|
const { code, message, data } = await savePlacementGuide(updatedSaveForm);
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
|
Message.success(message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user